define("scarabSlotModelGamePlugin", ["clientkernelLoaderApi", "slotModelApi", "slotmodelGamePluginCommonGle", "money", "clientkernelEventbusApi", "clientkernelModulesApi", "slotmodelGamePluginApi", "clientkernelLoggerApi"],
    function(clientkernelLoaderApi, slotModelApi, slotmodelGamePluginCommonGle, money, clientkernelEventbusApi, clientkernelModulesApi, slotmodelGamePluginApi, clientkernelLoggerApi) {
        "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 = {

        };
        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 (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 scarabSlotModelGamePlugin == 'undefined') {
            var scarabSlotModelGamePlugin = {};
        };
        scarabSlotModelGamePlugin.ChainCollectionParser = function() {
            this.chainCollection = new _hcmn_.haxe_ds_StringMap();
            this.chainInteger = [];
            this.fsWilds = [];
            this.pickerData = [];
            this.wildTriggers = [];
            this.betInfoSteps = [];
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.__name__ = ["scarabSlotModelGamePlugin", "ChainCollectionParser"];
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.chainCollection = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.chainInteger = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.fsWilds = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.wildTriggers = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.pickerData = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.betInfoSteps = null;
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parseValuesPerBet = function(platformResponse) {
            var keyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairOutcome");
            if (keyValuePairOutcome == null) return null;
            else {
                var _g1 = 0;
                var _g = keyValuePairOutcome.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome[i], "@name") == "BaseGame.Frames.ChainCollection") {
                        var chainValues = keyValuePairOutcome[i];
                        var mapping = slotmodelGamePluginCommonGle.StdHelper.getArrayField(chainValues, "Mapping");
                        var _g3 = 0;
                        var _g2 = mapping.length;
                        while (_g3 < _g2) {
                            var j = _g3++;
                            var key = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@key");
                            var value = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@value");
                            var valuesSTR = value.split(",");
                            var values = [];
                            var _g5 = 0;
                            var _g4 = valuesSTR.length;
                            while (_g5 < _g4) {
                                var i1 = _g5++;
                                values[i1] = _hcmn_.Std.parseInt(valuesSTR[i1]);
                            }
                            this.chainCollection.set(key, values);
                        }
                    }
                }
                haxe.Log.trace("[GAME_PLUGIN] ChainCollectionParser: " + this.chainCollection.toString(), {
                    fileName: "ChainCollectionParser.hx",
                    lineNumber: 56,
                    className: "slotmodel.gameplugin.ChainCollectionParser",
                    methodName: "parseValuesPerBet"
                });
                return this.chainCollection;
            }
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parseWilds = function(platformResponse) {
            this.fsWilds = null;
            this.fsWilds = [];
            var keyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "TriggerOutcome");
            if (keyValuePairOutcome == null) return null;
            else {
                var _g1 = 0;
                var _g = keyValuePairOutcome.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome[i], "@name") == "FreeSpin.Wilds") {
                        var trigger = keyValuePairOutcome[i];
                        var mapping = slotmodelGamePluginCommonGle.StdHelper.getArrayField(trigger, "Trigger");
                        var _g3 = 0;
                        var _g2 = mapping.length;
                        while (_g3 < _g2) {
                            var j = _g3++;
                            var name = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@name");
                            var rc = name.split("L0")[1];
                            this.fsWilds.push(rc);
                        }
                    }
                }
            }
            haxe.Log.trace("[GAME_PLUGIN] fsWilds: " + _hcmn_.Std.string(this.fsWilds), {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 92,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parseWilds"
            });
            return this.fsWilds;
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parseBetInfo = function(platformResponse) {
            var patternSliderInfo = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "PatternSliderInfo");
            if (patternSliderInfo == null) return null;
            var _g1 = 0;
            var _g = patternSliderInfo.length;
            while (_g1 < _g) {
                var i = _g1++;
                var sliderInfo = patternSliderInfo[i];
                var betInfo = slotmodelGamePluginCommonGle.StdHelper.getField(sliderInfo, "BetInfo");
                this.betInfoSteps = slotmodelGamePluginCommonGle.StdHelper.getStringArray(betInfo.Step);
            }
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parseWildTriggers = function(platformResponse) {
            var _g = [];
            var _g1 = 0;
            while (_g1 < 5) {
                var i = _g1++;
                _g.push((function($this) {
                    var $r;
                    var _g2 = []; {
                        var _g3 = 0;
                        while (_g3 < 4) {
                            var j = _g3++;
                            _g2.push(0);
                        }
                    }
                    $r = _g2;
                    return $r;
                }(this)));
            }
            this.wildTriggers = _g;
            var keyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "HighlightOutcome");
            if (keyValuePairOutcome == null) return null;
            var _g21 = 0;
            var _g11 = keyValuePairOutcome.length;
            while (_g21 < _g11) {
                var i1 = _g21++;
                if (slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome[i1], "@name") == "BaseGame.Scarab") {
                    var trigger = keyValuePairOutcome[i1];
                    var highlight = slotmodelGamePluginCommonGle.StdHelper.getField(trigger, "Highlight");
                    if (highlight != null) {
                        var cells = slotmodelGamePluginCommonGle.StdHelper.getArrayField(highlight, "Cell");
                        var _g4 = 0;
                        var _g31 = cells.length;
                        while (_g4 < _g31) {
                            var j1 = _g4++;
                            var cell = cells[j1];
                            var name = slotmodelGamePluginCommonGle.StdHelper.getField(cell, "@name");
                            var rc = name.split("L0")[1];
                            var row = _hcmn_.Std.parseInt(rc.split("R")[1]);
                            var col = _hcmn_.Std.parseInt(rc.split("R")[0].split("C")[1]);
                            this.wildTriggers[col][row] = 1;
                        }
                    }
                }
            }
            haxe.Log.trace("[ChainCollectionParser] [parseWildTriggers] ", {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 141,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parseWildTriggers",
                customParams: [this.wildTriggers]
            });
            return this.wildTriggers;
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parse = function(platformResponse) {
            var keyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairInfo");
            var _g1 = 0;
            var _g = keyValuePairOutcome.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome[i], "@name") == "BaseGame.ChainIntegerArray") {
                    var chainValues = keyValuePairOutcome[i];
                    var mapping = slotmodelGamePluginCommonGle.StdHelper.getArrayField(chainValues, "Mapping");
                    var _g3 = 0;
                    var _g2 = mapping.length;
                    while (_g3 < _g2) {
                        var j = _g3++;
                        this.chainInteger[j] = [];
                        var key = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@key");
                        var value = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@value");
                        var values = value.split(",");
                        var _g5 = 0;
                        var _g4 = values.length;
                        while (_g5 < _g4) {
                            var i1 = _g5++;
                            var val = _hcmn_.Std.parseInt(values[i1].split("R")[1]);
                            if (val == null) val = -1;
                            this.chainInteger[j].push(val);
                        }
                    }
                }
            }
            haxe.Log.trace("[GAME_PLUGIN] ChainInteger: " + _hcmn_.Std.string(this.chainInteger), {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 177,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parse"
            });
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parseCurrentPick = function(platformResponse) {
            var currentPick = -1;
            var pickerOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "PickerOutcome");
            if (pickerOutcome == null) return null;
            else {
                var _g1 = 0;
                var _g = pickerOutcome.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    var layer = slotmodelGamePluginCommonGle.StdHelper.getField(pickerOutcome[i], "Layer");
                    var entry = slotmodelGamePluginCommonGle.StdHelper.getArrayField(layer, "Pick");
                    var _g3 = 0;
                    var _g2 = entry.length;
                    while (_g3 < _g2) {
                        var j = _g3++;
                        var cell = slotmodelGamePluginCommonGle.StdHelper.getField(entry[j], "@picked");
                        if (cell) {
                            currentPick = _hcmn_.Std.parseInt(slotmodelGamePluginCommonGle.StdHelper.getField(entry[j], "@name"));
                            break;
                        }
                    }
                }
            }
            haxe.Log.trace("[GAME_PLUGIN] parseCurrentPick:pickerOutcome " + _hcmn_.Std.string(pickerOutcome), {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 206,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parseCurrentPick"
            });
            haxe.Log.trace("[GAME_PLUGIN] parseCurrentPick: " + currentPick, {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 207,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parseCurrentPick"
            });
            return currentPick;
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.parsePickerData = function(platformResponse) {
            var populationOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "PopulationOutcome");
            if (populationOutcome == null) return null;
            else {
                var _g1 = 0;
                var _g = populationOutcome.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(populationOutcome[i], "@name") == "Picker.Picker") {
                        var values = populationOutcome[i];
                        var entry = slotmodelGamePluginCommonGle.StdHelper.getArrayField(values, "Entry");
                        var _g3 = 0;
                        var _g2 = entry.length;
                        while (_g3 < _g2) {
                            var j = _g3++;
                            this.pickerData[j] = [];
                            var cell = slotmodelGamePluginCommonGle.StdHelper.getField(entry[j], "Cell");
                            var text = slotmodelGamePluginCommonGle.StdHelper.getField(cell, "#text");
                            var spins = text.split(",")[1];
                            var wilds = text.split(",")[3].split("Wilds")[1];
                            this.pickerData[j][0] = _hcmn_.Std.parseInt(spins);
                            this.pickerData[j][1] = _hcmn_.Std.parseInt(wilds);
                        }
                    }
                }
            }
            haxe.Log.trace("[GAME_PLUGIN] pickerData: " + _hcmn_.Std.string(this.pickerData), {
                fileName: "ChainCollectionParser.hx",
                lineNumber: 241,
                className: "slotmodel.gameplugin.ChainCollectionParser",
                methodName: "parsePickerData"
            });
            return this.pickerData;
        };
        scarabSlotModelGamePlugin.ChainCollectionParser.prototype.__class__ = scarabSlotModelGamePlugin.ChainCollectionParser;
        scarabSlotModelGamePlugin.GamePlugin = function() {
            haxe.Log.trace("[GAME_PLUGIN] new: ", {
                fileName: "GamePlugin.hx",
                lineNumber: 45,
                className: "slotmodel.gameplugin.GamePlugin",
                methodName: "new"
            });
            this.commonParser = new slotmodelGamePluginCommonGle.PfPluginCommonResponseParser(scarabSlotModelGamePlugin.GamePlugin.GAME_ID, $bind(this, this.onError), scarabSlotModelGamePlugin.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID);
            this.stripeParser = new scarabSlotModelGamePlugin.StripeParser(this.commonParser);
            this.localParser = new scarabSlotModelGamePlugin.PfPluginResponseParser(scarabSlotModelGamePlugin.GamePlugin.GAME_ID, $bind(this, this.onError), scarabSlotModelGamePlugin.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID, this.commonParser);
            this.resumePerStakeParser = new scarabSlotModelGamePlugin.ResumePerStakeParser(this.commonParser);
            this.chainCollectionParser = new scarabSlotModelGamePlugin.ChainCollectionParser();
            this.retriggerParser = new scarabSlotModelGamePlugin.RetriggerParser(this.commonParser);
            this.payLines = new _hcmn_.haxe_ds_StringMap();
        };
        scarabSlotModelGamePlugin.GamePlugin = ck_implements(scarabSlotModelGamePlugin.GamePlugin, clientkernelModulesApi.IService);
        scarabSlotModelGamePlugin.GamePlugin = ck_implements(scarabSlotModelGamePlugin.GamePlugin, slotmodelGamePluginApi.IGamePlugin);
        scarabSlotModelGamePlugin.GamePlugin.__interfaces__ = [clientkernelModulesApi.IService, slotmodelGamePluginApi.IGamePlugin];
        scarabSlotModelGamePlugin.GamePlugin.__name__ = ["scarabSlotModelGamePlugin", "GamePlugin"];
        scarabSlotModelGamePlugin.GamePlugin.prototype.commonParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.localParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.stripeParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.chainCollectionParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.retriggerParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.resumePerStakeParser = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.payLines = null;
        scarabSlotModelGamePlugin.GamePlugin.prototype.getAdditionalLineWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getBonusWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getCustomBigWin = function(totalStakeCredit, totalWinCredit) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getImplementedFeatures = function() {
            return [slotmodelGamePluginApi.EPluginFeature.CUSTOM_FIELD, slotmodelGamePluginApi.EPluginFeature.STRIPE_LAYER_PER_BET, slotmodelGamePluginApi.EPluginFeature.STRIPE_LAYER_FOR_SYNCHRONIZED_REELS, slotmodelGamePluginApi.EPluginFeature.RESUME_PER_STAKE];
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getNextSpinStripeLayersForSynchronizedReels = function(platformResponse, slotDefinition) {
            return this.localParser.parseNextSpinStripeLayers(platformResponse, slotDefinition);
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getNextSpinStripeLayersPerBet = function(platformResponse, slotDefinition) {
            haxe.Log.trace("[GAME_PLUGIN] getNextSpinStripeLayersPerBet\t: ", {
                fileName: "GamePlugin.hx",
                lineNumber: 88,
                className: "slotmodel.gameplugin.GamePlugin",
                methodName: "getNextSpinStripeLayersPerBet",
                customParams: [platformResponse]
            });
            this.stripeParser.init(platformResponse);
            this.chainCollectionParser.parse(platformResponse);
            this.chainCollectionParser.parseWilds(platformResponse);
            this.chainCollectionParser.parseBetInfo(platformResponse);
            this.payLines = scarabSlotModelGamePlugin.Helper.parsePayLines(platformResponse);
            return this.stripeParser.parseNextSpinStripeLayers(platformResponse, slotDefinition);
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getNextSpinStripeLayers = function(platformResponse, slotDefinition) {
            return this.stripeParser.parseNextSpinStripeLayers(platformResponse, slotDefinition);
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getProgressMeter = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getResumePerStake = function(platformResponse, slotDefinition) {
            var customField = this.parseCustomField(platformResponse);
            return this.resumePerStakeParser.parse(platformResponse, slotDefinition, customField);
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.getScatterWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.parseCustomField = function(platformResponse) {
            var out = {
                spinsCounterPerBet: scarabSlotModelGamePlugin.Helper.parseKeyValuePairOutcomeSpins(platformResponse),
                chainCollection: this.chainCollectionParser.parseValuesPerBet(platformResponse),
                fsWilds: this.chainCollectionParser.parseWilds(platformResponse),
                wildTriggers: this.chainCollectionParser.parseWildTriggers(platformResponse),
                chainInteger: this.chainCollectionParser.chainInteger,
                pickerData: this.chainCollectionParser.parsePickerData(platformResponse),
                currentPick: this.chainCollectionParser.parseCurrentPick(platformResponse),
                retriggerData: this.retriggerParser.parse(platformResponse),
                betInfoSteps: this.chainCollectionParser.betInfoSteps,
                payLines: this.payLines
            };
            haxe.Log.trace("[GamePlugin] [parseCustomField]", {
                fileName: "GamePlugin.hx",
                lineNumber: 132,
                className: "slotmodel.gameplugin.GamePlugin",
                methodName: "parseCustomField",
                customParams: [out.wildTriggers]
            });
            return out;
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.parseCustomData = function(platformResponse) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.stop = function(context) {};
        scarabSlotModelGamePlugin.GamePlugin.prototype.onError = function(error) {
            slotmodelGamePluginCommonGle.Log.getLogger(this).error("[GamePlugin][" + error.id + "] " + error.message);
            throw new js._Boot.HaxeError(error);
        };
        scarabSlotModelGamePlugin.GamePlugin.prototype.__class__ = scarabSlotModelGamePlugin.GamePlugin;
        scarabSlotModelGamePlugin.Helper = function() {};
        scarabSlotModelGamePlugin.Helper.__name__ = ["scarabSlotModelGamePlugin", "Helper"];
        scarabSlotModelGamePlugin.Helper.createMatrix = function() {
            var _g = [];
            var _g1 = 0;
            while (_g1 < 5) {
                var i = _g1++;
                _g.push((function($this) {
                    var $r;
                    var _g2 = []; {
                        var _g3 = 0;
                        while (_g3 < 4) {
                            var j = _g3++;
                            _g2.push(0);
                        }
                    }
                    $r = _g2;
                    return $r;
                }(this)));
            }
            return _g;
        };
        scarabSlotModelGamePlugin.Helper.fillMatrix = function(mat, cells) {
            var _g1 = 0;
            var _g = cells.length;
            while (_g1 < _g) {
                var i = _g1++;
                var name = _hcmn_.Reflect.field(cells[i], "@name");
                var reel = _hcmn_.Std.parseInt(name.charAt(3));
                var cell = _hcmn_.Std.parseInt(name.charAt(5)) - 1;
                mat[reel][cell] = 1;
            }
            return cells.length;
        };
        scarabSlotModelGamePlugin.Helper.createBonusWin = function(type, id, lineId, path, multiplier) {
            var win = new slotmodelGamePluginCommonGle.BonusWin(type, id, "", lineId);
            win.setWinPath(new slotModelApi.ReelPictureInfo(path));
            win.setPayProperties(0, new money.Money("0"), multiplier, 0);
            return win;
        };
        scarabSlotModelGamePlugin.Helper.createEmptyBonusWin = function(type, id, lineId, multiplier) {
            return scarabSlotModelGamePlugin.Helper.createBonusWin(type, id, lineId, scarabSlotModelGamePlugin.Helper.createMatrix(), multiplier);
        };
        scarabSlotModelGamePlugin.Helper.getMapping = function(obj) {
            var array = slotmodelGamePluginCommonGle.StdHelper.getArrayField(obj, "Mapping");
            var map = new _hcmn_.haxe_ds_StringMap();
            if (array != null) {
                var $it0 = _hcmn_.HxOverrides.iter(array);
                while ($it0.hasNext()) {
                    var elem = $it0.next();
                    var key = slotmodelGamePluginCommonGle.StdHelper.getField(elem, "@key");
                    var value = slotmodelGamePluginCommonGle.StdHelper.getField(elem, "@value");
                    if (_hcmn_.__map_reserved[key] != null) map.setReserved(key, value);
                    else map.h[key] = value;
                }
            }
            return map;
        };
        scarabSlotModelGamePlugin.Helper.getTrigger = function(obj) {
            var array = slotmodelGamePluginCommonGle.StdHelper.getArrayField(obj, "Trigger");
            var reelSet = "1";
            if (array != null) {
                var $it0 = _hcmn_.HxOverrides.iter(array);
                while ($it0.hasNext()) {
                    var elem = $it0.next();
                    reelSet = slotmodelGamePluginCommonGle.StdHelper.getField(elem, "@name");
                }
            }
            return reelSet;
        };
        scarabSlotModelGamePlugin.Helper.getStage = function(platformResponse) {
            var Outcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "OutcomeDetail");
            var stage = "BaseGame";
            if (Outcome != null) {
                var $it0 = _hcmn_.HxOverrides.iter(Outcome);
                while ($it0.hasNext()) {
                    var elem = $it0.next();
                    stage = slotmodelGamePluginCommonGle.StdHelper.getField(elem, "Stage");
                }
            }
            return stage;
        };
        scarabSlotModelGamePlugin.Helper.getDefaultValue = function(obj) {
            var array = slotmodelGamePluginCommonGle.StdHelper.getArrayField(obj, "Mapping");
            var $it0 = _hcmn_.HxOverrides.iter(array);
            while ($it0.hasNext()) {
                var elem = $it0.next();
                if (slotmodelGamePluginCommonGle.StdHelper.getField(elem, "@key") == "default") return slotmodelGamePluginCommonGle.StdHelper.getField(elem, "@value");
            }
            return null;
        };
        scarabSlotModelGamePlugin.Helper.parseKeyValuePairOutcome = function(platformResponse, string) {
            var KeyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairOutcome");
            if (KeyValuePairOutcome == null) KeyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairInfo");
            var $it0 = _hcmn_.HxOverrides.iter(KeyValuePairOutcome);
            while ($it0.hasNext()) {
                var data = $it0.next();
                if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == string) return data;
            }
            return null;
        };
        scarabSlotModelGamePlugin.Helper.parseTriggerOutcome = function(platformResponse) {
            var TriggerOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "TriggerOutcome");
            if (TriggerOutcome != null) {
                var $it0 = _hcmn_.HxOverrides.iter(TriggerOutcome);
                while ($it0.hasNext()) {
                    var data = $it0.next();
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == "FreeSpin.SelectedReelSet") return data;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == "FreeSpin.ReelSet") return data;
                }
            }
            return null;
        };
        scarabSlotModelGamePlugin.Helper.parseKeyValuePairOutcomeSpins = function(platformResponse) {
            var spinsCounter = new _hcmn_.haxe_ds_StringMap();
            var KeyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairOutcome");
            if (KeyValuePairOutcome != null) {
                var $it0 = _hcmn_.HxOverrides.iter(KeyValuePairOutcome);
                while ($it0.hasNext()) {
                    var data = $it0.next();
                    var name = slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name");
                    if (name == "BaseGame.Spins") spinsCounter = scarabSlotModelGamePlugin.Helper.getMapping(data);
                }
            }
            return spinsCounter;
        };
        scarabSlotModelGamePlugin.Helper.parsePayLines = function(paytableResponse) {
            var payLines = new _hcmn_.haxe_ds_StringMap();
            var patterns = slotmodelGamePluginCommonGle.StdHelper.getArrayField(paytableResponse, "PatternInfo");
            var _g = 0;
            while (_g < patterns.length) {
                var pattern = patterns[_g];
                ++_g;
                var isPayline = slotmodelGamePluginCommonGle.StdHelper.getField(pattern, "@name");
                if (isPayline == "Paylines") {
                    var lines = slotmodelGamePluginCommonGle.StdHelper.getArrayField(pattern, "Pattern");
                    var _g1 = 0;
                    while (_g1 < lines.length) {
                        var line = lines[_g1];
                        ++_g1;
                        var lineId = slotmodelGamePluginCommonGle.StdHelper.getField(line, "@name").split("Line ")[1];
                        var cells = slotmodelGamePluginCommonGle.StdHelper.getArrayField(line, "Cell");
                        var linePositions = [];
                        var position = null;
                        var _g2 = 0;
                        while (_g2 < cells.length) {
                            var cell = cells[_g2];
                            ++_g2;
                            var name = slotmodelGamePluginCommonGle.StdHelper.getField(cell, "@name");
                            position = scarabSlotModelGamePlugin.Helper.parsePosition(name);
                            linePositions.push(position);
                        }
                        payLines.set("bg_" + lineId, linePositions);
                    }
                }
            }
            return payLines;
        };
        scarabSlotModelGamePlugin.Helper.parsePosition = function(name) {
            var pos = {
                x: _hcmn_.Std.parseInt(name.split("C")[1].split("R")[0]),
                y: _hcmn_.Std.parseInt(name.split("R")[1])
            };
            return pos;
        };
        scarabSlotModelGamePlugin.Helper.prototype.__class__ = scarabSlotModelGamePlugin.Helper;
        scarabSlotModelGamePlugin.ModuleActivator = function() {};
        scarabSlotModelGamePlugin.ModuleActivator = ck_implements(scarabSlotModelGamePlugin.ModuleActivator, clientkernelModulesApi.IModuleActivator);
        scarabSlotModelGamePlugin.ModuleActivator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        scarabSlotModelGamePlugin.ModuleActivator.__name__ = ["scarabSlotModelGamePlugin", "ModuleActivator"];
        scarabSlotModelGamePlugin.ModuleActivator.prototype.gamePlugin = null;
        scarabSlotModelGamePlugin.ModuleActivator.prototype.registration = null;
        scarabSlotModelGamePlugin.ModuleActivator.prototype.start = function(context) {
            var _g = this;
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, clientkernelLoggerApi.ILoggerFactory, clientkernelEventbusApi.IEventBus]).then(function(context1) {
                _g.gamePlugin = new scarabSlotModelGamePlugin.GamePlugin();
                _g.registration = context1.registerService(_g.gamePlugin, slotmodelGamePluginApi.IGamePlugin, null);
            });
        };
        scarabSlotModelGamePlugin.ModuleActivator.prototype.stop = function(context) {
            if (this.gamePlugin != null) this.gamePlugin.stop(context);
            if (this.registration != null) this.registration.unregister();
        };
        scarabSlotModelGamePlugin.ModuleActivator.main = function() {};
        scarabSlotModelGamePlugin.ModuleActivator.prototype.__class__ = scarabSlotModelGamePlugin.ModuleActivator;
        scarabSlotModelGamePlugin.PfPluginResponseParser = function(gameId, onError, payloadErrorId, commonParser) {
            this.parseError = false;
            this.gameId = gameId;
            this.onError = onError;
            this.payloadErrorId = payloadErrorId;
            this.commonParser = commonParser;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.__name__ = ["scarabSlotModelGamePlugin", "PfPluginResponseParser"];
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.commonParser = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.chainCollectionYellow = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.onError = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.payloadErrorId = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.gameId = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseError = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.nameMap = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.chainCollection = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.defaultReelPictures = null;
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.onParseFatalError = function(message) {
            slotmodelGamePluginCommonGle.Log.getLoggerBykey("PfPluginResponseParser").error("[ParseFatalError]" + message);
            this.parseError = true;
            this.onError(this.getFatalError("ParseFatalError", message));
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getFatalError = function(source, message) {
            return new slotModelApi.Error(this.payloadErrorId, true, "[" + this.gameId + "][" + source + "] " + message);
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseNextSpinStripeLayers = function(response, slotDefinition) {
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var defaultBaseNextSpinStripeLayer = scarabSlotModelGamePlugin.PfPluginResponseParser.createIntArray(reelCount, scarabSlotModelGamePlugin.GamePlugin.BASE_GAME_DEFAULT_STRIPE_LAYER);
            var defaultFreeSpinNextSpinStripeLayer = scarabSlotModelGamePlugin.PfPluginResponseParser.createIntArray(reelCount, scarabSlotModelGamePlugin.GamePlugin.FREE_SPIN_DEFAULT_STRIPE_LAYER);
            var baseNextSpinStripeLayer = this.parseKeyValuePairNextSpinStripeLayers(response, slotDefinition, "BaseGame");
            var freeSpinNextSpinStripeLayer = this.parseKeyValuePairNextSpinStripeLayers(response, slotDefinition, "FreeSpin");
            return new scarabSlotModelGamePlugin.NextSpinStripeLayers(defaultBaseNextSpinStripeLayer, baseNextSpinStripeLayer, defaultFreeSpinNextSpinStripeLayer, freeSpinNextSpinStripeLayer);
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getBaseGameStartReelPicture = function(response, slotDefinition) {
            var reelPicture = this.parseStartReelPicture(response, "BaseGame", slotDefinition);
            if (reelPicture != null) return reelPicture;
            else return slotDefinition.startReelPicture;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getFreeSpinStartReelPicture = function(response, slotDefinition) {
            var reelPicture = this.parseStartReelPicture(response, "FreeSpin", slotDefinition);
            if (reelPicture != null) return reelPicture;
            else return slotDefinition.startFSReelPicture;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseStartReelPicture = function(response, stage, slotDefinition) {
            var reelPictureMappings = this.parseKeyValuePairOutcomeMappings(response, stage + ".ReelPicture");
            if (reelPictureMappings == null) return null;
            var startReelPictureString = this.getMapValue("default", reelPictureMappings);
            var startReelPicture = this.getReelPicture(startReelPictureString, slotDefinition.reelPictureSize);
            return startReelPicture;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.createSpinOutcomes = function(response, slotDefinition, stage) {
            var result = this.parseKeyValuePairOutcomes(response, slotDefinition, stage);
            if (result != null) return result;
            result = new _hcmn_.haxe_ds_IntMap();
            var reelPictures = this.createReelPictureMapping(response, stage + ".Reels");
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseKeyValuePairOutcomes = function(response, slotDefinition, stage) {
            var reelPictureMappings = this.parseKeyValuePairOutcomeMappings(response, stage + ".ReelPicture");
            if (reelPictureMappings == null) return null;
            var allKeys = this.getAllKeys(reelPictureMappings);
            if (allKeys == null) return null;
            var result = new _hcmn_.haxe_ds_IntMap();
            var key;
            var _g = 0;
            while (_g < allKeys.length) {
                var key1 = allKeys[_g];
                ++_g;
                var betPerLineCredit = this.getKeyValuePairBetPerLineCredit(key1);
                var outcome = this.getKeyValuePairOutcome(response, key1, reelPictureMappings, slotDefinition, stage);
                if (outcome != null) result.h[betPerLineCredit] = outcome;
            }
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseKeyValuePairNextSpinStripeLayers = function(response, slotDefinition, stage) {
            var sectionMappings = this.parseKeyValuePairOutcomeMappings(response, stage + ".Section");
            var result = new _hcmn_.haxe_ds_IntMap();
            if (sectionMappings == null) return null;
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var key;
            var $it0 = sectionMappings.keys();
            while ($it0.hasNext()) {
                var key1 = $it0.next();
                var sectionId = slotmodelGamePluginCommonGle.StdHelper.parseInt(_hcmn_.__map_reserved[key1] != null ? sectionMappings.getReserved(key1) : sectionMappings.h[key1], $bind(this, this.onParseFatalError));
                if (this.parseError) return null;
                var key2 = this.getKeyValuePairBetPerLineCredit(key1);
                var value = scarabSlotModelGamePlugin.PfPluginResponseParser.createIntArray(reelCount, sectionId);
                result.h[key2] = value;
            }
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.createReelPictureMapping = function(response, fieldName) {
            var keyValuePairOutcomes = slotmodelGamePluginCommonGle.StdHelper.getArrayField(response, "PopulationOutcome");
            var reelPicture = null;
            if (keyValuePairOutcomes != null) {
                var mappings = null;
                var _g = 0;
                while (_g < keyValuePairOutcomes.length) {
                    var keyValuePairOutcome = keyValuePairOutcomes[_g];
                    ++_g;
                    var name = slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome, "@name");
                    if (name == fieldName) {
                        mappings = slotmodelGamePluginCommonGle.StdHelper.getArrayField(keyValuePairOutcome, "Entry");
                        break;
                    }
                }
                reelPicture = this.commonParser.parseReelPicture(mappings);
            }
            return reelPicture;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.parseKeyValuePairOutcomeMappings = function(response, fieldName) {
            var keyValuePairOutcomes = slotmodelGamePluginCommonGle.StdHelper.getArrayField(response, "KeyValuePairOutcome");
            if (keyValuePairOutcomes == null) {
                keyValuePairOutcomes = slotmodelGamePluginCommonGle.StdHelper.getArrayField(response, "KeyValuePairInfo");
                if (keyValuePairOutcomes == null) return null;
            }
            var mappings = null;
            var _g = 0;
            while (_g < keyValuePairOutcomes.length) {
                var keyValuePairOutcome = keyValuePairOutcomes[_g];
                ++_g;
                var name = slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome, "@name");
                if (name == fieldName) {
                    mappings = slotmodelGamePluginCommonGle.StdHelper.getArrayField(keyValuePairOutcome, "Mapping");
                    break;
                }
            }
            if (mappings == null) return null;
            var result = new _hcmn_.haxe_ds_StringMap();
            var mapping;
            var _g1 = 0;
            while (_g1 < mappings.length) {
                var mapping1 = mappings[_g1];
                ++_g1;
                var key = slotmodelGamePluginCommonGle.StdHelper.getField(mapping1, "@key");
                var value = slotmodelGamePluginCommonGle.StdHelper.getField(mapping1, "@value");
                if (_hcmn_.__map_reserved[key] != null) result.setReserved(key, value);
                else result.h[key] = value;
            }
            var $it0 = _hcmn_.HxOverrides.iter(keyValuePairOutcomes);
            while ($it0.hasNext()) {
                var pair = $it0.next();
                var name1 = slotmodelGamePluginCommonGle.StdHelper.getField(pair, "@name");
                if (name1 == "BaseGame.ChainCollection") this.chainCollection = scarabSlotModelGamePlugin.Helper.getMapping(pair);
                if (name1 == "BaseGame.ChainKeyValuePairInfo") this.nameMap = scarabSlotModelGamePlugin.Helper.getMapping(pair);
                if (name1 == "BaseGame.ChainIntegerArray") this.nameMap = scarabSlotModelGamePlugin.Helper.getMapping(pair);
            }
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getAllKeys = function(map1) {
            var result = [];
            var key;
            if (map1 != null) {
                var $it0 = map1.keys();
                while ($it0.hasNext()) {
                    var key1 = $it0.next();
                    result.push(key1);
                }
            }
            if (result.length == 0) return null;
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getKeyValuePairBetPerLineCredit = function(key) {
            var keyInt = _hcmn_.Std.parseInt(key);
            if (keyInt != null) return keyInt;
            else return scarabSlotModelGamePlugin.GamePlugin.BASE_GAME_DEFAULT_STRIPE_LAYER;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getReelPicture = function(reelPictureString, reelPictureSize) {
            var reelPicture = null;
            if (!slotmodelGamePluginCommonGle.StdHelper.isEmpty(reelPictureString) && reelPictureSize != null) {
                var reelPictureStringTrunc = reelPictureString.split(" ").join("");
                var symbols = reelPictureStringTrunc.split(scarabSlotModelGamePlugin.PfPluginResponseParser.REELPICTURE_SEPARATOR);
                var reels = [];
                var reelIndex;
                var cellIndex;
                var _g1 = 0;
                var _g = reelPictureSize.reelCount;
                while (_g1 < _g) {
                    var reelIndex1 = _g1++;
                    reels[reelIndex1] = [];
                    var _g3 = 0;
                    var _g2 = reelPictureSize.reelLength;
                    while (_g3 < _g2) {
                        var cellIndex1 = _g3++;
                        var symbol = symbols.splice(0, 1)[0];
                        reels[reelIndex1][cellIndex1] = symbol;
                    }
                }
                reelPicture = new slotModelApi.ReelPicture(reels);
            }
            return reelPicture;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getKeyValuePairReelPictureInfo = function(reelPictureInfoString, reelPictureSize, reelPictureVisibility) {
            var reelPicturesInfo = null;
            if (!slotmodelGamePluginCommonGle.StdHelper.isEmpty(reelPictureInfoString)) {
                var reelPictureInfoStringTrunc = reelPictureInfoString.split(" ").join("");
                var cellsInfo = reelPictureInfoStringTrunc.split(scarabSlotModelGamePlugin.PfPluginResponseParser.REELPICTURE_SEPARATOR);
                var reelPictureInfo = this.commonParser.getDefaultReelPictureInfo(reelPictureSize, 0);
                this.commonParser.updateReelPictureInfo(reelPictureInfo, cellsInfo, reelPictureVisibility, scarabSlotModelGamePlugin.PfPluginResponseParser.WINNING_SYMBOL_INFO);
                reelPicturesInfo = new slotModelApi.ReelPictureInfo(reelPictureInfo);
            }
            return reelPicturesInfo;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getKeyValuePairOutcome = function(response, key, reelPictureMappings, slotDefinition, stage) {
            var reelPictureSize = slotDefinition.reelPictureSize;
            var reelPictureVisibility = slotDefinition.reelPictureVisibility;
            var reelStopString = this.getMapValue(key, reelPictureMappings);
            var reelStop = this.getReelPicture(reelStopString, slotDefinition.reelPictureSize);
            if (reelStop == null) reelStop = this.defaultReelPictures;
            return slotmodelGamePluginCommonGle.Outcome.create(stage, reelStop, null, null, null, null, null, null);
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.getMapValue = function(key, map) {
            if (map != null) {
                if (_hcmn_.__map_reserved[key] != null ? map.existsReserved(key) : map.h.hasOwnProperty(key)) return _hcmn_.__map_reserved[key] != null ? map.getReserved(key) : map.h[key];
            }
            return null;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.getDefaultReelPictureInfo = function(reelPictureSize, defaultValue) {
            var reelsInfo = [];
            var reelIndex;
            var symbolIndex;
            var _g1 = 0;
            var _g = reelPictureSize.reelCount;
            while (_g1 < _g) {
                var reelIndex1 = _g1++;
                var reelInfo = [];
                var _g3 = 0;
                var _g2 = reelPictureSize.reelLength;
                while (_g3 < _g2) {
                    var symbolIndex1 = _g3++;
                    reelInfo.push(defaultValue);
                }
                reelsInfo.push(reelInfo);
            }
            return new slotModelApi.ReelPictureInfo(reelsInfo);
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.createIntArray = function(size, value) {
            if (size == 0) return null;
            var result = [];
            var i;
            var _g = 0;
            while (_g < size) {
                var i1 = _g++;
                result.push(value);
            }
            return result;
        };
        scarabSlotModelGamePlugin.PfPluginResponseParser.prototype.__class__ = scarabSlotModelGamePlugin.PfPluginResponseParser;
        scarabSlotModelGamePlugin.ResumePerStakeParser = function(commonParser) {
            this.commonParser = commonParser;
            this.baseGameMap = new _hcmn_.haxe_ds_IntMap();
            this.freeSpinMap = new _hcmn_.haxe_ds_IntMap();
        };
        scarabSlotModelGamePlugin.ResumePerStakeParser.__name__ = ["scarabSlotModelGamePlugin", "ResumePerStakeParser"];
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.commonParser = null;
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.baseGameMap = null;
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.freeSpinMap = null;
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.parse = function(platformResponse, slotDefinition, customField) {
            var stage = slotmodelGamePluginCommonGle.StdHelper.getField(platformResponse, "OutcomeDetail.Stage");
            var rp = this.parseReelPicture(platformResponse, stage);
            var betPerLine = this.commonParser.parseBetPerLineCredit(platformResponse);
            this.parseBaseGameMap(platformResponse, slotDefinition);
            var rps = new scarabSlotModelGamePlugin.ResumePerStake(slotDefinition.startReelPicture, slotDefinition.startFSReelPicture, this.baseGameMap, this.freeSpinMap, customField);
            if (this.baseGameMap.h.hasOwnProperty(0)) rps.baseGameDefaultReelPicture = this.baseGameMap.h[0];
            else rps.baseGameDefaultReelPicture = this.parseReelPicture(platformResponse, "BaseGame");
            if (this.freeSpinMap.h.hasOwnProperty(0)) rps.freeSpinDefaultReelPicture = this.freeSpinMap.h[0];
            else rps.freeSpinDefaultReelPicture = this.parseReelPicture(platformResponse, "FreeSpin");
            return rps;
        };
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.parseReelPicture = function(platformResponse, stage) {
            var fieldName = stage + ".Reels";
            if (stage == "Picker") {
                var nextStage = slotmodelGamePluginCommonGle.StdHelper.getField(platformResponse, "OutcomeDetail.NextStage");
                fieldName = nextStage + ".Reels";
            }
            return this.commonParser.parseReelPicture(this.commonParser.parsePopulationOutcome(platformResponse, fieldName));
        };
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.parseBaseGameMap = function(platformResponse, slotDefinition) {
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var reelLength = slotDefinition.reelPictureSize.reelLength;
            var keyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairOutcome");
            if (keyValuePairOutcome == null) return null;
            else {
                var _g1 = 0;
                var _g = keyValuePairOutcome.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome[i], "@name") == "BaseGame.ReelPicture") {
                        var mapping = slotmodelGamePluginCommonGle.StdHelper.getArrayField(keyValuePairOutcome[i], "Mapping");
                        var _g3 = 0;
                        var _g2 = mapping.length;
                        while (_g3 < _g2) {
                            var j = _g3++;
                            var key = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@key");
                            var values = slotmodelGamePluginCommonGle.StdHelper.getField(mapping[j], "@value");
                            var allSymbols = values.split(",");
                            var reels = [];
                            var currentSymbol = 0;
                            var _g4 = 0;
                            while (_g4 < reelCount) {
                                var r = _g4++;
                                reels[r] = [];
                                var _g5 = 0;
                                while (_g5 < reelLength) {
                                    var k = _g5++;
                                    reels[r][k] = allSymbols[currentSymbol];
                                    currentSymbol++;
                                }
                            }
                            if (key == "default") {
                                var value = new slotModelApi.ReelPicture(reels);
                                this.baseGameMap.h[0] = value;
                            } else {
                                var key1 = _hcmn_.Std.parseInt(key);
                                var value1 = new slotModelApi.ReelPicture(reels);
                                this.baseGameMap.h[key1] = value1;
                            }
                        }
                    }
                }
            }
        };
        scarabSlotModelGamePlugin.ResumePerStakeParser.prototype.__class__ = scarabSlotModelGamePlugin.ResumePerStakeParser;
        scarabSlotModelGamePlugin.NextSpinStripeLayers = function(defaultBaseStripeLayer, baseStripeLayers, defaultFreeSpinStripeLayer, freeSpinStripeLayers) {
            this.defaultBaseStripeLayer = defaultBaseStripeLayer;
            this.baseStripeLayers = baseStripeLayers;
            this.defaultFreeSpinStripeLayer = defaultFreeSpinStripeLayer;
            this.freeSpinStripeLayers = freeSpinStripeLayers;
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers = ck_implements(scarabSlotModelGamePlugin.NextSpinStripeLayers, slotmodelGamePluginApi.INextSpinStripeLayers);
        scarabSlotModelGamePlugin.NextSpinStripeLayers.__interfaces__ = [slotmodelGamePluginApi.INextSpinStripeLayers];
        scarabSlotModelGamePlugin.NextSpinStripeLayers.__name__ = ["scarabSlotModelGamePlugin", "NextSpinStripeLayers"];
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.defaultBaseStripeLayer = null;
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.baseStripeLayers = null;
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.defaultFreeSpinStripeLayer = null;
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.freeSpinStripeLayers = null;
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getNextSpinStripeLayers = function(stage, lineCount, betPerLineCredit) {
            if (stage.toLowerCase() == "freespin") return this.getFreeSpinStripeLayers(lineCount, betPerLineCredit);
            return this.getBaseStripeLayers(lineCount, betPerLineCredit);
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getBaseStripeLayers = function(lineCount, betPerLineCredit) {
            if (this.baseStripeLayers != null) {
                if (this.baseStripeLayers.h.hasOwnProperty(betPerLineCredit)) return this.baseStripeLayers.h[betPerLineCredit];
            }
            return this.defaultBaseStripeLayer;
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getFreeSpinStripeLayers = function(lineCount, betPerLineCredit) {
            if (this.freeSpinStripeLayers != null) {
                if (this.freeSpinStripeLayers.h.hasOwnProperty(betPerLineCredit)) return this.freeSpinStripeLayers.h[betPerLineCredit];
            }
            return this.defaultFreeSpinStripeLayer;
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getStripeLayersForSynchronizedReels = function(stage, lineCount, betPerLineCredit) {
            if (stage.indexOf("FreeSpin") != -1) return this.getFreeSpinStripeLayers(lineCount, betPerLineCredit);
            return this.getBaseStripeLayers(lineCount, betPerLineCredit);
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getStripeLayersPerBet = function(slotDefinition, stage, stakeItems) {
            var sideBet = _hcmn_.Std.string(stakeItems.stakeItems.sideBet);
            var nextSpinStripeLayerValue = [];
            nextSpinStripeLayerValue = this.getBaseStripeLayersPerBet(slotDefinition, stakeItems.stakeItems.sideBet);
            return nextSpinStripeLayerValue;
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.getBaseStripeLayersPerBet = function(slotDefinition, sideBet) {
            var nextSpinStripeLayerValue = [];
            if (this.baseStripeLayers != null) nextSpinStripeLayerValue = this.baseStripeLayers.h[sideBet];
            if (nextSpinStripeLayerValue != null) return nextSpinStripeLayerValue;
            else return this.defaultBaseStripeLayer;
        };
        scarabSlotModelGamePlugin.NextSpinStripeLayers.prototype.__class__ = scarabSlotModelGamePlugin.NextSpinStripeLayers;
        scarabSlotModelGamePlugin.ResumePerStake = function(baseGameDefaultReelPicture, freeSpinDefaultReelPicture, baseGameMap, freeSpinMap, customField) {
            this.customField = customField;
            this.freeSpinMap = freeSpinMap;
            this.baseGameMap = baseGameMap;
            this.freeSpinDefaultReelPicture = freeSpinDefaultReelPicture;
            this.baseGameDefaultReelPicture = baseGameDefaultReelPicture;
        };
        scarabSlotModelGamePlugin.ResumePerStake = ck_implements(scarabSlotModelGamePlugin.ResumePerStake, slotmodelGamePluginApi.IResumePerStake);
        scarabSlotModelGamePlugin.ResumePerStake.__interfaces__ = [slotmodelGamePluginApi.IResumePerStake];
        scarabSlotModelGamePlugin.ResumePerStake.__name__ = ["scarabSlotModelGamePlugin", "ResumePerStake"];
        scarabSlotModelGamePlugin.ResumePerStake.prototype.baseGameDefaultReelPicture = null;
        scarabSlotModelGamePlugin.ResumePerStake.prototype.freeSpinDefaultReelPicture = null;
        scarabSlotModelGamePlugin.ResumePerStake.prototype.baseGameMap = null;
        scarabSlotModelGamePlugin.ResumePerStake.prototype.freeSpinMap = null;
        scarabSlotModelGamePlugin.ResumePerStake.prototype.customField = null;
        scarabSlotModelGamePlugin.ResumePerStake.prototype.getResumeOutcome = function(stage, lineCount, betPerLineCredit) {
            var outcome;
            if (stage == "FreeSpin") {
                if (this.freeSpinMap.h.hasOwnProperty(betPerLineCredit)) outcome = this.createOutcome(stage, this.freeSpinMap.h[betPerLineCredit], this.customField);
                else outcome = this.createOutcome(stage, this.freeSpinDefaultReelPicture, this.customField);
            } else if (this.baseGameMap.h.hasOwnProperty(betPerLineCredit)) outcome = this.createOutcome(stage, this.baseGameMap.h[betPerLineCredit], this.customField);
            else outcome = this.createOutcome(stage, this.baseGameDefaultReelPicture, this.customField);
            return outcome;
        };
        scarabSlotModelGamePlugin.ResumePerStake.prototype.createOutcome = function(stage, rp, customField) {
            var outcome = slotmodelGamePluginCommonGle.Outcome.create2(stage, rp);
            outcome.setCustomField(customField);
            return outcome;
        };
        scarabSlotModelGamePlugin.ResumePerStake.prototype.__class__ = scarabSlotModelGamePlugin.ResumePerStake;
        scarabSlotModelGamePlugin.RetriggerData = function(bonusesRemaining, maxRetrigger, initReels) {
            this.maxRetrigger = maxRetrigger;
            this.bonusesRemaining = bonusesRemaining;
            this.initReels = initReels;
        };
        scarabSlotModelGamePlugin.RetriggerData.__name__ = ["scarabSlotModelGamePlugin", "RetriggerData"];
        scarabSlotModelGamePlugin.RetriggerData.prototype.maxRetrigger = null;
        scarabSlotModelGamePlugin.RetriggerData.prototype.bonusesRemaining = null;
        scarabSlotModelGamePlugin.RetriggerData.prototype.initReels = null;
        scarabSlotModelGamePlugin.RetriggerData.prototype.__class__ = scarabSlotModelGamePlugin.RetriggerData;
        scarabSlotModelGamePlugin.RetriggerParser = function(commonParser) {
            this.commonParser = commonParser;
        };
        scarabSlotModelGamePlugin.RetriggerParser.__name__ = ["scarabSlotModelGamePlugin", "RetriggerParser"];
        scarabSlotModelGamePlugin.RetriggerParser.prototype.commonParser = null;
        scarabSlotModelGamePlugin.RetriggerParser.prototype.parse = function(platformResponse) {
            var remaining = this.parseBonusRemaining(platformResponse);
            var maxRetrriger = this.parseMaxRetrigger(platformResponse);
            var initReels = this.parseInitReels(platformResponse);
            return new scarabSlotModelGamePlugin.RetriggerData(remaining, maxRetrriger, initReels);
        };
        scarabSlotModelGamePlugin.RetriggerParser.prototype.parseInitReels = function(platformResponse) {
            var fieldName = "FreeSpin.InitReels";
            var keyValuePairOutcomes = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "PopulationOutcome");
            if (keyValuePairOutcomes == null) return null;
            var mappings = null;
            var _g = 0;
            while (_g < keyValuePairOutcomes.length) {
                var keyValuePairOutcome = keyValuePairOutcomes[_g];
                ++_g;
                var name = slotmodelGamePluginCommonGle.StdHelper.getField(keyValuePairOutcome, "@name");
                if (name == fieldName) {
                    mappings = slotmodelGamePluginCommonGle.StdHelper.getArrayField(keyValuePairOutcome, "Entry");
                    break;
                }
            }
            var reelPicture = this.commonParser.parseReelPicture(mappings);
            return reelPicture;
        };
        scarabSlotModelGamePlugin.RetriggerParser.prototype.parseMaxRetrigger = function(platformResponse) {
            var triggerOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "TriggerOutcome");
            if (triggerOutcome != null) {
                var _g = 0;
                while (_g < triggerOutcome.length) {
                    var data = triggerOutcome[_g];
                    ++_g;
                    if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == "FreeSpin.MaxFreeSpinReTrigger") {
                        var trigger = slotmodelGamePluginCommonGle.StdHelper.getArrayField(data, "Trigger");
                        if (trigger != null) {
                            var _g1 = 0;
                            while (_g1 < trigger.length) {
                                var data1 = trigger[_g1];
                                ++_g1;
                                if (slotmodelGamePluginCommonGle.StdHelper.getField(data1, "@name") == "MaxReTrigger") return true;
                            }
                        }
                    }
                }
            }
            return false;
        };
        scarabSlotModelGamePlugin.RetriggerParser.prototype.parseBonusRemaining = function(platformResponse) {
            var ladderOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "LadderOutcome");
            var _g = 0;
            while (_g < ladderOutcome.length) {
                var data = ladderOutcome[_g];
                ++_g;
                if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == "PickersAwarded") {
                    var ladder = slotmodelGamePluginCommonGle.StdHelper.getField(data, "Ladder");
                    return slotmodelGamePluginCommonGle.StdHelper.parseIntField(ladder, "#text", $bind(this, this.onError));
                }
            }
            return 0;
        };
        scarabSlotModelGamePlugin.RetriggerParser.prototype.onError = function(errorMsg) {
            haxe.Log.trace("[mm - log error", {
                fileName: "RetriggerParser.hx",
                lineNumber: 84,
                className: "slotmodel.gameplugin.outcome.RetriggerParser",
                methodName: "onError",
                customParams: [errorMsg]
            });
        };
        scarabSlotModelGamePlugin.RetriggerParser.prototype.__class__ = scarabSlotModelGamePlugin.RetriggerParser;
        scarabSlotModelGamePlugin.StripeParser = function(commonParser) {
            this.commonParser = commonParser;
        };
        scarabSlotModelGamePlugin.StripeParser.__name__ = ["scarabSlotModelGamePlugin", "StripeParser"];
        scarabSlotModelGamePlugin.StripeParser.prototype.commonParser = null;
        scarabSlotModelGamePlugin.StripeParser.prototype.defaultBaseGameStripe = null;
        scarabSlotModelGamePlugin.StripeParser.prototype.defaultFreeSpinStripe = null;
        scarabSlotModelGamePlugin.StripeParser.prototype.init = function(platformResponse) {
            var keyValuesPairInfo = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairInfo");
            if (keyValuesPairInfo != null) {
                var $it0 = _hcmn_.HxOverrides.iter(keyValuesPairInfo);
                while ($it0.hasNext()) {
                    var pair = $it0.next();
                    var name = slotmodelGamePluginCommonGle.StdHelper.getField(pair, "@name");
                    if (name == "BaseGame.Section") this.defaultBaseGameStripe = _hcmn_.Std.parseInt(scarabSlotModelGamePlugin.Helper.getDefaultValue(pair));
                }
            }
        };
        scarabSlotModelGamePlugin.StripeParser.prototype.parseNextSpinStripeLayers = function(response, slotDefinition) {
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var defaultBaseNextSpinStripeLayer = this.createIntArray(reelCount, this.defaultBaseGameStripe);
            var defaultFreeSpinNextSpinStripeLayer = this.createIntArray(reelCount, this.defaultFreeSpinStripe);
            var baseNextSpinStripeLayer = this.parseKeyValuePairNextSpinStripeLayers(response, slotDefinition, "BaseGame");
            var freeSpinNextSpinStripeLayer = this.parseKeyValuePairNextSpinStripeLayersFS(response, slotDefinition);
            return new scarabSlotModelGamePlugin.NextSpinStripeLayers(defaultBaseNextSpinStripeLayer, baseNextSpinStripeLayer, defaultFreeSpinNextSpinStripeLayer, freeSpinNextSpinStripeLayer);
        };
        scarabSlotModelGamePlugin.StripeParser.prototype.createIntArray = function(size, value) {
            if (size == 0) return null;
            var result = [];
            var i;
            var _g = 0;
            while (_g < size) {
                var i1 = _g++;
                result.push(value);
            }
            return result;
        };
        scarabSlotModelGamePlugin.StripeParser.prototype.parseKeyValuePairNextSpinStripeLayers = function(response, slotDefinition, stage) {
            var section = scarabSlotModelGamePlugin.Helper.parseKeyValuePairOutcome(response, stage + ".Section");
            if (section == null) return null;
            var sectionMappings = scarabSlotModelGamePlugin.Helper.getMapping(section);
            var result = new _hcmn_.haxe_ds_IntMap();
            if (sectionMappings == null) return null;
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var key;
            var $it0 = sectionMappings.keys();
            while ($it0.hasNext()) {
                var key1 = $it0.next();
                if (key1 != "default") {
                    var sectionId = _hcmn_.Std.parseInt(_hcmn_.__map_reserved[key1] != null ? sectionMappings.getReserved(key1) : sectionMappings.h[key1]);
                    var keyId = _hcmn_.Std.parseInt(key1);
                    var value = this.createIntArray(reelCount, sectionId);
                    result.h[keyId] = value;
                }
            }
            return result;
        };
        scarabSlotModelGamePlugin.StripeParser.prototype.parseKeyValuePairNextSpinStripeLayersFS = function(response, slotDefinition) {
            var reelSet = scarabSlotModelGamePlugin.Helper.parseTriggerOutcome(response);
            if (reelSet == null) return null;
            var sectionId = _hcmn_.Std.parseInt(scarabSlotModelGamePlugin.Helper.getTrigger(reelSet));
            var result = new _hcmn_.haxe_ds_IntMap();
            var reelCount = slotDefinition.reelPictureSize.reelCount;
            var value = this.createIntArray(reelCount, sectionId);
            result.h[1] = value;
            return result;
        };
        scarabSlotModelGamePlugin.StripeParser.parseKeyValuePairOutcome = function(platformResponse, string) {
            var KeyValuePairOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "KeyValuePairOutcome");
            var $it0 = _hcmn_.HxOverrides.iter(KeyValuePairOutcome);
            while ($it0.hasNext()) {
                var data = $it0.next();
                if (slotmodelGamePluginCommonGle.StdHelper.getField(data, "@name") == string) return data;
            }
            return null;
        };
        scarabSlotModelGamePlugin.StripeParser.prototype.__class__ = scarabSlotModelGamePlugin.StripeParser;
        scarabSlotModelGamePlugin.GamePlugin.GAME_ID = "${package}";;
        scarabSlotModelGamePlugin.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID = 9999;;
        scarabSlotModelGamePlugin.GamePlugin.WILD_REEL = "WildReel";;
        scarabSlotModelGamePlugin.GamePlugin.BASE_GAME_DEFAULT_STRIPE_LAYER = 4;;
        scarabSlotModelGamePlugin.GamePlugin.FREE_SPIN_DEFAULT_STRIPE_LAYER = 11;;
        scarabSlotModelGamePlugin.PfPluginResponseParser.WINNING_SYMBOL_INFO = 1;;
        scarabSlotModelGamePlugin.PfPluginResponseParser.DISABLED_WINNING_SYMBOL_INFO = 2;;
        scarabSlotModelGamePlugin.PfPluginResponseParser.REELPICTURE_SEPARATOR = ",";;
        return {
            exports: scarabSlotModelGamePlugin,
            activator: scarabSlotModelGamePlugin.ModuleActivator
        };
    });
//# sourceURL=scarabSlotModelGamePlugin.js