define("winMeter", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "slotModelApi", "winMeterApi", "displayEngineApi", "displayEngineUtils", "gameLayoutApi", "clientkernelEventbusApi", "clientkernelModulesApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, slotModelApi, winMeterApi, displayEngineApi, displayEngineUtils, gameLayoutApi, clientkernelEventbusApi, clientkernelModulesApi, moneyApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

        haxe.IMap = function() {}
        haxe.IMap.prototype = {

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        if (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (typeof winMeter == 'undefined') {
            var winMeter = {};
        };
        winMeter.Activator = function(context) {};
        winMeter.Activator = ck_implements(winMeter.Activator, clientkernelModulesApi.IModuleActivator);
        winMeter.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        winMeter.Activator.__name__ = ["winMeter", "Activator"];
        winMeter.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider, moneyApi.IMoneyFormatter]).then(function(context1) {
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                winMeter.ExternalService.initialize(context1, vbf);
                context1.registerService(new winMeter.WinMeterFactory(context1), winMeterApi.WinMeterDeclaration, null);
            });
        };
        winMeter.Activator.prototype.stop = function(context) {};
        winMeter.Activator.main = function() {};
        winMeter.Activator.prototype.__class__ = winMeter.Activator;
        winMeter.ExternalService = function() {};
        winMeter.ExternalService.__name__ = ["winMeter", "ExternalService"];
        winMeter.ExternalService.displayProvider = null;
        winMeter.ExternalService.assetRegistry = null;
        winMeter.ExternalService.viewBuilderFactory = null;
        winMeter.ExternalService.loadedAssets = null;
        winMeter.ExternalService.loadedDefinitionConfig = null;
        winMeter.ExternalService.moneyFormatter = null;
        winMeter.ExternalService.initialize = function(context, vbf) {
            winMeter.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            winMeter.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            winMeter.ExternalService.moneyFormatter = context.getAnyService(moneyApi.IMoneyFormatter, null);
            winMeter.ExternalService.viewBuilderFactory = vbf;
        };
        winMeter.ExternalService.prototype.__class__ = winMeter.ExternalService;
        winMeter.InterruptTimer = function(callback) {
            this.timer = new _hcmn_.haxe_Timer(0);
            this.callback = callback;
        };
        winMeter.InterruptTimer.__name__ = ["winMeter", "InterruptTimer"];
        winMeter.InterruptTimer.prototype.timer = null;
        winMeter.InterruptTimer.prototype.callback = null;
        winMeter.InterruptTimer.prototype.start = function(payload) {
            var level = payload.winSegments.length;
            var time = this.getTime(level);
            this.timer = new _hcmn_.haxe_Timer(time);
            this.timer.run = $bind(this, this.run);
        };
        winMeter.InterruptTimer.prototype.getTime = function(level) {
            var skipProperties = winMeter.ExternalService.loadedDefinitionConfig.skip_properties;
            var $it0 = _hcmn_.HxOverrides.iter(skipProperties);
            while ($it0.hasNext()) {
                var prop = $it0.next();
                if (prop.id == level) return prop.time;
            }
            return 0;
        };
        winMeter.InterruptTimer.prototype.stop = function() {
            this.timer.stop();
        };
        winMeter.InterruptTimer.prototype.run = function() {
            this.timer.stop();
            this.callback();
        };
        winMeter.InterruptTimer.prototype.__class__ = winMeter.InterruptTimer;
        winMeter.WinMeter = function(context) {
            this.assetsLoaded = false;
            this.initialized = false;
            this.layoutPayload = null;
            this.DEFINITION_CONFIG_ID = "winmeter-assets/winmeter_definition_config.json";
            this.MAIN_CONFIG_ID = "winmeter-assets/winmeter_layout.viewbuilder.json";
            this.BACKGROUND_ID = "WIN_METER_BG";
            this.COMPONENT_ID = "WIN_METER";
            var _g = this;
            this.context = context;
            this.port = context.getImplementedPort(winMeterApi.IWinMeterImplementationPort);
            this.slotModelPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.controller = new winMeter.WinMeterController(this);
            winMeter.ExternalService.assetRegistry.getAsset(this.MAIN_CONFIG_ID).getContent().then(function(vb) {
                winMeter.ExternalService.loadedAssets = vb;
                winMeter.ExternalService.assetRegistry.getAsset(_g.DEFINITION_CONFIG_ID).getContent().then(function(config) {
                    _g.assetsLoaded = true;
                    winMeter.ExternalService.loadedDefinitionConfig = config;
                    _g.initialize();
                });
            });
        };
        winMeter.WinMeter.__name__ = ["winMeter", "WinMeter"];
        winMeter.WinMeter.prototype.COMPONENT_ID = null;
        winMeter.WinMeter.prototype.BACKGROUND_ID = null;
        winMeter.WinMeter.prototype.MAIN_CONFIG_ID = null;
        winMeter.WinMeter.prototype.DEFINITION_CONFIG_ID = null;
        winMeter.WinMeter.prototype.view = null;
        winMeter.WinMeter.prototype.winMeterComponent = null;
        winMeter.WinMeter.prototype.port = null;
        winMeter.WinMeter.prototype.layoutPort = null;
        winMeter.WinMeter.prototype.slotModelPort = null;
        winMeter.WinMeter.prototype.controller = null;
        winMeter.WinMeter.prototype.context = null;
        winMeter.WinMeter.prototype.layoutPayload = null;
        winMeter.WinMeter.prototype.initialized = null;
        winMeter.WinMeter.prototype.assetsLoaded = null;
        winMeter.WinMeter.prototype.updateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (!this.initialized) this.initialize();
            else {
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            }
        };
        winMeter.WinMeter.prototype.initialize = function() {
            if (this.assetsLoaded && this.layoutPayload != null) {
                winMeter.WinMeterDefinition.initialize(winMeter.ExternalService.loadedDefinitionConfig);
                this.view = winMeter.ExternalService.viewBuilderFactory.createView(winMeter.ExternalService.loadedAssets);
                var container = this.view.getComponentById(this.COMPONENT_ID);
                var background = this.view.getComponentById(this.BACKGROUND_ID);
                if (container == null) throw new Error("WinMeter container (with " + this.COMPONENT_ID + " id) not found in assets!");
                this.winMeterComponent = new winMeter.WinMeterComponent(container, background);
                this.controller.init();
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
                this.initialized = true;
            }
        };
        winMeter.WinMeter.prototype.getWinMeterComponent = function() {
            return this.winMeterComponent;
        };
        winMeter.WinMeter.prototype.__class__ = winMeter.WinMeter;
        winMeter.WinMeterController = function(winMeterComponent) {
            this.flag_addedToStage = false;
            this.winMeter = winMeterComponent;
            this.interuptTimmer = new winMeter.InterruptTimer($bind(this, this.onInterruptAvailable));
            winMeter.WinMeterController.moneyFormatter = winMeter.ExternalService.moneyFormatter;
        };
        winMeter.WinMeterController.__name__ = ["winMeter", "WinMeterController"];
        winMeter.WinMeterController.prototype.winMeter = null;
        winMeter.WinMeterController.prototype.flag_addedToStage = null;
        winMeter.WinMeterController.prototype.testIndex = null;
        winMeter.WinMeterController.prototype.interuptTimmer = null;
        winMeter.WinMeterController.prototype.updateLayout = function(layoutPayload) {
            var $it0 = layoutPayload.containers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = layoutPayload.containers.get(layerId);
                var cfg = layerPayload.configuration;
                var stage;
                var this1 = winMeter.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container = this.winMeter.view.getComponentById(layerId);
                var containerDO = container.getDisplayObject();
                containerDO.setCacheAsBitmap(false);
                if (!this.flag_addedToStage) stage.addChild(containerDO);
                containerDO.setX(layerPayload.left);
                containerDO.setY(layerPayload.top);
                containerDO.setScaleX(layerPayload.width / containerDO.getUserData().viewBuilderW);
                containerDO.setScaleY(layerPayload.height / containerDO.getUserData().viewBuilderH);
                containerDO.setZIndex(layerPayload.zIndex);
                if (cfg == null) continue;
                this.winMeter.getWinMeterComponent().configure(cfg);
            }
            if (!this.flag_addedToStage) {
                this.flag_addedToStage = true;
                null;
            }
        };
        winMeter.WinMeterController.prototype.init = function() {
            this.winMeter.port.displayWin().subscribe($bind(this, this.onDisplayWin));
            this.winMeter.port.showMessage().subscribe($bind(this, this.onDisplayMessage));
            this.winMeter.getWinMeterComponent().getEvents().getCountUpEvents().COUNTER_STARTED().addListener($bind(this, this.onCounterStarted));
            this.winMeter.getWinMeterComponent().getEvents().getCountUpEvents().COUNTER_FINISHED().addListener($bind(this, this.onCounterFinished));
            this.winMeter.getWinMeterComponent().getEvents().ANIMATION_FINISHED().addListener($bind(this, this.onAnimationFinished));
        };
        winMeter.WinMeterController.prototype.test1 = function(index) {
            var a = [];
            a[0] = new slotModelApi.BigWinSegment(1, "200.00");
            a[1] = new slotModelApi.BigWinSegment(2, "350.00");
            a[2] = new slotModelApi.BigWinSegment(3, "500.00");
            a[3] = new slotModelApi.BigWinSegment(4, "900.00");
            a[4] = new slotModelApi.BigWinSegment(5, "1500.00");
            if (index % 2 == 0) this.winMeter.getWinMeterComponent().displayWin(new winMeterApi.WinMeterPayload("2050.00", a));
            else this.winMeter.getWinMeterComponent().displayMessage("G____L____");
        };
        winMeter.WinMeterController.prototype.onDisplayWin = function(e) {
            this.winMeter.getWinMeterComponent().displayWin(e.getPayload());
            if (e.getPayload().instantShow) this.interuptTimmer.stop();
            else this.interuptTimmer.start(e.getPayload());
        };
        winMeter.WinMeterController.prototype.onDisplayMessage = function(e) {
            this.interuptTimmer.stop();
            this.winMeter.getWinMeterComponent().displayMessage(e.getPayload());
        };
        winMeter.WinMeterController.prototype.onCounterStarted = function() {
            this.winMeter.port.onCountUpStarted().publish(null);
        };
        winMeter.WinMeterController.prototype.onCounterFinished = function() {
            this.winMeter.port.onCountUpFinished().publish(null);
        };
        winMeter.WinMeterController.prototype.onAnimationFinished = function() {
            this.interuptTimmer.stop();
            this.winMeter.port.onDisplayWinFinished().publish(null);
        };
        winMeter.WinMeterController.prototype.onInterruptAvailable = function() {
            this.winMeter.port.onInterruptAvailable().publish(null);
        };
        winMeter.WinMeterController.moneyFormatter = null;
        winMeter.WinMeterController.prototype.__class__ = winMeter.WinMeterController;
        winMeter.WinMeterDefinition = function() {};
        winMeter.WinMeterDefinition.__name__ = ["winMeter", "WinMeterDefinition"];
        winMeter.WinMeterDefinition.BIGWIN_MAPPINGS = null;
        winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS = null;
        winMeter.WinMeterDefinition.LOWIN_MAPPINGS = null;
        winMeter.WinMeterDefinition.COUNTER_TIMINGS = null;
        winMeter.WinMeterDefinition.loadedDefinitionConfig = null;
        winMeter.WinMeterDefinition.classLimitsSet = null;
        winMeter.WinMeterDefinition.initialize = function(loadedDefinitionConfig) {
            winMeter.WinMeterDefinition.loadedDefinitionConfig = loadedDefinitionConfig;
            winMeter.WinMeterDefinition.BIGWIN_MAPPINGS = loadedDefinitionConfig.win_mapping.BIG;
            winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS = loadedDefinitionConfig.win_mapping.MEDIUM;
            winMeter.WinMeterDefinition.LOWIN_MAPPINGS = loadedDefinitionConfig.win_mapping.LOW;
            winMeter.WinMeterDefinition.extractLimitMappings();
            var _g = 0;
            var _g1 = _hcmn_.Type.getEnumConstructs(winMeter.WinAnimationType);
            while (_g < _g1.length) {
                var t = _g1[_g];
                ++_g;
                var _g2 = 0;
                var _g3 = _hcmn_.Type.getEnumConstructs(winMeter.WinAnimationDirection);
                while (_g2 < _g3.length) {
                    var d = _g3[_g2];
                    ++_g2;
                    winMeter.WinMeterDefinition.populateWithDefaults(winMeter.WinMeterDefinition.getTweenDefinition(_hcmn_.Type.createEnum(winMeter.WinAnimationType, t, null), _hcmn_.Type.createEnum(winMeter.WinAnimationDirection, d, null)));
                }
            }
            winMeter.WinMeterDefinition.COUNTER_TIMINGS = [];
            var _g4 = 0;
            var _g11;
            _g11 = _hcmn_.js_Boot.__cast(loadedDefinitionConfig.counter_properties, Array);
            while (_g4 < _g11.length) {
                var cpdynamic = _g11[_g4];
                ++_g4;
                var cp = cpdynamic;
                winMeter.WinMeterDefinition.COUNTER_TIMINGS[cp.id] = cp;
            }
        };
        winMeter.WinMeterDefinition.extractLimitMappings = function() {
            winMeter.WinMeterDefinition.classLimitsSet = [];
            var currMax = null;
            if (winMeter.WinMeterDefinition.LOWIN_MAPPINGS != null) {
                var _g = 0;
                var _g1 = winMeter.WinMeterDefinition.LOWIN_MAPPINGS;
                while (_g < _g1.length) {
                    var c = _g1[_g];
                    ++_g;
                    if (currMax == null) currMax = c;
                    if (c > currMax) currMax = c;
                }
                winMeter.WinMeterDefinition.classLimitsSet.push(currMax);
                currMax = null;
            }
            if (winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS != null) {
                var _g2 = 0;
                var _g11 = winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS;
                while (_g2 < _g11.length) {
                    var c1 = _g11[_g2];
                    ++_g2;
                    if (currMax == null) currMax = c1;
                    if (c1 > currMax) currMax = c1;
                }
                winMeter.WinMeterDefinition.classLimitsSet.push(currMax);
                currMax = null;
            }
            if (winMeter.WinMeterDefinition.BIGWIN_MAPPINGS != null) {
                var _g3 = 0;
                var _g12 = winMeter.WinMeterDefinition.BIGWIN_MAPPINGS;
                while (_g3 < _g12.length) {
                    var c2 = _g12[_g3];
                    ++_g3;
                    if (currMax == null) currMax = c2;
                    if (c2 > currMax) currMax = c2;
                }
                winMeter.WinMeterDefinition.classLimitsSet.push(currMax);
                currMax = null;
            }
        };
        winMeter.WinMeterDefinition.populateWithDefaults = function(tweenspack) {
            if (tweenspack == null) return;
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(tweenspack);
            while (_g < _g1.length) {
                var f = _g1[_g];
                ++_g;
                var tween = _hcmn_.Reflect.field(tweenspack, f);
                if (tween.time == null) tween.time = 1;
                if (tween.delay == null) tween.delay = 1;
            }
        };
        winMeter.WinMeterDefinition.getTweenDefinition = function(type, direction) {
            var tweens = _hcmn_.Reflect.field(winMeter.WinMeterDefinition.loadedDefinitionConfig.animations, type[0]);
            if (tweens == null) return null;
            return _hcmn_.Reflect.field(tweens, direction[0]);
        };
        winMeter.WinMeterDefinition.getDefaultProperties = function(id) {
            var defaults = _hcmn_.Reflect.field(winMeter.WinMeterDefinition.loadedDefinitionConfig, "defaultLabelProperties");
            if (defaults == null) return null;
            return _hcmn_.Reflect.field(defaults, id);
        };
        winMeter.WinMeterDefinition.getClassLimits = function() {
            return winMeter.WinMeterDefinition.classLimitsSet;
        };
        winMeter.WinMeterDefinition.prototype.__class__ = winMeter.WinMeterDefinition;
        winMeter.WinMeterFactory = function(context) {
            this.context = context;
        };
        winMeter.WinMeterFactory = ck_implements(winMeter.WinMeterFactory, clientkernelModulesApi.IService);
        winMeter.WinMeterFactory = ck_implements(winMeter.WinMeterFactory, componentmodelComponentApi.IComponentFactory);
        winMeter.WinMeterFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        winMeter.WinMeterFactory.__name__ = ["winMeter", "WinMeterFactory"];
        winMeter.WinMeterFactory.prototype.vbf = null;
        winMeter.WinMeterFactory.prototype.context = null;
        winMeter.WinMeterFactory.prototype.getComponentDeclaration = function() {
            return winMeterApi.WinMeterDeclaration;
        };
        winMeter.WinMeterFactory.prototype.createComponent = function(context) {
            new winMeter.WinMeter(context);
        };
        winMeter.WinMeterFactory.prototype.__class__ = winMeter.WinMeterFactory;

        winMeter.IWinMeterComponent = function() {}
        winMeter.IWinMeterComponent.prototype = {

            configure: function(cfg) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            displayWin: function(payload) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            displayMessage: function(message) {
                return {
                    arguments: ["string"],
                    returns: "void"
                };
            },
            getEvents: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };
        winMeter.AnimationSegment = function(winClass, wAmount, sAmount) {
            if (sAmount == null) sAmount = "0.00";
            this.winClass = winClass;
            this.startAmount = sAmount;
            this.winAmount = wAmount;
        };
        winMeter.AnimationSegment.__name__ = ["winMeter", "AnimationSegment"];
        winMeter.AnimationSegment.prototype.winClass = null;
        winMeter.AnimationSegment.prototype.startAmount = null;
        winMeter.AnimationSegment.prototype.winAmount = null;
        winMeter.AnimationSegment.prototype.__class__ = winMeter.AnimationSegment;
        winMeter.CountUpController = function() {
            this.currentDegree = 1;
            this.events = new winMeter.CountUpEvents();
        };
        winMeter.CountUpController.__name__ = ["winMeter", "CountUpController"];
        winMeter.CountUpController.prototype.countUpCurrentStep = null;
        winMeter.CountUpController.prototype.countUpStepsArray = null;
        winMeter.CountUpController.prototype.countUpStepTime = null;
        winMeter.CountUpController.prototype.countUpTimer = null;
        winMeter.CountUpController.prototype.currentDegree = null;
        winMeter.CountUpController.prototype.lastCountUpTimestamp = null;
        winMeter.CountUpController.prototype.events = null;
        winMeter.CountUpController.prototype.startCountUp = function(stepsArray, totalTime) {
            this.lastCountUpTimestamp = new _hcmn_.Date().getTime();
            this.countUpCurrentStep = 0;
            this.countUpStepsArray = stepsArray;
            this.countUpStepTime = _hcmn_.Math.floor(totalTime / stepsArray.length);
            this.currentDegree = this.getStartingDegree();
            if (this.countUpTimer != null) {
                this.countUpTimer.stop();
                this.countUpTimer = null;
            }
            this.countUpTimer = new _hcmn_.haxe_Timer(this.countUpStepTime);
            this.countUpTimer.run = $bind(this, this.countUp);
            this.events.COUNTER_STARTED().dispatch();
        };
        winMeter.CountUpController.prototype.getStartingDegree = function() {
            var tempDegree = 1;
            while (this.countUpStepsArray[0] > _hcmn_.Math.pow(10, tempDegree)) tempDegree++;
            return tempDegree;
        };
        winMeter.CountUpController.prototype.stopCountUp = function() {
            this.countUpCurrentStep = 0;
            if (this.countUpTimer != null) {
                this.countUpTimer.stop();
                this.countUpTimer = null;
            }
        };
        winMeter.CountUpController.prototype.countUp = function() {
            var bigJump = this.countUpStepsArray[this.countUpCurrentStep] > _hcmn_.Math.pow(10, this.currentDegree);
            if (bigJump) this.currentDegree++;
            this.events.COUNTER_STEP_UP().dispatch(new winMeter.CountUpPayload(this.countUpStepsArray[this.countUpCurrentStep], bigJump));
            if (this.countUpCurrentStep == this.countUpStepsArray.length - 1) {
                this.countUpTimer.stop();
                this.countUpTimer = null;
                this.events.COUNTER_FINISHED().dispatch(this.countUpStepsArray[this.countUpCurrentStep]);
            }
            var countUpDelta = 1;
            var deltaTime = _hcmn_.Math.ceil(new _hcmn_.Date().getTime() - this.lastCountUpTimestamp);
            if (deltaTime > this.countUpStepTime) countUpDelta = _hcmn_.Math.round(deltaTime / this.countUpStepTime);
            this.countUpCurrentStep += countUpDelta;
            if (this.countUpCurrentStep > this.countUpStepsArray.length - 1) this.countUpCurrentStep = this.countUpStepsArray.length - 1;
            this.lastCountUpTimestamp = new _hcmn_.Date().getTime();
        };
        winMeter.CountUpController.prototype.__class__ = winMeter.CountUpController;
        winMeter.CountUpPayload = function(value, bigStep) {
            this.value = value;
            this.isBigStep = bigStep;
        };
        winMeter.CountUpPayload.__name__ = ["winMeter", "CountUpPayload"];
        winMeter.CountUpPayload.prototype.value = null;
        winMeter.CountUpPayload.prototype.isBigStep = null;
        winMeter.CountUpPayload.prototype.__class__ = winMeter.CountUpPayload;
        winMeter.WinMeterComponent = function(container, background) {
            this.instantShow = false;
            this.container = container;
            this.background = background;
            this.configure({});
            this.mediumWinBkg = container.createContainerFromStoredConfig("range2bg");
            container.addChildComponent(this.mediumWinBkg, "range2bg");
            this.bigWinBkg = container.createContainerFromStoredConfig("range3bg");
            container.addChildComponent(this.bigWinBkg, "range3bg");
            this.label = container.getComponentById("winMeterLabel");
            this.labelBottom = container.getComponentById("winMeterLabelBottom");
            this.totalWinLabel = container.getComponentById("WinMeterLabelStatic");
            this.totalWinLabel.hide();
            container.getDisplayObject().setChildIndex(this.label.getDisplayObject(), container.getDisplayObject().getNumChildren() - 1);
            this.label.setText("");
            this.mediumWinBkg.getDisplayObject().setVisible(false);
            this.bigWinBkg.getDisplayObject().setVisible(false);
            this.background.getDisplayObject().setVisible(false);
            this.setPivotPoint(this.label.getDisplayObject(), new displayEngineApi.Point(0.5, 0.5));
            this.setPivotPoint(this.labelBottom.getDisplayObject(), new displayEngineApi.Point(0.5, 0.5));
            this.setPivotPoint(this.totalWinLabel.getDisplayObject(), new displayEngineApi.Point(0.5, 0.5));
            this.setPivotPoint(this.mediumWinBkg.getDisplayObject(), new displayEngineApi.Point(0.5, 0.5));
            this.setPivotPoint(this.bigWinBkg.getDisplayObject(), new displayEngineApi.Point(0.5, 0.5));
            this.setLabelValuesFromConfiguration();
            this.labelResetProperties = this.extractInitialDisplayProperties(this.label.getDisplayObject());
            this.mediumWinBkgResetProperties = this.extractInitialDisplayProperties(this.mediumWinBkg.getDisplayObject());
            this.bigWinBkgResetProperties = this.extractInitialDisplayProperties(this.bigWinBkg.getDisplayObject());
            this.countUpController = new winMeter.CountUpController();
            this.events = new winMeter.WinMeterEvents(this.countUpController.events);
            this.countUpController.events.COUNTER_STEP_UP().addListener($bind(this, this.onCountUp));
            this.countUpController.events.COUNTER_FINISHED().addListener($bind(this, this.onCounterFinished));
            this.countUpDelayTimer = new _hcmn_.haxe_Timer(0);
            this.tweens = [];
        };
        winMeter.WinMeterComponent = ck_implements(winMeter.WinMeterComponent, winMeter.IWinMeterComponent);
        winMeter.WinMeterComponent.__interfaces__ = [winMeter.IWinMeterComponent];
        winMeter.WinMeterComponent.__name__ = ["winMeter", "WinMeterComponent"];
        winMeter.WinMeterComponent.prototype.container = null;
        winMeter.WinMeterComponent.prototype.background = null;
        winMeter.WinMeterComponent.prototype.label = null;
        winMeter.WinMeterComponent.prototype.labelBottom = null;
        winMeter.WinMeterComponent.prototype.totalWinLabel = null;
        winMeter.WinMeterComponent.prototype.mediumWinBkg = null;
        winMeter.WinMeterComponent.prototype.bigWinBkg = null;
        winMeter.WinMeterComponent.prototype.labelResetProperties = null;
        winMeter.WinMeterComponent.prototype.mediumWinBkgResetProperties = null;
        winMeter.WinMeterComponent.prototype.bigWinBkgResetProperties = null;
        winMeter.WinMeterComponent.prototype.winMeterPayload = null;
        winMeter.WinMeterComponent.prototype.countUpController = null;
        winMeter.WinMeterComponent.prototype.countUpDelayTimer = null;
        winMeter.WinMeterComponent.prototype.tweens = null;
        winMeter.WinMeterComponent.prototype.preCountUpLabelScale = null;
        winMeter.WinMeterComponent.prototype.animationSegments = null;
        winMeter.WinMeterComponent.prototype.currentAnimationSegment = null;
        winMeter.WinMeterComponent.prototype.events = null;
        winMeter.WinMeterComponent.prototype.instantShow = null;
        winMeter.WinMeterComponent.prototype.setLabelValuesFromConfiguration = function() {
            var scale = this.container.getDisplayObject().getScaleX();
            this.applyProperties(this.label.getDisplayObject(), winMeter.WinMeterDefinition.getDefaultProperties("winMeterLabel"));
            this.applyProperties(this.labelBottom.getDisplayObject(), winMeter.WinMeterDefinition.getDefaultProperties("winMeterLabelBottom"));
            this.applyProperties(this.totalWinLabel.getDisplayObject(), winMeter.WinMeterDefinition.getDefaultProperties("WinMeterLabelStatic"));
        };
        winMeter.WinMeterComponent.prototype.configure = function(cfg) {};
        winMeter.WinMeterComponent.prototype.displayWin = function(payload) {
            this.instantShow = payload.instantShow;
            if (this.instantShow) {
                this.resetPositions();
                this.label.setText(winMeter.WinMeterController.moneyFormatter.format(payload.winAmount));
                this.totalWinLabel.show();
                return;
            }
            this.totalWinLabel.show();
            this.winMeterPayload = payload;
            this.resetPositions();
            this.label.setText(winMeter.WinMeterController.moneyFormatter.format(payload.startingAmount));
            if (payload.winSegments.length == 1 && payload.winSegments[0].winGroup == 0) return;
            this.animationSegments = this.generateWinAnimationSegments(payload);
            this.currentAnimationSegment = null;
            this.startAnimation();
        };
        winMeter.WinMeterComponent.prototype.displayMessage = function(message) {
            this.totalWinLabel.hide();
            this.resetPositions();
            this.labelBottom.setText(message);
            this.label.setText("");
            this.labelBottom.getDisplayObject().setAlpha(0);
            displayEngineUtils.TweenX.to(this.labelBottom.getDisplayObject(), {
                alpha: 1
            }, null, null, null, null, null, null, null, null, {
                fileName: "WinMeterComponent.hx",
                lineNumber: 149,
                className: "winmeter.component.components.WinMeterComponent",
                methodName: "displayMessage"
            }).time(0.5);
        };
        winMeter.WinMeterComponent.prototype.getEvents = function() {
            return this.events;
        };
        winMeter.WinMeterComponent.prototype.onCountUp = function(cPayload) {
            this.label.setText(winMeter.WinMeterController.moneyFormatter.format(cPayload.value + ""));
        };
        winMeter.WinMeterComponent.prototype.onCounterFinished = function(e) {
            this.startAnimation();
        };
        winMeter.WinMeterComponent.prototype.startAnimation = function() {
            var currentWinAnimationType = null;
            if (this.animationSegments.length > 0) {
                if (this.currentAnimationSegment != null) {
                    currentWinAnimationType = this.getWinAnimationType(this.currentAnimationSegment.winClass);
                    this.performSegmentAnimation(currentWinAnimationType, winMeter.WinAnimationDirection.OUTRO, true);
                }
                this.currentAnimationSegment = this.animationSegments.shift();
                currentWinAnimationType = this.getWinAnimationType(this.currentAnimationSegment.winClass);
                this.performSegmentAnimation(currentWinAnimationType, winMeter.WinAnimationDirection.INTRO);
                this.countUpDelayTimer = _hcmn_.haxe_Timer.delay($bind(this, this.startCountUp), winMeter.WinMeterDefinition.COUNTER_TIMINGS[this.currentAnimationSegment.winClass].delay);
            } else {
                currentWinAnimationType = this.getWinAnimationType(this.currentAnimationSegment.winClass);
                if (this.animationSegments.length == 0) this.performSegmentAnimation(currentWinAnimationType, winMeter.WinAnimationDirection.OUTRO, false, $bind(this, this.animationFinished));
                else this.performSegmentAnimation(currentWinAnimationType, winMeter.WinAnimationDirection.OUTRO, false);
            }
        };
        winMeter.WinMeterComponent.prototype.animationFinished = function() {
            this.events.ANIMATION_FINISHED().dispatch();
        };
        winMeter.WinMeterComponent.prototype.startCountUp = function() {
            var max_steps = winMeter.WinMeterDefinition.COUNTER_TIMINGS[this.currentAnimationSegment.winClass].max_steps;
            var total_time = winMeter.WinMeterDefinition.COUNTER_TIMINGS[this.currentAnimationSegment.winClass].time;
            this.preCountUpLabelScale = new displayEngineApi.Point(this.label.getDisplayObject().getScaleX(), this.label.getDisplayObject().getScaleY());
            var stepsArray = this.generateCountUpStepsArray(this.currentAnimationSegment.winAmount, this.currentAnimationSegment.startAmount, max_steps);
            if (this.animationSegments.length == 0) stepsArray[stepsArray.length - 1] = parseFloat(this.winMeterPayload.winAmount);
            this.countUpController.startCountUp(stepsArray, total_time);
        };
        winMeter.WinMeterComponent.prototype.generateCountUpStepsArray = function(winAmount, startingAmount, len) {
            if (len == null) len = 1;
            var stepsArray = [];
            var startFloat = parseFloat(startingAmount);
            var endFloat = parseFloat(winAmount);
            var stepFloat = (endFloat - startFloat) / len;
            var _g = 0;
            while (_g < len) {
                var i = _g++;
                var floatValue = this.floatToFixed(startFloat + stepFloat * i, 2);
                stepsArray.push(floatValue);
            }
            stepsArray[0] = startFloat;
            stepsArray[stepsArray.length - 1] = endFloat;
            return stepsArray;
        };
        winMeter.WinMeterComponent.prototype.generateWinAnimationSegments = function(payload) {
            var segmentsArray = [];
            var classLimits = winMeter.WinMeterDefinition.getClassLimits();
            var _g1 = 0;
            var _g = payload.winSegments.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (_hcmn_.HxOverrides.indexOf(classLimits, payload.winSegments[i].winGroup, 0) < 0 && i < payload.winSegments.length - 1) continue;
                var segment = payload.winSegments[i];
                var startingAmount = this.winMeterPayload.startingAmount;
                if (segmentsArray[segmentsArray.length - 1] != null) startingAmount = segmentsArray[segmentsArray.length - 1].winAmount;
                var totalAmount = this.floatToFixed(parseFloat(this.winMeterPayload.startingAmount) + parseFloat(segment.totalWin), 2);
                if (segment.winGroup != 0) {
                    var aSegment = new winMeter.AnimationSegment(segment.winGroup, totalAmount + "", startingAmount);
                    segmentsArray.push(aSegment);
                }
            }
            return segmentsArray;
        };
        winMeter.WinMeterComponent.prototype.extractInitialDisplayProperties = function(displayObject) {
            var props = {
                y: displayObject.getY(),
                x: displayObject.getX(),
                scaleX: displayObject.getScaleX(),
                scaleY: displayObject.getScaleY(),
                alpha: displayObject.getAlpha()
            };
            return props;
        };
        winMeter.WinMeterComponent.prototype.setPivotPoint = function(displayObject, pp) {
            displayObject.setPivot(new displayEngineApi.Point(displayObject.getWidth() * pp.x, displayObject.getHeight() * pp.y));
            displayObject.setX(displayObject.getX() + displayObject.getWidth() * pp.x);
            displayObject.setY(displayObject.getY() + displayObject.getHeight() * pp.y);
        };
        winMeter.WinMeterComponent.prototype.getWinAnimationType = function(winclass) {
            if (winMeter.WinMeterDefinition.BIGWIN_MAPPINGS != null && _hcmn_.HxOverrides.indexOf(winMeter.WinMeterDefinition.BIGWIN_MAPPINGS, winclass, 0) >= 0) return winMeter.WinAnimationType.BIG;
            else if (winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS != null && _hcmn_.HxOverrides.indexOf(winMeter.WinMeterDefinition.MEDIUMWIN_MAPPINGS, winclass, 0) >= 0) return winMeter.WinAnimationType.MEDIUM;
            else return winMeter.WinAnimationType.LOW;
        };
        winMeter.WinMeterComponent.prototype.resetPositions = function() {
            if (this.countUpDelayTimer != null) {
                this.countUpDelayTimer.stop();
                this.countUpDelayTimer = null;
            }
            this.countUpController.stopCountUp();
            this.resetActiveTweens();
            this.applyProperties(this.label.getDisplayObject(), this.labelResetProperties);
            this.applyProperties(this.mediumWinBkg.getDisplayObject(), this.mediumWinBkgResetProperties);
            this.applyProperties(this.bigWinBkg.getDisplayObject(), this.bigWinBkgResetProperties);
            this.mediumWinBkg.getDisplayObject().setVisible(false);
            this.bigWinBkg.getDisplayObject().setVisible(false);
            this.background.getDisplayObject().setVisible(false);
        };
        winMeter.WinMeterComponent.prototype.resetActiveTweens = function() {
            var _g = 0;
            var _g1 = this.tweens;
            while (_g < _g1.length) {
                var t = _g1[_g];
                ++_g;
                t["goto"](t.get_totalTime(), false);
                t.onHead($bind(t, t.stop));
                t = null;
            }
            this.tweens = [];
        };
        winMeter.WinMeterComponent.prototype.applyProperties = function(displayObject, props) {
            if (props == null) return;
            if (props.y != null) displayObject.setY(props.y);
            if (props.x != null) displayObject.setX(props.x);
            if (props.scaleX != null) displayObject.setScaleX(props.scaleX);
            if (props.scaleY != null) displayObject.setScaleY(props.scaleY);
            if (props.alpha != null) displayObject.setAlpha(props.alpha);
        };
        winMeter.WinMeterComponent.prototype.floatToFixed = function(f, n) {
            var f1 = f;
            f1 *= _hcmn_.Math.pow(10, n);
            f1 = _hcmn_.Math.floor(f1) / _hcmn_.Math.pow(10, n);
            return f1;
        };
        winMeter.WinMeterComponent.prototype.performSegmentAnimation = function(type, direction, transition, onFinish) {
            if (transition == null) transition = false;
            var _g = this;
            var tweenProps = winMeter.WinMeterDefinition.getTweenDefinition(type, direction);
            var rangeBg = null;
            var globalBg = this.background.getDisplayObject();
            if (type == winMeter.WinAnimationType.MEDIUM) rangeBg = this.mediumWinBkg.getDisplayObject();
            if (type == winMeter.WinAnimationType.BIG) rangeBg = this.bigWinBkg.getDisplayObject();
            if (direction == winMeter.WinAnimationDirection.INTRO) {
                if (rangeBg != null) {
                    rangeBg.setVisible(true);
                    rangeBg.setAlpha(0);
                }
                if (globalBg != null) {
                    globalBg.setVisible(true);
                    globalBg.setAlpha(0);
                }
                this.performTween(this.label.getDisplayObject(), tweenProps.label);
                this.performTween(globalBg, tweenProps.globalBkg);
                this.performTween(rangeBg, tweenProps.bkg);
            } else {
                if (!transition) {
                    this.performTween(this.label.getDisplayObject(), tweenProps.label, function() {
                        if (onFinish != null && !_g.instantShow) onFinish();
                    }, displayEngineUtils.EaseX.bounceOut);
                    this.performTween(globalBg, tweenProps.globalBkg, function() {
                        if (tweenProps.alpha == 0) globalBg.setVisible(false);
                    });
                }
                this.performTween(rangeBg, tweenProps.bkg, function() {
                    if (tweenProps.alpha == 0) rangeBg.setVisible(false);
                });
            }
        };
        winMeter.WinMeterComponent.prototype.performTween = function(displayObject, props, onFinish, ease) {
            var easing;
            if (ease != null) easing = ease;
            else easing = displayEngineUtils.EaseX.linear;
            if (props != null) this.tweens.push(displayEngineUtils.TweenX.to(displayObject, props, props.time, null, null, null, null, null, null, null, {
                fileName: "WinMeterComponent.hx",
                lineNumber: 495,
                className: "winmeter.component.components.WinMeterComponent",
                methodName: "performTween"
            }).delay(props.delay / 1000).ease(easing).onFinish(onFinish));
        };
        winMeter.WinMeterComponent.prototype.__class__ = winMeter.WinMeterComponent;
        winMeter.WinAnimationDirection = {
            __ename__: ["winMeter", "WinAnimationDirection"],
            __constructs__: ["INTRO", "OUTRO"]
        };
        winMeter.WinAnimationDirection.OUTRO = ["OUTRO", 1];
        winMeter.WinAnimationDirection.OUTRO.toString = $estr;
        winMeter.WinAnimationDirection.OUTRO.__enum__ = winMeter.WinAnimationDirection;
        winMeter.WinAnimationDirection.INTRO = ["INTRO", 0];
        winMeter.WinAnimationDirection.INTRO.toString = $estr;
        winMeter.WinAnimationDirection.INTRO.__enum__ = winMeter.WinAnimationDirection;
        winMeter.WinAnimationType = {
            __ename__: ["winMeter", "WinAnimationType"],
            __constructs__: ["LOW", "MEDIUM", "BIG"]
        };
        winMeter.WinAnimationType.MEDIUM = ["MEDIUM", 1];
        winMeter.WinAnimationType.MEDIUM.toString = $estr;
        winMeter.WinAnimationType.MEDIUM.__enum__ = winMeter.WinAnimationType;
        winMeter.WinAnimationType.BIG = ["BIG", 2];
        winMeter.WinAnimationType.BIG.toString = $estr;
        winMeter.WinAnimationType.BIG.__enum__ = winMeter.WinAnimationType;
        winMeter.WinAnimationType.LOW = ["LOW", 0];
        winMeter.WinAnimationType.LOW.toString = $estr;
        winMeter.WinAnimationType.LOW.__enum__ = winMeter.WinAnimationType;
        winMeter.BaseEvent = function() {
            this._signal = new _hcmn_.msignal_Signal1();
        };
        winMeter.BaseEvent.__name__ = ["winMeter", "BaseEvent"];
        winMeter.BaseEvent.prototype._signal = null;
        winMeter.BaseEvent.prototype.addListener = function(listener) {
            this._signal.add(listener);
        };
        winMeter.BaseEvent.prototype.removeListener = function(listener) {
            this._signal.remove(listener);
        };
        winMeter.BaseEvent.prototype.dispatch = function(data) {
            this._signal.dispatch(data);
        };
        winMeter.BaseEvent.prototype.__class__ = winMeter.BaseEvent;
        winMeter.CountUpEvents = function() {
            this.counterStarted = new winMeter.BaseEvent();
            this.counterStepUp = new winMeter.BaseEvent();
            this.counterFinished = new winMeter.BaseEvent();
        };
        winMeter.CountUpEvents.__name__ = ["winMeter", "CountUpEvents"];
        winMeter.CountUpEvents.prototype.counterStarted = null;
        winMeter.CountUpEvents.prototype.counterStepUp = null;
        winMeter.CountUpEvents.prototype.counterFinished = null;
        winMeter.CountUpEvents.prototype.COUNTER_STEP_UP = function() {
            return this.counterStepUp;
        };
        winMeter.CountUpEvents.prototype.COUNTER_FINISHED = function() {
            return this.counterFinished;
        };
        winMeter.CountUpEvents.prototype.COUNTER_STARTED = function() {
            return this.counterStarted;
        };
        winMeter.CountUpEvents.prototype.__class__ = winMeter.CountUpEvents;
        winMeter.WinMeterEvents = function(countupEvents) {
            this.countUpEvents = countupEvents;
            this.animationFinished = new winMeter.BaseEvent();
        };
        winMeter.WinMeterEvents.__name__ = ["winMeter", "WinMeterEvents"];
        winMeter.WinMeterEvents.prototype.animationFinished = null;
        winMeter.WinMeterEvents.prototype.countUpEvents = null;
        winMeter.WinMeterEvents.prototype.ANIMATION_FINISHED = function() {
            return this.animationFinished;
        };
        winMeter.WinMeterEvents.prototype.getCountUpEvents = function() {
            return this.countUpEvents;
        };
        winMeter.WinMeterEvents.prototype.__class__ = winMeter.WinMeterEvents;
        return {
            exports: winMeter,
            activator: winMeter.Activator
        };
    });
//# sourceURL=slotWinMeter.js