define("jackpotMeter", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "jackpotMeterApi", "gameLayoutApi", "money", "PIXI", "BABYLON", "clientkernelEventbusApi", "clientkernelModulesApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, jackpotMeterApi, gameLayoutApi, money, PIXI, BABYLON, 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"
                };
            },
            iterator: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        if (!haxe.ds) {
            haxe.ds = {};
        };
        if (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        if (typeof jackpotMeter == 'undefined') {
            var jackpotMeter = {};
        };
        jackpotMeter.Activator = function(context) {};
        jackpotMeter.Activator = ck_implements(jackpotMeter.Activator, clientkernelModulesApi.IModuleActivator);
        jackpotMeter.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        jackpotMeter.Activator.__name__ = ["jackpotMeter", "Activator"];
        jackpotMeter.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider, moneyApi.IMoneyFormatter, moneyApi.IMoneyFormatterController]).then(function(context1) {
                jackpotMeter.ExternalService.initialize(context1);
                context1.registerService(new jackpotMeter.JackpotMeterFactory(context1), jackpotMeterApi.JackpotMeterDeclaration, null);
            });
        };
        jackpotMeter.Activator.prototype.stop = function(context) {};
        jackpotMeter.Activator.main = function() {};
        jackpotMeter.Activator.prototype.__class__ = jackpotMeter.Activator;
        jackpotMeter.JackpotMeter = function(context) {
            this.configId = "JACKPOT_METER_configuration";
            this.popupAssetId = "JACKPOT_POPUP_VB";
            this.assetId = "JACKPOT_METER_VB";
            var _g = this;
            this.context = context;
            this.jpPort = context.getUsedPort(slotModelApi.IJackpotPort);
            this.jpMeterPort = context.getImplementedPort(jackpotMeterApi.IJackpotMeterImplementationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            var smPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            var layoutController = new jackpotMeter.LayoutController(this);
            var meterController = new jackpotMeter.MeterController(this);
            this.messageController = new jackpotMeter.MessageController(this);
            var layoutInitialized = layoutController.getInit();
            var meterInitialized = meterController.getInit();
            var configInitialized = jackpotMeter.ExternalService.getAsset(this.configId).then(function(data) {
                _g.config = data;
            });
            Promise.all([layoutInitialized, meterInitialized, configInitialized]).then(function(o) {
                var viewInitialized = jackpotMeter.ExternalService.getAsset(_g.assetId).then(function(vbAssets) {
                    _g.view = new jackpotMeter.MeterView(vbAssets);
                });
                var popupInitalized = jackpotMeter.ExternalService.getAsset(_g.popupAssetId).then(function(vbAssets1) {
                    _g.popup = new jackpotMeter.PlayerAcknowledgement(vbAssets1, _g.jpMeterPort);
                });
                Promise.all([viewInitialized, popupInitalized]).then(function(o1) {
                    layoutController.start();
                });
            });
            var gameInitialized = new Promise(function(resolve, reject) {
                var onInit = function(e) {
                    resolve(e.getPayload().riskControlSettings.denomination);
                };
                var initGame = smPort.getStages().getInitStage().getInitializeGamePhase().getInitializeGame();
                initGame.subscribe(onInit);
                var onResume = function(e1) {
                    resolve(e1.getPayload().initializationProperties.riskControlSettings.denomination);
                };
                var resume = smPort.getStages().getResumeStage().getPrepareResume();
                resume.subscribe(onResume);
            });
            gameInitialized.then(function(denomination) {
                jackpotMeter.Formatter.setDenomination(denomination);
                meterController.start();
                _g.messageController.start();
                _g.view.setVisible(true);
            });
        };
        jackpotMeter.JackpotMeter.__name__ = ["jackpotMeter", "JackpotMeter"];
        jackpotMeter.JackpotMeter.prototype.context = null;
        jackpotMeter.JackpotMeter.prototype.jpPort = null;
        jackpotMeter.JackpotMeter.prototype.jpMeterPort = null;
        jackpotMeter.JackpotMeter.prototype.layoutPort = null;
        jackpotMeter.JackpotMeter.prototype.view = null;
        jackpotMeter.JackpotMeter.prototype.popup = null;
        jackpotMeter.JackpotMeter.prototype.config = null;
        jackpotMeter.JackpotMeter.prototype.assetId = null;
        jackpotMeter.JackpotMeter.prototype.popupAssetId = null;
        jackpotMeter.JackpotMeter.prototype.configId = null;
        jackpotMeter.JackpotMeter.prototype.messageController = null;
        jackpotMeter.JackpotMeter.prototype.getMessageController = function() {
            return this.messageController;
        };
        jackpotMeter.JackpotMeter.prototype.__class__ = jackpotMeter.JackpotMeter;
        jackpotMeter.JackpotMeterFactory = function(context) {
            this.context = context;
        };
        jackpotMeter.JackpotMeterFactory = ck_implements(jackpotMeter.JackpotMeterFactory, clientkernelModulesApi.IService);
        jackpotMeter.JackpotMeterFactory = ck_implements(jackpotMeter.JackpotMeterFactory, componentmodelComponentApi.IComponentFactory);
        jackpotMeter.JackpotMeterFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        jackpotMeter.JackpotMeterFactory.__name__ = ["jackpotMeter", "JackpotMeterFactory"];
        jackpotMeter.JackpotMeterFactory.prototype.vbf = null;
        jackpotMeter.JackpotMeterFactory.prototype.context = null;
        jackpotMeter.JackpotMeterFactory.prototype.getComponentDeclaration = function() {
            return jackpotMeterApi.JackpotMeterDeclaration;
        };
        jackpotMeter.JackpotMeterFactory.prototype.createComponent = function(context) {
            new jackpotMeter.JackpotMeter(context);
        };
        jackpotMeter.JackpotMeterFactory.prototype.__class__ = jackpotMeter.JackpotMeterFactory;
        jackpotMeter.BaseController = function(jackpotMeter1) {
            this.initialized = false;
            this.component = jackpotMeter1;
        };
        jackpotMeter.BaseController.__name__ = ["jackpotMeter", "BaseController"];
        jackpotMeter.BaseController.prototype.component = null;
        jackpotMeter.BaseController.prototype.resolve = null;
        jackpotMeter.BaseController.prototype.initialized = null;
        jackpotMeter.BaseController.prototype.start = function() {
            this.initialized = true;
        };
        jackpotMeter.BaseController.prototype.getInit = function() {
            var _g = this;
            var p = new Promise(function(resolve, reject) {
                _g.resolve = resolve;
            });
            return p;
        };
        jackpotMeter.BaseController.prototype.__class__ = jackpotMeter.BaseController;
        jackpotMeter.Counter = function(startValue) {
            this.paused = false;
            this.currentValue = startValue;
            this.target = startValue;
            this.timestamp = new _hcmn_.Date().getTime();
        };
        jackpotMeter.Counter.__name__ = ["jackpotMeter", "Counter"];
        jackpotMeter.Counter.prototype.callback = null;
        jackpotMeter.Counter.prototype.currentValue = null;
        jackpotMeter.Counter.prototype.target = null;
        jackpotMeter.Counter.prototype.timestamp = null;
        jackpotMeter.Counter.prototype.timer = null;
        jackpotMeter.Counter.prototype.increment = null;
        jackpotMeter.Counter.prototype.paused = null;
        jackpotMeter.Counter.prototype.onCount = function(callback) {
            this.callback = callback;
            callback(this.currentValue);
        };
        jackpotMeter.Counter.prototype.update = function(newValue) {
            if (this.paused) return;
            var now = new _hcmn_.Date().getTime();
            if (this.timer != null) this.timer.stop();
            this.target = newValue;
            var diff = this.target - this.currentValue;
            if (diff < 2) {
                this.currentValue = this.target;
                this.callback(this.currentValue);
            } else {
                var time = now - this.timestamp;
                if (time > 20000) time = 20000;
                this.increment = 1;
                var interval = _hcmn_.Math.floor(time / diff);
                if (interval < 500) {
                    interval = 500;
                    var steps = _hcmn_.Math.floor(time / interval);
                    this.increment = _hcmn_.Math.ceil(diff / steps);
                }
                this.timer = new _hcmn_.haxe_Timer(interval);
                this.timer.run = $bind(this, this.run);
            }
            this.timestamp = now;
        };
        jackpotMeter.Counter.prototype.resume = function() {
            this.paused = false;
        };
        jackpotMeter.Counter.prototype.pause = function() {
            if (this.timer != null) this.timer.stop();
            this.paused = true;
            this.currentValue = this.target;
            this.callback(this.currentValue);
        };
        jackpotMeter.Counter.prototype.run = function() {
            this.currentValue += this.increment;
            if (this.currentValue >= this.target) {
                this.currentValue = this.target;
                this.timer.stop();
            }
            this.callback(this.currentValue);
        };
        jackpotMeter.Counter.prototype.forceValue = function(newValue) {
            this.target = this.currentValue = newValue;
            this.callback(this.currentValue);
        };
        jackpotMeter.Counter.prototype.__class__ = jackpotMeter.Counter;
        jackpotMeter.Formatter = function() {};
        jackpotMeter.Formatter.__name__ = ["jackpotMeter", "Formatter"];
        jackpotMeter.Formatter.denomination = null;
        jackpotMeter.Formatter.jackpotValue = null;
        jackpotMeter.Formatter.setDenomination = function(value) {
            jackpotMeter.Formatter.denomination = value;
        };
        jackpotMeter.Formatter.setJackpot = function(value) {
            jackpotMeter.Formatter.jackpotValue = value;
        };
        jackpotMeter.Formatter.formatMoney = function(value) {
            var val = parseFloat(jackpotMeter.Formatter.denomination) * value;
            var text = (Number(_hcmn_.Math.round(val + "e2") + "e-2").toFixed(2));
            return jackpotMeter.ExternalService.moneyFormatter.format(text);
        };
        jackpotMeter.Formatter.formatText = function(text) {
            var out = jackpotMeter.Formatter.replaceJackpot(text);
            return jackpotMeter.Formatter.formatValuesInText(out);
        };
        jackpotMeter.Formatter.formatValuesInText = function(text) {
            var arr1 = text.split("{");
            if (arr1.length > 1) {
                var arr2 = arr1[1].split("}");
                var value = _hcmn_.Std.parseInt(arr2[0]);
                return arr1[0] + jackpotMeter.Formatter.formatMoney(value) + arr2[1];
            } else return text;
        };
        jackpotMeter.Formatter.replaceJackpot = function(text) {
            var arr = text.split("%j");
            if (arr.length > 1) {
                var jackpot = jackpotMeter.Formatter.formatMoney(jackpotMeter.Formatter.jackpotValue);
                return arr.join(jackpot);
            } else return text;
        };
        jackpotMeter.Formatter.prototype.__class__ = jackpotMeter.Formatter;
        jackpotMeter.LayoutController = function(jackpotMeter1) {
            jackpotMeter.BaseController.call(this, jackpotMeter1);
            this.component.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.onUpdateLayout));
        };
        jackpotMeter.LayoutController.__name__ = ["jackpotMeter", "LayoutController"];
        jackpotMeter.LayoutController.__super__ = jackpotMeter.BaseController;
        for (var k in jackpotMeter.BaseController.prototype) jackpotMeter.LayoutController.prototype[k] = jackpotMeter.BaseController.prototype[k];
        jackpotMeter.LayoutController.prototype.layoutPayload = null;
        jackpotMeter.LayoutController.prototype.onUpdateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (this.resolve != null) {
                this.resolve(null);
                this.resolve = null;
            }
            if (this.initialized) this.updateLayout();
        };
        jackpotMeter.LayoutController.prototype.updateLayout = function() {
            var containerLayout = this.layoutPayload.containers.get("JACKPOT_METER");
            var displayObject = this.component.view.getDisplayObject();
            var portrait = false;
            if (containerLayout.configuration != null) {
                if (containerLayout.configuration.portrait != null) portrait = containerLayout.configuration.portrait;
            }
            this.component.view.setOrientation(portrait);
            this.setLayout(displayObject, containerLayout);
            containerLayout = this.layoutPayload.containers.get("JACKPOT_POPUP");
            displayObject = this.component.popup.getDisplayObject();
            this.setLayout(displayObject, containerLayout);
            this.component.layoutPort.getComponentLayoutUpdated().publish(this.component.context.getInstance());
        };
        jackpotMeter.LayoutController.prototype.setLayout = function(displayObject, containerLayout) {
            displayObject.setX(containerLayout.left);
            displayObject.setY(containerLayout.top);
            displayObject.setWidth(containerLayout.width);
            displayObject.setHeight(containerLayout.height);
            displayObject.setZIndex(containerLayout.zIndex);
            displayObject.setZOrder(containerLayout.stageZIndex);
        };
        jackpotMeter.LayoutController.prototype.start = function() {
            this.initialized = true;
            var stage;
            var this1 = jackpotMeter.ExternalService.displayProvider.getStages();
            var key = this.layoutPayload.containers.get("JACKPOT_METER").stage;
            stage = this1.get(key);
            stage.addChild(this.component.view.getDisplayObject());
            stage.addChild(this.component.popup.getDisplayObject());
            var this2 = jackpotMeter.ExternalService.displayProvider.getStages();
            var key1 = this.layoutPayload.containers.get("JACKPOT_POPUP").stage;
            stage = this2.get(key1);
            this.updateLayout();
        };
        jackpotMeter.LayoutController.prototype.__class__ = jackpotMeter.LayoutController;
        jackpotMeter.MessageController = function(component) {
            this.messages = [];
            this.component = component;
        };
        jackpotMeter.MessageController.__name__ = ["jackpotMeter", "MessageController"];
        jackpotMeter.MessageController.prototype.component = null;
        jackpotMeter.MessageController.prototype.messages = null;
        jackpotMeter.MessageController.prototype.timer = null;
        jackpotMeter.MessageController.prototype.subsriptionGetPlayerMessageUpdate = null;
        jackpotMeter.MessageController.prototype.start = function() {
            this.showMesssage("");
            this.subsriptionGetPlayerMessageUpdate = this.component.jpPort.getPlayerMessageUpdate().subscribe($bind(this, this.onMessage));
        };
        jackpotMeter.MessageController.prototype.onMessage = function(e) {
            var payload = e.getPayload();
            if (payload.playerMessage.message.length > 0) {
                var _g = 0;
                var _g1 = payload.playerMessage.message;
                while (_g < _g1.length) {
                    var msg = _g1[_g];
                    ++_g;
                    this.messages.push(msg.text);
                }
                if (this.timer == null) {
                    this.timer = new _hcmn_.haxe_Timer(this.component.config.messageDuration);
                    this.timer.run = $bind(this, this.run);
                    this.run();
                }
            }
        };
        jackpotMeter.MessageController.prototype.run = function() {
            if (this.messages.length > 0) this.showMesssage(this.messages.shift());
            else {
                this.showMesssage("");
                this.timer.stop();
                this.timer = null;
            }
        };
        jackpotMeter.MessageController.prototype.showMesssage = function(text) {
            var formatedText = jackpotMeter.Formatter.formatText(text);
            this.component.view.setMessageText(formatedText);
        };
        jackpotMeter.MessageController.prototype.__class__ = jackpotMeter.MessageController;
        jackpotMeter.MeterController = function(jackpotMeter1) {
            jackpotMeter.BaseController.call(this, jackpotMeter1);
            this.jackpotMeter = jackpotMeter1;
            this.component.jpPort.getMeterUpdate().subscribe($bind(this, this.onMessage));
            this.component.jpMeterPort.pause().subscribe($bind(this, this.onPause));
            this.component.jpMeterPort.resume().subscribe($bind(this, this.onResume));
            this.component.jpMeterPort.getValues().subscribe($bind(this, this.onGetValues));
            this.component.jpMeterPort.setValue().subscribe($bind(this, this.onSetValue));
            this.component.jpMeterPort.showMessages().subscribe($bind(this, this.onShowMessages));
            this.component.jpMeterPort.hideMessages().subscribe($bind(this, this.onHideMessages));
        };
        jackpotMeter.MeterController.__name__ = ["jackpotMeter", "MeterController"];
        jackpotMeter.MeterController.__super__ = jackpotMeter.BaseController;
        for (var k in jackpotMeter.BaseController.prototype) jackpotMeter.MeterController.prototype[k] = jackpotMeter.BaseController.prototype[k];
        jackpotMeter.MeterController.prototype.initValue = null;
        jackpotMeter.MeterController.prototype.counter = null;
        jackpotMeter.MeterController.prototype.payload = null;
        jackpotMeter.MeterController.prototype.jackpotMeter = null;
        jackpotMeter.MeterController.prototype.onSetValue = function(e) {
            this.counter.forceValue(e.getPayload());
        };
        jackpotMeter.MeterController.prototype.onGetValues = function(e) {
            e.reply(this.payload.jackpots.jackpot);
        };
        jackpotMeter.MeterController.prototype.onResume = function(e) {
            this.counter.resume();
        };
        jackpotMeter.MeterController.prototype.onPause = function(e) {
            this.counter.pause();
        };
        jackpotMeter.MeterController.prototype.onMessage = function(e) {
            this.payload = e.getPayload();
            var value = this.getJackpotValue(this.payload, this.component.config.jackpotType);
            if (this.resolve != null) {
                this.resolve(null);
                this.resolve = null;
                this.initValue = value;
            }
            if (this.initialized) {
                this.counter.update(value);
                jackpotMeter.Formatter.setJackpot(value);
            }
        };
        jackpotMeter.MeterController.prototype.getJackpotValue = function(payload, jackpotType) {
            var _g = 0;
            var _g1 = payload.jackpots.jackpot;
            while (_g < _g1.length) {
                var jp = _g1[_g];
                ++_g;
                if (jp.type == jackpotType) return jp.showNow;
            }
            return null;
        };
        jackpotMeter.MeterController.prototype.start = function() {
            this.initialized = true;
            jackpotMeter.Formatter.setJackpot(this.initValue);
            this.counter = new jackpotMeter.Counter(this.initValue);
            this.counter.onCount($bind(this, this.updateLabel));
        };
        jackpotMeter.MeterController.prototype.updateLabel = function(value) {
            var text = jackpotMeter.Formatter.formatMoney(value);
            this.component.view.setJPValue(text);
            this.component.jpMeterPort.onValueChanged().publish(value);
        };
        jackpotMeter.MeterController.prototype.onShowMessages = function(e) {
            this.jackpotMeter.jpPort.getPlayerMessageUpdate().subscribe(($_ = this.jackpotMeter.getMessageController(), $bind($_, $_.onMessage)));
            this.component.view.showMessageLabel();
        };
        jackpotMeter.MeterController.prototype.onHideMessages = function(e) {
            this.jackpotMeter.getMessageController().subsriptionGetPlayerMessageUpdate.unsubscribe();
            this.jackpotMeter.getMessageController().messages = [];
            this.component.view.hideMessageLabel();
        };
        jackpotMeter.MeterController.prototype.__class__ = jackpotMeter.MeterController;
        jackpotMeter.CheckBbox = function(btn_checked, btn_not_checked) {
            this.btn_not_checked = btn_not_checked;
            this.btn_checked = btn_checked;
            this.btn_not_checked.getEvents().DOWN().addListener($bind(this, this.toggle));
            this.btn_checked.getEvents().DOWN().addListener($bind(this, this.toggle));
            this.set_checked(false);
        };
        jackpotMeter.CheckBbox.__name__ = ["jackpotMeter", "CheckBbox"];
        jackpotMeter.CheckBbox.prototype.checked = null;
        jackpotMeter.CheckBbox.prototype.onChange = null;
        jackpotMeter.CheckBbox.prototype._checked = null;
        jackpotMeter.CheckBbox.prototype.btn_checked = null;
        jackpotMeter.CheckBbox.prototype.btn_not_checked = null;
        jackpotMeter.CheckBbox.prototype.toggle = function() {
            this.set_checked(!this.get_checked());
        };
        jackpotMeter.CheckBbox.prototype.get_checked = function() {
            return this._checked;
        };
        jackpotMeter.CheckBbox.prototype.set_checked = function(value) {
            if (value) {
                this.btn_checked.show();
                this.btn_not_checked.hide();
            } else {
                this.btn_checked.hide();
                this.btn_not_checked.show();
            }
            if (this.onChange != null) this.onChange(value);
            return this._checked = value;
        };
        jackpotMeter.CheckBbox.prototype.__class__ = jackpotMeter.CheckBbox;
        jackpotMeter.ExternalService = function() {};
        jackpotMeter.ExternalService.__name__ = ["jackpotMeter", "ExternalService"];
        jackpotMeter.ExternalService.assetRegistry = null;
        jackpotMeter.ExternalService.variableRegistry = null;
        jackpotMeter.ExternalService.viewBuilderFactory = null;
        jackpotMeter.ExternalService.displayProvider = null;
        jackpotMeter.ExternalService.moneyFormatter = null;
        jackpotMeter.ExternalService.bus = null;
        jackpotMeter.ExternalService.initialize = function(context) {
            jackpotMeter.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            jackpotMeter.ExternalService.variableRegistry = context.getAnyService(clientkernelLoaderApi.IVariableRegistry, null);
            jackpotMeter.ExternalService.viewBuilderFactory = context.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
            jackpotMeter.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            jackpotMeter.ExternalService.moneyFormatter = context.getAnyService(moneyApi.IMoneyFormatter, null);
            jackpotMeter.ExternalService.bus = context.getAnyService(clientkernelEventbusApi.IEventBus, null);
        };
        jackpotMeter.ExternalService.getAsset = function(assetId) {
            return jackpotMeter.ExternalService.assetRegistry.getAsset(assetId).getContent();
        };
        jackpotMeter.ExternalService.prototype.__class__ = jackpotMeter.ExternalService;
        jackpotMeter.TextStyles = function() {};
        jackpotMeter.TextStyles.__name__ = ["jackpotMeter", "TextStyles"];
        jackpotMeter.TextStyles.apply = function(container, styletableId) {
            jackpotMeter.ExternalService.getAsset(styletableId).then(function(data) {
                jackpotMeter.TextStyles.applyStyles(container, data);
            });
        };
        jackpotMeter.TextStyles.applyStyles = function(container, data) {
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(data.styles);
            while (_g < _g1.length) {
                var labelId = _g1[_g];
                ++_g;
                var $it0 = (function($this) {
                    var $r;
                    var this1 = container.getChildComponents();
                    $r = this1.iterator();
                    return $r;
                }(this));
                while ($it0.hasNext()) {
                    var child = $it0.next();
                    if (child.isContainer()) jackpotMeter.TextStyles.applyStyles(child, data);
                    else {
                        var labelComponent = container.getComponentById(labelId);
                        if (labelComponent != null)(_hcmn_.js_Boot.__cast(labelComponent, viewBuilderApi.ILabel)).updateTo("", _hcmn_.Reflect.getProperty(data.styles, labelId));
                    }
                }
            }
        };
        jackpotMeter.TextStyles.prototype.__class__ = jackpotMeter.TextStyles;
        jackpotMeter.MeterView = function(vbAssets) {
            this.styletableId = "JACKPOT_METER_VB_styletable";
            this.container = jackpotMeter.ExternalService.viewBuilderFactory.createView(vbAssets).getComponentById("JACKPOT_METER");
            jackpotMeter.TextStyles.apply(this.container, this.styletableId);
            this.setVisible(false);
        };
        jackpotMeter.MeterView.__name__ = ["jackpotMeter", "MeterView"];
        jackpotMeter.MeterView.prototype.container = null;
        jackpotMeter.MeterView.prototype.styletableId = null;
        jackpotMeter.MeterView.prototype.setOrientation = function(portrait) {
            if (portrait) {
                this.container.getComponentById("landscape").hide();
                this.container.getComponentById("portrait").show();
            } else {
                this.container.getComponentById("landscape").show();
                this.container.getComponentById("portrait").hide();
            }
        };
        jackpotMeter.MeterView.prototype.getLabel = function(containerId, labelId) {
            return (_hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer)).getLabelById(labelId);
        };
        jackpotMeter.MeterView.prototype.setJPValue = function(text) {
            this.getLabel("landscape", "jpValueLabel").setText(text);
            this.getLabel("portrait", "jpValueLabel2").setText(text);
        };
        jackpotMeter.MeterView.prototype.setMessageText = function(text) {
            this.getLabel("landscape", "jpMessageLabel").setText(text);
            this.getLabel("portrait", "jpMessageLabel2").setText(text);
        };
        jackpotMeter.MeterView.prototype.setVisible = function(value) {
            if (value) this.container.show();
            else this.container.hide();
        };
        jackpotMeter.MeterView.prototype.getDisplayObject = function() {
            return this.container.getDisplayObject();
        };
        jackpotMeter.MeterView.prototype.showMessageLabel = function() {
            this.getLabel("landscape", "jpMessageLabel").show();
            this.getLabel("portrait", "jpMessageLabel2").show();
        };
        jackpotMeter.MeterView.prototype.hideMessageLabel = function() {
            this.getLabel("landscape", "jpMessageLabel").hide();
            this.getLabel("portrait", "jpMessageLabel2").hide();
        };
        jackpotMeter.MeterView.prototype.__class__ = jackpotMeter.MeterView;
        jackpotMeter.PlayerAcknowledgement = function(vbAssets, jpMeterPort) {
            this.active = false;
            jpMeterPort.getPlayerAckonowledgement().subscribe($bind(this, this.show));
            this.container = jackpotMeter.ExternalService.viewBuilderFactory.createView(vbAssets).getComponentById("JACKPOT_POPUP");
            jackpotMeter.TextStyles.apply(this.container, "JACKPOT_POPUP_VB_styletable");
            this.btnContinue = this.container.getButtonById("BUTTON_CONTINUE");
            this.btnContinue.getEvents().DOWN().addListener($bind(this, this.onButtonDown));
            this.btnContinue.disable();
            this.btnClose = this.container.getButtonById("BUTTON_CLOSE");
            this.btnClose.getEvents().DOWN().addListener($bind(this, this.onButtonDown));
            this.btnClose.disable();
            var checkedBtn = this.container.getButtonById("BUTTON_CHECKED");
            var notCheckedBtn = this.container.getButtonById("BUTTON_NOT_CHECKED");
            this.checkbox = new jackpotMeter.CheckBbox(checkedBtn, notCheckedBtn);
            this.checkbox.onChange = $bind(this, this.onCheckboxChange);
            this.container.hide();
            jackpotMeter.ExternalService.bus.getChannel("GFBus").subscribe("jackpotmeter:check", $bind(this, this.testFrameworkCheck));
            jackpotMeter.ExternalService.bus.getChannel("GFBus").subscribe("jackpotmeter:select", $bind(this, this.testFrameworkSelect));
        };
        jackpotMeter.PlayerAcknowledgement.__name__ = ["jackpotMeter", "PlayerAcknowledgement"];
        jackpotMeter.PlayerAcknowledgement.prototype.container = null;
        jackpotMeter.PlayerAcknowledgement.prototype.btnContinue = null;
        jackpotMeter.PlayerAcknowledgement.prototype.btnClose = null;
        jackpotMeter.PlayerAcknowledgement.prototype.requestEvent = null;
        jackpotMeter.PlayerAcknowledgement.prototype.checkbox = null;
        jackpotMeter.PlayerAcknowledgement.prototype.active = null;
        jackpotMeter.PlayerAcknowledgement.prototype.testFrameworkSelect = function(e) {
            if (this.active && this.checkbox.get_checked()) this.onButtonDown();
        };
        jackpotMeter.PlayerAcknowledgement.prototype.testFrameworkCheck = function(e) {
            if (this.active) {
                this.checkbox.set_checked(true);
                this.onCheckboxChange(true);
            }
        };
        jackpotMeter.PlayerAcknowledgement.prototype.onCheckboxChange = function(value) {
            if (value) {
                this.btnContinue.enable();
                this.btnClose.enable();
                jackpotMeter.ExternalService.bus.getChannel("GFBus").publish("jackpotmeter:selectReady", null);
            } else {
                this.btnClose.disable();
                this.btnContinue.disable();
            }
        };
        jackpotMeter.PlayerAcknowledgement.prototype.getDisplayObject = function() {
            return this.container.getDisplayObject();
        };
        jackpotMeter.PlayerAcknowledgement.prototype.show = function(e) {
            this.requestEvent = e;
            this.setText("title", e.getPayload().title);
            this.setText("content", e.getPayload().content);
            this.setText("message_confirm", e.getPayload().msg_confirm);
            this.active = true;
            this.checkbox.set_checked(false);
            this.container.show();
            jackpotMeter.ExternalService.bus.getChannel("GFBus").publish("jackpotmeter:presented", null);
        };
        jackpotMeter.PlayerAcknowledgement.prototype.setText = function(labelId, text) {
            var label = this.container.getLabelById(labelId);
            label.setText(text);
        };
        jackpotMeter.PlayerAcknowledgement.prototype.onButtonDown = function() {
            this.active = false;
            this.container.hide();
            this.requestEvent.reply(null);
        };
        jackpotMeter.PlayerAcknowledgement.prototype.__class__ = jackpotMeter.PlayerAcknowledgement;
        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;
        jackpotMeter.Counter.MIN_INTERVAL = 500;;
        jackpotMeter.Counter.MAX_TIME = 20000;;
        return {
            exports: jackpotMeter,
            activator: jackpotMeter.Activator
        };
    });
//# sourceURL=jackpotMeter.js