define("parser", ["money", "gameProtocolApi", "slotParserApi", "clientkernelModulesApi", "moneyApi"],
    function(money, gameProtocolApi, slotParserApi, clientkernelModulesApi, moneyApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        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 parser == 'undefined') {
            var parser = {};
        };
        parser.Activator = function() {};
        parser.Activator = ck_implements(parser.Activator, clientkernelModulesApi.IModuleActivator);
        parser.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        parser.Activator.__name__ = ["parser", "Activator"];
        parser.Activator.prototype.registration = null;
        parser.Activator.prototype.parser = null;
        parser.Activator.prototype.start = function(context) {
            var _g = this;
            haxe.Log.trace("parser Start", {
                fileName: "Activator.hx",
                lineNumber: 20,
                className: "slot.parser.Activator",
                methodName: "start"
            });
            _hcmn_.haxe_Timer.delay(function() {
                _g.parser = new parser.SlotParser();
                _g.registration = context.registerService(_g.parser, slotParserApi.ISlotParser, null);
            }, 0);
        };
        parser.Activator.prototype.stop = function(context) {
            if (this.registration != null) this.registration.unregister();
        };
        parser.Activator.main = function() {};
        parser.Activator.prototype.__class__ = parser.Activator;
        parser.ParserData = function() {};
        parser.ParserData.__name__ = ["parser", "ParserData"];
        parser.ParserData.initPayload = null;
        parser.ParserData.paytableResonse = null;
        parser.ParserData.currencyResponse = null;
        parser.ParserData.slotDefinition = null;
        parser.ParserData.riscControl = null;
        parser.ParserData.reelPictureSize = null;
        parser.ParserData.reelPictureSizePresentation = null;
        parser.ParserData.denomination = null;
        parser.ParserData.denominationString = null;
        parser.ParserData.defaultStake = null;
        parser.ParserData.prototype.__class__ = parser.ParserData;
        parser.SlotParser = function() {
            haxe.Log.trace("[SLOT_PARSER] Constructor", {
                fileName: "SlotParser.hx",
                lineNumber: 19,
                className: "slot.parser.SlotParser",
                methodName: "new"
            });
        };
        parser.SlotParser = ck_implements(parser.SlotParser, clientkernelModulesApi.IService);
        parser.SlotParser = ck_implements(parser.SlotParser, slotParserApi.ISlotParser);
        parser.SlotParser = ck_implements(parser.SlotParser, gameProtocolApi.IParserServices);
        parser.SlotParser.__interfaces__ = [clientkernelModulesApi.IService, slotParserApi.ISlotParser, gameProtocolApi.IParserServices];
        parser.SlotParser.__name__ = ["parser", "SlotParser"];
        parser.SlotParser.prototype.parseInitPayload = function(gameInitPayload, gameConfigJson) {
            parser.ParserData.initPayload = parser.InitParser.parse(gameInitPayload, gameConfigJson);
        };
        parser.SlotParser.prototype.parseSpinOutcome = function(gameLogicResponse) {
            var payload = parser.SpinOutcomeParser.parse(gameLogicResponse);
            return Promise.resolve(payload);
        };
        parser.SlotParser.prototype.parsePickerChoices = function(gameLogicResponse) {
            var pickerBonusInfo = parser.PickerParser.parsePickerBonusInfo(gameLogicResponse);
            return Promise.resolve(pickerBonusInfo.choices);
        };
        parser.SlotParser.prototype.getInitPayload = function() {
            return parser.ParserData.initPayload;
        };
        parser.SlotParser.prototype.getPaytableResponse = function() {
            return parser.ParserData.paytableResonse;
        };
        parser.SlotParser.prototype.getCurrencyResponse = function() {
            return parser.ParserData.currencyResponse;
        };
        parser.SlotParser.prototype.__class__ = parser.SlotParser;
        parser.CurrencyParser = function() {};
        parser.CurrencyParser.__name__ = ["parser", "CurrencyParser"];
        parser.CurrencyParser.parseCurrencyFormat = function(currencyResponse) {
            var currencyFormat = new moneyApi.CurrencyFormat(_hcmn_.Reflect.getProperty(currencyResponse, "@currencyCode"), _hcmn_.Reflect.getProperty(currencyResponse, "MAJOR_SYMBOL"), _hcmn_.Reflect.getProperty(currencyResponse, "MINOR_SYMBOL"), _hcmn_.Reflect.getProperty(currencyResponse, "MAJOR_SYMBOL_ALIGNMENT") == "left", _hcmn_.Reflect.getProperty(currencyResponse, "MINOR_SYMBOL_ALIGNMENT") == "left", _hcmn_.Reflect.getProperty(currencyResponse, "MAJOR_SYMBOL_PADDING_SPACE") == "true", _hcmn_.Reflect.getProperty(currencyResponse, "MINOR_SYMBOL_PADDING_SPACE") == "true", _hcmn_.Reflect.getProperty(currencyResponse, "DECIMAL_SEPARATOR"), _hcmn_.Reflect.getProperty(currencyResponse, "THOUSANDS_SEPARATOR"), _hcmn_.Std.parseInt(_hcmn_.Reflect.getProperty(currencyResponse, "DECIMAL_PRECISION")), _hcmn_.Reflect.getProperty(currencyResponse, "USE_THOUSANDS_SEPARATOR") == "yes", _hcmn_.Reflect.getProperty(currencyResponse, "MINOR_CURRENCY_LOCK") == "yes", _hcmn_.Reflect.getProperty(currencyResponse, "CHIP_SET_CODE"));
            return currencyFormat;
        };
        parser.CurrencyParser.prototype.__class__ = parser.CurrencyParser;
        parser.InitParser = function() {};
        parser.InitParser.__name__ = ["parser", "InitParser"];
        parser.InitParser.parse = function(gameInitPayload, gameConfigJson) {
            haxe.Log.trace("[SLOT_PARSER] InitParser.parse", {
                fileName: "InitParser.hx",
                lineNumber: 19,
                className: "slot.parser.init.InitParser",
                methodName: "parse"
            });
            var currencyResponse = parser.Extender.getField(gameInitPayload, "CurrencyResponse");
            var initGameLogicResponse = parser.Extender.getField(gameInitPayload, "GameLogicResponse");
            var paytableResponse = parser.Extender.getField(gameInitPayload, "PaytableResponse");
            var rgPresentation = parser.Extender.getField(gameInitPayload, "rgPresentation");
            parser.ParserData.paytableResonse = paytableResponse;
            parser.ParserData.currencyResponse = currencyResponse;
            var riscControl = parser.RiscControlParser.parse(paytableResponse, currencyResponse, initGameLogicResponse, rgPresentation);
            var defaultStake = parser.InitParser.parseDefaultStake(initGameLogicResponse);
            parser.ParserData.defaultStake = defaultStake;
            parser.ParserData.riscControl = parser.RiscControlParser.setTotalBets(riscControl);
            var slotDefinition = parser.SlotDefinitionParser.parse(gameConfigJson, paytableResponse, initGameLogicResponse);
            parser.ParserData.slotDefinition = slotDefinition;
            parser.BigWinParser.init(gameConfigJson);
            var consoleSettings = null;
            var spinOutcome = parser.SpinOutcomeParser.parse(initGameLogicResponse);
            var out = new slotParserApi.InitPayload(riscControl, slotDefinition, consoleSettings, defaultStake, spinOutcome);
            return out;
        };
        parser.InitParser.parseDefaultStake = function(platformResponse) {
            var numberOfLines = parser.Extender.toInt(parser.Extender.getField(parser.Extender.getField(platformResponse, "ResumeWagerOutcome"), "Lines"));
            if (numberOfLines == null) numberOfLines = parser.Extender.toInt(parser.Extender.getField(parser.Extender.getField(platformResponse, "PatternSliderInput"), "PatternsBet"));
            var betPerLineInt = parser.Extender.toInt(parser.Extender.getField(parser.Extender.getField(platformResponse, "PatternSliderInput"), "BetPerPattern"));
            var betPerLine = parser.ParserData.denomination.mulInt(betPerLineInt).value;
            var sideBet = parser.Extender.toInt(parser.Extender.getField(parser.Extender.getField(platformResponse, "ResumeWagerOutcome"), "SideBet"));
            if (sideBet == null) sideBet = 0;
            var totalBet = parser.InitParser.getTotalBet(numberOfLines, betPerLine, sideBet);
            var stakeItem = new slotParserApi.StakeItem(numberOfLines, betPerLine, totalBet, sideBet);
            return stakeItem;
        };
        parser.InitParser.getTotalBet = function(lineCount, betPerLine, sideBet) {
            var bpl = new money.Money(betPerLine);
            return bpl.mulInt(lineCount).add(parser.ParserData.denomination.mulInt(sideBet)).value;
        };
        parser.InitParser.prototype.__class__ = parser.InitParser;
        parser.ReelParser = function() {};
        parser.ReelParser.__name__ = ["parser", "ReelParser"];
        parser.ReelParser.parseReels = function(stripeLayersMap, paytableResponse) {
            var stripeLayers = parser.Extender.getFieldAsArray(paytableResponse, "StripInfo");
            var stripeMap = new _hcmn_.haxe_ds_IntMap();
            var stripeLayerJson;
            var _g = 0;
            while (_g < stripeLayers.length) {
                var stripeLayerJson1 = stripeLayers[_g];
                ++_g;
                var stripeName = parser.Extender.getField(stripeLayerJson1, "@name");
                var stripeId = _hcmn_.Std.parseInt(stripeName);
                if (stripeId == null) stripeId = _hcmn_.__map_reserved[stripeName] != null ? stripeLayersMap.getReserved(stripeName) : stripeLayersMap.h[stripeName];
                var strips = parser.Extender.getFieldAsArray(stripeLayerJson1, "Strip");
                var _g1 = 0;
                while (_g1 < strips.length) {
                    var strip = strips[_g1];
                    ++_g1;
                    var reelName = parser.Extender.getField(strip, "@name");
                    var reelId = _hcmn_.Std.parseInt(reelName.split("Reel")[1]);
                    var stop = parser.Extender.getFieldAsArray(strip, "Stop");
                    var symbols = [];
                    var _g2 = 0;
                    while (_g2 < stop.length) {
                        var symbolJson = stop[_g2];
                        ++_g2;
                        symbols.push(parser.Extender.getField(symbolJson, "@symbolID"));
                    }
                    if (reelId != null) {
                        if (!stripeMap.h.hasOwnProperty(reelId)) {
                            var value = [];
                            stripeMap.h[reelId] = value;
                        }
                        stripeMap.h[reelId].push(new slotParserApi.Stripe(stripeId, symbols));
                    }
                }
            }
            var reels = [];
            var $it0 = stripeMap.keys();
            while ($it0.hasNext()) {
                var reelId1 = $it0.next();
                var reel = new slotParserApi.Reel(reelId1, stripeMap.h[reelId1]);
                reels.push(reel);
            }
            return reels;
        };
        parser.ReelParser.parseStripeLayersMap = function(paytableResponse) {
            var reelSetKeyValue = parser.Extender.find(parser.Extender.getFieldAsArray(paytableResponse, "KeyValuePairInfo"), "@name", "ReelSetKeyValuePair");
            if (reelSetKeyValue == null) {
                window.console.warn("ReelSetKeyValuePair = null!, Generating map from StripInfo");
                var out = new _hcmn_.haxe_ds_StringMap();
                var counter = 0;
                var stripInfo = parser.Extender.getFieldAsArray(paytableResponse, "StripInfo");
                var _g = 0;
                while (_g < stripInfo.length) {
                    var strip = stripInfo[_g];
                    ++_g;
                    var name = parser.Extender.getField(strip, "@name");
                    if (!(_hcmn_.__map_reserved[name] != null ? out.existsReserved(name) : out.h.hasOwnProperty(name))) {
                        var value = counter++;
                        if (_hcmn_.__map_reserved[name] != null) out.setReserved(name, value);
                        else out.h[name] = value;
                    }
                }
                haxe.Log.trace("stripLayresMap = " + out.toString(), {
                    fileName: "ReelParser.hx",
                    lineNumber: 74,
                    className: "slot.parser.init.ReelParser",
                    methodName: "parseStripeLayersMap"
                });
                return out;
            } else return parser.Helper.getKeyValueMapping_String_Int(reelSetKeyValue);
        };
        parser.ReelParser.prototype.__class__ = parser.ReelParser;
        parser.RiscControlParser = function() {};
        parser.RiscControlParser.__name__ = ["parser", "RiscControlParser"];
        parser.RiscControlParser.parse = function(paytableResponse, currencyResponse, initGameLogicResponse, rgPresentation) {
            var denominationObj = parser.Extender.getField(parser.Extender.getField(paytableResponse, "DenominationList"), "Denomination");
            var softwareId = parser.Extender.getField(denominationObj, "@softwareId");
            var denomination = parser.Extender.getField(denominationObj, "#text");
            parser.ParserData.denominationString = denomination;
            parser.ParserData.denomination = new money.Money(denomination);
            var currencyFormat = parser.CurrencyParser.parseCurrencyFormat(currencyResponse);
            var awardCap = parser.Extender.getField(parser.Extender.getField(parser.Extender.getField(paytableResponse, "AwardCapInfo"), "CurrencyCap"), "AwardCap");
            var betMultiplierSteps = [];
            var betPerLineArray = [];
            var betPerLineMap = new _hcmn_.haxe_ds_StringMap();
            parser.RiscControlParser.parseBetPerLine(paytableResponse, betMultiplierSteps, betPerLineArray, betPerLineMap);
            var lineSteps = parser.RiscControlParser.parseLineSteps(paytableResponse);
            var sideBetSteps = parser.RiscControlParser.parseSideBetSteps(paytableResponse);
            var out = new slotParserApi.RiskControlSettings(softwareId, currencyFormat, awardCap, denomination, betMultiplierSteps, betPerLineArray, betPerLineMap, lineSteps, sideBetSteps, null, null, rgPresentation);
            return out;
        };
        parser.RiscControlParser.setTotalBets = function(riscControl) {
            var totalBetsForSelectedLines = parser.TotalBets.getForSelectedLines(riscControl.betPerLineArray);
            var totalBetsForSelectedBetPerLine = parser.TotalBets.getForSelectedBetPerLine(riscControl.lineSteps);
            riscControl.totalBetsForSelectedLines = totalBetsForSelectedLines;
            riscControl.totalBetsForSelectedBetPerLine = totalBetsForSelectedBetPerLine;
            return riscControl;
        };
        parser.RiscControlParser.parseBetPerLine = function(paytableResponse, betMultiplierSteps, betPerLineArray, betPerLineMap) {
            var steps = parser.Extender.getFieldAsArray(parser.Extender.getField(parser.Extender.getField(paytableResponse, "PatternSliderInfo"), "BetInfo"), "Step");
            var _g = 0;
            while (_g < steps.length) {
                var step = steps[_g];
                ++_g;
                var betPerLineInt = _hcmn_.Std.parseInt(step);
                var betPerLine = parser.ParserData.denomination.mulInt(betPerLineInt).value;
                betMultiplierSteps.push(betPerLineInt);
                betPerLineArray.push(betPerLine);
                if (_hcmn_.__map_reserved[betPerLine] != null) betPerLineMap.setReserved(betPerLine, betPerLineInt);
                else betPerLineMap.h[betPerLine] = betPerLineInt;
            }
        };
        parser.RiscControlParser.parseLineSteps = function(paytableResponse) {
            return parser.Extender.toIntArray(parser.Extender.getFieldAsArray(parser.Extender.getField(parser.Extender.getField(paytableResponse, "PatternSliderInfo"), "PatternInfo"), "Step"));
        };
        parser.RiscControlParser.parseSideBetSteps = function(paytableResponse) {
            return parser.Extender.toIntArray(parser.Extender.getFieldAsArray(parser.Extender.getField(parser.Extender.getField(paytableResponse, "PatternInfo"), "SelectableSideBetInfo"), "Step"));
        };
        parser.RiscControlParser.prototype.__class__ = parser.RiscControlParser;
        parser.SlotDefinitionParser = function() {};
        parser.SlotDefinitionParser.__name__ = ["parser", "SlotDefinitionParser"];
        parser.SlotDefinitionParser.parse = function(slotDefinitionJson, paytableResponse, gameLogicResponse) {
            var rtp = parser.SlotDefinitionParser.parseRtp(paytableResponse);
            var reelPictureSize = parser.ReelPictureParser.parseReelPictureSize(gameLogicResponse, "BaseGame.Reels");
            var reelPictureSizePresentation = parser.ReelPictureParser.parseReelPictureSize(gameLogicResponse, "BaseGame.Presentation");
            if (reelPictureSizePresentation == null) reelPictureSizePresentation = reelPictureSize;
            parser.ParserData.reelPictureSize = reelPictureSize;
            parser.ParserData.reelPictureSizePresentation = reelPictureSizePresentation;
            var reelPictureVisibility = new slotParserApi.ReelPictureInfo(parser.Helper.createIntMatrix(reelPictureSize, slotParserApi.ReelPictureSymbols.UNIT_SYMBOL));
            var reelPictureVisibilityPresentation = new slotParserApi.ReelPictureInfo(parser.Helper.createIntMatrix(reelPictureSizePresentation, slotParserApi.ReelPictureSymbols.UNIT_SYMBOL));
            var symbols = parser.SlotDefinitionParser.getSymbols(slotDefinitionJson.symbols);
            var stripeLayersMap = parser.ReelParser.parseStripeLayersMap(paytableResponse);
            var reels = parser.ReelParser.parseReels(stripeLayersMap, paytableResponse);
            var lines = parser.SlotDefinitionParser.parsePayLines(paytableResponse);
            var startReelPicture = parser.ReelPictureParser.parse(gameLogicResponse, "BaseGame.Reels", reelPictureSize);
            var startReelPicturePresentation = parser.ReelPictureParser.parse(gameLogicResponse, "BaseGame.Presentation", reelPictureSizePresentation);
            if (startReelPicturePresentation == null) startReelPicturePresentation = startReelPicture;
            var startReelPicturePerBet = null;
            var startFSReelPicture = parser.ReelPictureParser.parse(gameLogicResponse, "FreeSpin.Reels", reelPictureSize);
            var startFSReelPicturePresentation = parser.ReelPictureParser.parse(gameLogicResponse, "FreeSpin.Presentation", reelPictureSizePresentation);
            if (startFSReelPicturePresentation == null) startFSReelPicturePresentation = startFSReelPicture;
            var startFSReelPicturePerBet = null;
            var autoSpins = parser.SlotDefinitionParser.parseAutospins(paytableResponse);
            var outcomes = parser.SlotDefinitionParser.parsePaytableOutcomes(paytableResponse);
            return new slotParserApi.SlotDefinitionSettings(rtp, reelPictureSize, reelPictureSizePresentation, reelPictureVisibility, reelPictureVisibilityPresentation, symbols, reels, lines, startReelPicture, startReelPicturePresentation, startReelPicturePerBet, startFSReelPicture, startReelPicturePresentation, startFSReelPicturePerBet, autoSpins, outcomes, stripeLayersMap);
        };
        parser.SlotDefinitionParser.getSymbols = function(symbols) {
            var out = [];
            var _g = 0;
            while (_g < symbols.length) {
                var s = symbols[_g];
                ++_g;
                var symbol = new slotParserApi.Symbol(parser.Extender.getField(s, "id"), parser.Extender.getField(s, "description"), parser.Extender.getBoolValue(parser.Extender.getField(s, "isWild")), parser.Extender.getBoolValue(parser.Extender.getField(s, "isBonus")), parser.Extender.getBoolValue(parser.Extender.getField(s, "isScatter")), parser.Extender.getBoolValue(parser.Extender.getField(s, "hasLandingAnimation")), parser.Extender.getBoolValue(parser.Extender.getField(s, "isBleed")), parser.Extender.getField(s, "block"), parser.Extender.getField(s, "asset"));
                out.push(symbol);
            }
            return out;
        };
        parser.SlotDefinitionParser.parseAutospins = function(paytableResponse) {
            var enabled = false;
            var steps = [];
            var autospinInfo = parser.Extender.getField(paytableResponse, "AutoSpinInfo");
            if (autospinInfo != null) {
                enabled = parser.Extender.getBoolValue(parser.Extender.getField(autospinInfo, "@enable"));
                var _g = 0;
                var _g1 = parser.Extender.getFieldAsArray(autospinInfo, "Step");
                while (_g < _g1.length) {
                    var step = _g1[_g];
                    ++_g;
                    steps.push(_hcmn_.Std.parseInt(step));
                }
            }
            return new slotParserApi.AutoSpinDefinition(enabled, steps);
        };
        parser.SlotDefinitionParser.parseRtp = function(paytableResponse) {
            var paytableStatistics = parser.Extender.getField(paytableResponse, "PaytableStatistics");
            if (paytableStatistics == null) return null;
            var minRTP = parser.Extender.getField(paytableStatistics, "@minRTP");
            var maxRTP = parser.Extender.getField(paytableStatistics, "@maxRTP");
            var singleRTP = parser.Extender.getBoolValue(parser.Extender.getField(paytableStatistics, "@singleRTP"));
            var maxSingleRTP = parser.Extender.getField(paytableStatistics, "@maxSingleRTP");
            var minSingleRTP = parser.Extender.getField(paytableStatistics, "@minSingleRTP");
            return new slotParserApi.Rtp(minRTP, maxRTP, singleRTP, minSingleRTP, maxSingleRTP);
        };
        parser.SlotDefinitionParser.parsePayLines = function(paytableResponse) {
            var lines = [];
            var patterns = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(paytableResponse, "PatternInfo"), "@name", "Paylines"), "Pattern");
            if (patterns.length == 0) return null;
            var _g = 0;
            while (_g < patterns.length) {
                var pattern = patterns[_g];
                ++_g;
                var namePattern = parser.Extender.getField(pattern, "@name");
                var lineId = _hcmn_.Std.parseInt(namePattern.split("Line ")[1]);
                var offsets = [];
                var cells = parser.Extender.getFieldAsArray(pattern, "Cell");
                var _g1 = 0;
                while (_g1 < cells.length) {
                    var cell = cells[_g1];
                    ++_g1;
                    var position = parser.Extender.getField(cell, "@name");
                    var reelIndex = _hcmn_.Std.parseInt(position.split("C")[1].split("R")[1]);
                    offsets.push(reelIndex);
                }
                var line = new slotParserApi.Line(lineId, offsets);
                lines.push(line);
            }
            return lines;
        };
        parser.SlotDefinitionParser.parsePaytableOutcomes = function(paytableResponse) {
            var prizes = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(paytableResponse, "PrizeInfo"), "@name", "PrizeInfoLines"), "Prize");
            if (parser.Extender.isEmpty(prizes)) return null;
            var out = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            while (_g < prizes.length) {
                var prize = prizes[_g];
                ++_g;
                var symbol = parser.Extender.getField(prize, "@name");
                var pays = parser.Extender.getFieldAsArray(prize, "PrizePay");
                var _g1 = 0;
                while (_g1 < pays.length) {
                    var prizePay = pays[_g1];
                    ++_g1;
                    var count = parser.Extender.getField(prizePay, "@count");
                    var id = symbol + "x" + count;
                    var value = parser.Extender.getField(prizePay, "@value");
                    if (_hcmn_.__map_reserved[id] != null) out.setReserved(id, value);
                    else out.h[id] = value;
                }
            }
            return out;
        };
        parser.SlotDefinitionParser.prototype.__class__ = parser.SlotDefinitionParser;
        parser.TotalBets = function() {};
        parser.TotalBets.__name__ = ["parser", "TotalBets"];
        parser.TotalBets.getForSelectedLines = function(betPerLineArray) {
            var totalBetSelectedLines = [];
            var _g = 0;
            while (_g < betPerLineArray.length) {
                var betPerLine = betPerLineArray[_g];
                ++_g;
                var bpl = new money.Money(betPerLine);
                var totalBet = bpl.mulInt(parser.ParserData.defaultStake.numberOfLines + parser.ParserData.defaultStake.sideBet).value;
                var totalBetSL = [];
                totalBetSL[0] = totalBet;
                totalBetSL[1] = betPerLine;
                totalBetSelectedLines.push(totalBetSL);
            }
            return totalBetSelectedLines;
        };
        parser.TotalBets.getForSelectedBetPerLine = function(selectableLinesStep) {
            var totalBetSelectedBPL = [];
            var betPerLine = new money.Money(parser.ParserData.defaultStake.betPerLine);
            var _g = 0;
            while (_g < selectableLinesStep.length) {
                var selectableLineCount = selectableLinesStep[_g];
                ++_g;
                var totalBet = betPerLine.mulInt(selectableLineCount + parser.ParserData.defaultStake.sideBet).value;
                var totalBetSBPL = [];
                totalBetSBPL[0] = totalBet;
                totalBetSBPL[1] = selectableLineCount;
                totalBetSelectedBPL.push(totalBetSBPL);
            }
            return totalBetSelectedBPL;
        };
        parser.TotalBets.prototype.__class__ = parser.TotalBets;
        parser.BaseGameParser = function() {};
        parser.BaseGameParser.__name__ = ["parser", "BaseGameParser"];
        parser.BaseGameParser.parse = function(gameLogicResponse) {
            var reelPicture = parser.ReelPictureParser.parse(gameLogicResponse, "BaseGame.Reels", parser.ParserData.reelPictureSize);
            var reelPicturePresentation = parser.ReelPictureParser.parse(gameLogicResponse, "BaseGame.Presentation", parser.ParserData.reelPictureSizePresentation);
            if (reelPicturePresentation == null) reelPicturePresentation = reelPicture;
            var reelPictureAdditional = parser.ReelPictureParser.parse(gameLogicResponse, "BaseGame.AdditionalReels", parser.ParserData.reelPictureSize);
            var awardCapExceeded = parser.Extender.getBoolValue(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "AwardCapOutcome"), "AwardCapExceeded"));
            var stake = parser.BaseGameParser.parseStake(gameLogicResponse);
            var lineWin = parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "BaseGame.Lines");
            var multiWayWin = parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "BaseGame.MultiWay");
            var lineWins = [];
            var win = 0;
            if (lineWin != null) {
                lineWins = parser.LineWinParser.parse(gameLogicResponse, "BaseGame.Lines");
                win = parser.Extender.toInt(parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "BaseGame.Lines"), "@totalPay"));
            } else if (multiWayWin != null) {
                lineWins = parser.MultiWayWinParser.parse(gameLogicResponse, "BaseGame.MultiWay");
                win = parser.Extender.toInt(parser.Extender.getField(parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "BaseGame.MultiWay"), "@totalPay"));
            }
            var scatterWins = parser.ScatterWinParser.parse(gameLogicResponse, "BaseGame.Scatter");
            var bigWin = parser.BigWinParser.getBigWin(stake, win, awardCapExceeded);
            var totalPayout = parser.ParserData.denomination.mulInt(win).value;
            if (awardCapExceeded) totalPayout = parser.ParserData.riscControl.awardCap;
            var bonusWins = null;
            var customField = parser.Extender.getField(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "LadderOutcome"), "Ladder"), "#text");
            haxe.Log.trace("[dex] customField", {
                fileName: "BaseGameParser.hx",
                lineNumber: 63,
                className: "slot.parser.outcome.BaseGameParser",
                methodName: "parse",
                customParams: [customField]
            });
            var pickerWins = null;
            var outcome = new slotParserApi.Outcome(reelPicture, reelPicturePresentation, reelPictureAdditional, lineWins, scatterWins, bonusWins, pickerWins, totalPayout, bigWin, customField);
            return new slotParserApi.BaseGameOutcome(outcome);
        };
        parser.BaseGameParser.parseStake = function(gameLogicResponse) {
            var betPerPattern = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "BetPerPattern");
            var patternsBet = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "PatternsBet");
            return betPerPattern * patternsBet;
        };
        parser.BaseGameParser.prototype.__class__ = parser.BaseGameParser;
        parser.BigWinParser = function() {};
        parser.BigWinParser.__name__ = ["parser", "BigWinParser"];
        parser.BigWinParser.bigWinGroupPoints = null;
        parser.BigWinParser.init = function(gameConfigJson) {
            parser.BigWinParser.bigWinGroupPoints = parser.BigWinParser.parseBigWinGroupPoints(gameConfigJson);
            if (parser.BigWinParser.bigWinGroupPoints == null) parser.BigWinParser.bigWinGroupPoints = parser.BigWinParser.DEFAULT_BIG_WIN_GROUP_POINTS;
        };
        parser.BigWinParser.parseBigWinGroupPoints = function(gameConfigJson) {
            if (gameConfigJson == null) return null;
            var bigWinGroupPointsArray = parser.Extender.getFieldAsArray(gameConfigJson, parser.BigWinParser.BIG_WIN_GROUP_POINTS_STRING);
            if (bigWinGroupPointsArray == null) return null;
            var bigWinGroupPoints = [];
            var bigWinGroupPointsItem;
            var _g = 0;
            while (_g < bigWinGroupPointsArray.length) {
                var bigWinGroupPointsItem1 = bigWinGroupPointsArray[_g];
                ++_g;
                bigWinGroupPoints.push(bigWinGroupPointsItem1);
            }
            return bigWinGroupPoints;
        };
        parser.BigWinParser.getBigWin = function(stakeCredit, winCredit, awardCapExceeded) {
            var denomination = parser.ParserData.denomination;
            if (stakeCredit == null || stakeCredit == 0 || winCredit == null) return null;
            var winSegments = parser.BigWinParser.getWinSegments(stakeCredit, winCredit, denomination, awardCapExceeded);
            var winGroup = 0;
            if (winSegments != null && winSegments.length > 0) winGroup = winSegments[winSegments.length - 1].winGroup;
            return new slotParserApi.BigWin(winGroup, winSegments, null);
        };
        parser.BigWinParser.getWinSegments = function(stakeCredit, winCredit, denomination, awardCapExceeded) {
            if (winCredit == 0) return [new slotParserApi.BigWinSegment(0, denomination.mulInt(winCredit).value)];
            var segmentWinCredit = denomination.mulInt(winCredit).value;
            if (awardCapExceeded) segmentWinCredit = parser.ParserData.riscControl.awardCap;
            var bigWinGroupPoints = parser.BigWinParser.bigWinGroupPoints;
            if (bigWinGroupPoints == null || parser.Extender.isEmpty(bigWinGroupPoints)) return [new slotParserApi.BigWinSegment(0, segmentWinCredit)];
            var stake = denomination.mulInt(stakeCredit);
            var winMultiplier = winCredit / stakeCredit;
            var bigWinSegments = new _hcmn_.haxe_ds_IntMap();
            var i;
            var _g1 = 0;
            var _g = bigWinGroupPoints.length;
            while (_g1 < _g) {
                var i1 = _g1++;
                var point = bigWinGroupPoints[i1];
                if (point[0] > -1 && winMultiplier > point[0]) {
                    if (point[1] == -1 || stakeCredit < point[1]) {
                        var groupWin = stake.mul(new money.Money(_hcmn_.Std.string(point[0])));
                        var key1 = _hcmn_.Std.parseInt(_hcmn_.Std.string(point[2]));
                        bigWinSegments.h[key1] = groupWin.value;
                    }
                    continue;
                }
                if (point[1] > -1 && stakeCredit >= point[1]) continue;
                var key2 = _hcmn_.Std.parseInt(_hcmn_.Std.string(point[2]));
                bigWinSegments.h[key2] = segmentWinCredit;
                break;
            }
            var result = [];
            var key;
            var $it0 = bigWinSegments.keys();
            while ($it0.hasNext()) {
                var key3 = $it0.next();
                result.push(new slotParserApi.BigWinSegment(key3, bigWinSegments.h[key3]));
            }
            return result;
        };
        parser.BigWinParser.prototype.__class__ = parser.BigWinParser;
        parser.FreeSpinParser = function() {};
        parser.FreeSpinParser.__name__ = ["parser", "FreeSpinParser"];
        parser.FreeSpinParser.parse = function(gameLogicResponse) {
            var fsData = parser.Extender.getField(gameLogicResponse, "FreeSpinOutcome");
            if (fsData == null) return null;
            var reelPicture = parser.ReelPictureParser.parse(gameLogicResponse, "FreeSpin.Reels", parser.ParserData.reelPictureSize);
            var reelPicturePresentation = parser.ReelPictureParser.parse(gameLogicResponse, "FreeSpin.Presentation", parser.ParserData.reelPictureSizePresentation);
            if (reelPicturePresentation == null) reelPicturePresentation = reelPicture;
            var reelPictureAdditional = parser.ReelPictureParser.parse(gameLogicResponse, "FreeSpin.AdditionalReels", parser.ParserData.reelPictureSize);
            var awardCapExceeded = parser.Extender.getBoolValue(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "AwardCapOutcome"), "AwardCapExceeded"));
            var stake = parser.FreeSpinParser.parseStake(gameLogicResponse);
            var lineWin = parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "FreeSpin.Lines");
            var multiWayWin = parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "FreeSpin.MultiWay");
            var lineWins = [];
            var win = 0;
            if (lineWin != null) {
                lineWins = parser.LineWinParser.parse(gameLogicResponse, "FreeSpin.Lines");
                win = parser.Extender.toInt(parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "FreeSpin.Lines"), "@totalPay"));
            } else if (multiWayWin != null) {
                lineWins = parser.MultiWayWinParser.parse(gameLogicResponse, "FreeSpin.MultiWay");
                win = parser.Extender.toInt(parser.Extender.getField(parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "FreeSpin.MultiWay"), "@totalPay"));
            }
            var scatterWins = parser.ScatterWinParser.parse(gameLogicResponse, "FreeSpin.Scatter");
            var bigWin = parser.BigWinParser.getBigWin(stake, win, awardCapExceeded);
            var totalPayout = parser.ParserData.denomination.mulInt(win).value;
            if (awardCapExceeded) totalPayout = parser.ParserData.riscControl.awardCap;
            var bonusWins = null;
            var customField = parser.Extender.getField(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "LadderOutcome"), "Ladder"), "#text");
            var pickerWins = null;
            var outcome = new slotParserApi.Outcome(reelPicture, reelPicturePresentation, reelPictureAdditional, lineWins, scatterWins, bonusWins, pickerWins, totalPayout, bigWin, customField);
            var awarded = parser.Extender.toInt(parser.Extender.getField(fsData, "Awarded"));
            var isMaxAwarded = parser.Extender.getField(fsData, "MaxAwarded") == "true";
            var isIncrementTriggered = parser.Extender.getField(fsData, "IncrementTriggered") == "true";
            var total = parser.Extender.toInt(parser.Extender.getField(fsData, "TotalAwarded"));
            var current = parser.Extender.toInt(parser.Extender.getField(fsData, "Count"));
            return new slotParserApi.FreeSpinOutcome(awarded, isMaxAwarded, isIncrementTriggered, total, current, outcome);
        };
        parser.FreeSpinParser.parseStake = function(gameLogicResponse) {
            var betPerPattern = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "BetPerPattern");
            var patternsBet = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "PatternsBet");
            return betPerPattern * patternsBet;
        };
        parser.FreeSpinParser.prototype.__class__ = parser.FreeSpinParser;
        parser.LineWinParser = function() {};
        parser.LineWinParser.__name__ = ["parser", "LineWinParser"];
        parser.LineWinParser.parse = function(gameLogicResponse, fieldName) {
            var prizes = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", fieldName), "Prize");
            if (parser.Extender.isEmpty(prizes)) return null;
            var lines = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "HighlightOutcome"), "@name", fieldName), "Highlight");
            var wins = [];
            var _g = 0;
            while (_g < prizes.length) {
                var prize = prizes[_g];
                ++_g;
                var name = parser.Extender.getField(prize, "@name");
                var line = parser.Extender.find(lines, "@name", name);
                wins.push(parser.LineWinParser.createLineWin(prize, line));
            }
            return wins;
        };
        parser.LineWinParser.createLineWin = function(prize, line) {
            var id = parser.Extender.getField(prize, "@name");
            var lineID = _hcmn_.Std.parseInt(id.split("Line ")[1]);
            var linePath = parser.LineWinParser.getLinePath(lineID);
            var cells = parser.Extender.getFieldAsArray(line, "Cell");
            var reelPictureInfo = parser.LineWinParser.createReelPictureInfo(linePath, cells);
            var name = parser.Extender.getField(prize, "@payName");
            var winningSymbol = name.split(" ")[1];
            var pay = parser.Extender.getField(prize, "@pay");
            var multiplier = parser.Extender.toInt(parser.Extender.getField(prize, "@multiplier"));
            var totalPay = parser.ParserData.denomination.mulInt(parser.Extender.getField(prize, "@totalPay")).value;
            var symbolCount = parser.Extender.toInt(parser.Extender.getField(prize, "@symbolCount"));
            var win = new slotParserApi.LineWin(name, lineID, pay, multiplier, totalPay, reelPictureInfo, winningSymbol, symbolCount, parser.LineWinParser.LINE_TYPE);
            return win;
        };
        parser.LineWinParser.getLinePath = function(lineID) {
            var reelPictureSize = parser.ParserData.reelPictureSize;
            var line = parser.ParserData.slotDefinition.getLine(lineID);
            if (line != null) return line.getLinePath(reelPictureSize);
            else return parser.Helper.createBoolMatrix(reelPictureSize, false);
        };
        parser.LineWinParser.createReelPictureInfo = function(linePath, cells) {
            var matrix = parser.Helper.createIntMatrix(parser.ParserData.reelPictureSize, slotParserApi.ReelPictureSymbols.ZERO_SYMBOL);
            var _g1 = 0;
            var _g = matrix.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = matrix[0].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    if (linePath[i][j]) matrix[i][j] = slotParserApi.ReelPictureSymbols.DISABLED_WINNING_SYMBOL;
                }
                var _g21 = 0;
                while (_g21 < cells.length) {
                    var cell = cells[_g21];
                    ++_g21;
                    var position = parser.Helper.parsePosition(parser.Extender.getField(cell, "@name"));
                    matrix[position.x][position.y] = slotParserApi.ReelPictureSymbols.ENABLE_WINNING_SYMBOL;
                }
            }
            return new slotParserApi.ReelPictureInfo(matrix);
        };
        parser.LineWinParser.prototype.__class__ = parser.LineWinParser;
        parser.MultiWayWinParser = function() {};
        parser.MultiWayWinParser.__name__ = ["parser", "MultiWayWinParser"];
        parser.MultiWayWinParser.parse = function(gameLogicResponse, fieldName) {
            var prizes = parser.Extender.getFieldAsArray(parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", fieldName), "Prize");
            if (parser.Extender.isEmpty(prizes)) return null;
            var lines = parser.Extender.getFieldAsArray(parser.Extender.contains(parser.Extender.getFieldAsArray(gameLogicResponse, "HighlightOutcome"), "@name", fieldName), "Highlight");
            var wins = [];
            var _g = 0;
            while (_g < prizes.length) {
                var prize = prizes[_g];
                ++_g;
                var name = parser.Extender.getField(prize, "@name");
                var line = parser.Extender.find(lines, "@name", name);
                wins.push(parser.MultiWayWinParser.createLineWin(prize, line));
            }
            return wins;
        };
        parser.MultiWayWinParser.createLineWin = function(prize, line) {
            var id = parser.Extender.getField(prize, "@name");
            var lineID = _hcmn_.Std.parseInt(id.split(" ")[0]);
            var cells = parser.Extender.getFieldAsArray(line, "Cell");
            var reelPictureInfo = parser.MultiWayWinParser.createReelPictureInfo(cells);
            var name = parser.Extender.getField(prize, "@payName");
            var winningSymbol = name.split(" ")[1];
            var pay = parser.Extender.getField(prize, "@pay");
            var multiplier = parser.Extender.toInt(parser.Extender.getField(prize, "@multiplier"));
            var totalPay = parser.ParserData.denomination.mulInt(parser.Extender.getField(prize, "@totalPay")).value;
            var symbolCount = parser.Extender.toInt(parser.Extender.getField(prize, "@symbolCount"));
            var win = new slotParserApi.LineWin(name, lineID, pay, multiplier, totalPay, reelPictureInfo, winningSymbol, symbolCount);
            return win;
        };
        parser.MultiWayWinParser.createReelPictureInfo = function(cells) {
            var matrix = parser.Helper.createIntMatrix(parser.ParserData.reelPictureSize, slotParserApi.ReelPictureSymbols.ZERO_SYMBOL);
            var _g1 = 0;
            var _g = matrix.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g2 = 0;
                while (_g2 < cells.length) {
                    var cell = cells[_g2];
                    ++_g2;
                    var position = parser.Helper.parsePosition(parser.Extender.getField(cell, "@name"));
                    matrix[position.x][position.y] = slotParserApi.ReelPictureSymbols.ENABLE_WINNING_SYMBOL;
                }
            }
            return new slotParserApi.ReelPictureInfo(matrix);
        };
        parser.MultiWayWinParser.prototype.__class__ = parser.MultiWayWinParser;
        parser.PickerParser = function() {};
        parser.PickerParser.__name__ = ["parser", "PickerParser"];
        parser.PickerParser.parse = function(gameLogicResponse) {
            var pickerBonusInfo = parser.PickerParser.parsePickerBonusInfo(gameLogicResponse);
            var outcome = parser.PickerParser.parsePickerBonusOutcomes(gameLogicResponse);
            if (pickerBonusInfo == null && outcome == null) return null;
            else return new slotParserApi.PickerBonusOutcome(pickerBonusInfo, outcome);
        };
        parser.PickerParser.parsePickerBonusOutcomes = function(gameLogicResponse) {
            var pickerOutcomes = parser.Extender.getFieldAsArray(gameLogicResponse, "PickerOutcome");
            var pickerInput = parser.Extender.getField(gameLogicResponse, "PickerInput");
            if (pickerOutcomes == null) return null;
            var pickerWins = [];
            var payout = parser.ParserData.denomination.mulInt(parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "Picker"), "@totalPay")).value;
            var awardCapExceeded = parser.Extender.getBoolValue(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "AwardCapOutcome"), "AwardCapExceeded"));
            if (awardCapExceeded) payout = parser.ParserData.riscControl.awardCap;
            var stage = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "OutcomeDetail"), "Stage");
            var _g = 0;
            while (_g < pickerOutcomes.length) {
                var pickerOutcome = pickerOutcomes[_g];
                ++_g;
                var name = parser.Extender.getField(pickerOutcome, "@name");
                if (stage.indexOf(name) != -1) {
                    var layers = parser.Extender.getFieldAsArray(pickerOutcome, "Layer");
                    if (layers == null) return null;
                    var _g1 = 0;
                    while (_g1 < layers.length) {
                        var layer = layers[_g1];
                        ++_g1;
                        var pickerWin = parser.PickerParser.parsePickerWin(layer, name, pickerInput, payout);
                        pickerWins.push(pickerWin);
                    }
                    break;
                }
            }
            if (parser.Extender.isEmpty(pickerWins)) return null;
            var stake = parser.PickerParser.parseStake(gameLogicResponse);
            var winCredit = _hcmn_.Std.parseInt(parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "Picker"), "@totalPay"));
            var bigWin = parser.BigWinParser.getBigWin(stake, winCredit, awardCapExceeded);
            return new slotParserApi.Outcome(null, null, null, null, null, null, pickerWins, payout, bigWin, null);
        };
        parser.PickerParser.parsePrizeOutcome = function(gameLogicResponse, fieldName) {
            var prizeOutcomes = parser.Extender.getField(gameLogicResponse, "PrizeOutcome");
            if (prizeOutcomes == null) return null;
            var result = null;
            var _g = 0;
            while (_g < prizeOutcomes.length) {
                var prizeOutcome = prizeOutcomes[_g];
                ++_g;
                var name = parser.Extender.getField(prizeOutcome, "@name");
                if (name == fieldName) {
                    result = prizeOutcome;
                    break;
                }
            }
            return result;
        };
        parser.PickerParser.parsePickerWin = function(layer, name, pickerInput, payout) {
            var pickArray = parser.Extender.getFieldAsArray(layer, "Pick");
            if (pickArray == null) return null;
            var lastPick = null;
            var lastPickName = null;
            var pickerInputPick = parser.Extender.getField(pickerInput, "Pick");
            if (pickerInputPick == null) return null;
            lastPickName = parser.Extender.getField(pickerInputPick, "@name");
            var picks = [];
            var _g = 0;
            while (_g < pickArray.length) {
                var p = pickArray[_g];
                ++_g;
                var pick = parser.PickerParser.parsePick(p);
                picks.push(pick);
                if (pick.name == lastPickName) lastPick = pick;
            }
            return new slotParserApi.PickerWin(name, null, null, null, null, payout, null, null, null, null, picks, null, lastPick);
        };
        parser.PickerParser.parsePick = function(pick) {
            var name = parser.Extender.getField(pick, "@name");
            var picked = parser.Extender.getBoolField(pick, "@picked", false);
            var value = parser.Extender.getField(parser.Extender.getField(pick, "Feature"), "@value");
            var type = parser.Extender.getField(parser.Extender.getField(pick, "Feature"), "@type");
            return new slotParserApi.Pick(name, picked, type, value);
        };
        parser.PickerParser.parsePickerBonusInfo = function(gameLogicResponse) {
            var populationField = ".Picker";
            var populationOutcomes = parser.PickerParser.parsePopulationOutcomeContains(gameLogicResponse, populationField);
            if (populationOutcomes == null) return null;
            var choices = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            while (_g < populationOutcomes.length) {
                var populationOutcome = populationOutcomes[_g];
                ++_g;
                var cell = parser.Extender.getField(populationOutcome, "Cell");
                var name = parser.Extender.getField(cell, "@name");
                var text = parser.Extender.getField(cell, "#text");
                if (_hcmn_.__map_reserved[name] != null) choices.setReserved(name, text);
                else choices.h[name] = text;
            }
            var isIncrementTriggered = false;
            var pickerSummaryOutcome = parser.Extender.getFieldAsArray(gameLogicResponse, "PickerSummaryOutcome");
            if (pickerSummaryOutcome != null) isIncrementTriggered = parser.Extender.getBoolField(pickerSummaryOutcome, "IncrementTriggered", false);
            return new slotParserApi.PickerBonusInfo(choices, isIncrementTriggered);
        };
        parser.PickerParser.parseStake = function(gameLogicResponse) {
            var betPerPattern = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "BetPerPattern");
            var patternsBet = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "PatternSliderInput"), "PatternsBet");
            return betPerPattern * patternsBet;
        };
        parser.PickerParser.parsePopulationOutcomeContains = function(gameLogicResponse, populationField) {
            var populationOutcomes = parser.Extender.getFieldAsArray(gameLogicResponse, "PopulationOutcome");
            if (populationOutcomes == null) return null;
            var result = null;
            var _g = 0;
            while (_g < populationOutcomes.length) {
                var populationOutcome = populationOutcomes[_g];
                ++_g;
                var name = parser.Extender.getField(populationOutcome, "@name");
                if (name.indexOf(populationField) != -1) {
                    result = parser.Extender.getFieldAsArray(populationOutcome, "Entry");
                    break;
                }
            }
            return result;
        };
        parser.PickerParser.prototype.__class__ = parser.PickerParser;
        parser.ReelPictureParser = function() {};
        parser.ReelPictureParser.__name__ = ["parser", "ReelPictureParser"];
        parser.ReelPictureParser.parse = function(gameLogicResponse, name, reelPictureSize) {
            var reelsData = parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PopulationOutcome"), "@name", name);
            if (reelsData == null) return null;
            var reels = parser.ReelPictureParser.parseReelCells(parser.Extender.getFieldAsArray(reelsData, "Entry"), reelPictureSize);
            haxe.Log.trace("parse reels", {
                fileName: "ReelPictureParser.hx",
                lineNumber: 20,
                className: "slot.parser.outcome.ReelPictureParser",
                methodName: "parse",
                customParams: [reels]
            });
            return new slotParserApi.ReelPicture(reels);
        };
        parser.ReelPictureParser.parseReelCells = function(arrayField, reelPictureSize) {
            var reels = parser.Helper.createStringMatrix(reelPictureSize, "");
            var _g = 0;
            while (_g < arrayField.length) {
                var entry = arrayField[_g];
                ++_g;
                var cells = parser.Extender.getFieldAsArray(entry, "Cell");
                var _g1 = 0;
                while (_g1 < cells.length) {
                    var cell = cells[_g1];
                    ++_g1;
                    var name = parser.Extender.getField(cell, "@name");
                    var position = parser.Helper.parsePosition(name);
                    var symbol = parser.Extender.getField(cell, "#text");
                    reels[position.x][position.y] = symbol;
                }
            }
            return reels;
        };
        parser.ReelPictureParser.parseReelPictureSize = function(gameLogicResponse, name) {
            var reelsData = parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PopulationOutcome"), "@name", name);
            if (reelsData == null) return null;
            var numberOfColumns = parser.Extender.getFieldAsArray(reelsData, "Entry").length;
            var numberOfRows = parser.Extender.getFieldAsArray(parser.Extender.getFieldAsArray(reelsData, "Entry")[0], "Cell").length;
            return new slotParserApi.ReelPictureSize(numberOfColumns, numberOfRows);
        };
        parser.ReelPictureParser.prototype.__class__ = parser.ReelPictureParser;
        parser.ScatterWinParser = function() {};
        parser.ScatterWinParser.__name__ = ["parser", "ScatterWinParser"];
        parser.ScatterWinParser.parse = function(gameLogicResponse, fieldName) {
            var prizes = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", fieldName), "Prize");
            if (parser.Extender.isEmpty(prizes)) return null;
            var lines = parser.Extender.getFieldAsArray(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "HighlightOutcome"), "@name", fieldName), "Highlight");
            var wins = [];
            var _g = 0;
            while (_g < prizes.length) {
                var prize = prizes[_g];
                ++_g;
                var name = parser.Extender.getField(prize, "@name");
                var line = parser.Extender.find(lines, "@name", name);
                wins.push(parser.ScatterWinParser.createScatterWin(prize, line));
            }
            return wins;
        };
        parser.ScatterWinParser.createScatterWin = function(prize, line) {
            var cells = parser.Extender.getFieldAsArray(line, "Cell");
            var winPath = parser.ScatterWinParser.createReelPictureInfo(cells);
            var name = parser.Extender.getField(prize, "@payName");
            var winningSymbol = name.split(" ")[1];
            var pay = parser.Extender.getField(prize, "@pay");
            var multiplier = parser.Extender.toInt(parser.Extender.getField(prize, "@multiplier"));
            var totalPay = parser.ParserData.denomination.mulInt(parser.Extender.getField(prize, "@totalPay")).value;
            var symbolCount = parser.Extender.toInt(parser.Extender.getField(prize, "@symbolCount"));
            var win = new slotParserApi.ScatterWin(name, pay, multiplier, totalPay, winPath, winningSymbol, symbolCount);
            return win;
        };
        parser.ScatterWinParser.createReelPictureInfo = function(cells) {
            var matrix = parser.Helper.createIntMatrix(parser.ParserData.reelPictureSize, slotParserApi.ReelPictureSymbols.ZERO_SYMBOL);
            var _g = 0;
            while (_g < cells.length) {
                var cell = cells[_g];
                ++_g;
                var position = parser.Helper.parsePosition(parser.Extender.getField(cell, "@name"));
                matrix[position.x][position.y] = slotParserApi.ReelPictureSymbols.ENABLE_WINNING_SYMBOL;
            }
            return new slotParserApi.ReelPictureInfo(matrix);
        };
        parser.ScatterWinParser.prototype.__class__ = parser.ScatterWinParser;
        parser.SpinOutcomeParser = function() {};
        parser.SpinOutcomeParser.__name__ = ["parser", "SpinOutcomeParser"];
        parser.SpinOutcomeParser.parse = function(gameLogicResponse) {
            haxe.Log.trace("[SLOT_PARSER] SpinOutcome.parse", {
                fileName: "SpinOutcomeParser.hx",
                lineNumber: 17,
                className: "slot.parser.outcome.SpinOutcomeParser",
                methodName: "parse"
            });
            var stage = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "OutcomeDetail"), "Stage");
            var nextStage = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "OutcomeDetail"), "NextStage");
            var gameStatus = parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "OutcomeDetail"), "GameStatus");
            var baseGame = parser.BaseGameParser.parse(gameLogicResponse);
            var freeSpin = parser.FreeSpinParser.parse(gameLogicResponse);
            var pickerBonus = parser.PickerParser.parse(gameLogicResponse);
            var previousFreeSpins = [];
            var acumulatedFreeSpinPayout = parser.ParserData.denomination.mulInt(parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "FreeSpin.Total"), "@totalPay")).value;
            var accPayoutValue = parser.Extender.getField(parser.Extender.find(parser.Extender.getFieldAsArray(gameLogicResponse, "PrizeOutcome"), "@name", "Game.Total"), "@totalPay");
            var acumulatedPayout = parser.ParserData.denomination.mulInt(accPayoutValue).value;
            var awardCapExceeded = parser.Extender.getBoolValue(parser.Extender.getField(parser.Extender.getField(gameLogicResponse, "AwardCapOutcome"), "AwardCapExceeded"));
            if (awardCapExceeded) acumulatedPayout = parser.ParserData.riscControl.awardCap;
            var spinOutcome = new slotParserApi.SpinOutcome(stage, nextStage, gameStatus, baseGame, freeSpin, pickerBonus, previousFreeSpins, acumulatedFreeSpinPayout, acumulatedPayout, awardCapExceeded);
            return spinOutcome;
        };
        parser.SpinOutcomeParser.prototype.__class__ = parser.SpinOutcomeParser;
        parser.Extender = function() {};
        parser.Extender.__name__ = ["parser", "Extender"];
        parser.Extender.getField = function(obj, field) {
            if (obj == null) return null;
            if (Object.prototype.hasOwnProperty.call(obj, field)) return _hcmn_.Reflect.field(obj, field);
            else return null;
        };
        parser.Extender.getFieldAsArray = function(obj, path) {
            return parser.Extender.makeArray(parser.Extender.getField(obj, path));
        };
        parser.Extender.makeArray = function(field) {
            if (field == null) return [];
            if ((field instanceof Array) && field.__enum__ == null) return field;
            else return [field];
        };
        parser.Extender.find = function(arr, field, value) {
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                if (parser.Extender.getField(elem, field) == value) return elem;
            }
            return null;
        };
        parser.Extender.contains = function(arr, field, value) {
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                if (parser.Extender.getField(elem, field).indexOf(value) != -1) return elem;
            }
            return null;
        };
        parser.Extender.isEmpty = function(value) {
            if (value == null) return true;
            if (value.length == 0) return true;
            return false;
        };
        parser.Extender.getBoolValue = function(obj) {
            if (obj != null) {
                if (typeof(obj) == "string") return obj.toLowerCase() == "true";
                return obj;
            }
            return false;
        };
        parser.Extender.toIntArray = function(arr) {
            var out = [];
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                out.push(_hcmn_.Std.parseInt(elem));
            }
            return out;
        };
        parser.Extender.toInt = function(obj) {
            if (obj == null) return null;
            return _hcmn_.Std.parseInt(obj);
        };
        parser.Extender.clone = function(obj) {
            return JSON.parse(JSON.stringify(obj));
        };
        parser.Extender.getBoolField = function(object, name, defaultValue) {
            var dynammicValue = parser.Extender.getField(object, name);
            if (dynammicValue == null) return defaultValue;
            return _hcmn_.Std.string(dynammicValue).toLowerCase() == "true";
        };
        parser.Extender.prototype.__class__ = parser.Extender;
        parser.Helper = function() {};
        parser.Helper.__name__ = ["parser", "Helper"];
        parser.Helper.getKeyValueMapping_String_Int = function(keyValuesPairInfo) {
            var pairs = parser.Extender.getFieldAsArray(keyValuesPairInfo, "Mapping");
            if (pairs == null) return null;
            else {
                var out = new _hcmn_.haxe_ds_StringMap();
                var _g = 0;
                while (_g < pairs.length) {
                    var pair = pairs[_g];
                    ++_g;
                    var key = parser.Extender.getField(pair, "@key");
                    var value = parser.Extender.getField(pair, "@value");
                    if (_hcmn_.__map_reserved[key] != null) out.setReserved(key, value);
                    else out.h[key] = value;
                }
                return out;
            }
        };
        parser.Helper.createBoolMatrix = function(rpSize, value) {
            var _g = [];
            var _g2 = 0;
            var _g1 = rpSize.numberOfCollumns;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push((function($this) {
                    var $r;
                    var _g3 = []; {
                        var _g5 = 0;
                        var _g4 = rpSize.numberOfRows;
                        while (_g5 < _g4) {
                            var j = _g5++;
                            _g3.push(value);
                        }
                    }
                    $r = _g3;
                    return $r;
                }(this)));
            }
            return _g;
        };
        parser.Helper.createIntMatrix = function(rpSize, value) {
            var _g = [];
            var _g2 = 0;
            var _g1 = rpSize.numberOfCollumns;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push((function($this) {
                    var $r;
                    var _g3 = []; {
                        var _g5 = 0;
                        var _g4 = rpSize.numberOfRows;
                        while (_g5 < _g4) {
                            var j = _g5++;
                            _g3.push(value);
                        }
                    }
                    $r = _g3;
                    return $r;
                }(this)));
            }
            return _g;
        };
        parser.Helper.createStringMatrix = function(rpSize, value) {
            var _g = [];
            var _g2 = 0;
            var _g1 = rpSize.numberOfCollumns;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push((function($this) {
                    var $r;
                    var _g3 = []; {
                        var _g5 = 0;
                        var _g4 = rpSize.numberOfRows;
                        while (_g5 < _g4) {
                            var j = _g5++;
                            _g3.push(value);
                        }
                    }
                    $r = _g3;
                    return $r;
                }(this)));
            }
            return _g;
        };
        parser.Helper.parsePosition = function(name) {
            var pos = {
                x: _hcmn_.Std.parseInt(name.charAt(3)),
                y: _hcmn_.Std.parseInt(name.charAt(5))
            };
            return pos;
        };
        parser.Helper.prototype.__class__ = parser.Helper;
        parser.BigWinParser.BIG_WIN_GROUP_POINTS_STRING = "bigWinGroupPoints";;
        parser.BigWinParser.DEFAULT_BIG_WIN_GROUP_POINTS = [
            [1, -1, 1],
            [1.5, -1, 2],
            [2, 100, 2],
            [2.5, 25, 2],
            [2.5, -1, 3],
            [3, 10, 2],
            [3, 750, 3],
            [4, 200, 3],
            [5, 75, 3],
            [6, 10, 3],
            [8, -1, 4],
            [9, 2500, 4],
            [10, 500, 4],
            [12, 150, 4],
            [15, -1, 5],
            [20, 5000, 5],
            [25, 500, 5],
            [30, 200, 5],
            [40, 50, 5],
            [-1, -1, 6]
        ];;
        parser.LineWinParser.LINE_TYPE = "LineLeft";;
        return {
            exports: parser,
            activator: parser.Activator
        };
    });
//# sourceURL=slotParser.js