define("smashthepigPicker", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "displayEngineApi", "gameLayoutApi", "clientkernelEventbusApi", "clientkernelModulesApi", "smashthepigComponentsPickerPort"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, displayEngineApi, gameLayoutApi, clientkernelEventbusApi, clientkernelModulesApi, smashthepigComponentsPickerPort) {
        "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"
                };
            },
            exists: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            keys: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        haxe.Log = function() {};
        haxe.Log.__name__ = ["haxe", "Log"];
        haxe.Log.trace = function(v, infos) {
            _hcmn_.js_Boot.__trace(v, infos);
        };
        haxe.Log.prototype.__class__ = haxe.Log;
        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 (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (typeof smashthepigPicker == 'undefined') {
            var smashthepigPicker = {};
        };
        smashthepigPicker.Activator = function(context) {};
        smashthepigPicker.Activator = ck_implements(smashthepigPicker.Activator, clientkernelModulesApi.IModuleActivator);
        smashthepigPicker.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        smashthepigPicker.Activator.__name__ = ["smashthepigPicker", "Activator"];
        smashthepigPicker.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider]).then(function(context1) {
                smashthepigPicker.ExternalService.initialize(context1);
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                smashthepigPicker.ExternalService.viewBuilderFactory = vbf;
                context1.registerService(new smashthepigPicker.PickerFactory(vbf, context1), smashthepigComponentsPickerPort.PickerDeclaration, null);
            });
        };
        smashthepigPicker.Activator.prototype.stop = function(context) {};
        smashthepigPicker.Activator.main = function() {};
        smashthepigPicker.Activator.prototype.__class__ = smashthepigPicker.Activator;
        smashthepigPicker.ExternalService = function() {};
        smashthepigPicker.ExternalService.__name__ = ["smashthepigPicker", "ExternalService"];
        smashthepigPicker.ExternalService.displayProvider = null;
        smashthepigPicker.ExternalService.assetRegistry = null;
        smashthepigPicker.ExternalService.translationManager = null;
        smashthepigPicker.ExternalService.viewBuilderFactory = null;
        smashthepigPicker.ExternalService.initialize = function(context) {
            smashthepigPicker.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            smashthepigPicker.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            smashthepigPicker.ExternalService.translationManager = context.getAnyService(translationmanagerApi.ITranslationManager, null);
        };
        smashthepigPicker.ExternalService.prototype.__class__ = smashthepigPicker.ExternalService;
        smashthepigPicker.Picker = function(context, vbf) {
            this.buttonState = true;
            this.layoutCfgId = "picker_definition_config.json";
            this.initialized = false;
            this.layoutPayload = null;
            this.assetsLoaded = false;
            this.vbf = vbf;
            this.context = context;
            this.components = new haxe.ds.EnumValueMap();
            this.port = context.getImplementedPort(smashthepigComponentsPickerPort.IPickerImplementationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.loadConfigData();
            this.baseEvents = new smashthepigPicker.BaseEvents();
        };
        smashthepigPicker.Picker.__name__ = ["smashthepigPicker", "Picker"];
        smashthepigPicker.Picker.prototype.view = null;
        smashthepigPicker.Picker.prototype.components = null;
        smashthepigPicker.Picker.prototype.layoutPort = null;
        smashthepigPicker.Picker.prototype.port = null;
        smashthepigPicker.Picker.prototype.context = null;
        smashthepigPicker.Picker.prototype.vbf = null;
        smashthepigPicker.Picker.prototype.vba = null;
        smashthepigPicker.Picker.prototype.cfg = null;
        smashthepigPicker.Picker.prototype.component = null;
        smashthepigPicker.Picker.prototype.assetsLoaded = null;
        smashthepigPicker.Picker.prototype.layoutPayload = null;
        smashthepigPicker.Picker.prototype.initialized = null;
        smashthepigPicker.Picker.prototype.componentId = null;
        smashthepigPicker.Picker.prototype.layerContainers = null;
        smashthepigPicker.Picker.prototype.layoutCfgId = null;
        smashthepigPicker.Picker.prototype.baseEvents = null;
        smashthepigPicker.Picker.prototype.buttonState = null;
        smashthepigPicker.Picker.prototype.loadConfigData = function() {
            var _g = this;
            smashthepigPicker.ExternalService.assetRegistry.getAsset(this.layoutCfgId).getContent().then(function(data) {
                _g.cfg = data;
                _g.loadVBAssets();
            });
        };
        smashthepigPicker.Picker.prototype.loadVBAssets = function() {
            var _g = this;
            smashthepigPicker.ExternalService.assetRegistry.getAssetsContent(this.cfg.vbAssets).then(function(data) {
                smashthepigPicker.ExternalService.loadedAssets = data;
                _g.loadMainAssets();
            });
        };
        smashthepigPicker.Picker.prototype.loadMainAssets = function() {
            var _g = this;
            smashthepigPicker.ExternalService.assetRegistry.getAsset(this.cfg.vbLayout).getContent().then(function(vba) {
                _g.vba = vba;
                _g.assetsLoaded = true;
                _g.initialize();
            });
        };
        smashthepigPicker.Picker.prototype.updateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (this.initialized) {
                this.handleUpdateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            } else this.initialize();
        };
        smashthepigPicker.Picker.prototype.initialize = function() {
            if (!this.initialized && this.vba != null && this.layoutPayload != null) {
                this.view = this.vbf.createView(this.vba);
                this.registerAllComponents();
                this.handleUpdateLayout(this.layoutPayload);
                this.port.getShow().subscribe($bind(this, this.handleShow));
                this.port.getHide().subscribe($bind(this, this.handleHide));
                this.port.getSummary().subscribe($bind(this, this.handleSummary));
                this.port.getPicks().subscribe($bind(this, this.handlePicks));
                this.port.getState().subscribe($bind(this, this.handleState));
                this.port.getTotal().subscribe($bind(this, this.handleTotal));
                this.initialized = true;
                this.baseEvents.getEvent(smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE).add($bind(this, this.handlePlayerChoice));
                this.baseEvents.getEvent(smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS).add($bind(this, this.handleAvailablePicks));
            }
        };
        smashthepigPicker.Picker.prototype.handlePlayerChoice = function(e) {
            this.port.getChoice().publish(new smashthepigComponentsPickerPort.PickerChoicePayload(_hcmn_.Std["int"](e)));
        };
        smashthepigPicker.Picker.prototype.handleAvailablePicks = function(e) {
            this.port.getAvailablePicks().publish(e);
        };
        smashthepigPicker.Picker.prototype.handleUpdateLayout = function(layoutPayload) {
            var $it0 = this.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = layoutPayload.containers.get(layerId);
                var stage;
                var this1 = smashthepigPicker.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container = this.layerContainers.get(layerId).getDisplayObject();
                try {
                    stage.removeChild(container);
                } catch (e) {
                    if (e instanceof js._Boot.HaxeError) e = e.val;
                    if (_hcmn_.js_Boot.__instanceof(e, Error)) {} else throw (e);
                }
                stage.addChild(container);
                container.setX(layerPayload.left);
                container.setY(layerPayload.top);
                container.setScaleX(layerPayload.width / container.getUserData().viewBuilderW);
                container.setScaleY(layerPayload.height / container.getUserData().viewBuilderH);
                container.setZIndex(layerPayload.zIndex);
            }
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
        };
        smashthepigPicker.Picker.prototype.registerAllComponents = function() {
            this.layerContainers = this.view.getChildComponents();
            this.component = null;
            var $it0 = this.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var constructorIndex;
                var _this = _hcmn_.Type.getEnumConstructs(smashthepigPicker.ComponentsEnum);
                constructorIndex = _hcmn_.HxOverrides.indexOf(_this, layerId, 0);
                if (constructorIndex < 0) continue;
                var componentEnum = _hcmn_.Type.createEnum(smashthepigPicker.ComponentsEnum, layerId, null);
                this.registerComponent(componentEnum);
            }
        };
        smashthepigPicker.Picker.prototype.registerComponent = function(componentEnum) {
            this.component = null;
            this.registerContainerComponent(smashthepigPicker.ComponentsEnum.PICKER_CONTAINER, smashthepigPicker.PickerAnimation);
            return true;
        };
        smashthepigPicker.Picker.prototype.handleShow = function(e) {
            this.component.show(e.getPayload().symbols);
        };
        smashthepigPicker.Picker.prototype.handleHide = function(e) {
            this.component.hide();
        };
        smashthepigPicker.Picker.prototype.handleSummary = function(e) {
            var symbolId = e.getPayload().symbolId;
            var value = e.getPayload().value;
            var state = e.getPayload().state;
            this.component.handleSummary(symbolId, value, state);
        };
        smashthepigPicker.Picker.prototype.handlePicks = function(e) {
            this.component.handlePicks(e.getPayload());
        };
        smashthepigPicker.Picker.prototype.handleState = function(e) {
            var state = e.getPayload();
            this.component.handleStateChange(state);
        };
        smashthepigPicker.Picker.prototype.handleTotal = function(e) {
            this.component.handleTotal(e.getPayload().totalPickerWin, e.getPayload().totalPicks);
        };
        smashthepigPicker.Picker.prototype.registerContainerComponent = function(componentEnum, componentClass) {
            var container = this.view.getComponentById(componentEnum[0]);
            if (container == null) return;
            this.component = _hcmn_.Type.createInstance(componentClass, [container, this.cfg, this.baseEvents]);
        };
        smashthepigPicker.Picker.prototype.__class__ = smashthepigPicker.Picker;
        smashthepigPicker.PickerFactory = function(vbf, context) {
            this.context = context;
            this.vbf = vbf;
        };
        smashthepigPicker.PickerFactory = ck_implements(smashthepigPicker.PickerFactory, clientkernelModulesApi.IService);
        smashthepigPicker.PickerFactory = ck_implements(smashthepigPicker.PickerFactory, componentmodelComponentApi.IComponentFactory);
        smashthepigPicker.PickerFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        smashthepigPicker.PickerFactory.__name__ = ["smashthepigPicker", "PickerFactory"];
        smashthepigPicker.PickerFactory.prototype.vbf = null;
        smashthepigPicker.PickerFactory.prototype.context = null;
        smashthepigPicker.PickerFactory.prototype.getComponentDeclaration = function() {
            return smashthepigComponentsPickerPort.PickerDeclaration;
        };
        smashthepigPicker.PickerFactory.prototype.createComponent = function(context) {
            new smashthepigPicker.Picker(context, this.vbf);
        };
        smashthepigPicker.PickerFactory.prototype.__class__ = smashthepigPicker.PickerFactory;
        smashthepigPicker.PickerAnimation = function(container, cfg, baseEvents) {
            this.isPicking = false;
            this.choiceDelay = 0;
            this.randomFrom = 1000;
            this.randomTo = 100;
            this.active = false;
            this.vbElements = cfg.vbElements;
            this.baseEvents = baseEvents;
            this.randomFrom = cfg.randomFrom;
            this.randomTo = cfg.randomTo;
            this.choiceDelay = cfg.choiceDelay;
            this.defaultAnimations = cfg.defaultAnimations;
            this.extendedAnimations = cfg.extendedAnimations;
            this.idleStates = cfg.idleStates;
            this.decisionButtons = cfg.decisionButtons;
            this.container = container;
            this.isIdle = new _hcmn_.haxe_ds_StringMap();
            this.symbolDefinitions = new _hcmn_.haxe_ds_StringMap();
            this.symbolsPositions = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(cfg.symbolDefinitions);
            while (_g < _g1.length) {
                var key = _g1[_g];
                ++_g;
                var def = _hcmn_.Reflect.field(cfg.symbolDefinitions, key);
                this.symbolDefinitions.set(key, def);
            }
            var _g2 = 0;
            var _g11 = _hcmn_.Reflect.fields(cfg.symbolsPositions);
            while (_g2 < _g11.length) {
                var key1 = _g11[_g2];
                ++_g2;
                var pos = _hcmn_.Reflect.field(cfg.symbolsPositions, key1);
                this.symbolsPositions.set(key1, pos);
            }
            container.hide();
        };
        smashthepigPicker.PickerAnimation.__name__ = ["smashthepigPicker", "PickerAnimation"];
        smashthepigPicker.PickerAnimation.prototype.container = null;
        smashthepigPicker.PickerAnimation.prototype.baseEvents = null;
        smashthepigPicker.PickerAnimation.prototype.active = null;
        smashthepigPicker.PickerAnimation.prototype.vbElements = null;
        smashthepigPicker.PickerAnimation.prototype.symbolDefinitions = null;
        smashthepigPicker.PickerAnimation.prototype.randomTo = null;
        smashthepigPicker.PickerAnimation.prototype.randomFrom = null;
        smashthepigPicker.PickerAnimation.prototype.choiceDelay = null;
        smashthepigPicker.PickerAnimation.prototype.decisionButtons = null;
        smashthepigPicker.PickerAnimation.prototype.symbolsPositions = null;
        smashthepigPicker.PickerAnimation.prototype.idleStates = null;
        smashthepigPicker.PickerAnimation.prototype.symbols = null;
        smashthepigPicker.PickerAnimation.prototype.picks = null;
        smashthepigPicker.PickerAnimation.prototype.defaultAnimations = null;
        smashthepigPicker.PickerAnimation.prototype.extendedAnimations = null;
        smashthepigPicker.PickerAnimation.prototype.pickerPosition = null;
        smashthepigPicker.PickerAnimation.prototype.pickerSymbolId = null;
        smashthepigPicker.PickerAnimation.prototype.isIdle = null;
        smashthepigPicker.PickerAnimation.prototype.isPicking = null;
        smashthepigPicker.PickerAnimation.prototype.show = function(symbols) {
            this.symbols = symbols;
            haxe.Log.trace("[LN] PickerAnimation.show ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 92,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "show",
                customParams: [symbols]
            });
            this.createAnimations(this.defaultAnimations);
            this.createButtons(this.decisionButtons);
            this.container.show();
            this.updateIdleStates(true);
            this.disableAllButtons();
        };
        smashthepigPicker.PickerAnimation.prototype.handleStateChange = function(state) {
            haxe.Log.trace("[LN] PickerAnimation.handleStateChange ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 105,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleStateChange",
                customParams: [state]
            });
            switch (state[1]) {
                case 1:
                    this.updateIdleStates(false);
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    this.disableAllButtons();
                    break;
                case 2:
                    this.updateIdleStates(false);
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    this.disableAllButtons();
                    break;
                case 3:
                    this.updateIdleStates(true);
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    this.enableAllButtons();
                    break;
                case 12:
                    this.updateIdleStates(false);
                    this.handleSymbols(smashthepigComponentsPickerPort.PickerStateEnum.END);
                    this.handleDefaultAnimations(state);
                    this.disableAllButtons();
                    break;
                case 11:
                    this.updateIdleStates(false);
                    this.handleSymbols(smashthepigComponentsPickerPort.PickerStateEnum.OUTRO);
                    this.handleDefaultAnimations(state);
                    this.disableAllButtons();
                    break;
                case 15:
                    this.updateIdleStates(false);
                    this.handleSymbols(smashthepigComponentsPickerPort.PickerStateEnum.OUTRO);
                    this.handleDefaultAnimations(state);
                    this.disableAllButtons();
                    this.disposeSymbols();
                    break;
                case 14:
                    this.updateIdleStates(false);
                    var $it0 = this.symbols.keys();
                    while ($it0.hasNext()) {
                        var key = $it0.next();
                        var value = _hcmn_.Std.string(smashthepigPicker.PickerAnimation.randomInt(0, 4));
                        this.symbols.set(key, value);
                    }
                    this.handleSymbols(smashthepigComponentsPickerPort.PickerStateEnum.ENTRY);
                    this.handleDefaultAnimations(smashthepigComponentsPickerPort.PickerStateEnum.ENTRY);
                    this.disableAllButtons();
                    break;
                default:
            }
        };
        smashthepigPicker.PickerAnimation.prototype.updateIdleStates = function(idle) {
            var $it0 = this.symbols.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.isIdle.set(key, idle);
            }
        };
        smashthepigPicker.PickerAnimation.prototype.handleTotal = function(totalPickerWin, totalPicks) {
            haxe.Log.trace("[LN] PickerAnimation.handleTotal ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 178,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleTotal",
                customParams: [totalPickerWin, totalPicks]
            });
            var containerId = "PICKER_OUTRO_MESSAGE_CONTAINER";
            var animationId = "PICKER_OUTRO_MESSAGE_VB";
            var totalWinContainer = this.getClip(containerId, animationId).getComponentById("TOTAL_PICKER_WIN_CONTAINER");
            var totalWinLabel = totalWinContainer.getComponentById("PickerOutroMessage_1");
            var totalWinLabelShadow = totalWinContainer.getComponentById("PickerOutroMessage_1_SHADOW");
            totalWinLabel.setText(_hcmn_.StringTools.replace(totalWinLabel.getText(), "[PICKER_TOTAL_WIN]", totalPickerWin));
            totalWinLabelShadow.setText(_hcmn_.StringTools.replace(totalWinLabelShadow.getText(), "[PICKER_TOTAL_WIN]", totalPickerWin));
            var totalPicksContainer = this.getClip(containerId, animationId).getComponentById("TOTAL_PICKS_CONTAINER");
            var totalPicksLabel = totalPicksContainer.getComponentById("PickerOutroMessage_2");
            var totalPicksLabelShadow = totalPicksContainer.getComponentById("PickerOutroMessage_2_SHADOW");
            var sufix = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_PLURAL");
            var sufixShadow = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_PLURAL_SHADOW");
            var picks = _hcmn_.Std.parseInt(totalPicks);
            if (picks > 1) {
                sufix = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_PLURAL");
                sufixShadow = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_PLURAL_SHADOW");
            } else {
                sufix = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_SINGULAR");
                sufixShadow = smashthepigPicker.ExternalService.translationManager.stringLookup("PickerOutroMessage_2_SUFIX_SINGULAR_SHADOW");
            }
            totalPicksLabel.setText(_hcmn_.StringTools.replace(totalPicksLabelShadow.getText() + sufix, "[TOTAL_PICKS_VALUE]", totalPicks));
            totalPicksLabelShadow.setText(_hcmn_.StringTools.replace(totalPicksLabelShadow.getText() + sufixShadow, "[TOTAL_PICKS_VALUE]", totalPicks));
        };
        smashthepigPicker.PickerAnimation.prototype.handleDefaultAnimations = function(state) {
            if (state == smashthepigComponentsPickerPort.PickerStateEnum.IDLE) {
                var rnd = _hcmn_.Std.string(smashthepigPicker.PickerAnimation.randomInt(0, this.idleStates.length - 1));
                var constr = this.getString(smashthepigComponentsPickerPort.PickerStateEnum.IDLE) + "_" + rnd;
                state = _hcmn_.Type.createEnum(smashthepigComponentsPickerPort.PickerStateEnum, constr, null);
            }
            var _g1 = 0;
            var _g = this.defaultAnimations.length;
            while (_g1 < _g) {
                var i = _g1++;
                var containerId = this.defaultAnimations[i] + "_CONTAINER";
                var animationId = this.defaultAnimations[i] + "_VB";
                if (this.container.getComponentById(containerId) != null) {
                    var clipContainer = this.container.getComponentById(containerId);
                    if (clipContainer.getComponentById(animationId) != null) {
                        var vbAnimHolder = clipContainer.getComponentById(animationId);
                        if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                            var vbAnimationContent = vbAnimHolder.getComponentById("ANIMATION_CONTENT");
                            vbAnimationContent.gotoAndPlay(false, this.getString(state));
                        }
                    }
                }
            }
        };
        smashthepigPicker.PickerAnimation.prototype.handleSymbols = function(state) {
            haxe.Log.trace("[LN] PickerAnimation.handleSymbols, symbols: ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 235,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleSymbols",
                customParams: [this.symbols, " definitions: ", this.symbolDefinitions, state]
            });
            var containerId = "SYMBOLS_CONTAINER";
            var $it0 = this.symbols.keys();
            while ($it0.hasNext()) {
                var i = $it0.next();
                var $it1 = this.symbolDefinitions.keys();
                while ($it1.hasNext()) {
                    var assetId = $it1.next();
                    var symbolDef = this.symbolDefinitions.get(assetId);
                    if (this.symbols.get(i) == symbolDef) {
                        haxe.Log.trace("[LN] PickerAnimation.handleSymbols:key ", {
                            fileName: "PickerAnimation.hx",
                            lineNumber: 242,
                            className: "smashthepig.components.picker.components.PickerAnimation",
                            methodName: "handleSymbols",
                            customParams: [i, " child: ", $bind(this, this.handleSymbols), " state ", state]
                        });
                        var symbolsContainer;
                        symbolsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                        var animId = assetId + "_" + i + "_" + symbolDef;
                        var symbolExists;
                        var this1 = symbolsContainer.getChildComponents();
                        symbolExists = this1.exists(animId);
                        if (!symbolExists) this.createClip(containerId, assetId, animId, i, 0, 0);
                        var rnd = _hcmn_.Std.string(smashthepigPicker.PickerAnimation.randomInt(0, this.idleStates.length - 1));
                        var st = state;
                        if (state == smashthepigComponentsPickerPort.PickerStateEnum.IDLE) {
                            var constr = this.getString(smashthepigComponentsPickerPort.PickerStateEnum.IDLE) + "_" + rnd;
                            st = _hcmn_.Type.createEnum(smashthepigComponentsPickerPort.PickerStateEnum, constr, null);
                        }
                        var clipContainer;
                        clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                        var vbAnimHolder = clipContainer.getComponentById(animId);
                        var vbAnimationContent;
                        vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                        vbAnimationContent.gotoAndPlay(false, this.getString(st));
                        vbAnimationContent.addEventListener("evIdleComplete", $bind(this, this.handleIdleState), ["SYMBOLS_CONTAINER", animId, i]);
                    }
                }
            }
        };
        smashthepigPicker.PickerAnimation.prototype.handleIdleState = function(data) {
            var _g = this;
            var containerId = data[0];
            var animId = data[1];
            var symbolId = data[2];
            var rnd = _hcmn_.Std.string(smashthepigPicker.PickerAnimation.randomInt(0, this.idleStates.length - 1));
            var state = _hcmn_.Std.string(smashthepigComponentsPickerPort.PickerStateEnum.IDLE) + "_" + rnd;
            haxe.Log.trace("[LN] PickerAnimation.handleIdleState ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 280,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleIdleState",
                customParams: [this.isIdle.get(symbolId)]
            });
            var clipContainer = this.container.getComponentById(containerId);
            if (clipContainer.getComponentById(animId) != null) {
                var vbAnimHolder = clipContainer.getComponentById(animId);
                if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                    var vbAnimationContent = vbAnimHolder.getComponentById("ANIMATION_CONTENT");
                    vbAnimationContent.gotoAndStop(false, "IDLE_0");
                }
            }
            _hcmn_.haxe_Timer.delay(function() {
                if (_g.isIdle.get(symbolId)) {
                    var idleClipContainer = _g.container.getComponentById(containerId);
                    if (idleClipContainer.getComponentById(animId) != null) {
                        var idleAnimHolder = idleClipContainer.getComponentById(animId);
                        if (idleAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                            var idleAnimationContent = idleAnimHolder.getComponentById("ANIMATION_CONTENT");
                            idleAnimationContent.gotoAndPlay(false, state);
                        }
                    }
                }
            }, smashthepigPicker.PickerAnimation.randomInt(this.randomFrom, this.randomTo));
        };
        smashthepigPicker.PickerAnimation.prototype.handleChoice = function(e) {
            var _g = this;
            haxe.Log.trace("[LN] PickerX.handlePlayerChoice: ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 311,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleChoice",
                customParams: [e.getName(), " picks ", this.picks]
            });
            this.disableAllButtons();
            this.baseEvents.getEvent(smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE).dispatch(-1);
            var symbolId = _hcmn_.Std["int"](e.getName());
            if (!this.isPicking) {
                this.isPicking = true;
                var animId = "PICKER_SMASH_" + symbolId;
                this.createClip("PICKER_SMASH_CONTAINER", "PICKER_SMASH", animId, symbolId == null ? "null" : "" + symbolId, 120, -80);
                var state = this.getString(smashthepigComponentsPickerPort.PickerStateEnum.END);
                var smashContainer;
                smashContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById("PICKER_SMASH_CONTAINER"), viewBuilderApi.IViewBuilderContainer);
                var smashVbAnimHolder = smashContainer.getComponentById(animId);
                var smashVbAnimationContent;
                smashVbAnimationContent = _hcmn_.js_Boot.__cast(smashVbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                smashVbAnimationContent.gotoAndPlay(false, state);
                _hcmn_.haxe_Timer.delay(function() {
                    var containerId = "SYMBOLS_CONTAINER";
                    var symbolsContainer;
                    symbolsContainer = _hcmn_.js_Boot.__cast(_g.container.getComponentById("SYMBOLS_CONTAINER"), viewBuilderApi.IViewBuilderContainer);
                    var $it0 = _g.symbolDefinitions.keys();
                    while ($it0.hasNext()) {
                        var key = $it0.next();
                        var symbolDef = _g.symbolDefinitions.get(key);
                        if ((function($this) {
                                var $r;
                                var key1 = e.getName();
                                $r = _g.symbols.get(key1);
                                return $r;
                            }(this)) == symbolDef) {
                            var animId1 = key + "_" + symbolId + "_" + symbolDef;
                            var clipContainer;
                            clipContainer = _hcmn_.js_Boot.__cast(_g.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                            if (clipContainer.getComponentById(animId1) != null) {
                                var vbAnimHolder = clipContainer.getComponentById(animId1);
                                if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                                    var vbAnimationContent;
                                    vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                                    vbAnimationContent.gotoAndPlay(false, "PICKED");
                                    vbAnimationContent.removeEventListener("evIdleComplete");
                                    var key2 = e.getName();
                                    _g.isIdle.set(key2, false);
                                }
                            }
                        }
                    }
                    _g.handleSrvWaitingAnimation(symbolId, "PICKER_WAITING");
                    _hcmn_.haxe_Timer.delay(function() {
                        _g.baseEvents.getEvent(smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE).dispatch(symbolId);
                    }, _g.choiceDelay);
                }, this.choiceDelay);
            }
        };
        smashthepigPicker.PickerAnimation.prototype.handleSummary = function(symbolId, value, state) {
            haxe.Log.trace("[LN] Picker.handleSummary: ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 374,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handleSummary",
                customParams: [symbolId, value, state, this.isPicking]
            });
            var containerId = "SYMBOLS_CONTAINER";
            var symbolsContainer;
            symbolsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById("SYMBOLS_CONTAINER"), viewBuilderApi.IViewBuilderContainer);
            var $it0 = this.symbolDefinitions.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                var symbolDef = this.symbolDefinitions.get(key);
                if (this.symbols.get(symbolId) == symbolDef) {
                    var animId = key + "_" + symbolId + "_" + symbolDef;
                    var clipContainer;
                    clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                    if (clipContainer.getComponentById(animId) != null) {
                        var vbAnimHolder = clipContainer.getComponentById(animId);
                        if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                            var vbAnimationContent;
                            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                            vbAnimationContent.gotoAndPlay(false, state);
                            vbAnimationContent.removeEventListener("evIdleComplete");
                            this.isIdle.set(symbolId, false);
                            var labelContainer = vbAnimationContent.getComponentById("LABEL_OUTCOME_CONTAINER");
                            var label = labelContainer.getComponentById("PICKER_LABEL_OUTCOME");
                            label.setText(value);
                        }
                    }
                }
            }
            if (this.container.getComponentById("PICKER_WAITING_CONTAINER") != null) {
                var clipContainer1;
                clipContainer1 = _hcmn_.js_Boot.__cast(this.container.getComponentById("PICKER_WAITING_CONTAINER"), viewBuilderApi.IViewBuilderContainer);
                if (clipContainer1.getComponentById("PICKER_WAITING" + symbolId) != null) {
                    var vbAnimHolder1 = clipContainer1.getComponentById("PICKER_WAITING" + symbolId);
                    if (vbAnimHolder1.getComponentById("ANIMATION_CONTENT") != null) {
                        var vbAnimationContent1;
                        vbAnimationContent1 = _hcmn_.js_Boot.__cast(vbAnimHolder1.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                        vbAnimationContent1.stop();
                        vbAnimationContent1.hide();
                        vbAnimationContent1.dispose();
                    }
                }
            }
            this.isPicking = false;
        };
        smashthepigPicker.PickerAnimation.prototype.handleSrvWaitingAnimation = function(symbolId, animationId) {
            var containerId = animationId + "_CONTAINER";
            var vbAsset = smashthepigPicker.ExternalService.loadedAssets.get(animationId + "_VB");
            var animView = smashthepigPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
            animView.show();
            var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            var position;
            if (symbolId == null) position = "null";
            else position = "" + symbolId;
            var xPos = _hcmn_.Std["int"](this.symbolsPositions.get(position).x) - 15;
            var yPos = _hcmn_.Std["int"](this.symbolsPositions.get(position).y) - 100;
            vbAnimHolder.setX(xPos);
            vbAnimHolder.setY(yPos);
            var cont;
            cont = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            var exists;
            var this1 = cont.getChildComponents();
            exists = this1.exists(animationId);
            if (!exists) {
                cont.addChildComponent(vbAnimHolder, animationId + symbolId);
                var vbAnimationContent;
                vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                vbAnimationContent.show();
                vbAnimationContent.gotoAndPlay(false, "LOOP");
            }
        };
        smashthepigPicker.PickerAnimation.prototype.handlePicks = function(picks) {
            this.picks = picks;
            this.enableAllButtons();
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var $it0 = picks.keys();
            while ($it0.hasNext()) {
                var pick = $it0.next();
                var contId = "CHOICE_CONTAINER" + pick;
                var buttonContainer = buttonsContainer.getComponentById(contId);
                var button = buttonContainer.getComponentById("CHOICE_BUTTON");
                button.disable();
            }
            var availablePicks = new _hcmn_.haxe_ds_StringMap();
            var cntdId = "CHOICE_CONTAINER";
            var $it1 = (function($this) {
                var $r;
                var this1 = buttonsContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it1.hasNext()) {
                var key = $it1.next();
                var pickId = _hcmn_.HxOverrides.substr(key, cntdId.length, key.length);
                if (!(_hcmn_.__map_reserved[pickId] != null ? picks.existsReserved(pickId) : picks.h.hasOwnProperty(pickId))) {
                    if (_hcmn_.__map_reserved[pickId] != null) availablePicks.setReserved(pickId, true);
                    else availablePicks.h[pickId] = true;
                }
            }
            this.baseEvents.getEvent(smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS).dispatch(availablePicks);
            haxe.Log.trace("[LN] PickerAnimation.handlePicks: ", {
                fileName: "PickerAnimation.hx",
                lineNumber: 475,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "handlePicks",
                customParams: [picks, " availablePicks: ", availablePicks]
            });
        };
        smashthepigPicker.PickerAnimation.prototype.hide = function() {
            haxe.Log.trace("[LN] PickerAnimation.HIDE", {
                fileName: "PickerAnimation.hx",
                lineNumber: 480,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "hide"
            });
            this.dispose();
            this.container.hide();
            this.isPicking = false;
        };
        smashthepigPicker.PickerAnimation.prototype.dispose = function() {
            haxe.Log.trace("[LN] PickerAnimation.dispose", {
                fileName: "PickerAnimation.hx",
                lineNumber: 490,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "dispose"
            });
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                var cont = this.container.getComponentById(key);
                var $it1 = (function($this) {
                    var $r;
                    var this2 = cont.getChildComponents();
                    $r = this2.keys();
                    return $r;
                }(this));
                while ($it1.hasNext()) {
                    var i = $it1.next();
                    cont.disposeChildComponent(i);
                }
            }
            this.isPicking = false;
        };
        smashthepigPicker.PickerAnimation.prototype.createAnimations = function(animations) {
            haxe.Log.trace("[LN] PickerAnimation.createAnimations", {
                fileName: "PickerAnimation.hx",
                lineNumber: 504,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "createAnimations"
            });
            var _g1 = 0;
            var _g = animations.length;
            while (_g1 < _g) {
                var i = _g1++;
                var containerId = animations[i] + "_CONTAINER";
                var animId = animations[i] + "_VB";
                var vbAsset = smashthepigPicker.ExternalService.loadedAssets.get(animId);
                var vbAnimView = smashthepigPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
                vbAnimView.show();
                var vbAnimationHolder = vbAnimView.createContainerFromStoredConfig("ANIMATION_HOLDER");
                var vbAnimationComponent;
                vbAnimationComponent = _hcmn_.js_Boot.__cast(vbAnimationHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                var animationContainer;
                animationContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                animationContainer.addChildComponent(vbAnimationHolder, animId);
            }
        };
        smashthepigPicker.PickerAnimation.prototype.createClip = function(contId, assetId, animId, position, xOffset, yOffset) {
            haxe.Log.trace("[LN] PickerAnimation.createClip", {
                fileName: "PickerAnimation.hx",
                lineNumber: 523,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "createClip"
            });
            var vbAsset = smashthepigPicker.ExternalService.loadedAssets.get(assetId + "_VB");
            var animView = smashthepigPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
            animView.show();
            var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            var xPos = _hcmn_.Std["int"](this.symbolsPositions.get(position).x + xOffset);
            var yPos = _hcmn_.Std["int"](this.symbolsPositions.get(position).y + yOffset);
            vbAnimHolder.setX(xPos);
            vbAnimHolder.setY(yPos);
            var vbAnimationContent;
            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
            vbAnimationContent.show();
            var cont;
            cont = _hcmn_.js_Boot.__cast(this.container.getComponentById(contId), viewBuilderApi.IViewBuilderContainer);
            var exists;
            var this1 = cont.getChildComponents();
            exists = this1.exists(animId);
            if (!exists) cont.addChildComponent(vbAnimHolder, animId);
        };
        smashthepigPicker.PickerAnimation.prototype.createButtons = function(cfg) {
            haxe.Log.trace("[LN] PickerAnimation.createButtons", {
                fileName: "PickerAnimation.hx",
                lineNumber: 552,
                className: "smashthepig.components.picker.components.PickerAnimation",
                methodName: "createButtons"
            });
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(cfg);
            while (_g < _g1.length) {
                var key = _g1[_g];
                ++_g;
                var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
                var buttonContainer = buttonsContainer.createContainerFromStoredConfig("CHOICE_CONTAINER");
                var props = _hcmn_.Reflect.field(cfg, key);
                var buttonContainerId = "CHOICE_CONTAINER" + key;
                var exists;
                var this1 = buttonsContainer.getChildComponents();
                exists = this1.exists(buttonContainerId);
                if (!exists) buttonsContainer.addChildComponent(buttonContainer, buttonContainerId);
                var button = buttonContainer.getComponentById("CHOICE_BUTTON");
                button.setX(props.x);
                button.setY(props.y);
                button.show();
                button.disable();
                button.getMainMovieClip().setName(key);
                button.getEvents().DOWN().addListener($bind(this, this.handleChoice));
            }
        };
        smashthepigPicker.PickerAnimation.prototype.getClip = function(contId, clipId) {
            var clipContainer;
            clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(contId), viewBuilderApi.IViewBuilderContainer);
            var vbAnimHolder = clipContainer.getComponentById(clipId);
            var vbAnimationContent;
            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
            return vbAnimationContent;
        };
        smashthepigPicker.PickerAnimation.prototype.disposeSymbols = function() {
            var containerId = "SYMBOLS_CONTAINER";
            var symbolsContainer;
            symbolsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            var $it0 = (function($this) {
                var $r;
                var this1 = symbolsContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (this.container.getComponentById(containerId) != null) {
                    var clipContainer;
                    clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                    if (clipContainer.getComponentById(key) != null) {
                        var vbAnimHolder = clipContainer.getComponentById(key);
                        var vbAnimationContent;
                        vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                        vbAnimationContent.stop();
                        vbAnimationContent.removeEventListener("evIdleComplete");
                    }
                }
                symbolsContainer.disposeChildComponent(key);
            }
            var waitingContainer = this.container.getComponentById("PICKER_WAITING_CONTAINER");
            var $it1 = (function($this) {
                var $r;
                var this2 = waitingContainer.getChildComponents();
                $r = this2.keys();
                return $r;
            }(this));
            while ($it1.hasNext()) {
                var animations = $it1.next();
                waitingContainer.disposeChildComponent(animations);
            }
        };
        smashthepigPicker.PickerAnimation.prototype.enableAllButtons = function() {
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var buttonId = "CHOICE_BUTTON";
            var $it0 = (function($this) {
                var $r;
                var this1 = buttonsContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                var buttonContainer = buttonsContainer.getComponentById(key);
                var button = buttonContainer.getComponentById(buttonId);
                button.enable();
            }
        };
        smashthepigPicker.PickerAnimation.prototype.disableAllButtons = function() {
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var buttonId = "CHOICE_BUTTON";
            var $it0 = (function($this) {
                var $r;
                var this1 = buttonsContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                var buttonContainer = buttonsContainer.getComponentById(key);
                var button = buttonContainer.getComponentById(buttonId);
                button.disable();
            }
        };
        smashthepigPicker.PickerAnimation.prototype.disableButton = function(contId, buttonId) {
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var buttonContainer = buttonsContainer.getComponentById(contId);
            var button = buttonContainer.getComponentById(buttonId);
            button.disable();
        };
        smashthepigPicker.PickerAnimation.prototype.enableButton = function(contId, buttonId) {
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var buttonContainer = buttonsContainer.getComponentById(contId);
            var button = buttonContainer.getComponentById(buttonId);
            button.enable();
        };
        smashthepigPicker.PickerAnimation.prototype.getButton = function(contId, buttonId) {
            var buttonsContainer = this.container.getComponentById("BUTTONS_CONTAINER");
            var buttonContainer = buttonsContainer.getComponentById(contId);
            var button = buttonContainer.getComponentById(buttonId);
            return button;
        };
        smashthepigPicker.PickerAnimation.prototype.getString = function(state) {
            return _hcmn_.Std.string(state);
        };
        smashthepigPicker.PickerAnimation.randomInt = function(from, to) {
            return from + _hcmn_.Math.floor((to - from + 1) * _hcmn_.Math.random());
        };
        smashthepigPicker.PickerAnimation.prototype.__class__ = smashthepigPicker.PickerAnimation;
        smashthepigPicker.BaseEventsEnum = {
            __ename__: ["smashthepigPicker", "BaseEventsEnum"],
            __constructs__: ["PLAYER_CHOICE", "AVAILABLE_PICKS"]
        };
        smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE = ["PLAYER_CHOICE", 0];
        smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE.toString = $estr;
        smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE.__enum__ = smashthepigPicker.BaseEventsEnum;
        smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS = ["AVAILABLE_PICKS", 1];
        smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS.toString = $estr;
        smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS.__enum__ = smashthepigPicker.BaseEventsEnum;
        smashthepigPicker.ComponentsEnum = {
            __ename__: ["smashthepigPicker", "ComponentsEnum"],
            __constructs__: ["PICKER_CONTAINER"]
        };
        smashthepigPicker.ComponentsEnum.PICKER_CONTAINER = ["PICKER_CONTAINER", 0];
        smashthepigPicker.ComponentsEnum.PICKER_CONTAINER.toString = $estr;
        smashthepigPicker.ComponentsEnum.PICKER_CONTAINER.__enum__ = smashthepigPicker.ComponentsEnum;
        smashthepigPicker.BaseEvents = function() {
            this.events = new haxe.ds.EnumValueMap();
            this.registerEvents();
        };
        smashthepigPicker.BaseEvents.__name__ = ["smashthepigPicker", "BaseEvents"];
        smashthepigPicker.BaseEvents.prototype.events = null;
        smashthepigPicker.BaseEvents.prototype.registerEvents = function() {
            var value = new _hcmn_.msignal_Signal1();
            this.events.set(smashthepigPicker.BaseEventsEnum.PLAYER_CHOICE, value);
            var value1 = new _hcmn_.msignal_Signal1();
            this.events.set(smashthepigPicker.BaseEventsEnum.AVAILABLE_PICKS, value1);
        };
        smashthepigPicker.BaseEvents.prototype.getEvent = function(id) {
            return this.events.get(id);
        };
        smashthepigPicker.BaseEvents.prototype.__class__ = smashthepigPicker.BaseEvents;
        smashthepigPicker.ExternalService.loadedAssets = new _hcmn_.haxe_ds_StringMap();;
        return {
            exports: smashthepigPicker,
            activator: smashthepigPicker.Activator
        };
    });
//# sourceURL=smashThePigPicker.js