define("BonusInfoPanel", ["BonusInfoPanelApi", "viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "displayEngineApi", "displayEngineUtils", "gameLayoutApi", "wildFuryAnimationPort", "PIXI", "BABYLON", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(BonusInfoPanelApi, viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, displayEngineApi, displayEngineUtils, gameLayoutApi, wildFuryAnimationPort, PIXI, BABYLON, clientkernelEventbusApi, clientkernelModulesApi) {
        "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 BonusInfoPanel == 'undefined') {
            var BonusInfoPanel = {};
        };
        BonusInfoPanel.Activator = function(context) {};
        BonusInfoPanel.Activator = ck_implements(BonusInfoPanel.Activator, clientkernelModulesApi.IModuleActivator);
        BonusInfoPanel.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        BonusInfoPanel.Activator.__name__ = ["BonusInfoPanel", "Activator"];
        BonusInfoPanel.Activator.prototype.start = function(context) {
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, viewBuilderApi.IViewBuilderFactory, displayEngineApi.IDisplayProvider, translationmanagerApi.ITranslationManager]).then(function(context1) {
                BonusInfoPanel.ExternalService.initialize(context1);
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                BonusInfoPanel.ExternalService.viewBuilderFactory = vbf;
                context1.registerService(new BonusInfoPanel.BonusInfoPanelFactory(), BonusInfoPanelApi.BonusInfoPanelDeclaration, null);
            });
        };
        BonusInfoPanel.Activator.prototype.stop = function(context) {};
        BonusInfoPanel.Activator.main = function() {};
        BonusInfoPanel.Activator.prototype.__class__ = BonusInfoPanel.Activator;
        BonusInfoPanel.BonusInfoPanel = function(container) {
            this.view = container;
            this.targetObject = this.view.getDisplayObject();
            this.visibleY = this.targetObject.getY();
            this.hiddenY = this.visibleY + this.targetObject.getHeight();
        };
        BonusInfoPanel.BonusInfoPanel.__name__ = ["BonusInfoPanel", "BonusInfoPanel"];
        BonusInfoPanel.BonusInfoPanel.prototype.view = null;
        BonusInfoPanel.BonusInfoPanel.prototype.visibleY = null;
        BonusInfoPanel.BonusInfoPanel.prototype.targetObject = null;
        BonusInfoPanel.BonusInfoPanel.prototype.hiddenY = null;
        BonusInfoPanel.BonusInfoPanel.prototype.freespins = null;
        BonusInfoPanel.BonusInfoPanel.prototype.wilds = null;
        BonusInfoPanel.BonusInfoPanel.prototype.init = function(freespins, wilds) {
            this.freespins = freespins;
            this.wilds = wilds;
            this.setCounterValue(freespins, "Right_counter");
            this.setCounterValue(wilds, "Left_counter");
        };
        BonusInfoPanel.BonusInfoPanel.prototype.setCounterValue = function(value, counterName) {
            var wingContainer = this.view.getContainerById("BONUS_INFO_PANEL");
            var counter = wingContainer.getLabelById(counterName);
            counter.setText(value + "");
        };
        BonusInfoPanel.BonusInfoPanel.prototype.setLevel = function(level) {
            this.setLevelBackground(level, this.view.getContainerById("BONUS_INFO_PANEL").getContainerById("Wing_Left"));
            this.setLevelBackground(level, this.view.getContainerById("BONUS_INFO_PANEL").getContainerById("Wing_Right"));
        };
        BonusInfoPanel.BonusInfoPanel.prototype.setLevelBackground = function(level, wing) {
            var _g = 1;
            while (_g < 11) {
                var i = _g++;
                wing.getContainerById("l" + i).getDisplayObject().setVisible(false);
            }
            if (level == 0) level = 1;
            else level = level;
            wing.getContainerById("l" + level).getDisplayObject().setVisible(true);
        };
        BonusInfoPanel.BonusInfoPanel.prototype.updateFreeSpinsCounter = function(data) {
            if (data == null) data = -1;
            if (data >= 0) this.freespins = data;
            else this.freespins++;
            this.setCounterValue(this.freespins, "Right_counter");
        };
        BonusInfoPanel.BonusInfoPanel.prototype.updateWildsCounter = function(data) {
            if (data == null) data = -1;
            var value;
            if (data >= 0) value = data;
            else value = ++this.wilds;
            this.setCounterValue(value, "Left_counter");
        };
        BonusInfoPanel.BonusInfoPanel.prototype.show = function() {
            this.changePosition(this.hiddenY, this.visibleY);
            this.targetObject.setVisible(true);
        };
        BonusInfoPanel.BonusInfoPanel.prototype.hide = function() {
            var _g = this;
            this.changePosition(this.visibleY, this.hiddenY).onFinish(function() {
                _g.targetObject.setVisible(false);
            });
        };
        BonusInfoPanel.BonusInfoPanel.prototype.changePosition = function(startY, endY) {
            displayEngineUtils.TweenX.from(this.targetObject, {
                y: startY
            }, null, null, null, null, {
                fileName: "BonusInfoPanel.hx",
                lineNumber: 78,
                className: "components.bonusinfopanel.BonusInfoPanel",
                methodName: "changePosition"
            });
            return displayEngineUtils.TweenX.to(this.targetObject, {
                y: endY
            }, 500, null, null, null, null, null, null, null, {
                fileName: "BonusInfoPanel.hx",
                lineNumber: 79,
                className: "components.bonusinfopanel.BonusInfoPanel",
                methodName: "changePosition"
            });
        };
        BonusInfoPanel.BonusInfoPanel.prototype.__class__ = BonusInfoPanel.BonusInfoPanel;
        BonusInfoPanel.BonusInfoPanelController = function(context, cfgId) {
            this.initialized = false;
            var _g = this;
            this.context = context;
            this.port = context.getImplementedPort(BonusInfoPanelApi.IBonusInfoPanelImplementationPort);
            this.animationPort = context.getUsedPort(wildFuryAnimationPort.IAnimationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.onUpdateLayout));
            this.container = BonusInfoPanel.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.container.setName("BONUS_INFO_PANEL");
            BonusInfoPanel.ExternalService.getAsset("bonusinfopanel-assets/bonusinfopanel_layout_config_json").then(function(vba) {
                _g.vba = vba;
                _g.initialize();
            });
        };
        BonusInfoPanel.BonusInfoPanelController.__name__ = ["BonusInfoPanel", "BonusInfoPanelController"];
        BonusInfoPanel.BonusInfoPanelController.prototype.animationPort = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.port = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.context = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.layoutPort = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.layoutPayload = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.initialized = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.vba = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.fba = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.container = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.currentPanel = null;
        BonusInfoPanel.BonusInfoPanelController.prototype.onFlightComplete = function(e) {
            var type = e.getPayload();
            if (type == "WILD") this.currentPanel.updateWildsCounter();
            else this.currentPanel.updateFreeSpinsCounter();
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onHide = function(e) {
            this.currentPanel.hide();
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onShow = function(e) {
            var initData = e.getPayload();
            this.currentPanel.init(initData[0], initData[1]);
            this.currentPanel.show();
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onUpdateFreeSpinsCounter = function(e) {
            this.currentPanel.updateFreeSpinsCounter(e.getPayload());
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onJackpotLevelUpdate = function(e) {
            this.currentPanel.setLevel(e.getPayload());
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onUpdateWildsCounter = function(e) {
            this.currentPanel.updateWildsCounter(e.getPayload());
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.onUpdateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (!this.initialized) this.initialize();
            else this.updateLayout();
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.initialize = function() {
            if (this.layoutPayload != null && this.vba != null) {
                var view = BonusInfoPanel.ExternalService.viewBuilderFactory.createView(this.vba);
                this.currentPanel = new BonusInfoPanel.BonusInfoPanel(view.getContainerById("BONUS_INFO_PANEL"));
                this.initialized = true;
                this.container.addChild(this.currentPanel.view.getDisplayObject());
                this.currentPanel.hide();
                this.updateLayout();
                this.addSubscribes();
            }
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.updateLayout = function() {
            var layout = this.layoutPayload.containers.get("BONUS_INFO_PANEL");
            var stage;
            var this1 = BonusInfoPanel.ExternalService.displayProvider.getStages();
            stage = this1.get(layout.stage);
            stage.removeChild(this.container);
            var userData = this.currentPanel.view.getDisplayObject().getUserData();
            this.container.setX(layout.left);
            this.container.setY(layout.top);
            this.container.setZIndex(layout.zIndex);
            this.container.setScaleX(layout.width / userData.viewBuilderW);
            this.container.setScaleY(this.container.getScaleX());
            this.container.setPos(layout.left, layout.top);
            stage.addChild(this.container);
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.addSubscribes = function() {
            this.port.getHide().subscribe($bind(this, this.onHide));
            this.port.getShow().subscribe($bind(this, this.onShow));
            this.port.getUpdateFreeSpinsCounter().subscribe($bind(this, this.onUpdateFreeSpinsCounter));
            this.port.getUpdateWildsCounter().subscribe($bind(this, this.onUpdateWildsCounter));
            this.port.getUpdateJackpotLevel().subscribe($bind(this, this.onJackpotLevelUpdate));
            this.animationPort.getSymbolFlightComplete().subscribe($bind(this, this.onFlightComplete));
        };
        BonusInfoPanel.BonusInfoPanelController.prototype.__class__ = BonusInfoPanel.BonusInfoPanelController;
        BonusInfoPanel.BonusInfoPanelFactory = function() {};
        BonusInfoPanel.BonusInfoPanelFactory = ck_implements(BonusInfoPanel.BonusInfoPanelFactory, clientkernelModulesApi.IService);
        BonusInfoPanel.BonusInfoPanelFactory = ck_implements(BonusInfoPanel.BonusInfoPanelFactory, componentmodelComponentApi.IComponentFactory);
        BonusInfoPanel.BonusInfoPanelFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        BonusInfoPanel.BonusInfoPanelFactory.__name__ = ["BonusInfoPanel", "BonusInfoPanelFactory"];
        BonusInfoPanel.BonusInfoPanelFactory.prototype.getComponentDeclaration = function() {
            return BonusInfoPanelApi.BonusInfoPanelDeclaration;
        };
        BonusInfoPanel.BonusInfoPanelFactory.prototype.createComponent = function(context) {
            var cfgId = context.getConfiguration();
            new BonusInfoPanel.BonusInfoPanelController(context, cfgId);
        };
        BonusInfoPanel.BonusInfoPanelFactory.prototype.__class__ = BonusInfoPanel.BonusInfoPanelFactory;
        BonusInfoPanel.ExternalService = function() {};
        BonusInfoPanel.ExternalService.__name__ = ["BonusInfoPanel", "ExternalService"];
        BonusInfoPanel.ExternalService.assetRegistry = null;
        BonusInfoPanel.ExternalService.displayProvider = null;
        BonusInfoPanel.ExternalService.viewBuilderFactory = null;
        BonusInfoPanel.ExternalService.translationManager = null;
        BonusInfoPanel.ExternalService.busChanel = null;
        BonusInfoPanel.ExternalService.initialize = function(context) {
            BonusInfoPanel.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            BonusInfoPanel.ExternalService.viewBuilderFactory = context.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
            BonusInfoPanel.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            BonusInfoPanel.ExternalService.translationManager = context.getAnyService(translationmanagerApi.ITranslationManager, null);
            var bus = context.getAnyService(clientkernelEventbusApi.IEventBus, null);
            BonusInfoPanel.ExternalService.busChanel = bus.getChannel("GFBus");
        };
        BonusInfoPanel.ExternalService.getAsset = function(id) {
            return BonusInfoPanel.ExternalService.assetRegistry.getAsset(id).getContent();
        };
        BonusInfoPanel.ExternalService.prototype.__class__ = BonusInfoPanel.ExternalService;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        BonusInfoPanel.BonusInfoPanel.TWEEN_TIME = 500;;
        BonusInfoPanel.BonusInfoPanelController.COMPONENT_ID = "BONUS_INFO_PANEL";;
        BonusInfoPanel.ExternalService.loadedAssets = new _hcmn_.haxe_ds_StringMap();;
        return {
            exports: BonusInfoPanel,
            activator: BonusInfoPanel.Activator
        };
    });
//# sourceURL=wildFuryBonusInfoPanel.js