define("ballooniesIXFPaytable", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "ballooniesIXFComponentsPaytableApi", "gameLayoutApi", "BABYLON", "clientkernelEventbusApi", "clientkernelModulesApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, ballooniesIXFComponentsPaytableApi, gameLayoutApi, 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 ballooniesIXFPaytable == 'undefined') {
            var ballooniesIXFPaytable = {};
        };
        ballooniesIXFPaytable.Activator = function(context) {};
        ballooniesIXFPaytable.Activator = ck_implements(ballooniesIXFPaytable.Activator, clientkernelModulesApi.IModuleActivator);
        ballooniesIXFPaytable.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        ballooniesIXFPaytable.Activator.__name__ = ["ballooniesIXFPaytable", "Activator"];
        ballooniesIXFPaytable.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider, translationmanagerApi.ITranslationManager]).then(function(context1) {
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                ballooniesIXFPaytable.ExternalService.initialize(context1, vbf);
                context1.registerService(new ballooniesIXFPaytable.PaytableFactory(context1), ballooniesIXFComponentsPaytableApi.PaytableDeclaration, null);
            });
        };
        ballooniesIXFPaytable.Activator.prototype.stop = function(context) {};
        ballooniesIXFPaytable.Activator.main = function() {};
        ballooniesIXFPaytable.Activator.prototype.__class__ = ballooniesIXFPaytable.Activator;
        ballooniesIXFPaytable.ExternalService = function() {};
        ballooniesIXFPaytable.ExternalService.__name__ = ["ballooniesIXFPaytable", "ExternalService"];
        ballooniesIXFPaytable.ExternalService.displayProvider = null;
        ballooniesIXFPaytable.ExternalService.assetRegistry = null;
        ballooniesIXFPaytable.ExternalService.viewBuilderFactory = null;
        ballooniesIXFPaytable.ExternalService.translationManager = null;
        ballooniesIXFPaytable.ExternalService.loadedAssets = null;
        ballooniesIXFPaytable.ExternalService.loadedDefinitionConfig = null;
        ballooniesIXFPaytable.ExternalService.moneyFormatter = null;
        ballooniesIXFPaytable.ExternalService.initialize = function(context, vbf) {
            ballooniesIXFPaytable.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            ballooniesIXFPaytable.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            ballooniesIXFPaytable.ExternalService.moneyFormatter = context.getAnyService(moneyApi.IMoneyFormatter);
            ballooniesIXFPaytable.ExternalService.translationManager = context.getAnyService(translationmanagerApi.ITranslationManager);
            ballooniesIXFPaytable.ExternalService.viewBuilderFactory = vbf;
        };
        ballooniesIXFPaytable.ExternalService.prototype.__class__ = ballooniesIXFPaytable.ExternalService;
        ballooniesIXFPaytable.Paytable = function(context) {
            this.assetsLoaded = false;
            this.initialized = false;
            this.presentationInitializationPayload = null;
            this.layoutPayload = null;
            this.DEFINITION_CONFIG_ID = "paytable-assets/paytable_definition_config.json";
            this.MAIN_CONFIG_ID = "paytable-assets/paytable_layout.viewbuilder.json";
            this.COMPONENT_ID = "PAYTABLE";
            var _g = this;
            this.context = context;
            this.baseEvents = new ballooniesIXFPaytable.BaseEvents();
            this.port = context.getImplementedPort(ballooniesIXFComponentsPaytableApi.IPaytableImplementationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.slotModelPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            this.slotModelPort.getStages().getInitStage().getInitializeGamePhase().getInitializeGame().subscribe($bind(this, this.handlePresentationInitialization));
            this.slotModelPort.getStages().getResumeStage().getPrepareResume().subscribe($bind(this, this.handlePrepareResume));
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.controller = new ballooniesIXFPaytable.PaytableController(this);
            ballooniesIXFPaytable.ExternalService.assetRegistry.getAsset(this.MAIN_CONFIG_ID).getContent().then(function(vb) {
                ballooniesIXFPaytable.ExternalService.loadedAssets = vb;
                ballooniesIXFPaytable.ExternalService.assetRegistry.getAsset(_g.DEFINITION_CONFIG_ID).getContent().then(function(config) {
                    _g.assetsLoaded = true;
                    ballooniesIXFPaytable.ExternalService.loadedDefinitionConfig = config;
                    _g.initialize();
                });
            });
        };
        ballooniesIXFPaytable.Paytable.__name__ = ["ballooniesIXFPaytable", "Paytable"];
        ballooniesIXFPaytable.Paytable.prototype.COMPONENT_ID = null;
        ballooniesIXFPaytable.Paytable.prototype.MAIN_CONFIG_ID = null;
        ballooniesIXFPaytable.Paytable.prototype.DEFINITION_CONFIG_ID = null;
        ballooniesIXFPaytable.Paytable.prototype.view = null;
        ballooniesIXFPaytable.Paytable.prototype.paytableComponent = null;
        ballooniesIXFPaytable.Paytable.prototype.port = null;
        ballooniesIXFPaytable.Paytable.prototype.layoutPort = null;
        ballooniesIXFPaytable.Paytable.prototype.slotModelPort = null;
        ballooniesIXFPaytable.Paytable.prototype.controller = null;
        ballooniesIXFPaytable.Paytable.prototype.context = null;
        ballooniesIXFPaytable.Paytable.prototype.layoutPayload = null;
        ballooniesIXFPaytable.Paytable.prototype.presentationInitializationPayload = null;
        ballooniesIXFPaytable.Paytable.prototype.initialized = null;
        ballooniesIXFPaytable.Paytable.prototype.assetsLoaded = null;
        ballooniesIXFPaytable.Paytable.prototype.baseEvents = null;
        ballooniesIXFPaytable.Paytable.prototype.mainStageCacheID = null;
        ballooniesIXFPaytable.Paytable.prototype.handlePrepareResume = function(e) {
            this.paytableComponent.initializeContent(e.getPayload().initializationProperties);
        };
        ballooniesIXFPaytable.Paytable.prototype.handlePresentationInitialization = function(e) {
            this.paytableComponent.initializeContent(e.getPayload());
        };
        ballooniesIXFPaytable.Paytable.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());
            }
        };
        ballooniesIXFPaytable.Paytable.prototype.initialize = function() {
            if (this.assetsLoaded && this.layoutPayload != null) {
                ballooniesIXFPaytable.PaytableDefinition.initialize(ballooniesIXFPaytable.ExternalService.loadedDefinitionConfig);
                this.view = ballooniesIXFPaytable.ExternalService.viewBuilderFactory.createView(ballooniesIXFPaytable.ExternalService.loadedAssets);
                var container = this.view.getComponentById(this.COMPONENT_ID);
                if (container == null) throw new Error("paytable container (with paytable id) not found in assets!");
                this.paytableComponent = new ballooniesIXFPaytable.PaytableComponent(container, this.baseEvents);
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
                this.port.show().subscribe($bind(this, this.handleShow));
                this.port.hide().subscribe($bind(this, this.handleHide));
                this.port.setNextPage().subscribe($bind(this, this.handleNext));
                this.port.setPreviousPage().subscribe($bind(this, this.handlePrevious));
                this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.CLOSE).add($bind(this, this.handleClose));
                this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE).add($bind(this, this.handlePageUpdate));
                this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT).add($bind(this, this.handleNavigateLeft));
                this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT).add($bind(this, this.handleNavigateRight));
                this.initialized = true;
            }
        };
        ballooniesIXFPaytable.Paytable.prototype.handleShow = function(e) {
            this.paytableComponent.show();
            if (this.paytableComponent.isFullScreenMobile()) {
                var mainStage;
                var this1 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                mainStage = this1.get("skgl_0");
                var paytableStage;
                var this2 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                paytableStage = this2.get("skgl_1");
                paytableStage.getCanvas().style.removeProperty("pointer-events");
                mainStage.getCanvas().style.setProperty("pointer-events", "none");
                mainStage.setVisible(false);
                paytableStage.setVisible(true);
            }
        };
        ballooniesIXFPaytable.Paytable.prototype.handleHide = function(e) {
            this.paytableComponent.hide();
            if (this.paytableComponent.isFullScreenMobile()) {
                var mainStage;
                var this1 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                mainStage = this1.get("skgl_0");
                var paytableStage;
                var this2 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                paytableStage = this2.get("skgl_1");
                paytableStage.getCanvas().style.setProperty("pointer-events", "none");
                mainStage.getCanvas().style.removeProperty("pointer-events");
                mainStage.setVisible(true);
                paytableStage.setVisible(false);
            }
        };
        ballooniesIXFPaytable.Paytable.prototype.handleClose = function(e) {
            this.port.onCloseButtonPressed().publish(null);
        };
        ballooniesIXFPaytable.Paytable.prototype.handlePageUpdate = function(e) {
            this.port.onPageChanged().publish(e);
        };
        ballooniesIXFPaytable.Paytable.prototype.handleNavigateLeft = function(e) {};
        ballooniesIXFPaytable.Paytable.prototype.handleNavigateRight = function(e) {};
        ballooniesIXFPaytable.Paytable.prototype.handlePrevious = function(e) {
            this.paytableComponent.showPrevious();
        };
        ballooniesIXFPaytable.Paytable.prototype.handleNext = function(e) {
            this.paytableComponent.showNext();
        };
        ballooniesIXFPaytable.Paytable.prototype.getPaytableComponent = function() {
            return this.paytableComponent;
        };
        ballooniesIXFPaytable.Paytable.prototype.__class__ = ballooniesIXFPaytable.Paytable;
        ballooniesIXFPaytable.PaytableController = function(paytable) {
            this.flag_addedToStage = false;
            this.paytable = paytable;
        };
        ballooniesIXFPaytable.PaytableController.__name__ = ["ballooniesIXFPaytable", "PaytableController"];
        ballooniesIXFPaytable.PaytableController.prototype.paytable = null;
        ballooniesIXFPaytable.PaytableController.prototype.flag_addedToStage = null;
        ballooniesIXFPaytable.PaytableController.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 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container = this.paytable.view.getComponentById(layerId);
                var containerDO = container.getDisplayObject();
                var fullScreenCanvas = layerPayload.width == null || layerPayload.height == null;
                if (!this.flag_addedToStage) {
                    stage.addChild(containerDO);
                    this.flag_addedToStage = true;
                    if (fullScreenCanvas) {
                        var canvas = stage.getCanvas();
                        canvas.style.setProperty("pointer-events", "none");
                        stage.setVisible(false);
                    }
                }
                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) this.paytable.getPaytableComponent().setConfig(cfg, stage, fullScreenCanvas);
            }
        };
        ballooniesIXFPaytable.PaytableController.prototype.init = function() {};
        ballooniesIXFPaytable.PaytableController.prototype.__class__ = ballooniesIXFPaytable.PaytableController;
        ballooniesIXFPaytable.PaytableDefinition = function() {};
        ballooniesIXFPaytable.PaytableDefinition.__name__ = ["ballooniesIXFPaytable", "PaytableDefinition"];
        ballooniesIXFPaytable.PaytableDefinition.dynTextConfig = null;
        ballooniesIXFPaytable.PaytableDefinition.initialize = function(loadedDefinitionConfig) {
            if (Object.prototype.hasOwnProperty.call(loadedDefinitionConfig, "dynamicText")) ballooniesIXFPaytable.PaytableDefinition.dynTextConfig = loadedDefinitionConfig.dynamicText;
            else ballooniesIXFPaytable.PaytableDefinition.dynTextConfig = {
                RTP_FromTo: "PaytableContent_7_0",
                RTP_Single: "PaytableContent_7_0_singleRTP",
                awardCap: null
            };
        };
        ballooniesIXFPaytable.PaytableDefinition.getSingleRTPLabelId = function() {
            return ballooniesIXFPaytable.PaytableDefinition.dynTextConfig.RTP_Single;
        };
        ballooniesIXFPaytable.PaytableDefinition.getRTPLabelId = function() {
            return ballooniesIXFPaytable.PaytableDefinition.dynTextConfig.RTP_FromTo;
        };
        ballooniesIXFPaytable.PaytableDefinition.getAwardCapLabelId = function() {
            return ballooniesIXFPaytable.PaytableDefinition.dynTextConfig.awardCap;
        };
        ballooniesIXFPaytable.PaytableDefinition.prototype.__class__ = ballooniesIXFPaytable.PaytableDefinition;
        ballooniesIXFPaytable.PaytableFactory = function(context) {
            this.context = context;
        };
        ballooniesIXFPaytable.PaytableFactory = ck_implements(ballooniesIXFPaytable.PaytableFactory, clientkernelModulesApi.IService);
        ballooniesIXFPaytable.PaytableFactory = ck_implements(ballooniesIXFPaytable.PaytableFactory, componentmodelComponentApi.IComponentFactory);
        ballooniesIXFPaytable.PaytableFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        ballooniesIXFPaytable.PaytableFactory.__name__ = ["ballooniesIXFPaytable", "PaytableFactory"];
        ballooniesIXFPaytable.PaytableFactory.prototype.vbf = null;
        ballooniesIXFPaytable.PaytableFactory.prototype.context = null;
        ballooniesIXFPaytable.PaytableFactory.prototype.getComponentDeclaration = function() {
            return ballooniesIXFComponentsPaytableApi.PaytableDeclaration;
        };
        ballooniesIXFPaytable.PaytableFactory.prototype.createComponent = function(context) {
            new ballooniesIXFPaytable.Paytable(context);
        };
        ballooniesIXFPaytable.PaytableFactory.prototype.__class__ = ballooniesIXFPaytable.PaytableFactory;

        ballooniesIXFPaytable.IPaytableComponent = function() {}
        ballooniesIXFPaytable.IPaytableComponent.prototype = {

            hide: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            show: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            showNext: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            showPrevious: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            showPage: function(num) {
                return {
                    arguments: ["number"],
                    returns: "void"
                };
            },
            setConfig: function(cfg, stage, fullScreenCanvas) {
                return {
                    arguments: ["*", "*", {
                        type: "boolean",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            initializeContent: function(presentationInitializationPayload, newPage) {
                return {
                    arguments: ["*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            isFullScreenMobile: function() {
                return {
                    arguments: [],
                    returns: "boolean"
                };
            }
        };
        ballooniesIXFPaytable.PaytableComponent = function(container, baseEvents) {
            this.presentationInitializationPayload = null;
            this.textFormated = false;
            this.fullScreenCanvas = false;
            this.totalPages = 0;
            this.currentPage = 0;
            this.CONSOLE_OFFSET = 40;
            this.MAX_SCALE_FACTOR = 1.0;
            this.container = container;
            this.baseEvents = baseEvents;
            this.consoleOffset = this.CONSOLE_OFFSET;
            container.hide();
            this.content = container.getComponentById("Content");
            if (container.getComponentById("ControlsPortrait") != null) {
                this.controlsPortrait = container.getComponentById("ControlsPortrait").getDisplayObject();
                this.fixFaultyControlsPositions(this.controlsPortrait, "BtnLeft");
            }
            if (container.getComponentById("ControlsLandscape") != null) {
                this.controlsLandscape = container.getComponentById("ControlsLandscape").getDisplayObject();
                this.fixFaultyControlsPositions(this.controlsLandscape, "BtnRight");
            }
            if (container.getComponentById("ControlsClose") != null) this.controlsClose = container.getComponentById("ControlsClose").getDisplayObject();
            this.content.show();
            this.createdPages = new _hcmn_.haxe_ds_StringMap();
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.content.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                var page = this.content.getContainerById(key);
                page.hide();
                this.createdPages.set(key, page);
            }
        };
        ballooniesIXFPaytable.PaytableComponent = ck_implements(ballooniesIXFPaytable.PaytableComponent, ballooniesIXFPaytable.IPaytableComponent);
        ballooniesIXFPaytable.PaytableComponent.__interfaces__ = [ballooniesIXFPaytable.IPaytableComponent];
        ballooniesIXFPaytable.PaytableComponent.__name__ = ["ballooniesIXFPaytable", "PaytableComponent"];
        ballooniesIXFPaytable.PaytableComponent.prototype.container = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.MAX_SCALE_FACTOR = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.CONSOLE_OFFSET = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.baseEvents = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.currentPage = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.totalPages = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.config = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.defStage = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.fullScreenCanvas = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.textFormated = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.createdPages = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.presentationInitializationPayload = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.consoleOffset = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.content = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.direction = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.globalScale = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.controlsPortrait = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.controlsLandscape = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.controlsClose = null;
        ballooniesIXFPaytable.PaytableComponent.prototype.showNext = function() {
            if (this.currentPage < this.totalPages) this.currentPage++;
            else this.currentPage = 0;
            this.showPage(this.currentPage);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.showPrevious = function() {
            if (this.currentPage > 0) this.currentPage--;
            else this.currentPage = this.totalPages;
            this.showPage(this.currentPage);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.showPage = function(currentPage) {
            this.currentPage = currentPage;
            this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE).dispatch(currentPage);
            this.updatePagesBuffer(currentPage, this.totalPages);
            this.updatePageCounters();
            var $it0 = this.createdPages.iterator();
            while ($it0.hasNext()) {
                var p = $it0.next();
                p.hide();
            }
            var page = this.createdPages.get("page_" + currentPage);
            page.show();
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.updatePageCounters = function() {
            if (this.container.getComponentById("pageCounter") != null) {
                var pageCounter = this.container.getComponentById("pageCounter");
                pageCounter.setText(_hcmn_.Std.string(this.currentPage + 1) + "/" + (this.totalPages + 1));
            }
            if (this.controlsPortrait != null) {
                var pageCounter1 = this.container.getContainerById("ControlsPortrait").getComponentById("pageCounter");
                pageCounter1.setText(_hcmn_.Std.string(this.currentPage + 1) + "/" + (this.totalPages + 1));
            }
            if (this.controlsLandscape != null) {
                var pageCounter2 = this.container.getContainerById("ControlsLandscape").getComponentById("pageCounter");
                pageCounter2.setText(_hcmn_.Std.string(this.currentPage + 1) + "/" + (this.totalPages + 1));
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.handleClose = function(e) {
            this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.CLOSE).dispatch(null);
            ((function($this) {
                var $r;
                var this1 = ballooniesIXFPaytable.ExternalService.displayProvider.getStages();
                $r = this1.get("skgl_0");
                return $r;
            }(this))).getCanvas().style.visibility = "visible";
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.handleLeftButtonPressed = function(e) {
            this.showPrevious();
            this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT).dispatch(this.currentPage);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.handleRightButtonPressed = function(e) {
            this.showNext();
            this.baseEvents.getEvent(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT).dispatch(this.currentPage);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.setConfig = function(cfg, stage, fullScreenCanvas) {
            if (fullScreenCanvas == null) fullScreenCanvas = false;
            this.fullScreenCanvas = fullScreenCanvas;
            this.config = cfg;
            this.defStage = stage;
            this.updateLayout();
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.updateLayout = function() {
            var contentContainer;
            contentContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById("Content"), viewBuilderApi.IViewBuilderContainer);
            if (this.config != null) {
                if (this.config.pages != null) {
                    this.totalPages = this.config.pages;
                    this.updatePagesBuffer(this.currentPage, this.totalPages);
                }
                var stageH = this.defStage.getHeight();
                var stageW = this.defStage.getWidth();
                if (this.fullScreenCanvas) this.setForFullScreen();
                if (this.config.dir != null) {
                    this.direction = this.config.dir;
                    this.container.getComponentById("MainBg").getDisplayObject().setWidth(stageW);
                    this.container.getComponentById("MainBg").getDisplayObject().setHeight(stageH);
                    this.container.getComponentById("MainBg").disable();
                    this.calculateContentScale(true);
                    this.setLayout();
                }
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.updatePagesBuffer = function(currentPage, totalPages) {
            var prevPage;
            if (currentPage == 0) prevPage = totalPages;
            else prevPage = currentPage - 1;
            var nextPage;
            if (currentPage == totalPages) nextPage = 0;
            else nextPage = currentPage + 1;
            this.createNewPage("page_" + currentPage);
            this.createNewPage("page_" + prevPage);
            this.createNewPage("page_" + nextPage);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.createNewPage = function(pageId) {
            if (!this.createdPages.exists(pageId)) {
                var newPage = this.content.createContainerFromStoredConfig(pageId);
                this.createdPages.set(pageId, newPage);
                this.content.addChildComponent(newPage, pageId);
                newPage.getDisplayObject().setX(0);
                newPage.getDisplayObject().setY(0);
                this.initializeContent(this.presentationInitializationPayload, newPage);
                newPage.show();
                newPage.getDisplayObject().setCacheAsBitmap(true);
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.calculateContentScale = function(forceNew) {
            if (forceNew == null) forceNew = false;
            var stageH = this.defStage.getHeight();
            var stageW = this.defStage.getWidth();
            var contentDO = this.content.getDisplayObject();
            if (this.globalScale == null || forceNew) {
                if (this.direction == "up") {
                    var verticalOffset = 2.5 * this.consoleOffset;
                    var controlsPortrait = this.container.getComponentById("ControlsPortrait").getDisplayObject();
                    var globalScaleW = stageW / this.content.getDisplayObject().getUserData().viewBuilderW;
                    var globalScaleH = (stageH - verticalOffset) / this.content.getDisplayObject().getUserData().viewBuilderH;
                    this.globalScale = _hcmn_.Math.min(globalScaleW, globalScaleH);
                    contentDO.setScale(this.globalScale);
                    var posX = _hcmn_.Std["int"]((stageW - contentDO.getScaleX() * this.content.getDisplayObject().getUserData().viewBuilderW) / 2);
                    var posY = _hcmn_.Std["int"]((stageH - contentDO.getScaleY() * this.content.getDisplayObject().getUserData().viewBuilderH) / 2);
                    posY += this.consoleOffset / 4 | 0;
                    if (posY < this.consoleOffset) posY = this.consoleOffset;
                    contentDO.setPos(posX, posY);
                } else {
                    var controlsLandscape = this.container.getComponentById("ControlsLandscape").getDisplayObject();
                    var globalScaleW1 = (stageW - this.consoleOffset) / this.content.getDisplayObject().getUserData().viewBuilderW;
                    var globalScaleH1 = (stageH - this.consoleOffset) / this.content.getDisplayObject().getUserData().viewBuilderH;
                    this.globalScale = _hcmn_.Math.min(globalScaleW1, globalScaleH1);
                    contentDO.setScale(this.globalScale);
                    var posX1 = _hcmn_.Std["int"]((stageW - contentDO.getScaleX() * this.content.getDisplayObject().getUserData().viewBuilderW) / 2);
                    var posY1 = _hcmn_.Std["int"]((stageH - contentDO.getScaleY() * this.content.getDisplayObject().getUserData().viewBuilderH) / 2);
                    if (posY1 < this.consoleOffset) posY1 = this.consoleOffset * 0.8 | 0;
                    if (posX1 + contentDO.getWidth() > stageW - this.consoleOffset) posX1 = _hcmn_.Std["int"](posX1 - (posX1 + contentDO.getWidth() - (stageW - this.consoleOffset)));
                    contentDO.setPos(posX1, posY1);
                }
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.setForFullScreen = function() {
            var canvasElement;
            canvasElement = _hcmn_.js_Boot.__cast(this.defStage.getCanvas(), HTMLCanvasElement);
            var stageH = canvasElement.height;
            var stageW = canvasElement.width;
            var fisicalW = canvasElement.height;
            var fisicalH = canvasElement.width;
            if (canvasElement.style.width != "") {
                fisicalW = _hcmn_.Std.parseInt(_hcmn_.StringTools.replace(canvasElement.style.width, "px", ""));
                fisicalH = _hcmn_.Std.parseInt(_hcmn_.StringTools.replace(canvasElement.style.height, "px", ""));
            }
            var containerDO = this.container.getDisplayObject();
            containerDO.setX(0);
            containerDO.setY(0);
            this.defStage.setScaleX(1);
            this.defStage.setScaleY(1);
            containerDO.setScaleX(1);
            containerDO.setScaleY(1);
            if (window.devicePixelRatio != null) this.consoleOffset = this.CONSOLE_OFFSET * _hcmn_.Std["int"](window.devicePixelRatio);
            if ((function($this) {
                    var $r;
                    var f = containerDO.getWidth();
                    $r = isNaN(f);
                    return $r;
                }(this)) || (function($this) {
                    var $r;
                    var f1 = containerDO.getHeight();
                    $r = isNaN(f1);
                    return $r;
                }(this))) {
                containerDO.setWidth(fisicalW);
                containerDO.setHeight(fisicalH);
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.setLayout = function() {
            var stageH = this.defStage.getHeight();
            var stageW = this.defStage.getWidth();
            var offset = 0;
            if (this.config.offset != null) offset = this.config.offset;
            var contentDO = this.content.getDisplayObject();
            if (this.direction == "up") {
                this.controlsPortrait.setVisible(true);
                this.controlsLandscape.setVisible(false);
                var reservedTakenSpace = contentDO.getUserData().viewBuilderH * contentDO.getScaleY() * this.container.getDisplayObject().getScaleY() + contentDO.getY();
                this.controlsPortrait.setHeight(stageH - reservedTakenSpace);
                this.controlsPortrait.setScaleX(this.controlsPortrait.getScaleY());
                if (this.controlsPortrait.getWidth() > stageW) {
                    this.controlsPortrait.setWidth(stageW);
                    this.controlsPortrait.setScaleY(this.controlsPortrait.getScaleX());
                }
                if (this.controlsPortrait.getScaleX() > this.MAX_SCALE_FACTOR) this.controlsPortrait.setScale(this.MAX_SCALE_FACTOR);
                this.controlsPortrait.setX((stageW - this.controlsPortrait.getWidth()) / 2);
                this.controlsPortrait.setY(stageH - this.controlsPortrait.getHeight());
                this.controlsClose.setScale(this.controlsPortrait.getScaleX());
            } else {
                this.controlsPortrait.setVisible(false);
                this.controlsLandscape.setVisible(true);
                var reservedTakenSpace1 = contentDO.getUserData().viewBuilderW * contentDO.getScaleX() * this.container.getDisplayObject().getScaleX() + contentDO.getX();
                this.controlsLandscape.setWidth(stageW - reservedTakenSpace1);
                this.controlsLandscape.setScaleY(this.controlsLandscape.getScaleX());
                this.controlsClose.setScale(this.controlsLandscape.getScaleX());
                if (this.controlsLandscape.getHeight() + this.controlsClose.getHeight() > contentDO.getHeight()) {
                    this.controlsLandscape.setHeight(0.75 * contentDO.getHeight());
                    this.controlsLandscape.setScaleX(this.controlsLandscape.getScaleY());
                }
                if (this.controlsLandscape.getScaleY() > this.MAX_SCALE_FACTOR) this.controlsLandscape.setScale(this.MAX_SCALE_FACTOR);
                this.controlsClose.setScale(this.controlsLandscape.getScaleX());
                this.controlsLandscape.setX(stageW - this.controlsLandscape.getUserData().viewBuilderW * this.controlsLandscape.getScaleX());
                this.controlsLandscape.setY(stageH - this.controlsLandscape.getHeight());
            }
            this.controlsClose.setVisible(true);
            this.controlsClose.setX(stageW - this.controlsClose.getWidth());
            this.controlsClose.setY(this.consoleOffset - this.controlsClose.getHeight() * 0.25);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.attachHandlers = function() {
            if (this.container.getComponentById("ControlsClose") != null) {
                var controlsClose;
                controlsClose = _hcmn_.js_Boot.__cast(this.container.getComponentById("ControlsClose"), viewBuilderApi.IViewBuilderContainer);
                var btnClose;
                btnClose = _hcmn_.js_Boot.__cast(controlsClose.getComponentById("ButtonClose"), viewBuilderApi.IButton);
                btnClose.getEvents().DOWN().addListener($bind(this, this.handleClose));
            }
            this.attachControls("ControlsLandscape");
            this.attachControls("ControlsPortrait");
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.detachHandlers = function() {
            if (this.container.getComponentById("ControlsClose") != null) {
                var controlsClose;
                controlsClose = _hcmn_.js_Boot.__cast(this.container.getComponentById("ControlsClose"), viewBuilderApi.IViewBuilderContainer);
                var btnClose;
                btnClose = _hcmn_.js_Boot.__cast(controlsClose.getComponentById("ButtonClose"), viewBuilderApi.IButton);
                btnClose.getEvents().DOWN().removeListener($bind(this, this.handleClose));
            }
            this.detachControls("ControlsLandscape");
            this.detachControls("ControlsPortrait");
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.attachControls = function(id) {
            if (this.container.getComponentById(id) != null) {
                var controls = this.container.getComponentById(id);
                if (controls.getComponentById("BtnLeft") != null) {
                    var btnLeft;
                    btnLeft = _hcmn_.js_Boot.__cast(controls.getComponentById("BtnLeft"), viewBuilderApi.IButton);
                    btnLeft.getEvents().DOWN().addListener($bind(this, this.handleLeftButtonPressed));
                }
                if (controls.getComponentById("BtnRight") != null) {
                    var btnRight;
                    btnRight = _hcmn_.js_Boot.__cast(controls.getComponentById("BtnRight"), viewBuilderApi.IButton);
                    btnRight.getEvents().DOWN().addListener($bind(this, this.handleRightButtonPressed));
                }
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.detachControls = function(id) {
            if (this.container.getComponentById(id) != null) {
                var controls = this.container.getComponentById(id);
                if (controls.getComponentById("BtnLeft") != null) {
                    var btnLeft;
                    btnLeft = _hcmn_.js_Boot.__cast(controls.getComponentById("BtnLeft"), viewBuilderApi.IButton);
                    btnLeft.getEvents().DOWN().removeListener($bind(this, this.handleLeftButtonPressed));
                }
                if (controls.getComponentById("BtnRight") != null) {
                    var btnRight;
                    btnRight = _hcmn_.js_Boot.__cast(controls.getComponentById("BtnRight"), viewBuilderApi.IButton);
                    btnRight.getEvents().DOWN().removeListener($bind(this, this.handleRightButtonPressed));
                }
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.show = function() {
            this.attachHandlers();
            this.showPage(0);
            if (this.isFullScreenMobile()) {
                this.calculateContentScale(true);
                this.setLayout();
            }
            if (!this.textFormated) {
                this.textFormated = true;
                var content = this.container.getComponentById("Content");
                var $it0 = (function($this) {
                    var $r;
                    var this1 = content.getChildComponents();
                    $r = this1.keys();
                    return $r;
                }(this));
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    var page = content.getComponentById(key);
                    var $it1 = (function($this) {
                        var $r;
                        var this2 = page.getChildComponents();
                        $r = this2.keys();
                        return $r;
                    }(this));
                    while ($it1.hasNext()) {
                        var k = $it1.next();
                        if (_hcmn_.Std["is"](page.getComponentById(k), viewBuilderApi.ILabel))(_hcmn_.js_Boot.__cast(page.getComponentById(k), viewBuilderApi.ILabel)).forceRenderText();
                    }
                }
            }
            this.container.show();
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.hide = function() {
            var $it0 = this.createdPages.iterator();
            while ($it0.hasNext()) {
                var page = $it0.next();
                page.hide();
            }
            this.container.hide();
            this.detachHandlers();
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.initializeContent = function(presentationInitializationPayload, newPage) {
            if (presentationInitializationPayload == null) return;
            this.presentationInitializationPayload = presentationInitializationPayload;
            var awardCap = this.presentationInitializationPayload.riskControlSettings.awardCap;
            var outcomes = this.presentationInitializationPayload.slotDefinition.outcomes;
            var rtp = this.presentationInitializationPayload.slotDefinition.rtp;
            var minRTP;
            var maxRTP;
            if (rtp.singleRTP != null && rtp.singleRTP == true) {
                if (rtp.minSingleRTP == null) throw new Error("minSingleRTP must exist if singleRTP==true");
                minRTP = rtp.minSingleRTP;
                if (rtp.maxSingleRTP == null) throw new Error("maxSingleRTP must exist if singleRTP==true");
                maxRTP = rtp.maxSingleRTP;
            } else {
                minRTP = rtp.minRTP;
                maxRTP = rtp.maxRTP;
            }
            var decimalSeparator = ballooniesIXFPaytable.ExternalService.translationManager.stringLookup("rtpDecimalSeparator");
            if (decimalSeparator != null && decimalSeparator != "rtpDecimalSeparator") {
                minRTP = _hcmn_.StringTools.replace(minRTP, ".", decimalSeparator);
                maxRTP = _hcmn_.StringTools.replace(maxRTP, ".", decimalSeparator);
            }
            if (newPage == null) {
                var content = this.container.getComponentById("Content");
                var $it0 = (function($this) {
                    var $r;
                    var this1 = content.getChildComponents();
                    $r = this1.keys();
                    return $r;
                }(this));
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    var page = content.getComponentById(key);
                    this.setupPageContent(page, outcomes, awardCap, minRTP, maxRTP);
                }
            } else this.setupPageContent(newPage, outcomes, awardCap, minRTP, maxRTP);
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.fixFaultyControlsPositions = function(controlsContainer, btnId) {
            var btnPosX = controlsContainer.getChildByName(btnId).getX();
            var btnPosY = controlsContainer.getChildByName(btnId).getY();
            var _g = 0;
            var _g1 = controlsContainer.getChildren();
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (btnPosX < 0) c.setX(c.getX() - btnPosX);
                if (btnPosY < 0) c.setY(c.getY() - btnPosY);
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.isFullScreenMobile = function() {
            return this.fullScreenCanvas;
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.setupPageContent = function(page, outcomes, awardCap, minRTP, maxRTP) {
            var rtpLabelID = ballooniesIXFPaytable.PaytableDefinition.getRTPLabelId();
            var rtpSingleLabelID = ballooniesIXFPaytable.PaytableDefinition.getSingleRTPLabelId();
            var formattedAwardCap = ballooniesIXFPaytable.ExternalService.moneyFormatter.format(awardCap);
            if (page.getComponentById(rtpLabelID) != null) {
                var lbl = page.getComponentById(rtpLabelID);
                var newLabelContent = "";
                if (minRTP == maxRTP) newLabelContent = ballooniesIXFPaytable.ExternalService.translationManager.stringLookup(rtpSingleLabelID, [minRTP, formattedAwardCap]);
                if (minRTP != maxRTP || newLabelContent == rtpSingleLabelID) newLabelContent = ballooniesIXFPaytable.ExternalService.translationManager.stringLookup(rtpLabelID, [minRTP, maxRTP, formattedAwardCap]);
                lbl.setText(newLabelContent);
            }
            var awardCapLabelId = ballooniesIXFPaytable.PaytableDefinition.getAwardCapLabelId();
            if (awardCapLabelId != null && page.getComponentById(awardCapLabelId) != null) {
                var lbl1 = page.getComponentById(awardCapLabelId);
                var text = ballooniesIXFPaytable.ExternalService.translationManager.stringLookup(awardCapLabelId, [formattedAwardCap]);
                lbl1.setText(text);
            }
            var $it0 = outcomes.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                var labelId = "PaytableValues_" + key;
                if ((function($this) {
                        var $r;
                        var this1 = page.getChildComponents();
                        $r = this1.exists(labelId);
                        return $r;
                    }(this))) {
                    var lbl2 = page.getComponentById(labelId);
                    lbl2.setText(_hcmn_.__map_reserved[key] != null ? outcomes.getReserved(key) : outcomes.h[key]);
                }
            }
        };
        ballooniesIXFPaytable.PaytableComponent.prototype.__class__ = ballooniesIXFPaytable.PaytableComponent;
        ballooniesIXFPaytable.BaseEventsEnum = {
            __ename__: ["ballooniesIXFPaytable", "BaseEventsEnum"],
            __constructs__: ["CLOSE", "OPEN", "CURRENT_PAGE", "NAVIGATE_LEFT", "NAVIGATE_RIGHT"]
        };
        ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE = ["CURRENT_PAGE", 2];
        ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE.toString = $estr;
        ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE.__enum__ = ballooniesIXFPaytable.BaseEventsEnum;
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT = ["NAVIGATE_LEFT", 3];
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT.toString = $estr;
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT.__enum__ = ballooniesIXFPaytable.BaseEventsEnum;
        ballooniesIXFPaytable.BaseEventsEnum.CLOSE = ["CLOSE", 0];
        ballooniesIXFPaytable.BaseEventsEnum.CLOSE.toString = $estr;
        ballooniesIXFPaytable.BaseEventsEnum.CLOSE.__enum__ = ballooniesIXFPaytable.BaseEventsEnum;
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT = ["NAVIGATE_RIGHT", 4];
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT.toString = $estr;
        ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT.__enum__ = ballooniesIXFPaytable.BaseEventsEnum;
        ballooniesIXFPaytable.BaseEventsEnum.OPEN = ["OPEN", 1];
        ballooniesIXFPaytable.BaseEventsEnum.OPEN.toString = $estr;
        ballooniesIXFPaytable.BaseEventsEnum.OPEN.__enum__ = ballooniesIXFPaytable.BaseEventsEnum;
        ballooniesIXFPaytable.BaseEvents = function() {
            this.events = new haxe.ds.EnumValueMap();
            this.registerEvents();
        };
        ballooniesIXFPaytable.BaseEvents.__name__ = ["ballooniesIXFPaytable", "BaseEvents"];
        ballooniesIXFPaytable.BaseEvents.prototype.events = null;
        ballooniesIXFPaytable.BaseEvents.prototype.registerEvents = function() {
            var value = new _hcmn_.msignal_Signal1();
            this.events.set(ballooniesIXFPaytable.BaseEventsEnum.CLOSE, value);
            var value1 = new _hcmn_.msignal_Signal1();
            this.events.set(ballooniesIXFPaytable.BaseEventsEnum.CURRENT_PAGE, value1);
            var value2 = new _hcmn_.msignal_Signal1();
            this.events.set(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_LEFT, value2);
            var value3 = new _hcmn_.msignal_Signal1();
            this.events.set(ballooniesIXFPaytable.BaseEventsEnum.NAVIGATE_RIGHT, value3);
        };
        ballooniesIXFPaytable.BaseEvents.prototype.getEvent = function(id) {
            return this.events.get(id);
        };
        ballooniesIXFPaytable.BaseEvents.prototype.__class__ = ballooniesIXFPaytable.BaseEvents;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            },
            exists: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            keys: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        if (!haxe.ds) {
            haxe.ds = {};
        };
        haxe.ds.BalancedTree = function() {};
        haxe.ds.BalancedTree.__name__ = ["haxe", "ds", "BalancedTree"];
        haxe.ds.BalancedTree.prototype.root = null;
        haxe.ds.BalancedTree.prototype.set = function(key, value) {
            this.root = this.setLoop(key, value, this.root);
        };
        haxe.ds.BalancedTree.prototype.get = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return node.value;
                if (c < 0) node = node.left;
                else node = node.right;
            }
            return null;
        };
        haxe.ds.BalancedTree.prototype.exists = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return true;
                else if (c < 0) node = node.left;
                else node = node.right;
            }
            return false;
        };
        haxe.ds.BalancedTree.prototype.keys = function() {
            var ret = [];
            this.keysLoop(this.root, ret);
            return _hcmn_.HxOverrides.iter(ret);
        };
        haxe.ds.BalancedTree.prototype.setLoop = function(k, v, node) {
            if (node == null) return new haxe.ds.TreeNode(null, k, v, null);
            var c = this.compare(k, node.key);
            if (c == 0) return new haxe.ds.TreeNode(node.left, k, v, node.right, node == null ? 0 : node._height);
            else if (c < 0) {
                var nl = this.setLoop(k, v, node.left);
                return this.balance(nl, node.key, node.value, node.right);
            } else {
                var nr = this.setLoop(k, v, node.right);
                return this.balance(node.left, node.key, node.value, nr);
            }
        };
        haxe.ds.BalancedTree.prototype.keysLoop = function(node, acc) {
            if (node != null) {
                this.keysLoop(node.left, acc);
                acc.push(node.key);
                this.keysLoop(node.right, acc);
            }
        };
        haxe.ds.BalancedTree.prototype.balance = function(l, k, v, r) {
            var hl;
            if (l == null) hl = 0;
            else hl = l._height;
            var hr;
            if (r == null) hr = 0;
            else hr = r._height;
            if (hl > hr + 2) {
                if ((function($this) {
                        var $r;
                        var _this = l.left;
                        $r = _this == null ? 0 : _this._height;
                        return $r;
                    }(this)) >= (function($this) {
                        var $r;
                        var _this1 = l.right;
                        $r = _this1 == null ? 0 : _this1._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(l.left, l.key, l.value, new haxe.ds.TreeNode(l.right, k, v, r));
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l.left, l.key, l.value, l.right.left), l.right.key, l.right.value, new haxe.ds.TreeNode(l.right.right, k, v, r));
            } else if (hr > hl + 2) {
                if ((function($this) {
                        var $r;
                        var _this2 = r.right;
                        $r = _this2 == null ? 0 : _this2._height;
                        return $r;
                    }(this)) > (function($this) {
                        var $r;
                        var _this3 = r.left;
                        $r = _this3 == null ? 0 : _this3._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left), r.key, r.value, r.right);
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left.left), r.left.key, r.left.value, new haxe.ds.TreeNode(r.left.right, r.key, r.value, r.right));
            } else return new haxe.ds.TreeNode(l, k, v, r, (hl > hr ? hl : hr) + 1);
        };
        haxe.ds.BalancedTree.prototype.compare = function(k1, k2) {
            return _hcmn_.Reflect.compare(k1, k2);
        };
        haxe.ds.BalancedTree.prototype.__class__ = haxe.ds.BalancedTree;
        haxe.ds.TreeNode = function(l, k, v, r, h) {
            if (h == null) h = -1;
            this.left = l;
            this.key = k;
            this.value = v;
            this.right = r;
            if (h == -1) this._height = ((function($this) {
                var $r;
                var _this = $this.left;
                $r = _this == null ? 0 : _this._height;
                return $r;
            }(this)) > (function($this) {
                var $r;
                var _this1 = $this.right;
                $r = _this1 == null ? 0 : _this1._height;
                return $r;
            }(this)) ? (function($this) {
                var $r;
                var _this2 = $this.left;
                $r = _this2 == null ? 0 : _this2._height;
                return $r;
            }(this)) : (function($this) {
                var $r;
                var _this3 = $this.right;
                $r = _this3 == null ? 0 : _this3._height;
                return $r;
            }(this))) + 1;
            else this._height = h;
        };
        haxe.ds.TreeNode.__name__ = ["haxe", "ds", "TreeNode"];
        haxe.ds.TreeNode.prototype.left = null;
        haxe.ds.TreeNode.prototype.right = null;
        haxe.ds.TreeNode.prototype.key = null;
        haxe.ds.TreeNode.prototype.value = null;
        haxe.ds.TreeNode.prototype._height = null;
        haxe.ds.TreeNode.prototype.__class__ = haxe.ds.TreeNode;
        haxe.ds.EnumValueMap = function() {
            haxe.ds.BalancedTree.call(this);
        };
        haxe.ds.EnumValueMap.__interfaces__ = [haxe.IMap];
        haxe.ds.EnumValueMap.__name__ = ["haxe", "ds", "EnumValueMap"];
        haxe.ds.EnumValueMap.__super__ = haxe.ds.BalancedTree;
        for (var k in haxe.ds.BalancedTree.prototype) haxe.ds.EnumValueMap.prototype[k] = haxe.ds.BalancedTree.prototype[k];
        haxe.ds.EnumValueMap.prototype.compare = function(k1, k2) {
            var d = k1[1] - k2[1];
            if (d != 0) return d;
            var p1 = k1.slice(2);
            var p2 = k2.slice(2);
            if (p1.length == 0 && p2.length == 0) return 0;
            return this.compareArgs(p1, p2);
        };
        haxe.ds.EnumValueMap.prototype.compareArgs = function(a1, a2) {
            var ld = a1.length - a2.length;
            if (ld != 0) return ld;
            var _g1 = 0;
            var _g = a1.length;
            while (_g1 < _g) {
                var i = _g1++;
                var d = this.compareArg(a1[i], a2[i]);
                if (d != 0) return d;
            }
            return 0;
        };
        haxe.ds.EnumValueMap.prototype.compareArg = function(v1, v2) {
            if (_hcmn_.Reflect.isEnumValue(v1) && _hcmn_.Reflect.isEnumValue(v2)) return this.compare(v1, v2);
            else if ((v1 instanceof Array) && v1.__enum__ == null && ((v2 instanceof Array) && v2.__enum__ == null)) return this.compareArgs(v1, v2);
            else return _hcmn_.Reflect.compare(v1, v2);
        };
        haxe.ds.EnumValueMap.prototype.__class__ = haxe.ds.EnumValueMap;
        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 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;
        return {
            exports: ballooniesIXFPaytable,
            activator: ballooniesIXFPaytable.Activator
        };
    });
//# sourceURL=ballooniesIxfPaytable.js