define("soundEventTool", ["componentmodelComponentApi", "clientkernelLoaderApi", "soundManagerApi", "clientkernelEventbusApi", "clientkernelLoggerApi"],
    function(componentmodelComponentApi, clientkernelLoaderApi, soundManagerApi, clientkernelEventbusApi, 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 (!haxe.ds) {
            haxe.ds = {};
        };
        if (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        if (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (typeof soundEventTool == 'undefined') {
            var soundEventTool = {};
        };
        soundEventTool.SoundAction = function(obj) {
            this.id = obj.id;
            this.action = obj.action;
            this.isLocked = obj.status == "locked";
            if (obj.volume == null) this.volume = 1;
            else this.volume = _hcmn_.Std.parseFloat(obj.volume);
            if (obj.timeout == null) this.timeout = -1;
            else this.timeout = _hcmn_.Std.parseInt(obj.timeout);
            this.value = obj.value;
            this.lastPlayedTime = 0;
        };
        soundEventTool.SoundAction.__name__ = ["soundEventTool", "SoundAction"];
        soundEventTool.SoundAction.prototype.id = null;
        soundEventTool.SoundAction.prototype.action = null;
        soundEventTool.SoundAction.prototype.value = null;
        soundEventTool.SoundAction.prototype.lastPlayedTime = null;
        soundEventTool.SoundAction.prototype.volume = null;
        soundEventTool.SoundAction.prototype.isLocked = null;
        soundEventTool.SoundAction.prototype.timeout = null;
        soundEventTool.SoundAction.prototype.__class__ = soundEventTool.SoundAction;
        soundEventTool.SoundConfig = function() {};
        soundEventTool.SoundConfig.__name__ = ["soundEventTool", "SoundConfig"];
        soundEventTool.SoundConfig.prototype.events = null;
        soundEventTool.SoundConfig.prototype.actions = null;
        soundEventTool.SoundConfig.prototype.mapOfSoundList = null;
        soundEventTool.SoundConfig.prototype.reflectionMap = null;
        soundEventTool.SoundConfig.prototype.config = null;
        soundEventTool.SoundConfig.prototype.initialize = function(config) {
            if (config == null) throw new Error("SoundConfig: config is null");
            this.config = config;
            this.events = new _hcmn_.haxe_ds_StringMap();
            this.actions = new _hcmn_.haxe_ds_StringMap();
            this.mapOfSoundList = new _hcmn_.haxe_ds_StringMap();
            this.reflectionMap = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(config.soundList);
            while (_g < _g1.length) {
                var listName = _g1[_g];
                ++_g;
                var value = _hcmn_.Reflect.field(config.soundList, listName);
                this.mapOfSoundList.set(listName, value);
            }
            if (Object.prototype.hasOwnProperty.call(config, "reflectionMap")) {
                var reflectionMap = _hcmn_.Reflect.field(config, "reflectionMap");
                var _g2 = 0;
                var _g11 = _hcmn_.Reflect.fields(reflectionMap);
                while (_g2 < _g11.length) {
                    var soundMapField = _g11[_g2];
                    ++_g2;
                    var value1 = _hcmn_.Reflect.field(reflectionMap, soundMapField);
                    this.reflectionMap.set(soundMapField, value1);
                }
            }
            var _g3 = 0;
            var _g12 = _hcmn_.Reflect.fields(config.events);
            while (_g3 < _g12.length) {
                var eventName = _g12[_g3];
                ++_g3;
                var arr = _hcmn_.Reflect.field(config.events, eventName);
                var actions = [];
                var _g31 = 0;
                var _g21 = arr.length;
                while (_g31 < _g21) {
                    var i = _g31++;
                    var soundAction = new soundEventTool.SoundAction(arr[i]);
                    actions.push(soundAction);
                    this.addSoundAction(soundAction);
                    this.addSoundActionWithCustomId(eventName, soundAction);
                }
                this.events.set(eventName, actions);
            }
            var _g4 = 0;
            var _g13 = _hcmn_.Reflect.fields(config.additionalSoundActions);
            while (_g4 < _g13.length) {
                var eventName1 = _g13[_g4];
                ++_g4;
                var arr1 = _hcmn_.Reflect.field(config.additionalSoundActions, eventName1);
                var actions1 = [];
                var _g32 = 0;
                var _g22 = arr1.length;
                while (_g32 < _g22) {
                    var i1 = _g32++;
                    var soundAction1 = new soundEventTool.SoundAction(arr1[i1]);
                    actions1.push(soundAction1);
                    this.addSoundAction(soundAction1);
                    this.addSoundActionWithCustomId(eventName1, soundAction1);
                }
                this.events.set(eventName1, actions1);
            }
        };
        soundEventTool.SoundConfig.prototype.getReflectionSound = function(id, data) {
            var sound1 = this.getFieldFromObject(id, data);
            var reflectionMap = this.getReflectionSoundFromConfig(id, this.getAsStringify(sound1));
            var result;
            if (reflectionMap != null) result = reflectionMap;
            else result = sound1;
            return this.getAsStringify(result);
        };
        soundEventTool.SoundConfig.prototype.getAsStringify = function(value) {
            if (typeof(value) == "string") return value;
            else return eval("JSON.stringify(value)");
        };
        soundEventTool.SoundConfig.prototype.getFieldFromObject = function(id, data) {
            if (id == "" || id == null) return data;
            if (id.indexOf(".") == -1) return _hcmn_.Reflect.field(data, id);
            var result = data;
            var _g = 0;
            var _g1 = id.split(".");
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                result = this.getFieldFromObject(c, result);
                if (result == null) throw new Error("SoundConfig::getFieldFromObject: result is null when id: " + id);
            }
            return result;
        };
        soundEventTool.SoundConfig.prototype.getReflectionSoundFromConfig = function(soundMapId, soundId) {
            if (this.reflectionMap.exists(soundMapId)) {
                var soundsMap = this.reflectionMap.get(soundMapId);
                if (Object.prototype.hasOwnProperty.call(soundsMap, soundId)) return _hcmn_.Reflect.field(soundsMap, soundId);
            }
            return null;
        };
        soundEventTool.SoundConfig.prototype.getSoundMap = function(id) {
            var soundMap = new _hcmn_.haxe_ds_StringMap();
            var dynamicSoundMap = _hcmn_.Reflect.field(this.config, id);
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(dynamicSoundMap);
            while (_g < _g1.length) {
                var field = _g1[_g];
                ++_g;
                var fieldValue = _hcmn_.Reflect.field(dynamicSoundMap, field);
                if (_hcmn_.__map_reserved[field] != null) soundMap.setReserved(field, fieldValue);
                else soundMap.h[field] = fieldValue;
            }
            return soundMap;
        };
        soundEventTool.SoundConfig.prototype.getRadomSoundFromList = function(id) {
            var soundList = this.mapOfSoundList.get(id);
            var sound1 = soundList[_hcmn_.Std.random(soundList.length)];
            return sound1;
        };
        soundEventTool.SoundConfig.prototype.addSoundAction = function(soundAction) {
            this.addSoundActionWithCustomId(soundAction.id, soundAction);
        };
        soundEventTool.SoundConfig.prototype.addSoundActionWithCustomId = function(id, soundAction) {
            if (!this.actions.exists(id)) this.actions.set(id, []);
            this.actions.get(id).push(soundAction);
        };
        soundEventTool.SoundConfig.prototype.__class__ = soundEventTool.SoundConfig;
        soundEventTool.SoundController = function(context, assetRegistry, logger, chanels, model) {
            this.cachedValues = new _hcmn_.haxe_ds_StringMap();
            this.timeouts = new _hcmn_.haxe_ds_StringMap();
            this.soundPort = context.getUsedPort(soundManagerApi.ISoundManagerPort);
            this.logger = logger;
            this.model = model;
            this.soundPortHelper = new soundEventTool.SoundPortHelper(this.soundPort, 250, logger);
            var _g = 0;
            while (_g < chanels.length) {
                var chanel = chanels[_g];
                ++_g;
                chanel.subscribe("*", $bind(this, this.onAllEvents));
            }
            this.loadSoundConfigs(assetRegistry);
        };
        soundEventTool.SoundController.__name__ = ["soundEventTool", "SoundController"];
        soundEventTool.SoundController.prototype.cfg = null;
        soundEventTool.SoundController.prototype.soundPort = null;
        soundEventTool.SoundController.prototype.soundPortHelper = null;
        soundEventTool.SoundController.prototype.logger = null;
        soundEventTool.SoundController.prototype.timeouts = null;
        soundEventTool.SoundController.prototype.cachedValues = null;
        soundEventTool.SoundController.prototype.model = null;
        soundEventTool.SoundController.prototype.loadSoundConfigs = function(assetRegistry) {
            var _g = this;
            var assetsToBeLoaded = ["soundplayer-assets/soundevents", "soundplayer-assets/soundMapIE"];
            var timeoutId = window.setTimeout(function() {
                _g.logger.error("Would not loaded assets: " + _hcmn_.Std.string(assetsToBeLoaded));
            }, 60000);
            assetRegistry.getAssetsContent(assetsToBeLoaded).then(function(loadedAssets) {
                _g.cfg = new soundEventTool.SoundConfig();
                _g.cfg.initialize(_hcmn_.__map_reserved.soundevents != null ? loadedAssets.getReserved("soundevents") : loadedAssets.h["soundevents"]);
                var soundMapIE;
                soundMapIE = _hcmn_.__map_reserved.soundMapIE != null ? loadedAssets.getReserved("soundMapIE") : loadedAssets.h["soundMapIE"];
                _g.soundPortHelper.setSoundMapForVerification(soundMapIE);
                window.clearTimeout(timeoutId);
            });
        };
        soundEventTool.SoundController.prototype.onAllEvents = function(e) {
            var topic = e.getTopic();
            var payload = e.getPayload();
            this.onEvent(topic, payload);
        };
        soundEventTool.SoundController.prototype.onEvent = function(topic, payload) {
            if (this.cfg == null) return;
            if (this.cfg.events.exists(topic)) {
                var arr = this.cfg.events.get(topic);
                var _g1 = 0;
                var _g = arr.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    if (!this.model.isHighWin()) {
                        if (topic == "reels:spinStopped") this.executeAction(this.cfg.events.get("LOW_WIN_ANTICIPATION")[0], null);
                        if (topic == "winMeterCountupGroup1") this.executeAction(this.cfg.events.get("LOW_WIN")[0], null);
                        else if (topic == "popups:showFreeSpinOutro") {
                            if (i != arr.length - 1) this.executeAction(this.cfg.events.get("LOW_WIN_FS_OUTRO")[i], null);
                        } else this.executeAction(arr[i], payload);
                    } else this.executeAction(arr[i], payload);
                }
            }
            if (payload != null && payload.key == "sound") {
                if (payload.value == "1") this.soundPortHelper.turnOffSounds();
                else this.soundPortHelper.turnOnSounds();
            }
        };
        soundEventTool.SoundController.prototype.executeAction = function(action, payload, checkTimeout) {
            if (checkTimeout == null) checkTimeout = true;
            if (action.isLocked) return;
            this.clearTimeouts(action.id + action.value);
            if (checkTimeout && action.timeout > 0) {
                this.executeTimeoutedAction(action, payload);
                return;
            }
            var _g = action.action;
            switch (_g) {
                case "executeAction":
                    var actionId = action.value;
                    this.executeActionsByActionId(actionId, payload);
                    break;
                case "executePlayPayloadAction":
                    var actionId1 = this.cfg.getReflectionSound(action.id, payload);
                    this.executeActionsByActionId(actionId1, payload);
                    break;
                case "playPayload":
                    var soundMap = this.cfg.getSoundMap(action.id);
                    if ((function($this) {
                            var $r;
                            var key = payload;
                            $r = _hcmn_.__map_reserved[key] != null ? soundMap.existsReserved(key) : soundMap.h.hasOwnProperty(key);
                            return $r;
                        }(this))) {
                        var sound1;
                        var key1 = payload;
                        sound1 = _hcmn_.__map_reserved[key1] != null ? soundMap.getReserved(key1) : soundMap.h[key1];
                        this.soundPortHelper.playSound(sound1, action.volume);
                    }
                    break;
                case "executeActionIfMatches":
                    var actionId2 = action.id;
                    if (new _hcmn_.EReg(actionId2, "i").match(this.cfg.getAsStringify(payload))) {
                        var soundActions = this.cfg.actions.get(action.value);
                        this.executeActions(soundActions, action.id, payload);
                    }
                    break;
                case "executeActionIfLessThanCache":
                case "executeActionIfGreaterThanCache":
                case "executeActionIfLessOrEqualsThanCache":
                case "executeActionIfGreaterOrEqualsThanCache":
                case "executeActionIfEqualsToCache":
                    this.executeCompareAction(action, payload);
                    break;
                case "saveToCache":
                    var valueKey = action.value.split(":")[0];
                    var valuePath = action.value.split(":")[1];
                    var value = this.cfg.getFieldFromObject(valuePath, payload);
                    this.cachedValues.set(valueKey, value);
                    break;
                case "clearFromCache":
                    var valueKey1;
                    if (action.value.split(":").length > 0) valueKey1 = action.value.split(":")[0];
                    else valueKey1 = action.value;
                    this.cachedValues.remove(valueKey1);
                    break;
                case "invokePayloadActionMap":
                    var soundMap1 = this.cfg.getSoundMap(action.id);
                    if ((function($this) {
                            var $r;
                            var key2 = payload;
                            $r = _hcmn_.__map_reserved[key2] != null ? soundMap1.existsReserved(key2) : soundMap1.h.hasOwnProperty(key2);
                            return $r;
                        }(this))) {
                        var actionId3;
                        var key3 = payload;
                        actionId3 = _hcmn_.__map_reserved[key3] != null ? soundMap1.getReserved(key3) : soundMap1.h[key3];
                        this.executeActionsByActionId(actionId3, payload);
                    }
                    break;
                case "unlockAction":
                    this.unlockActions(action.value);
                    break;
                case "lockAction":
                    this.lockActions(action.value);
                    break;
                case "playRandom":
                    var sound2 = this.cfg.getRadomSoundFromList(action.id);
                    this.soundPortHelper.playSound(sound2, action.volume);
                    break;
                case "fadeOut":
                    this.soundPortHelper.fadeOut(action.id, _hcmn_.Std.parseInt(action.value), false);
                    break;
                case "fadeIn":
                    this.soundPortHelper.fadeIn(action.id, _hcmn_.Std.parseInt(action.value));
                    break;
                case "stop":
                    this.soundPortHelper.stopSound(action.id);
                    break;
                case "mute":
                    this.soundPortHelper.setVolume(action.id, 0);
                    break;
                case "play":
                    var currentTime = new _hcmn_.Date().getTime();
                    if (currentTime - action.lastPlayedTime > 50) {
                        this.soundPortHelper.playSound(action.id, action.volume);
                        action.lastPlayedTime = currentTime;
                    }
                    break;
            }
        };
        soundEventTool.SoundController.prototype.executeCompareAction = function(action, payload) {
            var valueKey = action.value.split(":")[0];
            var valuePath = action.value.split(":")[1];
            var cachedValue = this.cachedValues.get(valueKey);
            var newValue = this.cfg.getFieldFromObject(valuePath, payload);
            var isNullable = cachedValue == null && newValue == null;
            var compareResult = cachedValue - newValue;
            var splitOfActionId = action.id.split("action:");
            var actionId;
            if (splitOfActionId.length == 2) actionId = splitOfActionId[1];
            else actionId = "noAction";
            var _g = action.action;
            switch (_g) {
                case "executeActionIfLessThanCache":
                    if (!isNullable && compareResult > 0) this.executeActionsByActionId(actionId, payload);
                    break;
                case "executeActionIfGreaterThanCache":
                    if (!isNullable && compareResult < 0) this.executeActionsByActionId(actionId, payload);
                    break;
                case "executeActionIfLessOrEqualsThanCache":
                    if (isNullable || compareResult >= 0) this.executeActionsByActionId(actionId, payload);
                    break;
                case "executeActionIfGreaterOrEqualsThanCache":
                    if (isNullable || compareResult <= 0) this.executeActionsByActionId(actionId, payload);
                    break;
                case "executeActionIfEqualsToCache":
                    if (isNullable || compareResult == 0) this.executeActionsByActionId(actionId, payload);
                    break;
            }
        };
        soundEventTool.SoundController.prototype.executeTimeoutedAction = function(action, payload) {
            var _g = this;
            var timeoutId = window.setTimeout(function() {
                _g.executeAction(action, payload, false);
            }, action.timeout);
            var actionId = action.id + action.value;
            if (!this.timeouts.exists(actionId)) this.timeouts.set(actionId, [timeoutId]);
            else this.timeouts.get(actionId).push(timeoutId);
        };
        soundEventTool.SoundController.prototype.clearTimeouts = function(id) {
            if (this.timeouts.exists(id)) {
                var _g = 0;
                var _g1 = this.timeouts.get(id);
                while (_g < _g1.length) {
                    var timeoutId = _g1[_g];
                    ++_g;
                    window.clearTimeout(timeoutId);
                }
                this.timeouts.remove(id);
            }
        };
        soundEventTool.SoundController.prototype.unlockActions = function(id) {
            this.setLockStatusToActions(id, false);
        };
        soundEventTool.SoundController.prototype.lockActions = function(id) {
            this.setLockStatusToActions(id, true);
        };
        soundEventTool.SoundController.prototype.executeActionsByActionId = function(actionId, payload) {
            var soundActions = this.cfg.actions.get(actionId);
            this.executeActions(soundActions, actionId, payload);
        };
        soundEventTool.SoundController.prototype.executeActions = function(soundActions, actionId, payload) {
            if (soundActions == null) soundActions = [];
            else soundActions = soundActions;
            if (soundActions.length == 0) this.logger.warn("sound actionId: " + actionId + " is not present");
            var _g = 0;
            while (_g < soundActions.length) {
                var soundAction = soundActions[_g];
                ++_g;
                if (soundAction.id == actionId) throw new js._Boot.HaxeError("soundAction: " + actionId + " wanted to play similar action; Possible stack overflow;");
                this.executeAction(soundAction, payload);
            }
        };
        soundEventTool.SoundController.prototype.setLockStatusToActions = function(id, value) {
            var actions = this.cfg.actions.get(id);
            if (actions == null) {
                this.logger.warn("action " + id + " is not declared in config file");
                return;
            }
            var _g = 0;
            while (_g < actions.length) {
                var action = actions[_g];
                ++_g;
                action.isLocked = value;
            }
        };
        soundEventTool.SoundController.prototype.__class__ = soundEventTool.SoundController;
        soundEventTool.SoundPortHelper = function(soundPort, frameRate, logger) {
            this.soundMapForVerification = null;
            this.soundsMap = new _hcmn_.haxe_ds_StringMap();
            this.fadeSoundsMap = new _hcmn_.haxe_ds_StringMap();
            this.soundsMuted = false;
            this.soundPort = soundPort;
            this.frameRate = frameRate;
            window.setInterval($bind(this, this.intervalHandler), _hcmn_.Math.round(frameRate));
            this.time = new _hcmn_.Date().getTime();
            this.logger = logger;
        };
        soundEventTool.SoundPortHelper.__name__ = ["soundEventTool", "SoundPortHelper"];
        soundEventTool.SoundPortHelper.prototype.soundsMuted = null;
        soundEventTool.SoundPortHelper.prototype.soundPort = null;
        soundEventTool.SoundPortHelper.prototype.fadeSoundsMap = null;
        soundEventTool.SoundPortHelper.prototype.soundsMap = null;
        soundEventTool.SoundPortHelper.prototype.time = null;
        soundEventTool.SoundPortHelper.prototype.frameRate = null;
        soundEventTool.SoundPortHelper.prototype.soundMapForVerification = null;
        soundEventTool.SoundPortHelper.prototype.logger = null;
        soundEventTool.SoundPortHelper.prototype.setSoundMapForVerification = function(soundMapForVerification) {
            this.soundMapForVerification = soundMapForVerification;
        };
        soundEventTool.SoundPortHelper.prototype.fadeIn = function(soundId, fadeTimeout) {
            if (!this.fadeSoundsMap.exists(soundId)) {
                this.playSound(soundId, this.getSound(soundId).volume);
                var value = new sound.FadeValue(soundId, fadeTimeout, 0);
                this.fadeSoundsMap.set(soundId, value);
            }
            var fadedSoundValue = this.fadeSoundsMap.get(soundId);
            fadedSoundValue.stopAfterComplete = false;
            fadedSoundValue.timeout = fadeTimeout;
            if (fadedSoundValue.volume < 0) fadedSoundValue.volume = 0;
            fadedSoundValue.volumeOFsset = (1 - fadedSoundValue.volume) / (fadeTimeout / this.frameRate);
        };
        soundEventTool.SoundPortHelper.prototype.fadeOut = function(soundId, fadeTimeout, stopAfterComplete) {
            if (stopAfterComplete == null) stopAfterComplete = true;
            if (!this.fadeSoundsMap.exists(soundId)) {
                this.playSoundOnce(soundId, this.getSound(soundId).volume);
                var value = new sound.FadeValue(soundId, fadeTimeout);
                this.fadeSoundsMap.set(soundId, value);
            }
            var fadedSoundValue = this.fadeSoundsMap.get(soundId);
            if (fadedSoundValue.volume > 1) fadedSoundValue.volume = 1;
            fadedSoundValue.stopAfterComplete = stopAfterComplete;
            fadedSoundValue.timeout = fadeTimeout;
            fadedSoundValue.volumeOFsset = -(fadedSoundValue.volume / (fadeTimeout / this.frameRate));
        };
        soundEventTool.SoundPortHelper.prototype.stopSound = function(sound1) {
            if (this.isSoundValid(sound1)) {
                this.getSound(sound1).isPlayed = false;
                this.verifySoundOnExists(sound1);
                this.soundPort.stop().publish(sound1);
                this.fadeSoundsMap.remove(sound1);
            }
        };
        soundEventTool.SoundPortHelper.prototype.playSoundOnce = function(sound1, volume) {
            if (volume == null) volume = 1;
            if (this.isSoundValid(sound1) && !this.getSound(sound1).isPlayed) this.playSound(sound1, volume);
            else {
                this.setVolume(sound1, volume);
                this.fadeSoundsMap.remove(sound1);
            }
        };
        soundEventTool.SoundPortHelper.prototype.playSound = function(sound1, volume) {
            if (volume == null) volume = 1;
            if (this.isSoundValid(sound1)) {
                this.fadeSoundsMap.remove(sound1);
                var soundExist = this.verifySoundOnExists(sound1);
                var isSoundLoop = soundExist && this.soundMapForVerification[sound1].length == 3;
                if (isSoundLoop && this.getSound(sound1).isPlayed) this.fadeSoundsMap.remove(sound1);
                else {
                    this.soundPort.play().publish(sound1);
                    this.getSound(sound1).isPlayed = true;
                }
                if (volume != this.getSound(sound1).volume) this.setVolume(sound1, volume);
                if (this.soundsMuted) this.soundPort.mute().publish(sound1);
            }
        };
        soundEventTool.SoundPortHelper.prototype.setVolume = function(sound1, volume) {
            if (volume == null) volume = 1;
            this.verifySoundOnExists(sound1);
            this.soundPort.volume().publish(new soundManagerApi.SoundVolumeData(sound1, volume));
            this.getSound(sound1).volume = volume;
        };
        soundEventTool.SoundPortHelper.prototype.isSoundsMuted = function() {
            return this.soundsMuted;
        };
        soundEventTool.SoundPortHelper.prototype.isSoundValid = function(sound1) {
            return sound1 != null && sound1.length > 0;
        };
        soundEventTool.SoundPortHelper.prototype.turnOnSounds = function() {
            this.soundPort.unmuteAll().publish(null);
            this.soundsMuted = false;
        };
        soundEventTool.SoundPortHelper.prototype.turnOffSounds = function() {
            this.soundPort.muteAll().publish(null);
            this.soundsMuted = true;
        };
        soundEventTool.SoundPortHelper.prototype.intervalHandler = function() {
            var currentTime = new _hcmn_.Date().getTime();
            var dt = currentTime - this.time;
            this.time = currentTime;
            var $it0 = this.fadeSoundsMap.iterator();
            while ($it0.hasNext()) {
                var soundValue = $it0.next();
                if (soundValue.timeout <= 0) {
                    if (soundValue.stopAfterComplete) {
                        this.verifySoundOnExists(soundValue.sound);
                        this.soundPort.stop().publish(soundValue.sound);
                        this.fadeSoundsMap.remove(soundValue.sound);
                        this.getSound(soundValue.sound).isPlayed = soundValue.volume == 1;
                    }
                    continue;
                }
                soundValue.timeout -= dt;
                if (soundValue.volumeOFsset == 0) continue;
                var isFadeOut = soundValue.volumeOFsset < 0;
                if (isFadeOut && soundValue.volume == 0 || !isFadeOut && soundValue.volume == 1) continue;
                soundValue.volume += soundValue.volumeOFsset * (dt / this.frameRate);
                if (soundValue.volume < .005) soundValue.volume = 0;
                else if (soundValue.volume > 1) soundValue.volume = 1;
                this.setVolume(soundValue.sound, soundValue.volume);
            }
        };
        soundEventTool.SoundPortHelper.prototype.verifySoundOnExists = function(sound1) {
            var result = this.soundMapForVerification == null || Object.prototype.hasOwnProperty.call(this.soundMapForVerification, sound1);
            if (!result) this.logger.warn("sound: " + sound1 + " is not present in sound map list");
            return result;
        };
        soundEventTool.SoundPortHelper.prototype.getSound = function(sound1) {
            if (!this.soundsMap.exists(sound1)) {
                var value = new sound.Sound(sound1);
                this.soundsMap.set(sound1, value);
            }
            return this.soundsMap.get(sound1);
        };
        soundEventTool.SoundPortHelper.prototype.__class__ = soundEventTool.SoundPortHelper;
        if (typeof sound == 'undefined') {
            var sound = {};
        };
        sound.FadeValue = function(sound1, timeout, volume) {
            if (volume == null) volume = 1;
            this.volumeOFsset = 0;
            this.volume = 1;
            this.sound = sound1;
            this.timeout = timeout;
            this.volume = volume;
        };
        sound.FadeValue.__name__ = ["sound", "FadeValue"];
        sound.FadeValue.prototype.sound = null;
        sound.FadeValue.prototype.timeout = null;
        sound.FadeValue.prototype.volume = null;
        sound.FadeValue.prototype.stopAfterComplete = null;
        sound.FadeValue.prototype.volumeOFsset = null;
        sound.FadeValue.prototype.__class__ = sound.FadeValue;
        sound.Sound = function(sound1) {
            this.isLocked = false;
            this.isPlayed = false;
            this.volume = 1;
        };
        sound.Sound.__name__ = ["sound", "Sound"];
        sound.Sound.prototype.sound = null;
        sound.Sound.prototype.volume = null;
        sound.Sound.prototype.isPlayed = null;
        sound.Sound.prototype.isLocked = null;
        sound.Sound.prototype.__class__ = sound.Sound;
        return {
            exports: soundEventTool
        };
    });