define("clientKernelTestable", ["clientkernelTestableApi", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(clientkernelTestableApi, clientkernelEventbusApi, clientkernelModulesApi) {
        "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 clientKernelTestable == 'undefined') {
            var clientKernelTestable = {};
        };
        clientKernelTestable.Activator = function() {};
        clientKernelTestable.Activator = ck_implements(clientKernelTestable.Activator, clientkernelModulesApi.IModuleActivator);
        clientKernelTestable.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        clientKernelTestable.Activator.__name__ = ["clientKernelTestable", "Activator"];
        clientKernelTestable.Activator.prototype.start = function(context) {
            var _g = this;
            context.getServiceTracker([clientkernelEventbusApi.IEventBus]).then(function(context1) {
                var t = false;
                var testableString = _g.getUrlParam("testable");
                if (testableString != null) {
                    if (testableString == "1") t = true;
                }
                context1.registerService(new clientKernelTestable.Testable(t, context1.getAnyService(clientkernelEventbusApi.IEventBus, null)), clientkernelTestableApi.ITestable, null);
            });
        };
        clientKernelTestable.Activator.prototype.stop = function(context) {};
        clientKernelTestable.Activator.prototype.getUrlParam = function(param) {
            var urlParams;
            if (window.location != window.parent.location) urlParams = window.document.referrer.split("?")[1];
            else urlParams = window.document.location.search.split("?")[1];
            if (urlParams == null) return null;
            var vars = urlParams.split("&");
            var _g1 = 0;
            var _g = vars.length;
            while (_g1 < _g) {
                var i = _g1++;
                var pair = vars[i].split("=");
                if (pair[0] == param) return pair[1];
            }
            return null;
        };
        clientKernelTestable.Activator.main = function() {};
        clientKernelTestable.Activator.prototype.__class__ = clientKernelTestable.Activator;
        clientKernelTestable.NonTestableLogger = function() {};
        clientKernelTestable.NonTestableLogger = ck_implements(clientKernelTestable.NonTestableLogger, clientkernelTestableApi.ITestableLogger);
        clientKernelTestable.NonTestableLogger.__interfaces__ = [clientkernelTestableApi.ITestableLogger];
        clientKernelTestable.NonTestableLogger.__name__ = ["clientKernelTestable", "NonTestableLogger"];
        clientKernelTestable.NonTestableLogger.prototype.info = function(object, payload) {};
        clientKernelTestable.NonTestableLogger.prototype.__class__ = clientKernelTestable.NonTestableLogger;
        clientKernelTestable.Testable = function(enabled, bus) {
            this.bus = bus;
            this.enabled = enabled;
        };
        clientKernelTestable.Testable = ck_implements(clientKernelTestable.Testable, clientkernelModulesApi.IService);
        clientKernelTestable.Testable = ck_implements(clientKernelTestable.Testable, clientkernelTestableApi.ITestable);
        clientKernelTestable.Testable.__interfaces__ = [clientkernelModulesApi.IService, clientkernelTestableApi.ITestable];
        clientKernelTestable.Testable.__name__ = ["clientKernelTestable", "Testable"];
        clientKernelTestable.Testable.prototype.enabled = null;
        clientKernelTestable.Testable.prototype.bus = null;
        clientKernelTestable.Testable.prototype.getLogger = function(context) {
            if (this.enabled) return new clientKernelTestable.TestableLogger(context.getModule().getSymbolicName(), this.bus.getChannel("TBus"));
            else return clientKernelTestable.Testable.disabled;
        };
        clientKernelTestable.Testable.prototype.__class__ = clientKernelTestable.Testable;
        clientKernelTestable.TestableLogger = function(modulename, channel) {
            this.channel = channel;
            this.modulename = modulename;
        };
        clientKernelTestable.TestableLogger = ck_implements(clientKernelTestable.TestableLogger, clientkernelTestableApi.ITestableLogger);
        clientKernelTestable.TestableLogger.__interfaces__ = [clientkernelTestableApi.ITestableLogger];
        clientKernelTestable.TestableLogger.__name__ = ["clientKernelTestable", "TestableLogger"];
        clientKernelTestable.TestableLogger.prototype.modulename = null;
        clientKernelTestable.TestableLogger.prototype.channel = null;
        clientKernelTestable.TestableLogger.prototype.info = function(object, payload) {
            this.channel.publish("testable:" + this.modulename + ":" + object, payload);
        };
        clientKernelTestable.TestableLogger.prototype.__class__ = clientKernelTestable.TestableLogger;
        clientKernelTestable.Testable.disabled = new clientKernelTestable.NonTestableLogger();;
        return {
            exports: clientKernelTestable,
            activator: clientKernelTestable.Activator
        };
    });