(function() {
    "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, '');
    };
    var clientkernelModulesApi = function() {};
    clientkernelModulesApi.__name__ = ["clientkernelModulesApi"];
    clientkernelModulesApi.init = function() {};
    clientkernelModulesApi.prototype.__class__ = clientkernelModulesApi;
    if (typeof clientkernelModules == 'undefined') {
        var clientkernelModules = {};
    };
    clientkernelModules.Modules = function() {
        this.moduleRegistry = new _hcmn_.haxe_ds_StringMap();
    };
    clientkernelModules.Modules.__name__ = ["clientkernelModules", "Modules"];
    clientkernelModules.Modules.prototype.moduleRegistry = null;
    clientkernelModules.Modules.prototype.installBootstrapModule = function(mdef) {
        var key = mdef.getId();
        this.moduleRegistry.set(key, mdef);
    };
    clientkernelModules.Modules.prototype.installModule = function(mdef) {
        mdef.setState(clientkernelModulesApi.ModuleState.INSTALLED);
        var key = mdef.getId();
        this.moduleRegistry.set(key, mdef);
        this.resolve();
        this.activate();
    };
    clientkernelModules.Modules.prototype.restartModule = function(name) {
        var mdef = this.moduleRegistry.get(name);
        mdef.setState(clientkernelModulesApi.ModuleState.RESOLVED);
        this.activate();
    };
    clientkernelModules.Modules.prototype.verifyAllModulesResolved = function() {
        var $it0 = this.moduleRegistry.keys();
        while ($it0.hasNext()) {
            var mdefkey = $it0.next();
            var mdef = this.moduleRegistry.get(mdefkey);
            if (mdef.getState() == clientkernelModulesApi.ModuleState.INSTALLED || mdef.getState() == clientkernelModulesApi.ModuleState.UNINSTALLED) throw new Error("Unresolved modules exist.");
        }
    };
    clientkernelModules.Modules.prototype.resolve = function() {
        var $it0 = this.moduleRegistry.iterator();
        while ($it0.hasNext()) {
            var mdef = $it0.next();
            if (mdef.getState() == clientkernelModulesApi.ModuleState.INSTALLED) {
                var unreferenced = mdef.getUnreferencedDependency();
                while (unreferenced != null)
                    if (this.moduleRegistry.exists(unreferenced)) {
                        mdef.reference(this.moduleRegistry.get(unreferenced));
                        unreferenced = mdef.getUnreferencedDependency();
                    } else break;
            }
        }
        var resolvedOne;
        do {
            resolvedOne = false;
            var $it1 = this.moduleRegistry.iterator();
            while ($it1.hasNext()) {
                var mdef1 = $it1.next();
                if (mdef1.getState() == clientkernelModulesApi.ModuleState.INSTALLED && mdef1.getUnreferencedDependency() == null) {
                    if (mdef1.areAllDependenciesResolved()) {
                        mdef1.setState(clientkernelModulesApi.ModuleState.RESOLVED);
                        resolvedOne = true;
                    }
                }
            }
        } while (resolvedOne);
    };
    clientkernelModules.Modules.prototype.activate = function() {
        var $it0 = this.moduleRegistry.iterator();
        while ($it0.hasNext()) {
            var mdef = $it0.next();
            if (mdef.getState() == clientkernelModulesApi.ModuleState.RESOLVED) {
                mdef.setState(clientkernelModulesApi.ModuleState.STARTING);
                mdef.setState(clientkernelModulesApi.ModuleState.ACTIVE);
            }
        }
    };
    clientkernelModules.Modules.getInstance = function() {
        if (clientkernelModules.Modules.instance == null) clientkernelModules.Modules.instance = new clientkernelModules.Modules();
        return clientkernelModules.Modules.instance;
    };
    clientkernelModules.Modules.verify = function() {
        clientkernelModules.Modules.getInstance().verifyAllModulesResolved();
    };
    clientkernelModules.Modules.bootstrap = function(kernelApi) {
        clientkernelModules.Modules.getInstance().installBootstrapModule(new clientkernelModules.ModuleDefinition("clientkernelModulesApi", [], null, null).boostrap(kernelApi));
    };
    clientkernelModules.Modules.define = function(a1, a2, a3) {
        var module;
        var dependencies;
        var declaration;
        var shim = null;
        if (typeof a1 == "string") {
            module = a1;
            if (typeof a2 != "function") {
                dependencies = a2;
                declaration = a3;
            } else {
                dependencies = ["require", "exports", "module"];
                declaration = a2;
            }
        } else {
            module = define.amd.module;
            define.amd.module = undefined;;
            if (module == null) module = "unknown";
            if (typeof a1 != "function") {
                dependencies = a1;
                declaration = a2;
            } else {
                dependencies = ["require", "exports", "module"];
                declaration = a1;
            }
        }
        shim = define.amd.shim;
        define.amd.shim = undefined;;
        clientkernelModules.Modules.getInstance().installModule(new clientkernelModules.ModuleDefinition(module, dependencies, declaration, shim));
    };
    clientkernelModules.Modules.prototype.__class__ = clientkernelModules.Modules;
    clientkernelModules.ModuleDefinition = function(id, dependencies, declaration, shim) {
        this.mdl = null;
        this.activator = null;
        this.id = id;
        this.dependencies = dependencies;
        this.declaration = declaration;
        this.shim = shim;
        this.state = clientkernelModulesApi.ModuleState.UNINSTALLED;
        this.unreferenced = new _hcmn_.haxe_ds_StringMap();
        var _g = 0;
        while (_g < dependencies.length) {
            var i = dependencies[_g];
            ++_g;
            if (_hcmn_.HxOverrides.indexOf(["require", "exports", "module"], i, 0) == -1) this.unreferenced.set(i, null);
        }
        this.referenced = new _hcmn_.haxe_ds_StringMap();
    };
    clientkernelModules.ModuleDefinition.__name__ = ["clientkernelModules", "ModuleDefinition"];
    clientkernelModules.ModuleDefinition.prototype.id = null;
    clientkernelModules.ModuleDefinition.prototype.dependencies = null;
    clientkernelModules.ModuleDefinition.prototype.declaration = null;
    clientkernelModules.ModuleDefinition.prototype.unreferenced = null;
    clientkernelModules.ModuleDefinition.prototype.referenced = null;
    clientkernelModules.ModuleDefinition.prototype.definition = null;
    clientkernelModules.ModuleDefinition.prototype.context = null;
    clientkernelModules.ModuleDefinition.prototype.activator = null;
    clientkernelModules.ModuleDefinition.prototype.shim = null;
    clientkernelModules.ModuleDefinition.prototype.mdl = null;
    clientkernelModules.ModuleDefinition.prototype.state = null;
    clientkernelModules.ModuleDefinition.prototype.boostrap = function(exports) {
        this.definition = exports;
        this.state = clientkernelModulesApi.ModuleState.ACTIVE;
        return this;
    };
    clientkernelModules.ModuleDefinition.prototype.setState = function(state) {
        if (this.mdl == null) this.mdl = new clientkernelModules.Module(this);
        if (this.context == null) this.context = new clientkernelModules.ModuleContext(this.mdl);
        if (this.state == clientkernelModulesApi.ModuleState.INSTALLED && state == clientkernelModulesApi.ModuleState.RESOLVED) {
            this.onResolved();
            this.context.triggerModuleEvent(this.mdl, clientkernelModulesApi.ModuleEventType.RESOLVED);
        } else if (state == clientkernelModulesApi.ModuleState.STARTING) {
            this.context.triggerModuleEvent(this.mdl, clientkernelModulesApi.ModuleEventType.STARTING);
            this.onActivated();
            this.context.triggerModuleEvent(this.mdl, clientkernelModulesApi.ModuleEventType.STARTED);
        } else if (this.state == clientkernelModulesApi.ModuleState.ACTIVE && state == clientkernelModulesApi.ModuleState.RESOLVED) this.onDeactivate();
        this.state = state;
    };
    clientkernelModules.ModuleDefinition.prototype.getId = function() {
        return this.id;
    };
    clientkernelModules.ModuleDefinition.prototype.getState = function() {
        return this.state;
    };
    clientkernelModules.ModuleDefinition.prototype.getUnreferencedDependency = function() {
        if (this.unreferenced.keys().hasNext()) return this.unreferenced.keys().next();
        else return null;
    };
    clientkernelModules.ModuleDefinition.prototype.reference = function(res) {
        if ((function($this) {
                var $r;
                var key = res.getId();
                $r = $this.unreferenced.exists(key);
                return $r;
            }(this))) {
            var key1 = res.getId();
            this.unreferenced.remove(key1);
            var key2 = res.getId();
            this.referenced.set(key2, res);
        } else throw new Error("Trying to reference non dependency");
    };
    clientkernelModules.ModuleDefinition.prototype.getReferencedDependencies = function() {
        return this.referenced;
    };
    clientkernelModules.ModuleDefinition.prototype.areAllDependenciesResolved = function() {
        if (this.state == clientkernelModulesApi.ModuleState.RESOLVED || this.state == clientkernelModulesApi.ModuleState.ACTIVE) return true;
        if (this.getUnreferencedDependency() != null) return false;
        var found = false;
        var rm = [];
        var xm = new _hcmn_.haxe_ds_StringMap();
        var $it0 = this.referenced.iterator();
        while ($it0.hasNext()) {
            var i = $it0.next();
            if (i.getState() == clientkernelModulesApi.ModuleState.UNINSTALLED || i.getState() == clientkernelModulesApi.ModuleState.INSTALLED) rm.push(i);
            if (i.getState() == clientkernelModulesApi.ModuleState.UNINSTALLED || i.getState() == clientkernelModulesApi.ModuleState.INSTALLED || i.getState() == clientkernelModulesApi.ModuleState.STOPPING) found = true;
        }
        return !found;
    };
    clientkernelModules.ModuleDefinition.prototype.getGlobal = function() {
        return clientkernelModules.ModuleDefinition.global;
    };
    clientkernelModules.ModuleDefinition.prototype.getExports = function() {
        if (this.state == clientkernelModulesApi.ModuleState.RESOLVED || this.state == clientkernelModulesApi.ModuleState.ACTIVE) {
            if (Object.prototype.hasOwnProperty.call(this.definition, "exports")) return this.definition.exports;
            else return this.definition;
        } else throw new Error("Export from unresolved module");
    };
    clientkernelModules.ModuleDefinition.prototype.require = function(module) {
        if (this.referenced.exists(module)) return this.referenced.get(module).getExports();
        else throw new Error("non-dependent module required: " + module);
    };
    clientkernelModules.ModuleDefinition.prototype.getFnParamNames = function(fn) {
        return fn.toString().match(/\(.*?\)/)[0].replace(/[()]/gi, '').replace(/\s/gi, '').split(',');
    };
    clientkernelModules.ModuleDefinition.prototype.onResolved = function() {
        var params = [];
        var _g = 0;
        var _g1 = this.dependencies;
        while (_g < _g1.length) {
            var p = _g1[_g];
            ++_g;
            switch (p) {
                case "":
                    null;
                    break;
                case "require":
                    params.push($bind(this, this.require));
                    break;
                case "exports":
                    params.push(this.getGlobal());
                    break;
                case "module":
                    params.push({
                        id: this.id
                    });
                    break;
                default:
                    params.push(this.require(p));
            }
        }
        var fun = this.declaration;
        this.definition = fun.apply(null, params);
        if (this.shim != null) {
            var shimdef = this.shim;
            this.definition = eval(shimdef);
        }
        if (this.definition == null) this.definition = {};
    };
    clientkernelModules.ModuleDefinition.prototype.onActivated = function() {
        if (Object.prototype.hasOwnProperty.call(this.definition, "activator")) {
            var def = this.definition;
            var actd = new def.activator();
            if (ck_instanceof(actd, clientkernelModulesApi.IModuleActivator)) {
                this.activator = ck_cast(actd, clientkernelModulesApi.IModuleActivator);
                this.activator.start(this.context);
            } else {
                this.setState(clientkernelModulesApi.ModuleState.STOPPING);
                throw new Error("illegal activator.");
            }
        }
    };
    clientkernelModules.ModuleDefinition.prototype.onDeactivate = function() {
        if (Object.prototype.hasOwnProperty.call(this.definition, "activator")) {
            var def = this.definition;
            if (this.activator != null) {
                this.activator.stop(this.context);
                this.activator = null;
            } else {
                this.setState(clientkernelModulesApi.ModuleState.STOPPING);
                throw new Error("illegal activator.");
            }
        }
    };
    clientkernelModules.ModuleDefinition.prototype.__class__ = clientkernelModules.ModuleDefinition;
    clientkernelModules.Main = function() {
        var x = window.getBootstrapModules();
        var _g = 0;
        while (_g < x.length) {
            var i = x[_g];
            ++_g;
            if (i.module == "clientkernelModulesApi") {
                var kernelApiExports = i.definition();
                clientkernelModulesApi = kernelApiExports.exports;;
                clientkernelModules.Main.kernelApiExports = kernelApiExports;
            }
        }
    };
    clientkernelModules.Main.__name__ = ["clientkernelModules", "Main"];
    clientkernelModules.Main.kernelApiExports = null;
    clientkernelModules.Main.main = function() {
        clientkernelModulesApi.init();
    };
    clientkernelModules.Main.run = function() {
        window.define = clientkernelModules.Modules.define;
        window.define.amd = {};
        window.define.verify = clientkernelModules.Modules.verify;
        clientkernelModules.Modules.bootstrap(clientkernelModules.Main.kernelApiExports);
        return null;
    };
    clientkernelModules.Main.prototype.__class__ = clientkernelModules.Main;
    clientkernelModules.Main.startup = new clientkernelModules.Main();
    clientkernelModules.Module = function(mdef) {
        this.mdef = mdef;
    };
    clientkernelModules.Module = ck_implements(clientkernelModules.Module, clientkernelModulesApi.IModule);
    clientkernelModules.Module.__interfaces__ = [clientkernelModulesApi.IModule];
    clientkernelModules.Module.__name__ = ["clientkernelModules", "Module"];
    clientkernelModules.Module.prototype.mdef = null;
    clientkernelModules.Module.prototype.getState = function() {
        return this.mdef.getState();
    };
    clientkernelModules.Module.prototype.getSymbolicName = function() {
        return this.mdef.getId();
    };
    clientkernelModules.Module.prototype.getVersion = function() {
        return "tbd";
    };
    clientkernelModules.Module.prototype.__class__ = clientkernelModules.Module;
    clientkernelModules.KernelListenerAdapter = function() {};
    clientkernelModules.KernelListenerAdapter.__name__ = ["clientkernelModules", "KernelListenerAdapter"];
    clientkernelModules.KernelListenerAdapter.prototype.apply = function(listener, data) {
        listener.kernelEvent(data);
    };
    clientkernelModules.KernelListenerAdapter.prototype.__class__ = clientkernelModules.KernelListenerAdapter;
    clientkernelModules.Event = function(adapter) {
        this.signal = new _hcmn_.msignal_Signal1();
        this.adapter = adapter;
        this.listeners = [];
    };
    clientkernelModules.Event.__name__ = ["clientkernelModules", "Event"];
    clientkernelModules.Event.prototype.signal = null;
    clientkernelModules.Event.prototype.adapter = null;
    clientkernelModules.Event.prototype.listeners = null;
    clientkernelModules.Event.prototype.addListener = function(listener) {
        var x = new clientkernelModules.AdaptedListener(this.adapter, listener);
        this.listeners.push(x);
        this.signal.add($bind(x, x.apply));
    };
    clientkernelModules.Event.prototype.removeListener = function(listener) {
        var _g = 0;
        var _g1 = this.listeners;
        while (_g < _g1.length) {
            var i = _g1[_g];
            ++_g;
            if (i.getListener() == listener) this.signal.remove(i.apply);
        }
    };
    clientkernelModules.Event.prototype.dispatch = function(data) {
        this.signal.dispatch(data);
    };
    clientkernelModules.Event.prototype.__class__ = clientkernelModules.Event;
    clientkernelModules.ModuleListenerAdapter = function() {};
    clientkernelModules.ModuleListenerAdapter.__name__ = ["clientkernelModules", "ModuleListenerAdapter"];
    clientkernelModules.ModuleListenerAdapter.prototype.apply = function(listener, data) {
        listener.moduleChanged(data);
    };
    clientkernelModules.ModuleListenerAdapter.prototype.__class__ = clientkernelModules.ModuleListenerAdapter;
    clientkernelModules.ServiceListenerAdapter = function() {};
    clientkernelModules.ServiceListenerAdapter.__name__ = ["clientkernelModules", "ServiceListenerAdapter"];
    clientkernelModules.ServiceListenerAdapter.prototype.apply = function(listener, data) {
        listener.serviceChanged(data);
    };
    clientkernelModules.ServiceListenerAdapter.prototype.__class__ = clientkernelModules.ServiceListenerAdapter;
    clientkernelModules.ServiceRegistry = function() {
        this.services = new haxe.ds.ObjectMap();
    };
    clientkernelModules.ServiceRegistry.__name__ = ["clientkernelModules", "ServiceRegistry"];
    clientkernelModules.ServiceRegistry.prototype.services = null;
    clientkernelModules.ServiceRegistry.prototype.registerService = function(context, service, iface, properties) {
        var sr = new clientkernelModules.ServiceRegistration(this, context, service, iface, properties);
        if (!this.services.exists(iface)) this.services.set(iface, []);
        this.services.get(iface).push(sr);
        context.triggerServiceEvent(sr);
        return sr;
    };
    clientkernelModules.ServiceRegistry.prototype.expandFilter = function(props, value) {
        if (value == null) return null;
        var ret = value;
        var index = 0;
        var indexe;
        while ((index = ret.indexOf("${", index)) != -1) {
            if (ret.indexOf("}", index) == -1) return ret;
            var name = ret.substring(index + 2, indexe = ret.indexOf("}", index));
            if (_hcmn_.__map_reserved[name] != null ? props.existsReserved(name) : props.h.hasOwnProperty(name)) name = _hcmn_.__map_reserved[name] != null ? props.getReserved(name) : props.h[name];
            else name = "${" + name + "}";
            var rl = ret.length;
            ret = _hcmn_.HxOverrides.substr(ret, 0, index) + name + _hcmn_.HxOverrides.substr(ret, indexe + 1, null);
        }
        return ret;
    };
    clientkernelModules.ServiceRegistry.prototype.meets = function(filter) {
        var _g = this;
        return function(reg) {
            if (filter == null) return true;
            var expr = _g.expandFilter(reg.getProperties(), filter);
            var b = eval(expr);
            return b;
        };
    };
    clientkernelModules.ServiceRegistry.prototype.getAnyService = function(iface, filter) {
        if (!this.services.exists(iface)) return null;
        var _g = 0;
        var _g1 = this.services.get(iface);
        while (_g < _g1.length) {
            var i = _g1[_g];
            ++_g;
            if ((this.meets(filter))(i)) return i.getService();
        }
        return null;
    };
    clientkernelModules.ServiceRegistry.prototype.getServices = function(iface, filter) {
        var ret = null;
        if (!this.services.exists(iface)) return ret;
        var _g = 0;
        var _g1 = this.services.get(iface);
        while (_g < _g1.length) {
            var i = _g1[_g];
            ++_g;
            if ((this.meets(filter))(i)) {
                if (ret == null) ret = [];
                ret.push(i.getService());
            }
        }
        return ret;
    };
    clientkernelModules.ServiceRegistry.prototype.unregister = function(serviceRegistration, iface) {
        var _this = this.services.get(iface);
        _hcmn_.HxOverrides.remove(_this, serviceRegistration);
    };
    clientkernelModules.ServiceRegistry.prototype.__class__ = clientkernelModules.ServiceRegistry;
    if (typeof haxe == 'undefined') {
        var haxe = {};
    };

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

    };
    if (!haxe.ds) {
        haxe.ds = {};
    };
    haxe.ds.ObjectMap = function() {
        this.h = {};
        this.h.__keys__ = {};
    };
    haxe.ds.ObjectMap.__interfaces__ = [haxe.IMap];
    haxe.ds.ObjectMap.__name__ = ["haxe", "ds", "ObjectMap"];
    haxe.ds.ObjectMap.prototype.h = null;
    haxe.ds.ObjectMap.prototype.set = function(key, value) {
        var id = key.__id__ || (key.__id__ = ++haxe.ds.ObjectMap.count);
        this.h[id] = value;
        this.h.__keys__[id] = key;
    };
    haxe.ds.ObjectMap.prototype.get = function(key) {
        return this.h[key.__id__];
    };
    haxe.ds.ObjectMap.prototype.exists = function(key) {
        return this.h.__keys__[key.__id__] != null;
    };
    haxe.ds.ObjectMap.prototype.remove = function(key) {
        var id = key.__id__;
        if (this.h.__keys__[id] == null) return false;
        delete(this.h[id]);
        delete(this.h.__keys__[id]);
        return true;
    };
    haxe.ds.ObjectMap.prototype.keys = function() {
        var a = [];
        for (var key in this.h.__keys__) {
            if (this.h.hasOwnProperty(key)) a.push(this.h.__keys__[key]);
        }
        return _hcmn_.HxOverrides.iter(a);
    };
    haxe.ds.ObjectMap.prototype.__class__ = haxe.ds.ObjectMap;
    clientkernelModules.ModuleContext = function(mdl) {
        this.mdl = mdl;
    };
    clientkernelModules.ModuleContext = ck_implements(clientkernelModules.ModuleContext, clientkernelModulesApi.IModuleContext);
    clientkernelModules.ModuleContext.__interfaces__ = [clientkernelModulesApi.IModuleContext];
    clientkernelModules.ModuleContext.__name__ = ["clientkernelModules", "ModuleContext"];
    clientkernelModules.ModuleContext.prototype.mdl = null;
    clientkernelModules.ModuleContext.prototype.addKernelListener = function(listener) {
        clientkernelModules.ModuleContext.KERNEL_EVENT.addListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.addModuleListener = function(listener) {
        clientkernelModules.ModuleContext.MODULE_EVENT.addListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.addServiceListener = function(listener) {
        clientkernelModules.ModuleContext.SERVICE_EVENT.addListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.getModule = function() {
        return this.mdl;
    };
    clientkernelModules.ModuleContext.prototype.restartModule = function(name) {
        clientkernelModules.Modules.getInstance().restartModule(name);
    };
    clientkernelModules.ModuleContext.prototype.getProperty = function(key) {
        return null;
    };
    clientkernelModules.ModuleContext.prototype.getAnyService = function(iface, filter) {
        return clientkernelModules.ModuleContext.serviceRegistry.getAnyService(iface, filter);
    };
    clientkernelModules.ModuleContext.prototype.getServices = function(iface, filter) {
        return clientkernelModules.ModuleContext.serviceRegistry.getServices(iface, filter);
    };
    clientkernelModules.ModuleContext.prototype.getServiceTracker = function(ifaces) {
        return clientkernelModules.ServiceTracker.promise(this, ifaces);
    };
    clientkernelModules.ModuleContext.prototype.registerService = function(service, iface, properties) {
        var props = new _hcmn_.haxe_ds_StringMap();
        var _g = 0;
        var _g1 = _hcmn_.Reflect.fields(properties);
        while (_g < _g1.length) {
            var i = _g1[_g];
            ++_g;
            var value = "" + _hcmn_.Std.string(_hcmn_.Reflect.field(properties, i));
            if (_hcmn_.__map_reserved[i] != null) props.setReserved(i, value);
            else props.h[i] = value;
        }
        return clientkernelModules.ModuleContext.serviceRegistry.registerService(this, service, iface, props);
    };
    clientkernelModules.ModuleContext.prototype.removeKernelListener = function(listener) {
        clientkernelModules.ModuleContext.KERNEL_EVENT.removeListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.removeModuleListener = function(listener) {
        clientkernelModules.ModuleContext.MODULE_EVENT.removeListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.removeServiceListener = function(listener) {
        clientkernelModules.ModuleContext.SERVICE_EVENT.removeListener(listener);
    };
    clientkernelModules.ModuleContext.prototype.triggerModuleEvent = function(mdl, type) {
        clientkernelModules.ModuleContext.MODULE_EVENT.dispatch(new clientkernelModules.ModuleEvent(mdl, type));
    };
    clientkernelModules.ModuleContext.prototype.triggerServiceEvent = function(sreg) {
        clientkernelModules.ModuleContext.SERVICE_EVENT.dispatch(new clientkernelModules.ServiceEvent(sreg, clientkernelModulesApi.ServiceEventType.REGISTERED));
    };
    clientkernelModules.ModuleContext.prototype.__class__ = clientkernelModules.ModuleContext;
    clientkernelModules.ModuleEvent = function(mdl, type) {
        this.mdl = mdl;
        this.type = type;
    };
    clientkernelModules.ModuleEvent = ck_implements(clientkernelModules.ModuleEvent, clientkernelModulesApi.IModuleEvent);
    clientkernelModules.ModuleEvent.__interfaces__ = [clientkernelModulesApi.IModuleEvent];
    clientkernelModules.ModuleEvent.__name__ = ["clientkernelModules", "ModuleEvent"];
    clientkernelModules.ModuleEvent.prototype.mdl = null;
    clientkernelModules.ModuleEvent.prototype.type = null;
    clientkernelModules.ModuleEvent.prototype.getModule = function() {
        return this.mdl;
    };
    clientkernelModules.ModuleEvent.prototype.getType = function() {
        return this.type;
    };
    clientkernelModules.ModuleEvent.prototype.__class__ = clientkernelModules.ModuleEvent;
    clientkernelModules.ServiceEvent = function(sreg, etype) {
        this.sreg = sreg;
        this.etype = etype;
    };
    clientkernelModules.ServiceEvent = ck_implements(clientkernelModules.ServiceEvent, clientkernelModulesApi.IServiceEvent);
    clientkernelModules.ServiceEvent.__interfaces__ = [clientkernelModulesApi.IServiceEvent];
    clientkernelModules.ServiceEvent.__name__ = ["clientkernelModules", "ServiceEvent"];
    clientkernelModules.ServiceEvent.prototype.sreg = null;
    clientkernelModules.ServiceEvent.prototype.etype = null;
    clientkernelModules.ServiceEvent.prototype.getInterface = function() {
        return this.sreg.getInterface();
    };
    clientkernelModules.ServiceEvent.prototype.getService = function() {
        return this.sreg.getService();
    };
    clientkernelModules.ServiceEvent.prototype.getType = function() {
        return this.etype;
    };
    clientkernelModules.ServiceEvent.prototype.__class__ = clientkernelModules.ServiceEvent;
    clientkernelModules.ServiceRegistration = function(registry, context, service, iface, properties) {
        this.registry = registry;
        this.context = context;
        this.service = service;
        this.iface = iface;
        this.properties = properties;
    };
    clientkernelModules.ServiceRegistration = ck_implements(clientkernelModules.ServiceRegistration, clientkernelModulesApi.IServiceRegistration);
    clientkernelModules.ServiceRegistration.__interfaces__ = [clientkernelModulesApi.IServiceRegistration];
    clientkernelModules.ServiceRegistration.__name__ = ["clientkernelModules", "ServiceRegistration"];
    clientkernelModules.ServiceRegistration.prototype.context = null;
    clientkernelModules.ServiceRegistration.prototype.service = null;
    clientkernelModules.ServiceRegistration.prototype.properties = null;
    clientkernelModules.ServiceRegistration.prototype.iface = null;
    clientkernelModules.ServiceRegistration.prototype.registry = null;
    clientkernelModules.ServiceRegistration.prototype.setProperties = function(properties) {
        this.properties = properties;
    };
    clientkernelModules.ServiceRegistration.prototype.getProperties = function() {
        return this.properties;
    };
    clientkernelModules.ServiceRegistration.prototype.getService = function() {
        return this.service;
    };
    clientkernelModules.ServiceRegistration.prototype.getInterface = function() {
        return this.iface;
    };
    clientkernelModules.ServiceRegistration.prototype.unregister = function() {
        this.registry.unregister(this, this.iface);
    };
    clientkernelModules.ServiceRegistration.prototype.__class__ = clientkernelModules.ServiceRegistration;
    clientkernelModules.ServiceTracker = function(ctx, pending, resolve) {
        this.pending = null;
        this.ctx = ctx;
        this.pending = pending;
        this.resolve = resolve;
    };
    clientkernelModules.ServiceTracker = ck_implements(clientkernelModules.ServiceTracker, clientkernelModulesApi.IServiceListener);
    clientkernelModules.ServiceTracker.__interfaces__ = [clientkernelModulesApi.IServiceListener];
    clientkernelModules.ServiceTracker.__name__ = ["clientkernelModules", "ServiceTracker"];
    clientkernelModules.ServiceTracker.prototype.pending = null;
    clientkernelModules.ServiceTracker.prototype.ctx = null;
    clientkernelModules.ServiceTracker.prototype.resolve = null;
    clientkernelModules.ServiceTracker.prototype.serviceChanged = function(event) {
        if (this.pending == null) return;
        var $it0 = this.pending.keys();
        while ($it0.hasNext()) {
            var i = $it0.next();
            if (i == event.getInterface()) {
                this.pending.remove(i);
                if (!this.pending.keys().hasNext()) {
                    this.ctx.removeServiceListener(this);
                    this.resolve(this.ctx);
                }
            }
        }
    };
    clientkernelModules.ServiceTracker.promise = function(ctx, ifaces) {
        return new Promise(function(resolve, reject) {
            var pending = null;
            var _g = 0;
            while (_g < ifaces.length) {
                var i = ifaces[_g];
                ++_g;
                if (ctx.getAnyService(i, null) == null) {
                    if (pending == null) pending = new haxe.ds.ObjectMap();
                    pending.set(i, i);
                }
            }
            if (pending == null) resolve(ctx);
            else ctx.addServiceListener(new clientkernelModules.ServiceTracker(ctx, pending, resolve));
        });
    };
    clientkernelModules.ServiceTracker.prototype.__class__ = clientkernelModules.ServiceTracker;
    clientkernelModules.AdaptedListener = function(a, l) {
        this.adapter = a;
        this.listener = l;
    };
    clientkernelModules.AdaptedListener.__name__ = ["clientkernelModules", "AdaptedListener"];
    clientkernelModules.AdaptedListener.prototype.adapter = null;
    clientkernelModules.AdaptedListener.prototype.listener = null;
    clientkernelModules.AdaptedListener.prototype.apply = function(data) {
        this.adapter.apply(this.listener, data);
    };
    clientkernelModules.AdaptedListener.prototype.getListener = function() {
        return this.listener;
    };
    clientkernelModules.AdaptedListener.prototype.__class__ = clientkernelModules.AdaptedListener;
    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;
    clientkernelModules.Modules.instance = null;;
    clientkernelModules.ModuleDefinition.global = {};;;
    clientkernelModules.Main.init = clientkernelModules.Main.run();;
    clientkernelModules.ModuleListenerAdapter.x = "me";;
    haxe.ds.ObjectMap.count = 0;;
    clientkernelModules.ModuleContext.KERNEL_EVENT = new clientkernelModules.Event(new clientkernelModules.KernelListenerAdapter());;
    clientkernelModules.ModuleContext.MODULE_EVENT = new clientkernelModules.Event(new clientkernelModules.ModuleListenerAdapter());;
    clientkernelModules.ModuleContext.SERVICE_EVENT = new clientkernelModules.Event(new clientkernelModules.ServiceListenerAdapter());;
    clientkernelModules.ModuleContext.serviceRegistry = new clientkernelModules.ServiceRegistry();;
})();
//# sourceURL=modules.js