define("smashthepigSlotmodelGamepluginGle", ["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 = {

        };
        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 smashthepigSlotmodelGamepluginGle == 'undefined') {
            var smashthepigSlotmodelGamepluginGle = {};
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin = function() {
            this.commonParser = new slotmodelGamePluginCommonGle.PfPluginCommonResponseParser(smashthepigSlotmodelGamepluginGle.GamePlugin.GAME_ID, $bind(this, this.onError), smashthepigSlotmodelGamepluginGle.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID);
            this.localParser = new smashthepigSlotmodelGamepluginGle.PfPluginResponseParser(smashthepigSlotmodelGamepluginGle.GamePlugin.GAME_ID, $bind(this, this.onError), smashthepigSlotmodelGamepluginGle.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID, this.commonParser);
            this.payLines = new _hcmn_.haxe_ds_StringMap();
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin = ck_implements(smashthepigSlotmodelGamepluginGle.GamePlugin, clientkernelModulesApi.IService);
        smashthepigSlotmodelGamepluginGle.GamePlugin = ck_implements(smashthepigSlotmodelGamepluginGle.GamePlugin, slotmodelGamePluginApi.IGamePlugin);
        smashthepigSlotmodelGamepluginGle.GamePlugin.__interfaces__ = [clientkernelModulesApi.IService, slotmodelGamePluginApi.IGamePlugin];
        smashthepigSlotmodelGamepluginGle.GamePlugin.__name__ = ["smashthepigSlotmodelGamepluginGle", "GamePlugin"];
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.payLines = null;
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.commonParser = null;
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.localParser = null;
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.start = function(context) {};
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.stop = function(context) {};
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.onError = function(error) {
            slotmodelGamePluginCommonGle.Log.getLogger(this).error("[GamePlugin][" + error.id + "] " + error.message);
            throw new js._Boot.HaxeError(error);
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getImplementedFeatures = function() {
            return smashthepigSlotmodelGamepluginGle.GamePlugin.IMPLEMENTED;
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getAdditionalLineWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getScatterWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getBonusWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getResumePerStake = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getCustomBigWin = function(totalStakeCredit, totalWinCredit) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getNextSpinStripeLayersForSynchronizedReels = function(gameLogicResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Unimplemented method!");
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getNextSpinStripeLayersPerBet = function(paytableResponse, slotDefinition) {
            this.payLines = smashthepigSlotmodelGamepluginGle.Parser.parsePayLines(paytableResponse);
            return null;
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.parseCustomData = function(paytableResponse) {
            return {
                payLines: this.payLines
            };
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.getProgressMeter = function(gameLogicResponse, slotDefinition) {
            return this.localParser.parseProgressMeter(gameLogicResponse, slotDefinition);
        };
        smashthepigSlotmodelGamepluginGle.GamePlugin.prototype.__class__ = smashthepigSlotmodelGamepluginGle.GamePlugin;
        smashthepigSlotmodelGamepluginGle.ModuleActivator = function() {};
        smashthepigSlotmodelGamepluginGle.ModuleActivator = ck_implements(smashthepigSlotmodelGamepluginGle.ModuleActivator, clientkernelModulesApi.IModuleActivator);
        smashthepigSlotmodelGamepluginGle.ModuleActivator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        smashthepigSlotmodelGamepluginGle.ModuleActivator.__name__ = ["smashthepigSlotmodelGamepluginGle", "ModuleActivator"];
        smashthepigSlotmodelGamepluginGle.ModuleActivator.prototype.gamePlugin = null;
        smashthepigSlotmodelGamepluginGle.ModuleActivator.prototype.registration = null;
        smashthepigSlotmodelGamepluginGle.ModuleActivator.prototype.start = function(context) {
            var _g = this;
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, clientkernelLoggerApi.ILoggerFactory, clientkernelEventbusApi.IEventBus]).then(function(context1) {
                _g.gamePlugin = new smashthepigSlotmodelGamepluginGle.GamePlugin();
                _g.registration = context1.registerService(_g.gamePlugin, slotmodelGamePluginApi.IGamePlugin, null);
            });
        };
        smashthepigSlotmodelGamepluginGle.ModuleActivator.prototype.stop = function(context) {
            if (this.gamePlugin != null) this.gamePlugin.stop(context);
            if (this.registration != null) this.registration.unregister();
        };
        smashthepigSlotmodelGamepluginGle.ModuleActivator.main = function() {};
        smashthepigSlotmodelGamepluginGle.ModuleActivator.prototype.__class__ = smashthepigSlotmodelGamepluginGle.ModuleActivator;
        smashthepigSlotmodelGamepluginGle.Parser = function() {};
        smashthepigSlotmodelGamepluginGle.Parser.__name__ = ["smashthepigSlotmodelGamepluginGle", "Parser"];
        smashthepigSlotmodelGamepluginGle.Parser.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 = smashthepigSlotmodelGamepluginGle.Parser.parsePosition(name);
                            linePositions.push(position);
                        }
                        payLines.set("bg_" + lineId, linePositions);
                    }
                }
            }
            return payLines;
        };
        smashthepigSlotmodelGamepluginGle.Parser.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;
        };
        smashthepigSlotmodelGamepluginGle.Parser.prototype.__class__ = smashthepigSlotmodelGamepluginGle.Parser;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser = function(gameId, onError, payloadErrorId, commonParser) {
            this.parseError = false;
            this.gameId = gameId;
            this.onError = onError;
            this.payloadErrorId = payloadErrorId;
            this.commonParser = commonParser;
        };
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.__name__ = ["smashthepigSlotmodelGamepluginGle", "PfPluginResponseParser"];
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.commonParser = null;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.onError = null;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.payloadErrorId = null;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.gameId = null;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.parseError = null;
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.parseProgressMeter = function(gameLogicResponse, slotDefinition) {
            var populationField = "BaseGame.LuckMeter";
            return this.commonParser.parseProgressMeter(gameLogicResponse, populationField);
        };
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.onParseFatalError = function(message) {
            slotmodelGamePluginCommonGle.Log.getLoggerBykey("PfPluginResponseParser").error("[ParseFatalError]" + message);
            this.parseError = true;
            this.onError(this.getFatalError("ParseFatalError", message));
        };
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.getFatalError = function(source, message) {
            return new slotModelApi.Error(this.payloadErrorId, true, "[" + this.gameId + "][" + source + "] " + message);
        };
        smashthepigSlotmodelGamepluginGle.PfPluginResponseParser.prototype.__class__ = smashthepigSlotmodelGamepluginGle.PfPluginResponseParser;
        smashthepigSlotmodelGamepluginGle.GamePlugin.IMPLEMENTED = [slotmodelGamePluginApi.EPluginFeature.CUSTOM_DATA, slotmodelGamePluginApi.EPluginFeature.STRIPE_LAYER_PER_BET, slotmodelGamePluginApi.EPluginFeature.PROGRESS_METER];;
        smashthepigSlotmodelGamepluginGle.GamePlugin.GAME_ID = "SmashThePig";;
        smashthepigSlotmodelGamepluginGle.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID = 9999;;
        return {
            exports: smashthepigSlotmodelGamepluginGle,
            activator: smashthepigSlotmodelGamepluginGle.ModuleActivator
        };
    });
//# sourceURL=smashThePigSlotModelGamePluginGle.js