// temporary debug mute for test // 
if (window.document.location.search.split("&").indexOf("debug=1") == -1) {
    console.debug = function() {};
    console.log = function() {};
    console.info = function() {};
    console.warning = function() {};
}



// <Common haxe code> extracted from all modules ---------------------- //
// This is temporary solution - js should be dynamically injected into the page before all other haxe generated scripts

(function(Y) {
    function C(a, b) {
        function c() {}
        c.prototype = a;
        var d = new c,
            g;
        for (g in b) d[g] = b[g];
        b.toString !== Object.prototype.toString && (d.toString = b.toString);
        return d
    }

    function w(a) {
        return a instanceof Array ? function() {
            return h.iter(a)
        } : "function" == typeof a.iterator ? fa(a, a.iterator) : a.iterator
    }

    function fa(a, b) {
        if (null == b) return null;
        null == b.__id__ && (b.__id__ = ga++);
        var c;
        null == a.hx__closures__ ? a.hx__closures__ = {} : c = a.hx__closures__[b.__id__];
        null == c && (c = function() {
                return c.method.apply(c.scope, arguments)
            },
            c.scope = a, c.method = b, a.hx__closures__[b.__id__] = c);
        return c
    }
    var f = {},
        D = function() {
            return k.__string_rec(this, "")
        },
        t = function() {};
    f.DateTools = t;
    t.__name__ = ["DateTools"];
    t.__format_get = function(a, b) {
        switch (b) {
            case "%":
                return "%";
            case "C":
                return n.lpad(l.string(l["int"](a.getFullYear() / 100)), "0", 2);
            case "d":
                return n.lpad(l.string(a.getDate()), "0", 2);
            case "D":
                return t.__format(a, "%m/%d/%y");
            case "e":
                return l.string(a.getDate());
            case "F":
                return t.__format(a, "%Y-%m-%d");
            case "H":
            case "k":
                return n.lpad(l.string(a.getHours()),
                    "H" == b ? "0" : " ", 2);
            case "I":
            case "l":
                var c = a.getHours() % 12;
                return n.lpad(l.string(0 == c ? 12 : c), "I" == b ? "0" : " ", 2);
            case "m":
                return n.lpad(l.string(a.getMonth() + 1), "0", 2);
            case "M":
                return n.lpad(l.string(a.getMinutes()), "0", 2);
            case "n":
                return "\n";
            case "p":
                return 11 < a.getHours() ? "PM" : "AM";
            case "r":
                return t.__format(a, "%I:%M:%S %p");
            case "R":
                return t.__format(a, "%H:%M");
            case "s":
                return l.string(l["int"](a.getTime() / 1E3));
            case "S":
                return n.lpad(l.string(a.getSeconds()), "0", 2);
            case "t":
                return "\t";
            case "T":
                return t.__format(a,
                    "%H:%M:%S");
            case "u":
                return c = a.getDay(), 0 == c ? "7" : null == c ? "null" : "" + c;
            case "w":
                return l.string(a.getDay());
            case "y":
                return n.lpad(l.string(a.getFullYear() % 100), "0", 2);
            case "Y":
                return l.string(a.getFullYear());
            default:
                throw new p("Date.format %" + b + "- not implemented yet.");
        }
    };
    t.__format = function(a, b) {
        for (var c = new E, d = 0;;) {
            var g = b.indexOf("%", d);
            if (0 > g) break;
            c.addSub(b, d, g - d);
            c.add(t.__format_get(a, h.substr(b, g + 1, 1)));
            d = g + 2
        }
        c.addSub(b, d, b.length - d);
        return c.b
    };
    t.format = function(a, b) {
        return t.__format(a,
            b)
    };
    t.delta = function(a, b) {
        var c = a.getTime() + b,
            d = new Date;
        d.setTime(c);
        return d
    };
    t.getMonthDays = function(a) {
        var b = a.getMonth();
        a = a.getFullYear();
        return 1 != b ? t.DAYS_OF_MONTH[b] : 0 == a % 4 && 0 != a % 100 || 0 == a % 400 ? 29 : 28
    };
    t.seconds = function(a) {
        return 1E3 * a
    };
    t.minutes = function(a) {
        return 6E4 * a
    };
    t.hours = function(a) {
        return 36E5 * a
    };
    t.days = function(a) {
        return 864E5 * a
    };
    t.parse = function(a) {
        var b = a / 1E3,
            c = b / 60,
            d = c / 60;
        return {
            ms: a % 1E3,
            seconds: b % 60 | 0,
            minutes: c % 60 | 0,
            hours: d % 24 | 0,
            days: d / 24 | 0
        }
    };
    t.make = function(a) {
        return a.ms +
            1E3 * (a.seconds + 60 * (a.minutes + 60 * (a.hours + 24 * a.days)))
    };
    t.makeUtc = function(a, b, c, d, g, e) {
        return Date.UTC(a, b, c, d, g, e)
    };
    var T = function(a, b) {
        b = b.split("u").join("");
        this.r = new RegExp(a, b)
    };
    f.EReg = T;
    T.__name__ = ["EReg"];
    T.prototype = {
        r: null,
        match: function(a) {
            this.r.global && (this.r.lastIndex = 0);
            this.r.m = this.r.exec(a);
            this.r.s = a;
            return null != this.r.m
        },
        matched: function(a) {
            if (null != this.r.m && 0 <= a && a < this.r.m.length) return this.r.m[a];
            throw new p("EReg::matched");
        },
        matchedLeft: function() {
            if (null == this.r.m) throw new p("No string matched");
            return h.substr(this.r.s, 0, this.r.m.index)
        },
        matchedRight: function() {
            if (null == this.r.m) throw new p("No string matched");
            var a = this.r.m.index + this.r.m[0].length;
            return h.substr(this.r.s, a, this.r.s.length - a)
        },
        matchedPos: function() {
            if (null == this.r.m) throw new p("No string matched");
            return {
                pos: this.r.m.index,
                len: this.r.m[0].length
            }
        },
        matchSub: function(a, b, c) {
            null == c && (c = -1);
            if (this.r.global) {
                this.r.lastIndex = b;
                this.r.m = this.r.exec(0 > c ? a : h.substr(a, 0, b + c));
                if (b = null != this.r.m) this.r.s = a;
                return b
            }
            if (c = this.match(0 >
                    c ? h.substr(a, b, null) : h.substr(a, b, c))) this.r.s = a, this.r.m.index += b;
            return c
        },
        split: function(a) {
            return a.replace(this.r, "#__delim__#").split("#__delim__#")
        },
        replace: function(a, b) {
            return a.replace(this.r, b)
        },
        map: function(a, b) {
            var c = 0,
                d = new E;
            do {
                if (c >= a.length) break;
                else if (!this.matchSub(a, c)) {
                    d.add(h.substr(a, c, null));
                    break
                }
                var g = this.matchedPos();
                d.add(h.substr(a, c, g.pos - c));
                d.add(b(this));
                0 == g.len ? (d.add(h.substr(a, g.pos, 1)), c = g.pos + 1) : c = g.pos + g.len
            } while (this.r.global);
            !this.r.global && 0 < c && c < a.length &&
                d.add(h.substr(a, c, null));
            return d.b
        },
        __class__: T
    };
    var h = function() {};
    f.HxOverrides = h;
    h.__name__ = ["HxOverrides"];
    h.dateStr = function(a) {
        var b = a.getMonth() + 1,
            c = a.getDate(),
            d = a.getHours(),
            g = a.getMinutes(),
            e = a.getSeconds();
        return a.getFullYear() + "-" + (10 > b ? "0" + b : "" + b) + "-" + (10 > c ? "0" + c : "" + c) + " " + (10 > d ? "0" + d : "" + d) + ":" + (10 > g ? "0" + g : "" + g) + ":" + (10 > e ? "0" + e : "" + e)
    };
    h.strDate = function(a) {
        switch (a.length) {
            case 8:
                a = a.split(":");
                var b = new Date;
                b.setTime(0);
                b.setUTCHours(a[0]);
                b.setUTCMinutes(a[1]);
                b.setUTCSeconds(a[2]);
                return b;
            case 10:
                return a = a.split("-"), new Date(a[0], a[1] - 1, a[2], 0, 0, 0);
            case 19:
                return b = a.split(" "), a = b[0].split("-"), b = b[1].split(":"), new Date(a[0], a[1] - 1, a[2], b[0], b[1], b[2]);
            default:
                throw new p("Invalid date format : " + a);
        }
    };
    h.cca = function(a, b) {
        var c = a.charCodeAt(b);
        return c != c ? void 0 : c
    };
    h.substr = function(a, b, c) {
        if (null != b && 0 != b && null != c && 0 > c) return "";
        null == c && (c = a.length);
        0 > b ? (b = a.length + b, 0 > b && (b = 0)) : 0 > c && (c = a.length + c - b);
        return a.substr(b, c)
    };
    h.indexOf = function(a, b, c) {
        var d = a.length;
        0 > c &&
            (c += d, 0 > c && (c = 0));
        for (; c < d;) {
            if (a[c] === b) return c;
            c++
        }
        return -1
    };
    h.lastIndexOf = function(a, b, c) {
        var d = a.length;
        for (c >= d ? c = d - 1 : 0 > c && (c += d); 0 <= c;) {
            if (a[c] === b) return c;
            c--
        }
        return -1
    };
    h.remove = function(a, b) {
        var c = h.indexOf(a, b, 0);
        if (-1 == c) return !1;
        a.splice(c, 1);
        return !0
    };
    h.iter = function(a) {
        return {
            cur: 0,
            arr: a,
            hasNext: function() {
                return this.cur < this.arr.length
            },
            next: function() {
                return this.arr[this.cur++]
            }
        }
    };
    var F = function(a, b) {
        this.min = a;
        this.max = b
    };
    f.IntIterator = F;
    F.__name__ = ["IntIterator"];
    F.prototype = {
        min: null,
        max: null,
        hasNext: function() {
            return this.min < this.max
        },
        next: function() {
            return this.min++
        },
        __class__: F
    };
    var v = function() {};
    f.Lambda = v;
    v.__name__ = ["Lambda"];
    v.array = function(a) {
        var b = [];
        for (a = w(a)(); a.hasNext();) {
            var c = a.next();
            b.push(c)
        }
        return b
    };
    v.list = function(a) {
        var b = new z;
        for (a = w(a)(); a.hasNext();) {
            var c = a.next();
            b.add(c)
        }
        return b
    };
    v.map = function(a, b) {
        for (var c = new z, d = w(a)(); d.hasNext();) {
            var g = d.next();
            c.add(b(g))
        }
        return c
    };
    v.mapi = function(a, b) {
        for (var c = new z, d = 0, g = w(a)(); g.hasNext();) {
            var e =
                g.next();
            c.add(b(d++, e))
        }
        return c
    };
    v.has = function(a, b) {
        for (var c = w(a)(); c.hasNext();)
            if (c.next() == b) return !0;
        return !1
    };
    v.exists = function(a, b) {
        for (var c = w(a)(); c.hasNext();) {
            var d = c.next();
            if (b(d)) return !0
        }
        return !1
    };
    v.foreach = function(a, b) {
        for (var c = w(a)(); c.hasNext();) {
            var d = c.next();
            if (!b(d)) return !1
        }
        return !0
    };
    v.iter = function(a, b) {
        for (var c = w(a)(); c.hasNext();) {
            var d = c.next();
            b(d)
        }
    };
    v.filter = function(a, b) {
        for (var c = new z, d = w(a)(); d.hasNext();) {
            var g = d.next();
            b(g) && c.add(g)
        }
        return c
    };
    v.fold = function(a,
        b, c) {
        for (a = w(a)(); a.hasNext();) {
            var d = a.next();
            c = b(d, c)
        }
        return c
    };
    v.count = function(a, b) {
        var c = 0;
        if (null == b)
            for (var d = w(a)(); d.hasNext();) d.next(), c++;
        else
            for (d = w(a)(); d.hasNext();) {
                var g = d.next();
                b(g) && c++
            }
        return c
    };
    v.empty = function(a) {
        return !w(a)().hasNext()
    };
    v.indexOf = function(a, b) {
        for (var c = 0, d = w(a)(); d.hasNext();) {
            var g = d.next();
            if (b == g) return c;
            c++
        }
        return -1
    };
    v.find = function(a, b) {
        for (var c = w(a)(); c.hasNext();) {
            var d = c.next();
            if (b(d)) return d
        }
        return null
    };
    v.concat = function(a, b) {
        for (var c = new z,
                d = w(a)(); d.hasNext();) {
            var g = d.next();
            c.add(g)
        }
        for (d = w(b)(); d.hasNext();) g = d.next(), c.add(g);
        return c
    };
    var z = function() {
        this.length = 0
    };
    f.List = z;
    z.__name__ = ["List"];
    z.prototype = {
        h: null,
        q: null,
        length: null,
        add: function(a) {
            a = [a];
            null == this.h ? this.h = a : this.q[1] = a;
            this.q = a;
            this.length++
        },
        push: function(a) {
            this.h = a = [a, this.h];
            null == this.q && (this.q = a);
            this.length++
        },
        first: function() {
            return null == this.h ? null : this.h[0]
        },
        last: function() {
            return null == this.q ? null : this.q[0]
        },
        pop: function() {
            if (null == this.h) return null;
            var a = this.h[0];
            this.h = this.h[1];
            null == this.h && (this.q = null);
            this.length--;
            return a
        },
        isEmpty: function() {
            return null == this.h
        },
        clear: function() {
            this.q = this.h = null;
            this.length = 0
        },
        remove: function(a) {
            for (var b = null, c = this.h; null != c;) {
                if (c[0] == a) return null == b ? this.h = c[1] : b[1] = c[1], this.q == c && (this.q = b), this.length--, !0;
                b = c;
                c = c[1]
            }
            return !1
        },
        iterator: function() {
            return new U(this.h)
        },
        toString: function() {
            var a, b = !0,
                c = this.h;
            for (a = "{"; null != c;) b ? b = !1 : a += ", ", a += l.string(l.string(c[0])), c = c[1];
            return a + "}"
        },
        join: function(a) {
            for (var b = new E, c = !0, d = this.h; null != d;) c ? c = !1 : b.b = null == a ? b.b + "null" : b.b + ("" + a), b.add(d[0]), d = d[1];
            return b.b
        },
        filter: function(a) {
            for (var b = new z, c = this.h; null != c;) {
                var d = c[0],
                    c = c[1];
                a(d) && b.add(d)
            }
            return b
        },
        map: function(a) {
            for (var b = new z, c = this.h; null != c;) {
                var d = c[0],
                    c = c[1];
                b.add(a(d))
            }
            return b
        },
        __class__: z
    };
    var U = function(a) {
        this.head = a;
        this.val = null
    };
    f["_List.ListIterator"] = U;
    U.__name__ = ["_List", "ListIterator"];
    U.prototype = {
        head: null,
        val: null,
        hasNext: function() {
            return null != this.head
        },
        next: function() {
            this.val = this.head[0];
            this.head = this.head[1];
            return this.val
        },
        __class__: U
    };
    F = function() {};
    f.Main = F;
    F.__name__ = ["Main"];
    F.main = function() {
        window._hcmn_ = {};
        window._hcmn_.Std = l;
        window._hcmn_.EReg = T;
        window._hcmn_.List = z;
        window._hcmn_.Lambda = v;
        window._hcmn_.Reflect = m;
        window._hcmn_.StringBuf = E;
        window._hcmn_.StringTools = n;
        window._hcmn_.DateTools = t;
        window._hcmn_.Date = Date;
        window._hcmn_.HxOverrides = h;
        window._hcmn_.ValueType = e;
        window._hcmn_.Type = q;
        window._hcmn_.Math = Math;
        window._hcmn_.Int = ba;
        window._hcmn_.Float = Z;
        window._hcmn_.Bool = aa;
        window._hcmn_.Dynamic = ca;
        window._hcmn_.Class = da;
        window._hcmn_.Enum = ea;
        window._hcmn_.js_Boot = k;
        window._hcmn_.haxe_ds_StringMap = O;
        window._hcmn_.haxe_ds_IntMap = H;
        window._hcmn_.haxe_Timer = B;
        window._hcmn_.__map_reserved = J;
        window._hcmn_.msignal_Event = I;
        window._hcmn_.msignal_EventSlot = A;
        window._hcmn_.msignal_SignalEvent = P;
        window._hcmn_.msignal_Signal = x;
        window._hcmn_.msignal_Signal0 = Q;
        window._hcmn_.msignal_Signal1 = R;
        window._hcmn_.msignal_Signal2 = S;
        window._hcmn_.msignal_Slot =
            y;
        window._hcmn_.msignal_Slot0 = K;
        window._hcmn_.msignal_Slot1 = L;
        window._hcmn_.msignal_Slot2 = M;
        window._hcmn_.msignal_SlotList = r;
        window._hcmn_.msignal_EventDispatcher = N
    };
    Math.__name__ = ["Math"];
    var m = function() {};
    f.Reflect = m;
    m.__name__ = ["Reflect"];
    m.hasField = function(a, b) {
        return Object.prototype.hasOwnProperty.call(a, b)
    };
    m.field = function(a, b) {
        try {
            return a[b]
        } catch (c) {
            return haxe_CallStack.lastException = c, c instanceof p && (c = c.val), null
        }
    };
    m.setField = function(a, b, c) {
        a[b] = c
    };
    m.getProperty = function(a, b) {
        var c;
        return null == a ? null : a.__properties__ && (c = a.__properties__["get_" + b]) ? a[c]() : a[b]
    };
    m.setProperty = function(a, b, c) {
        var d;
        if (a.__properties__ && (d = a.__properties__["set_" + b])) a[d](c);
        else a[b] = c
    };
    m.callMethod = function(a, b, c) {
        return b.apply(a, c)
    };
    m.fields = function(a) {
        var b = [];
        if (null != a) {
            var c = Object.prototype.hasOwnProperty,
                d;
            for (d in a) "__id__" != d && "hx__closures__" != d && c.call(a, d) && b.push(d)
        }
        return b
    };
    m.isFunction = function(a) {
        return "function" == typeof a && !(a.__name__ || a.__ename__)
    };
    m.compare = function(a,
        b) {
        return a == b ? 0 : a > b ? 1 : -1
    };
    m.compareMethods = function(a, b) {
        return a == b ? !0 : m.isFunction(a) && m.isFunction(b) ? a.scope == b.scope && a.method == b.method && null != a.method : !1
    };
    m.isObject = function(a) {
        if (null == a) return !1;
        var b = typeof a;
        return "string" == b || "object" == b && null == a.__enum__ || "function" == b && null != (a.__name__ || a.__ename__)
    };
    m.isEnumValue = function(a) {
        return null != a && null != a.__enum__
    };
    m.deleteField = function(a, b) {
        if (!Object.prototype.hasOwnProperty.call(a, b)) return !1;
        delete a[b];
        return !0
    };
    m.copy = function(a) {
        for (var b = {}, c = 0, d = m.fields(a); c < d.length;) {
            var g = d[c];
            ++c;
            m.setField(b, g, m.field(a, g))
        }
        return b
    };
    m.makeVarArgs = function(a) {
        return function() {
            var b = Array.prototype.slice.call(arguments);
            return a(b)
        }
    };
    var l = function() {};
    f.Std = l;
    l.__name__ = ["Std"];
    l.is = function(a, b) {
        return k.__instanceof(a, b)
    };
    l.instance = function(a, b) {
        return a instanceof b ? a : null
    };
    l.string = function(a) {
        return k.__string_rec(a, "")
    };
    l["int"] = function(a) {
        return a | 0
    };
    l.parseInt = function(a) {
        var b = parseInt(a, 10);
        0 != b || 120 != h.cca(a, 1) && 88 != h.cca(a, 1) ||
            (b = parseInt(a));
        return isNaN(b) ? null : b
    };
    l.parseFloat = function(a) {
        return parseFloat(a)
    };
    l.random = function(a) {
        return 0 >= a ? 0 : Math.floor(Math.random() * a)
    };
    var E = function() {
        this.b = ""
    };
    f.StringBuf = E;
    E.__name__ = ["StringBuf"];
    E.prototype = {
        b: null,
        get_length: function() {
            return this.b.length
        },
        add: function(a) {
            this.b += l.string(a)
        },
        addChar: function(a) {
            this.b += String.fromCharCode(a)
        },
        addSub: function(a, b, c) {
            this.b = null == c ? this.b + h.substr(a, b, null) : this.b + h.substr(a, b, c)
        },
        toString: function() {
            return this.b
        },
        __class__: E,
        __properties__: {
            get_length: "get_length"
        }
    };
    var n = function() {};
    f.StringTools = n;
    n.__name__ = ["StringTools"];
    n.urlEncode = function(a) {
        return encodeURIComponent(a)
    };
    n.urlDecode = function(a) {
        return decodeURIComponent(a.split("+").join(" "))
    };
    n.htmlEscape = function(a, b) {
        a = a.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
        return b ? a.split('"').join("&quot;").split("'").join("&#039;") : a
    };
    n.htmlUnescape = function(a) {
        return a.split("&gt;").join(">").split("&lt;").join("<").split("&quot;").join('"').split("&#039;").join("'").split("&amp;").join("&")
    };
    n.startsWith = function(a, b) {
        return a.length >= b.length && h.substr(a, 0, b.length) == b
    };
    n.endsWith = function(a, b) {
        var c = b.length,
            d = a.length;
        return d >= c && h.substr(a, d - c, c) == b
    };
    n.isSpace = function(a, b) {
        var c = h.cca(a, b);
        return 8 < c && 14 > c || 32 == c
    };
    n.ltrim = function(a) {
        for (var b = a.length, c = 0; c < b && n.isSpace(a, c);) c++;
        return 0 < c ? h.substr(a, c, b - c) : a
    };
    n.rtrim = function(a) {
        for (var b = a.length, c = 0; c < b && n.isSpace(a, b - c - 1);) c++;
        return 0 < c ? h.substr(a, 0, b - c) : a
    };
    n.trim = function(a) {
        return n.ltrim(n.rtrim(a))
    };
    n.lpad = function(a,
        b, c) {
        if (0 >= b.length) return a;
        for (; a.length < c;) a = b + a;
        return a
    };
    n.rpad = function(a, b, c) {
        if (0 >= b.length) return a;
        for (; a.length < c;) a += b;
        return a
    };
    n.replace = function(a, b, c) {
        return a.split(b).join(c)
    };
    n.hex = function(a, b) {
        var c = "";
        do c = "0123456789ABCDEF".charAt(a & 15) + c, a >>>= 4; while (0 < a);
        if (null != b)
            for (; c.length < b;) c = "0" + c;
        return c
    };
    n.fastCodeAt = function(a, b) {
        return a.charCodeAt(b)
    };
    n.isEof = function(a) {
        return a != a
    };
    var e = f.ValueType = {
        __ename__: ["ValueType"],
        __constructs__: "TNull TInt TFloat TBool TObject TFunction TClass TEnum TUnknown".split(" ")
    };
    e.TNull = ["TNull", 0];
    e.TNull.toString = D;
    e.TNull.__enum__ = e;
    e.TInt = ["TInt", 1];
    e.TInt.toString = D;
    e.TInt.__enum__ = e;
    e.TFloat = ["TFloat", 2];
    e.TFloat.toString = D;
    e.TFloat.__enum__ = e;
    e.TBool = ["TBool", 3];
    e.TBool.toString = D;
    e.TBool.__enum__ = e;
    e.TObject = ["TObject", 4];
    e.TObject.toString = D;
    e.TObject.__enum__ = e;
    e.TFunction = ["TFunction", 5];
    e.TFunction.toString = D;
    e.TFunction.__enum__ = e;
    e.TClass = function(a) {
        a = ["TClass", 6, a];
        a.__enum__ = e;
        a.toString = D;
        return a
    };
    e.TEnum = function(a) {
        a = ["TEnum", 7, a];
        a.__enum__ = e;
        a.toString =
            D;
        return a
    };
    e.TUnknown = ["TUnknown", 8];
    e.TUnknown.toString = D;
    e.TUnknown.__enum__ = e;
    e.__empty_constructs__ = [e.TNull, e.TInt, e.TFloat, e.TBool, e.TObject, e.TFunction, e.TUnknown];
    var q = function() {};
    f.Type = q;
    q.__name__ = ["Type"];
    q.getClass = function(a) {
        return null == a ? null : k.getClass(a)
    };
    q.getEnum = function(a) {
        return null == a ? null : a.__enum__
    };
    q.getSuperClass = function(a) {
        return a.__super__
    };
    q.getClassName = function(a) {
        a = a.__name__;
        return null == a ? null : a.join(".")
    };
    q.getEnumName = function(a) {
        return a.__ename__.join(".")
    };
    q.resolveClass = function(a) {
        a = f[a];
        return null != a && a.__name__ ? a : null
    };
    q.resolveEnum = function(a) {
        a = f[a];
        return null != a && a.__ename__ ? a : null
    };
    q.createInstance = function(a, b) {
        switch (b.length) {
            case 0:
                return new a;
            case 1:
                return new a(b[0]);
            case 2:
                return new a(b[0], b[1]);
            case 3:
                return new a(b[0], b[1], b[2]);
            case 4:
                return new a(b[0], b[1], b[2], b[3]);
            case 5:
                return new a(b[0], b[1], b[2], b[3], b[4]);
            case 6:
                return new a(b[0], b[1], b[2], b[3], b[4], b[5]);
            case 7:
                return new a(b[0], b[1], b[2], b[3], b[4], b[5], b[6]);
            case 8:
                return new a(b[0],
                    b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
            default:
                throw new p("Too many arguments");
        }
    };
    q.createEmptyInstance = function(a) {
        function b() {}
        b.prototype = a.prototype;
        return new b
    };
    q.createEnum = function(a, b, c) {
        var d = m.field(a, b);
        if (null == d) throw new p("No such constructor " + b);
        if (m.isFunction(d)) {
            if (null == c) throw new p("Constructor " + b + " need parameters");
            return m.callMethod(a, d, c)
        }
        if (null != c && 0 != c.length) throw new p("Constructor " + b + " does not need parameters");
        return d
    };
    q.createEnumIndex = function(a, b, c) {
        var d =
            a.__constructs__[b];
        if (null == d) throw new p(b + " is not a valid enum constructor index");
        return q.createEnum(a, d, c)
    };
    q.getInstanceFields = function(a) {
        var b = [],
            c;
        for (c in a.prototype) b.push(c);
        h.remove(b, "__class__");
        h.remove(b, "__properties__");
        return b
    };
    q.getClassFields = function(a) {
        a = m.fields(a);
        h.remove(a, "__name__");
        h.remove(a, "__interfaces__");
        h.remove(a, "__properties__");
        h.remove(a, "__super__");
        h.remove(a, "__meta__");
        h.remove(a, "prototype");
        return a
    };
    q.getEnumConstructs = function(a) {
        return a.__constructs__.slice()
    };
    q["typeof"] = function(a) {
        switch (typeof a) {
            case "boolean":
                return e.TBool;
            case "string":
                return e.TClass(String);
            case "number":
                return Math.ceil(a) == a % 2147483648 ? e.TInt : e.TFloat;
            case "object":
                if (null == a) return e.TNull;
                var b = a.__enum__;
                if (null != b) return e.TEnum(b);
                a = k.getClass(a);
                return null != a ? e.TClass(a) : e.TObject;
            case "function":
                return a.__name__ || a.__ename__ ? e.TObject : e.TFunction;
            case "undefined":
                return e.TNull;
            default:
                return e.TUnknown
        }
    };
    q.enumEq = function(a, b) {
        if (a == b) return !0;
        try {
            if (a[0] != b[0]) return !1;
            for (var c = 2, d = a.length; c < d;) {
                var g = c++;
                if (!q.enumEq(a[g], b[g])) return !1
            }
            var e = a.__enum__;
            if (e != b.__enum__ || null == e) return !1
        } catch (f) {
            return haxe_CallStack.lastException = f, f instanceof p && (f = f.val), !1
        }
        return !0
    };
    q.enumConstructor = function(a) {
        return a[0]
    };
    q.enumParameters = function(a) {
        return a.slice(2)
    };
    q.enumIndex = function(a) {
        return a[1]
    };
    q.allEnums = function(a) {
        return a.__empty_constructs__
    };
    var u = function() {};
    f["haxe.IMap"] = u;
    u.__name__ = ["haxe", "IMap"];
    u.prototype = {
        get: null,
        set: null,
        exists: null,
        remove: null,
        keys: null,
        iterator: null,
        toString: null,
        __class__: u
    };
    var V = function() {};
    f["haxe.Log"] = V;
    V.__name__ = ["haxe", "Log"];
    V.trace = function(a, b) {
        k.__trace(a, b)
    };
    V.clear = function() {
        k.__clear_trace()
    };
    var B = function(a) {
        var b = this;
        this.id = setInterval(function() {
            b.run()
        }, a)
    };
    f["haxe.Timer"] = B;
    B.__name__ = ["haxe", "Timer"];
    B.delay = function(a, b) {
        var c = new B(b);
        c.run = function() {
            c.stop();
            a()
        };
        return c
    };
    B.measure = function(a, b) {
        var c = B.stamp(),
            d = a();
        V.trace(B.stamp() - c + "s", b);
        return d
    };
    B.stamp = function() {
        return (new Date).getTime() /
            1E3
    };
    B.prototype = {
        id: null,
        stop: function() {
            null != this.id && (clearInterval(this.id), this.id = null)
        },
        run: function() {},
        __class__: B
    };
    var G = {};
    f["haxe.ds._HashMap.HashMap_Impl_"] = G;
    G.__name__ = ["haxe", "ds", "_HashMap", "HashMap_Impl_"];
    G._new = function() {
        return new W
    };
    G.set = function(a, b, c) {
        a.keys.set(b.hashCode(), b);
        a.values.set(b.hashCode(), c)
    };
    G.get = function(a, b) {
        return a.values.get(b.hashCode())
    };
    G.exists = function(a, b) {
        return a.values.exists(b.hashCode())
    };
    G.remove = function(a, b) {
        a.values.remove(b.hashCode());
        return a.keys.remove(b.hashCode())
    };
    G.keys = function(a) {
        return a.keys.iterator()
    };
    G.iterator = function(a) {
        return a.values.iterator()
    };
    var W = function() {
        this.keys = new H;
        this.values = new H
    };
    f["haxe.ds._HashMap.HashMapData"] = W;
    W.__name__ = ["haxe", "ds", "_HashMap", "HashMapData"];
    W.prototype = {
        keys: null,
        values: null,
        __class__: W
    };
    var H = function() {
        this.h = {}
    };
    f["haxe.ds.IntMap"] = H;
    H.__name__ = ["haxe", "ds", "IntMap"];
    H.__interfaces__ = [u];
    H.prototype = {
        h: null,
        set: function(a, b) {
            this.h[a] = b
        },
        get: function(a) {
            return this.h[a]
        },
        exists: function(a) {
            return this.h.hasOwnProperty(a)
        },
        remove: function(a) {
            if (!this.h.hasOwnProperty(a)) return !1;
            delete this.h[a];
            return !0
        },
        keys: function() {
            var a = [],
                b;
            for (b in this.h) this.h.hasOwnProperty(b) && a.push(b | 0);
            return h.iter(a)
        },
        iterator: function() {
            return {
                ref: this.h,
                it: this.keys(),
                hasNext: function() {
                    return this.it.hasNext()
                },
                next: function() {
                    var a = this.it.next();
                    return this.ref[a]
                }
            }
        },
        toString: function() {
            var a;
            a = "{";
            for (var b = this.keys(); b.hasNext();) {
                var c = b.next();
                a = null == c ? a + "null" : a + ("" + c);
                a += " => ";
                a += l.string(l.string(this.h[c]));
                b.hasNext() && (a += ", ")
            }
            return a + "}"
        },
        __class__: H
    };
    var X = function(a, b) {
        this.map = a;
        this.keys = b;
        this.index = 0;
        this.count = b.length
    };
    f["haxe.ds._StringMap.StringMapIterator"] = X;
    X.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
    X.prototype = {
        map: null,
        keys: null,
        index: null,
        count: null,
        hasNext: function() {
            return this.index < this.count
        },
        next: function() {
            return this.map.get(this.keys[this.index++])
        },
        __class__: X
    };
    var O = function() {
        this.h = {}
    };
    f["haxe.ds.StringMap"] =
        O;
    O.__name__ = ["haxe", "ds", "StringMap"];
    O.__interfaces__ = [u];
    O.prototype = {
        h: null,
        rh: null,
        isReserved: function(a) {
            return null != J[a]
        },
        set: function(a, b) {
            null != J[a] ? this.setReserved(a, b) : this.h[a] = b
        },
        get: function(a) {
            return null != J[a] ? this.getReserved(a) : this.h[a]
        },
        exists: function(a) {
            return null != J[a] ? this.existsReserved(a) : this.h.hasOwnProperty(a)
        },
        setReserved: function(a, b) {
            null == this.rh && (this.rh = {});
            this.rh["$" + a] = b
        },
        getReserved: function(a) {
            return null == this.rh ? null : this.rh["$" + a]
        },
        existsReserved: function(a) {
            return null ==
                this.rh ? !1 : this.rh.hasOwnProperty("$" + a)
        },
        remove: function(a) {
            if (null != J[a]) {
                a = "$" + a;
                if (null == this.rh || !this.rh.hasOwnProperty(a)) return !1;
                delete this.rh[a]
            } else {
                if (!this.h.hasOwnProperty(a)) return !1;
                delete this.h[a]
            }
            return !0
        },
        keys: function() {
            var a = this.arrayKeys();
            return h.iter(a)
        },
        arrayKeys: function() {
            var a = [],
                b;
            for (b in this.h) this.h.hasOwnProperty(b) && a.push(b);
            if (null != this.rh)
                for (b in this.rh) 36 == b.charCodeAt(0) && a.push(b.substr(1));
            return a
        },
        iterator: function() {
            return new X(this, this.arrayKeys())
        },
        toString: function() {
            var a = new E;
            a.b += "{";
            for (var b = this.arrayKeys(), c = 0, d = b.length; c < d;) {
                var g = c++,
                    e = b[g];
                a.b = null == e ? a.b + "null" : a.b + ("" + e);
                a.b += " => ";
                a.add(l.string(null != J[e] ? this.getReserved(e) : this.h[e]));
                g < b.length && (a.b += ", ")
            }
            a.b += "}";
            return a.b
        },
        __class__: O
    };
    var p = function(a) {
        Error.call(this);
        this.val = a;
        this.message = String(a);
        Error.captureStackTrace && Error.captureStackTrace(this, p)
    };
    f["js._Boot.HaxeError"] = p;
    p.__name__ = ["js", "_Boot", "HaxeError"];
    p.__super__ = Error;
    p.prototype = C(Error.prototype, {
        val: null,
        __class__: p
    });
    var k = function() {};
    f["js.Boot"] = k;
    k.__name__ = ["js", "Boot"];
    k.__unhtml = function(a) {
        return a.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;")
    };
    k.__trace = function(a, b) {
        var c;
        c = null != b ? b.fileName + ":" + b.lineNumber + ": " : "";
        c += k.__string_rec(a, "");
        if (null != b && null != b.customParams)
            for (var d = 0, g = b.customParams; d < g.length;) {
                var e = g[d];
                ++d;
                c += "," + k.__string_rec(e, "")
            }
        var f;
        "undefined" != typeof document && null != (f = document.getElementById("haxe:trace")) ? f.innerHTML +=
            k.__unhtml(c) + "<br/>" : "undefined" != typeof Y && null != Y.log && Y.log(c)
    };
    k.__clear_trace = function() {
        var a = document.getElementById("haxe:trace");
        null != a && (a.innerHTML = "")
    };
    k.isClass = function(a) {
        return a.__name__
    };
    k.isEnum = function(a) {
        return a.__ename__
    };
    k.getClass = function(a) {
        if (a instanceof Array && null == a.__enum__) return Array;
        var b = a.__class__;
        if (null != b) return b;
        a = k.__nativeClassName(a);
        return null != a ? k.__resolveNativeClass(a) : null
    };
    k.__string_rec = function(a, b) {
        if (null == a) return "null";
        if (5 <= b.length) return "<...>";
        var c = typeof a;
        "function" == c && (a.__name__ || a.__ename__) && (c = "object");
        switch (c) {
            case "object":
                if (a instanceof Array) {
                    if (a.__enum__) {
                        if (2 == a.length) return a[0];
                        c = a[0] + "(";
                        b += "\t";
                        for (var d = 2, g = a.length; d < g;) var e = d++,
                            c = 2 != e ? c + ("," + k.__string_rec(a[e], b)) : c + k.__string_rec(a[e], b);
                        return c + ")"
                    }
                    c = a.length;
                    d = "[";
                    b += "\t";
                    for (g = 0; g < c;) e = g++, d += (0 < e ? "," : "") + k.__string_rec(a[e], b);
                    return d + "]"
                }
                try {
                    d = a.toString
                } catch (f) {
                    return haxe_CallStack.lastException = f, f instanceof p && (f = f.val), "???"
                }
                if (null != d && d != Object.toString &&
                    "function" == typeof d && (c = a.toString(), "[object Object]" != c)) return c;
                c = null;
                d = "{\n";
                b += "\t";
                g = null != a.hasOwnProperty;
                for (c in a) g && !a.hasOwnProperty(c) || "prototype" == c || "__class__" == c || "__super__" == c || "__interfaces__" == c || "__properties__" == c || (2 != d.length && (d += ", \n"), d += b + c + " : " + k.__string_rec(a[c], b));
                b = b.substring(1);
                return d + ("\n" + b + "}");
            case "function":
                return "<function>";
            case "string":
                return a;
            default:
                return String(a)
        }
    };
    k.__interfLoop = function(a, b) {
        if (null == a) return !1;
        if (a == b) return !0;
        var c =
            a.__interfaces__;
        if (null != c)
            for (var d = 0, e = c.length; d < e;) {
                var f = d++,
                    f = c[f];
                if (f == b || k.__interfLoop(f, b)) return !0
            }
        return k.__interfLoop(a.__super__, b)
    };
    k.__instanceof = function(a, b) {
        if (null == b) return !1;
        switch (b) {
            case ba:
                return (a | 0) === a;
            case Z:
                return "number" == typeof a;
            case aa:
                return "boolean" == typeof a;
            case String:
                return "string" == typeof a;
            case Array:
                return a instanceof Array && null == a.__enum__;
            case ca:
                return !0;
            default:
                if (null != a)
                    if ("function" == typeof b) {
                        if (a instanceof b || k.__interfLoop(k.getClass(a), b)) return !0
                    } else {
                        if ("object" ==
                            typeof b && k.__isNativeObj(b) && a instanceof b) return !0
                    }
                else return !1;
                return b == da && null != a.__name__ || b == ea && null != a.__ename__ ? !0 : a.__enum__ == b
        }
    };
    k.__cast = function(a, b) {
        if (k.__instanceof(a, b)) return a;
        throw new p("Cannot cast " + l.string(a) + " to " + l.string(b));
    };
    k.__nativeClassName = function(a) {
        a = k.__toStr.call(a).slice(8, -1);
        return "Object" == a || "Function" == a || "Math" == a || "JSON" == a ? null : a
    };
    k.__isNativeObj = function(a) {
        return null != k.__nativeClassName(a)
    };
    k.__resolveNativeClass = function(a) {
        return Function("return typeof " +
            a + ' != "undefined" ? ' + a + " : null")()
    };
    u = function() {};
    f["js.Browser"] = u;
    u.__name__ = ["js", "Browser"];
    u.__properties__ = {
        get_supported: "get_supported",
        get_console: "get_console",
        get_navigator: "get_navigator",
        get_location: "get_location",
        get_document: "get_document",
        get_window: "get_window"
    };
    u.get_window = function() {
        return window
    };
    u.get_document = function() {
        return window.document
    };
    u.get_location = function() {
        return window.location
    };
    u.get_navigator = function() {
        return window.navigator
    };
    u.get_console = function() {
        return window.console
    };
    u.get_supported = function() {
        return "undefined" != typeof window
    };
    u.getLocalStorage = function() {
        try {
            var a = window.localStorage;
            a.getItem("");
            return a
        } catch (b) {
            return haxe_CallStack.lastException = b, b instanceof p && (b = b.val), null
        }
    };
    u.getSessionStorage = function() {
        try {
            var a = window.sessionStorage;
            a.getItem("");
            return a
        } catch (b) {
            return haxe_CallStack.lastException = b, b instanceof p && (b = b.val), null
        }
    };
    u.createXMLHttpRequest = function() {
        if ("undefined" != typeof XMLHttpRequest) return new XMLHttpRequest;
        if ("undefined" !=
            typeof ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
        throw new p("Unable to create XMLHttpRequest object.");
    };
    u.alert = function(a) {
        window.alert(k.__string_rec(a, ""))
    };
    u = function() {};
    f["js.html._CanvasElement.CanvasUtil"] = u;
    u.__name__ = ["js", "html", "_CanvasElement", "CanvasUtil"];
    u.getContextWebGL = function(a, b) {
        for (var c = 0, d = ["webgl", "experimental-webgl"]; c < d.length;) {
            var e = d[c];
            ++c;
            e = a.getContext(e, b);
            if (null != e) return e
        }
        return null
    };
    var x = function(a) {
        null == a && (a = []);
        this.valueClasses =
            a;
        this.slots = r.NIL;
        this.priorityBased = !1
    };
    f["msignal.Signal"] = x;
    x.__name__ = ["msignal", "Signal"];
    x.prototype = {
        valueClasses: null,
        numListeners: null,
        slots: null,
        priorityBased: null,
        add: function(a) {
            return this.registerListener(a)
        },
        addOnce: function(a) {
            return this.registerListener(a, !0)
        },
        addWithPriority: function(a, b) {
            null == b && (b = 0);
            return this.registerListener(a, !1, b)
        },
        addOnceWithPriority: function(a, b) {
            null == b && (b = 0);
            return this.registerListener(a, !0, b)
        },
        remove: function(a) {
            var b = this.slots.find(a);
            if (null ==
                b) return null;
            this.slots = this.slots.filterNot(a);
            return b
        },
        removeAll: function() {
            this.slots = r.NIL
        },
        registerListener: function(a, b, c) {
            null == c && (c = 0);
            null == b && (b = !1);
            return this.registrationPossible(a, b) ? (a = this.createSlot(a, b, c), this.priorityBased || 0 == c || (this.priorityBased = !0), this.slots = this.priorityBased || 0 != c ? this.slots.insertWithPriority(a) : this.slots.prepend(a), a) : this.slots.find(a)
        },
        registrationPossible: function(a, b) {
            if (!this.slots.nonEmpty) return !0;
            var c = this.slots.find(a);
            if (null == c) return !0;
            if (c.once != b) throw new p("You cannot addOnce() then add() the same listener without removing the relationship first.");
            return !1
        },
        createSlot: function(a, b, c) {
            return null
        },
        get_numListeners: function() {
            return this.slots.get_length()
        },
        __class__: x,
        __properties__: {
            get_numListeners: "get_numListeners"
        }
    };
    var P = function(a) {
        x.call(this, [I]);
        this.target = a
    };
    f["msignal.EventSignal"] = P;
    P.__name__ = ["msignal", "EventSignal"];
    P.__super__ = x;
    P.prototype = C(x.prototype, {
        target: null,
        dispatch: function(a) {
            null == a.target && (a.target =
                this.target, a.signal = this);
            a.currentTarget = this.target;
            for (var b = this.slots; b.nonEmpty;) b.head.execute(a), b = b.tail
        },
        dispatchType: function(a) {
            this.dispatch(new I(a))
        },
        bubble: function(a) {
            this.dispatch(a);
            for (var b = this.target; null != b && Object.prototype.hasOwnProperty.call(b, "parent") && (b = m.field(b, "parent"), !k.__instanceof(b, N) || (a.currentTarget = b, k.__cast(b, N).dispatchEvent(a))););
        },
        bubbleType: function(a) {
            this.bubble(new I(a))
        },
        createSlot: function(a, b, c) {
            null == c && (c = 0);
            null == b && (b = !1);
            return new A(this,
                a, b, c)
        },
        __class__: P
    });
    var y = function(a, b, c, d) {
        null == d && (d = 0);
        null == c && (c = !1);
        this.signal = a;
        this.set_listener(b);
        this.once = c;
        this.priority = d;
        this.enabled = !0
    };
    f["msignal.Slot"] = y;
    y.__name__ = ["msignal", "Slot"];
    y.prototype = {
        listener: null,
        once: null,
        priority: null,
        enabled: null,
        signal: null,
        remove: function() {
            this.signal.remove(this.listener)
        },
        set_listener: function(a) {
            if (null == a) throw new p("listener cannot be null");
            return this.listener = a
        },
        __class__: y,
        __properties__: {
            set_listener: "set_listener"
        }
    };
    var A = function(a,
        b, c, d) {
        null == d && (d = 0);
        null == c && (c = !1);
        y.call(this, a, b, c, d)
    };
    f["msignal.EventSlot"] = A;
    A.__name__ = ["msignal", "EventSlot"];
    A.typeEq = function(a, b) {
        if (a == b) return !0;
        switch (q["typeof"](a)[1]) {
            case 7:
                return A.enumTypeEq(a, b);
            default:
                return !1
        }
    };
    A.enumTypeEq = function(a, b) {
        if (a == b) return !0;
        if (q.getEnum(a) != q.getEnum(b) || a[1] != b[1]) return !1;
        var c = a.slice(2);
        if (0 == c.length) return !0;
        for (var d = b.slice(2), e = 0, f = c.length; e < f;) {
            var h = e++,
                k = c[h],
                h = d[h];
            if (null != k && !A.typeEq(k, h)) return !1
        }
        return !0
    };
    A.__super__ = y;
    A.prototype =
        C(y.prototype, {
            filterType: null,
            execute: function(a) {
                this.enabled && (null == this.filterType || A.typeEq(this.filterType, a.type)) && (this.once && this.remove(), this.listener(a))
            },
            forType: function(a) {
                this.filterType = a
            },
            __class__: A
        });
    var I = function(a) {
        this.type = a
    };
    f["msignal.Event"] = I;
    I.__name__ = ["msignal", "Event"];
    I.prototype = {
        signal: null,
        target: null,
        type: null,
        currentTarget: null,
        __class__: I
    };
    var N = function() {};
    f["msignal.EventDispatcher"] = N;
    N.__name__ = ["msignal", "EventDispatcher"];
    N.prototype = {
        dispatchEvent: null,
        __class__: N
    };
    var Q = function() {
        x.call(this)
    };
    f["msignal.Signal0"] = Q;
    Q.__name__ = ["msignal", "Signal0"];
    Q.__super__ = x;
    Q.prototype = C(x.prototype, {
        dispatch: function() {
            for (var a = this.slots; a.nonEmpty;) a.head.execute(), a = a.tail
        },
        createSlot: function(a, b, c) {
            null == c && (c = 0);
            null == b && (b = !1);
            return new K(this, a, b, c)
        },
        __class__: Q
    });
    var R = function(a) {
        x.call(this, [a])
    };
    f["msignal.Signal1"] = R;
    R.__name__ = ["msignal", "Signal1"];
    R.__super__ = x;
    R.prototype = C(x.prototype, {
        dispatch: function(a) {
            for (var b = this.slots; b.nonEmpty;) b.head.execute(a),
                b = b.tail
        },
        createSlot: function(a, b, c) {
            null == c && (c = 0);
            null == b && (b = !1);
            return new L(this, a, b, c)
        },
        __class__: R
    });
    var S = function(a, b) {
        x.call(this, [a, b])
    };
    f["msignal.Signal2"] = S;
    S.__name__ = ["msignal", "Signal2"];
    S.__super__ = x;
    S.prototype = C(x.prototype, {
        dispatch: function(a, b) {
            for (var c = this.slots; c.nonEmpty;) c.head.execute(a, b), c = c.tail
        },
        createSlot: function(a, b, c) {
            null == c && (c = 0);
            null == b && (b = !1);
            return new M(this, a, b, c)
        },
        __class__: S
    });
    var K = function(a, b, c, d) {
        null == d && (d = 0);
        null == c && (c = !1);
        y.call(this, a, b, c,
            d)
    };
    f["msignal.Slot0"] = K;
    K.__name__ = ["msignal", "Slot0"];
    K.__super__ = y;
    K.prototype = C(y.prototype, {
        execute: function() {
            this.enabled && (this.once && this.remove(), this.listener())
        },
        __class__: K
    });
    var L = function(a, b, c, d) {
        null == d && (d = 0);
        null == c && (c = !1);
        y.call(this, a, b, c, d)
    };
    f["msignal.Slot1"] = L;
    L.__name__ = ["msignal", "Slot1"];
    L.__super__ = y;
    L.prototype = C(y.prototype, {
        param: null,
        execute: function(a) {
            this.enabled && (this.once && this.remove(), null != this.param && (a = this.param), this.listener(a))
        },
        __class__: L
    });
    var M =
        function(a, b, c, d) {
            null == d && (d = 0);
            null == c && (c = !1);
            y.call(this, a, b, c, d)
        };
    f["msignal.Slot2"] = M;
    M.__name__ = ["msignal", "Slot2"];
    M.__super__ = y;
    M.prototype = C(y.prototype, {
        param1: null,
        param2: null,
        execute: function(a, b) {
            this.enabled && (this.once && this.remove(), null != this.param1 && (a = this.param1), null != this.param2 && (b = this.param2), this.listener(a, b))
        },
        __class__: M
    });
    var r = function(a, b) {
        this.nonEmpty = !1;
        if (null == a && null == b) {
            if (null != r.NIL) throw new p("Parameters head and tail are null. Use the NIL element instead.");
            this.nonEmpty = !1
        } else {
            if (null == a) throw new p("Parameter head cannot be null.");
            this.head = a;
            this.tail = null == b ? r.NIL : b;
            this.nonEmpty = !0
        }
    };
    f["msignal.SlotList"] = r;
    r.__name__ = ["msignal", "SlotList"];
    r.NIL = null;
    r.prototype = {
        head: null,
        tail: null,
        nonEmpty: null,
        length: null,
        get_length: function() {
            if (!this.nonEmpty) return 0;
            if (this.tail == r.NIL) return 1;
            for (var a = 0, b = this; b.nonEmpty;) ++a, b = b.tail;
            return a
        },
        prepend: function(a) {
            return new r(a, this)
        },
        append: function(a) {
            if (null == a) return this;
            if (!this.nonEmpty) return new r(a);
            if (this.tail == r.NIL) return (new r(a)).prepend(this.head);
            for (var b = new r(this.head), c = b, d = this.tail; d.nonEmpty;) c = c.tail = new r(d.head), d = d.tail;
            c.tail = new r(a);
            return b
        },
        insertWithPriority: function(a) {
            if (!this.nonEmpty) return new r(a);
            var b = a.priority;
            if (b >= this.head.priority) return this.prepend(a);
            for (var c = new r(this.head), d = c, e = this.tail; e.nonEmpty;) {
                if (b > e.head.priority) return d.tail = e.prepend(a), c;
                d = d.tail = new r(e.head);
                e = e.tail
            }
            d.tail = new r(a);
            return c
        },
        filterNot: function(a) {
            if (!this.nonEmpty ||
                null == a) return this;
            if (m.compareMethods(this.head.listener, a)) return this.tail;
            for (var b = new r(this.head), c = b, d = this.tail; d.nonEmpty;) {
                if (m.compareMethods(d.head.listener, a)) return c.tail = d.tail, b;
                c = c.tail = new r(d.head);
                d = d.tail
            }
            return this
        },
        contains: function(a) {
            if (!this.nonEmpty) return !1;
            for (var b = this; b.nonEmpty;) {
                if (m.compareMethods(b.head.listener, a)) return !0;
                b = b.tail
            }
            return !1
        },
        find: function(a) {
            if (!this.nonEmpty) return null;
            for (var b = this; b.nonEmpty;) {
                if (m.compareMethods(b.head.listener, a)) return b.head;
                b = b.tail
            }
            return null
        },
        __class__: r,
        __properties__: {
            get_length: "get_length"
        }
    };
    var ga = 0;
    Array.prototype.indexOf && (h.indexOf = function(a, b, c) {
        return Array.prototype.indexOf.call(a, b, c)
    });
    Array.prototype.lastIndexOf && (h.lastIndexOf = function(a, b, c) {
        return Array.prototype.lastIndexOf.call(a, b, c)
    });
    f.Math = Math;
    String.prototype.__class__ = f.String = String;
    String.__name__ = ["String"];
    f.Array = Array;
    Array.__name__ = ["Array"];
    Date.prototype.__class__ = f.Date = Date;
    Date.__name__ = ["Date"];
    var ba = f.Int = {
            __name__: ["Int"]
        },
        ca = f.Dynamic = {
            __name__: ["Dynamic"]
        },
        Z = f.Float = Number;
    Z.__name__ = ["Float"];
    var aa = f.Bool = Boolean;
    aa.__ename__ = ["Bool"];
    var da = f.Class = {
            __name__: ["Class"]
        },
        ea = {};
    f.Void = {
        __ename__: ["Void"]
    };
    null == Array.prototype.map && (Array.prototype.map = function(a) {
        for (var b = [], c = 0, d = this.length; c < d;) {
            var e = c++;
            b[e] = a(this[e])
        }
        return b
    });
    null == Array.prototype.filter && (Array.prototype.filter = function(a) {
        for (var b = [], c = 0, d = this.length; c < d;) {
            var e = this[c++];
            a(e) && b.push(e)
        }
        return b
    });
    var J = {};
    r.NIL = new r(null, null);
    t.DAYS_OF_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    k.__toStr = {}.toString;
    F.main()
})("undefined" != typeof console ? console : {
    log: function() {}
});

// END of <Common haxe code>  ---------------------- //

(function(console) {
    "use strict";
    var HxOverrides = function() {};
    HxOverrides.indexOf = function(a, obj, i) {
        var len = a.length;
        if (i < 0) {
            i += len;
            if (i < 0) i = 0;
        }
        while (i < len) {
            if (a[i] === obj) return i;
            i++;
        }
        return -1;
    };
    HxOverrides.remove = function(a, obj) {
        var i = HxOverrides.indexOf(a, obj, 0);
        if (i == -1) return false;
        a.splice(i, 1);
        return true;
    };
    HxOverrides.iter = function(a) {
        return {
            cur: 0,
            arr: a,
            hasNext: function() {
                return this.cur < this.arr.length;
            },
            next: function() {
                return this.arr[this.cur++];
            }
        };
    };
    var Main = function() {};
    Main.main = function() {
        if (Main.internetExplorer()) {
            console.log("[dex] timer override!");
            var timerHack = new timer.RAFTimer();
            var win = window;
            win.timerHack = timerHack;
            win.setInterval = $bind(timerHack, timerHack.setInterval);
            win.setTimeout = $bind(timerHack, timerHack.setTimeout);
            win.clearInterval = $bind(timerHack, timerHack.clearInterval);
            win.clearTimeout = $bind(timerHack, timerHack.clearTimeout);
        }
    };
    Main.internetExplorer = function() {
        var testStr = "Trident";
        var userAgent = window.navigator.userAgent;
        if (userAgent.indexOf(testStr) != -1) {
            console.log("[dex] EXPLORER!");
            return true;
        }
        console.log("[dex] default timer");
        return false;
    };
    var timer = {};
    timer.Interval = function(id, callback, time_ms, time_now, oneShot) {
        this.oneShot = oneShot;
        this.callback = callback;
        this.time_ms = time_ms;
        this.last_run = time_now;
        this.id = id;
        this.oneShot = oneShot;
    };
    timer.Interval.stamp = function() {
        return new Date().getTime();
    };
    timer.Interval.prototype = {
        execute: function() {
            this.callback();
        }
    };
    timer.RAFTimer = function() {
        this.idCounter = 0;
        this.intervals = [];
        window.requestAnimationFrame($bind(this, this.run));
    };
    timer.RAFTimer.prototype = {
        run: function(f) {
            var now = this.timeNow();
            var $it0 = HxOverrides.iter(this.intervals);
            while ($it0.hasNext()) {
                var interval = $it0.next();
                var elapsed = now - interval.last_run;
                if (elapsed >= interval.time_ms) {
                    interval.execute();
                    if (interval.oneShot) HxOverrides.remove(this.intervals, interval);
                    else interval.last_run = now;
                }
            }
            window.requestAnimationFrame($bind(this, this.run));
        },
        setInterval: function(fn, time_ms) {
            var interval = new timer.Interval(this.idCounter++, fn, time_ms, this.timeNow(), false);
            this.intervals.push(interval);
            this.sort();
            return interval.id;
        },
        setTimeout: function(fn, time_ms) {
            var timeout = new timer.Interval(this.idCounter++, fn, time_ms, this.timeNow(), true);
            this.intervals.push(timeout);
            this.sort();
            return timeout.id;
        },
        clearInterval: function(id) {
            this.clearIntervalInternal(id);
        },
        clearTimeout: function(id) {
            this.clearIntervalInternal(id);
        },
        timeNow: function() {
            return new Date().getTime();
        },
        clearIntervalInternal: function(id) {
            var interval = this.getInterval(id);
            if (interval != null) HxOverrides.remove(this.intervals, interval);
        },
        getInterval: function(id) {
            var _g1 = 0;
            var _g = this.intervals.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (this.intervals[i].id == id) return this.intervals[i];
            }
            return null;
        },
        sort: function() {
            this.sortTimeStamp = this.timeNow();
            this.intervals.sort($bind(this, this.sortFn));
        },
        sortFn: function(a, b) {
            var elapsed_a = this.sortTimeStamp - a.last_run;
            var elapsed_b = this.sortTimeStamp - b.last_run;
            if (elapsed_a > elapsed_b) return -1;
            else return 1;
        }
    };
    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;
    }
    if (Array.prototype.indexOf) HxOverrides.indexOf = function(a, o, i) {
        return Array.prototype.indexOf.call(a, o, i);
    };
    Main.main();
})(typeof console != "undefined" ? console : {
    log: function() {}
});

//# sourceURL=timerOverride.js

//# sourceURL=timerOverride.js

/*! promise-polyfill 2.1.0 */
! function(a) {
    function b(a, b) {
        return function() {
            a.apply(b, arguments)
        }
    }

    function c(a) {
        if ("object" != typeof this) throw new TypeError("Promises must be constructed via new");
        if ("function" != typeof a) throw new TypeError("not a function");
        this._state = null, this._value = null, this._deferreds = [], i(a, b(e, this), b(f, this))
    }

    function d(a) {
        var b = this;
        return null === this._state ? void this._deferreds.push(a) : void j(function() {
            var c = b._state ? a.onFulfilled : a.onRejected;
            if (null === c) return void(b._state ? a.resolve : a.reject)(b._value);
            var d;
            try {
                d = c(b._value)
            } catch (e) {
                return void a.reject(e)
            }
            a.resolve(d)
        })
    }

    function e(a) {
        try {
            if (a === this) throw new TypeError("A promise cannot be resolved with itself.");
            if (a && ("object" == typeof a || "function" == typeof a)) {
                var c = a.then;
                if ("function" == typeof c) return void i(b(c, a), b(e, this), b(f, this))
            }
            this._state = !0, this._value = a, g.call(this)
        } catch (d) {
            f.call(this, d)
        }
    }

    function f(a) {
        this._state = !1, this._value = a, g.call(this)
    }

    function g() {
        for (var a = 0, b = this._deferreds.length; b > a; a++) d.call(this, this._deferreds[a]);
        this._deferreds = null
    }

    function h(a, b, c, d) {
        this.onFulfilled = "function" == typeof a ? a : null, this.onRejected = "function" == typeof b ? b : null, this.resolve = c, this.reject = d
    }

    function i(a, b, c) {
        var d = !1;
        try {
            a(function(a) {
                d || (d = !0, b(a))
            }, function(a) {
                d || (d = !0, c(a))
            })
        } catch (e) {
            if (d) return;
            d = !0, c(e)
        }
    }
    var j = "function" == typeof setImmediate && setImmediate || function(a) {
            setTimeout(a, 1)
        },
        k = Array.isArray || function(a) {
            return "[object Array]" === Object.prototype.toString.call(a)
        };
    c.prototype["catch"] = function(a) {
        return this.then(null, a)
    }, c.prototype.then = function(a, b) {
        var e = this;
        return new c(function(c, f) {
            d.call(e, new h(a, b, c, f))
        })
    }, c.all = function() {
        var a = Array.prototype.slice.call(1 === arguments.length && k(arguments[0]) ? arguments[0] : arguments);
        return new c(function(b, c) {
            function d(f, g) {
                try {
                    if (g && ("object" == typeof g || "function" == typeof g)) {
                        var h = g.then;
                        if ("function" == typeof h) return void h.call(g, function(a) {
                            d(f, a)
                        }, c)
                    }
                    a[f] = g, 0 === --e && b(a)
                } catch (i) {
                    c(i)
                }
            }
            if (0 === a.length) return b([]);
            for (var e = a.length, f = 0; f < a.length; f++) d(f, a[f])
        })
    }, c.resolve = function(a) {
        return a && "object" == typeof a && a.constructor === c ? a : new c(function(b) {
            b(a)
        })
    }, c.reject = function(a) {
        return new c(function(b, c) {
            c(a)
        })
    }, c.race = function(a) {
        return new c(function(b, c) {
            for (var d = 0, e = a.length; e > d; d++) a[d].then(b, c)
        })
    }, c._setImmediateFn = function(a) {
        j = a
    }, "undefined" != typeof module && module.exports ? module.exports = c : a.Promise || (a.Promise = c)
}(this);
(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, '');
    };
    if (typeof clientkernelBootstrap == 'undefined') {
        var clientkernelBootstrap = {};
    };
    clientkernelBootstrap.Main = function() {
        window.getBootstrapModules = clientkernelBootstrap.Main.getBootstrapModules;
        window.define = clientkernelBootstrap.Main.bootstrapDefine;
        window.define.amd = {};
    };
    clientkernelBootstrap.Main.__name__ = ["clientkernelBootstrap", "Main"];
    clientkernelBootstrap.Main.bootstrapDefine = function(module, dependencies, definition) {
        clientkernelBootstrap.Main.modules.push({
            module: module,
            dependencies: dependencies,
            definition: definition
        });
    };
    clientkernelBootstrap.Main.getBootstrapModules = function() {
        return clientkernelBootstrap.Main.modules;
    };
    clientkernelBootstrap.Main.main = function() {};
    clientkernelBootstrap.Main.prototype.__class__ = clientkernelBootstrap.Main;
    clientkernelBootstrap.Main.modules = [];;
    clientkernelBootstrap.Main.run = new clientkernelBootstrap.Main();;
})();
//# sourceURL=bootstrap.js
(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, '');
    };
    if (typeof clientkernelInterfaces == 'undefined') {
        var clientkernelInterfaces = {};
    };
    clientkernelInterfaces.InterfaceDeclaration = function() {};
    clientkernelInterfaces.InterfaceDeclaration.__name__ = ["clientkernelInterfaces", "InterfaceDeclaration"];
    clientkernelInterfaces.InterfaceDeclaration.isValidating = function() {
        if (clientkernelInterfaces.InterfaceDeclaration.optionValidate == null) clientkernelInterfaces.InterfaceDeclaration.optionValidate = (function($this) {
            var $r;
            var this1 = haxe.web.Request.getParams();
            $r = this1.get("kernel");
            return $r;
        }(this)) != null && ((function($this) {
            var $r;
            var this2 = haxe.web.Request.getParams();
            $r = this2.get("kernel");
            return $r;
        }(this))).indexOf("v") != -1;
        return clientkernelInterfaces.InterfaceDeclaration.optionValidate;
    };
    clientkernelInterfaces.InterfaceDeclaration.ck_implements = function(cls, iface) {
        return clientkernelInterfaces.InterfaceDeclaration.injectValidation(cls, iface);
    };
    clientkernelInterfaces.InterfaceDeclaration.ck_cast = function(objct, iface) {
        var check = objct;
        if (!clientkernelInterfaces.InterfaceDeclaration.isValidating()) check = Object.getPrototypeOf(objct);
        if (check._validator != null && check._validator.has(iface)) return objct;
        else throw new Error("Illegal cast");
    };
    clientkernelInterfaces.InterfaceDeclaration.ck_instanceof = function(objct, iface) {
        var check = objct;
        if (!clientkernelInterfaces.InterfaceDeclaration.isValidating()) check = Object.getPrototypeOf(objct);
        return check._validator != null && check._validator.has(iface);
    };
    clientkernelInterfaces.InterfaceDeclaration.injectValidation = function(cls, iface) {
        if (clientkernelInterfaces.InterfaceDeclaration.isValidating()) {
            if (cls._validator == null) {
                var v = new clientkernelInterfaces.InterfaceValidator(cls, iface);
                var validatedClass = function() {
                    this._validator = v;
                    v.validate(arguments, this);
                }
                validatedClass.prototype = cls.prototype;
                validatedClass._validator = v;
                return validatedClass;
            } else {
                var v1 = cls._validator;
                v1.addInterface(iface);
                return cls;
            }
        } else if (cls.prototype._validator == null) {
            cls.prototype._validator = new clientkernelInterfaces.InterfaceValidator(cls, iface);
            return cls;
        } else {
            var v2 = cls.prototype._validator;
            v2.addInterface(iface);
            return cls;
        }
    };
    clientkernelInterfaces.InterfaceDeclaration.prototype.__class__ = clientkernelInterfaces.InterfaceDeclaration;
    clientkernelInterfaces.InterfaceValidator = function(cls, iface) {
        this.original_constructor = cls.prototype.constructor;
        this.original_methods = new _hcmn_.haxe_ds_StringMap();
        this.interfaces = [];
        this.interfaces.push(iface);
    };
    clientkernelInterfaces.InterfaceValidator.__name__ = ["clientkernelInterfaces", "InterfaceValidator"];
    clientkernelInterfaces.InterfaceValidator.prototype.original_constructor = null;
    clientkernelInterfaces.InterfaceValidator.prototype.original_methods = null;
    clientkernelInterfaces.InterfaceValidator.prototype.interfaces = null;
    clientkernelInterfaces.InterfaceValidator.prototype.has = function(iface) {
        return (function($this) {
            var $r;
            var x = iface;
            $r = _hcmn_.HxOverrides.indexOf($this.interfaces, x, 0);
            return $r;
        }(this)) != -1;
    };
    clientkernelInterfaces.InterfaceValidator.prototype.validate = function(args, cls) {
        var _g = 0;
        var _g1 = this.interfaces;
        while (_g < _g1.length) {
            var i = _g1[_g];
            ++_g;
            var _g2 = 0;
            var _g3 = _hcmn_.Reflect.fields(i.prototype);
            while (_g2 < _g3.length) {
                var m = _g3[_g2];
                ++_g2;
                if (!_hcmn_.Reflect.isFunction(_hcmn_.Reflect.field(i.prototype, m))) continue;
                var method = _hcmn_.Reflect.field(i.prototype, m);
                var methodName = m;
                var origMethod = Object.getPrototypeOf(cls)[methodName];
                if (origMethod == null) throw new Error("function not implemented:" + methodName);
                var m1 = new clientkernelInterfaces.MethodValidator(methodName, origMethod, cls, method);
                cls[methodName] = $bind(m1, m1.validateCall);
            }
        }
        var ctr = this.original_constructor;
        ctr.apply(cls, args);
    };
    clientkernelInterfaces.InterfaceValidator.prototype.addInterface = function(iface) {
        this.interfaces.push(iface);
    };
    clientkernelInterfaces.InterfaceValidator.prototype.__class__ = clientkernelInterfaces.InterfaceValidator;
    if (typeof haxe == 'undefined') {
        var haxe = {};
    };
    if (!haxe.web) {
        haxe.web = {};
    };
    haxe.web.Request = function() {};
    haxe.web.Request.__name__ = ["haxe", "web", "Request"];
    haxe.web.Request.getParams = function() {
        var get;
        var _this = window.location.search;
        get = _hcmn_.HxOverrides.substr(_this, 1, null);
        var params = new _hcmn_.haxe_ds_StringMap();
        var _g = 0;
        var _g1 = new _hcmn_.EReg("[&;]", "g").split(get);
        while (_g < _g1.length) {
            var p = _g1[_g];
            ++_g;
            var pl = p.split("=");
            if (pl.length < 2) continue;
            var name = pl.shift();
            params.set(decodeURIComponent(name.split("+").join(" ")), _hcmn_.StringTools.urlDecode(pl.join("=")));
        }
        return params;
    };
    haxe.web.Request.prototype.__class__ = haxe.web.Request;

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

        get: function(k) {
            return {
                arguments: ["*"],
                returns: "null"
            };
        }
    };
    clientkernelInterfaces.Main = function() {
        clientkernelInterfaces.Main.main();
    };
    clientkernelInterfaces.Main.__name__ = ["clientkernelInterfaces", "Main"];
    clientkernelInterfaces.Main.main = function() {
        window.ck_implements = clientkernelInterfaces.InterfaceDeclaration.ck_implements;
        window.ck_cast = clientkernelInterfaces.InterfaceDeclaration.ck_cast;
        window.ck_instanceof = clientkernelInterfaces.InterfaceDeclaration.ck_instanceof;
    };
    clientkernelInterfaces.Main.prototype.__class__ = clientkernelInterfaces.Main;
    clientkernelInterfaces.MethodValidator = function(name, method, cls, ifacemethod) {
        this.name = name;
        this.method = method;
        this.cls = cls;
        this.ifacemethod = ifacemethod;
    };
    clientkernelInterfaces.MethodValidator.__name__ = ["clientkernelInterfaces", "MethodValidator"];
    clientkernelInterfaces.MethodValidator.prototype.name = null;
    clientkernelInterfaces.MethodValidator.prototype.method = null;
    clientkernelInterfaces.MethodValidator.prototype.cls = null;
    clientkernelInterfaces.MethodValidator.prototype.ifacemethod = null;
    clientkernelInterfaces.MethodValidator.prototype.validateCall = function() {
        var check = this.ifacemethod();
        var args = arguments;
        var method = this.method;
        var name = this.name;
        var cls = this.cls;
        if (args.length > check.arguments.length) throw new Error("invalid number of arguments");
        var _g1 = 0;
        var _g = args.length;
        while (_g1 < _g) {
            var i = _g1++;
            if (Object.prototype.hasOwnProperty.call(check.arguments[i], "type")) this.validateArgument(i, args[i], typeof args[i], _hcmn_.Reflect.field(check.arguments[i], "type"));
            else this.validateArgument(i, args[i], typeof args[i], check.arguments[i]);
        }
        var _g11 = args.length + 1;
        var _g2 = check.arguments.length;
        while (_g11 < _g2) {
            var i1 = _g11++;
            if (!Object.prototype.hasOwnProperty.call(check.arguments[i1], "opt")) throw new Error("invalid number of arguments");
            if (!_hcmn_.Reflect.field(check.arguments[i1], "opt")) throw new Error("invalid number of arguments");
        }
        var ret = method.apply(cls, arguments);
        var rettype = typeof ret;
        var checkret = (_hcmn_.Std.string(check.returns) + "").split(" ")[0];
        if (ret != null) {
            var _g3 = check.returns;
            switch (_g3) {
                case "string":
                    if (check.returns != rettype) throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
                    break;
                case "array":
                    if (Object.prototype.toString.call(ret) != "[object Array]") throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
                    break;
                case "number":
                    if (check.returns != rettype) throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
                    break;
                case "boolean":
                    if (check.returns != rettype) throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
                    break;
                case "void":
                    if (rettype != "undefined") throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
                    break;
                case "*":
                    break;
                default:
                    if (!clientkernelInterfaces.InterfaceDeclaration.ck_instanceof(ret, check.returns) && !ret instanceof check.returns) throw new Error("invalid return " + this.name + "(" + rettype + "!=" + checkret + ")");
            }
        }
        return ret;
    };
    clientkernelInterfaces.MethodValidator.prototype.validateArgument = function(index, arg, argtype, checktype) {
        var checkret = (_hcmn_.Std.string(checktype) + "").split(" ")[0];
        if (arg != null) switch (checktype) {
            case "string":
                if (checktype != argtype) throw new Error("invalid argument " + (index + 1) + " of " + this.name + "(" + argtype + "!=" + checkret + ")");
                break;
            case "array":
                if (Object.prototype.toString.call(arg) != "[object Array]") throw new Error("invalid argument " + (index + 1) + " of " + this.name + "(" + argtype + "!=" + checkret + ")");
                break;
            case "number":
                if (checktype != argtype) throw new Error("invalid argument " + (index + 1) + " of " + this.name + "(" + argtype + "!=" + checkret + ")");
                break;
            case "boolean":
                if (checktype != argtype) throw new Error("invalid argument " + (index + 1) + " of " + this.name + "(" + argtype + "!=" + checkret + ")");
                break;
            case "*":
                break;
            default:
                if (!clientkernelInterfaces.InterfaceDeclaration.ck_instanceof(arg, checktype)) throw new Error("invalid argument " + (index + 1) + " of " + this.name + "(" + argtype + "!=" + checkret + ")");
        }
    };
    clientkernelInterfaces.MethodValidator.prototype.__class__ = clientkernelInterfaces.MethodValidator;
    clientkernelInterfaces.InterfaceDeclaration.optionValidate = null;;
    clientkernelInterfaces.Main.instance = new clientkernelInterfaces.Main();;
})();
//# sourceURL=clientKernelInterfaces.js
define("clientkernelModulesApi", [],
    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, '');
        };
        if (typeof clientkernelModulesApi == 'undefined') {
            var clientkernelModulesApi = {};
        };

        clientkernelModulesApi.IKernelEvent = function() {}
        clientkernelModulesApi.IKernelEvent.prototype = {

            getType: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelModulesApi.IKernelListener = function() {}
        clientkernelModulesApi.IKernelListener.prototype = {

            kernelEvent: function(event) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelModulesApi.IModule = function() {}
        clientkernelModulesApi.IModule.prototype = {

            getState: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getSymbolicName: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getVersion: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            }
        };

        clientkernelModulesApi.IModuleActivator = function() {}
        clientkernelModulesApi.IModuleActivator.prototype = {

            start: function(context) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            stop: function(context) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelModulesApi.IModuleContext = function() {}
        clientkernelModulesApi.IModuleContext.prototype = {

            getProperty: function(key) {
                return {
                    arguments: ["string"],
                    returns: "string"
                };
            },
            getModule: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            addServiceListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            removeServiceListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            addModuleListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            removeModuleListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            addKernelListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            removeKernelListener: function(listener) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            registerService: function(service, iface, properties) {
                return {
                    arguments: ["*", "*", "*"],
                    returns: "*"
                };
            },
            getServices: function(iface, filter) {
                return {
                    arguments: ["*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "array"
                };
            },
            getAnyService: function(iface, filter) {
                return {
                    arguments: ["*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "*"
                };
            },
            getServiceTracker: function(ifaces) {
                return {
                    arguments: ["array"],
                    returns: "*"
                };
            },
            restartModule: function(name) {
                return {
                    arguments: ["string"],
                    returns: "void"
                };
            }
        };

        clientkernelModulesApi.IModuleEvent = function() {}
        clientkernelModulesApi.IModuleEvent.prototype = {

            getModule: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getType: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelModulesApi.IModuleListener = function() {}
        clientkernelModulesApi.IModuleListener.prototype = {

            moduleChanged: function(event) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelModulesApi.IService = function() {}
        clientkernelModulesApi.IService.prototype = {

        };

        clientkernelModulesApi.IServiceEvent = function() {}
        clientkernelModulesApi.IServiceEvent.prototype = {

            getService: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getInterface: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getType: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelModulesApi.IServiceListener = function() {}
        clientkernelModulesApi.IServiceListener.prototype = {

            serviceChanged: function(event) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelModulesApi.IServiceRegistration = function() {}
        clientkernelModulesApi.IServiceRegistration.prototype = {

            setProperties: function(properties) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            unregister: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            }
        };
        clientkernelModulesApi.KernelEventType = function(type) {
            this.type = type;
        };
        clientkernelModulesApi.KernelEventType.__name__ = ["clientkernelModulesApi", "KernelEventType"];
        clientkernelModulesApi.KernelEventType.prototype.type = null;
        clientkernelModulesApi.KernelEventType.prototype.__class__ = clientkernelModulesApi.KernelEventType;
        clientkernelModulesApi.ModuleEventType = function(type) {
            this.type = type;
        };
        clientkernelModulesApi.ModuleEventType.__name__ = ["clientkernelModulesApi", "ModuleEventType"];
        clientkernelModulesApi.ModuleEventType.prototype.type = null;
        clientkernelModulesApi.ModuleEventType.prototype.__class__ = clientkernelModulesApi.ModuleEventType;
        clientkernelModulesApi.ModuleState = function(type) {
            this.type = type;
        };
        clientkernelModulesApi.ModuleState.__name__ = ["clientkernelModulesApi", "ModuleState"];
        clientkernelModulesApi.ModuleState.prototype.type = null;
        clientkernelModulesApi.ModuleState.prototype.__class__ = clientkernelModulesApi.ModuleState;
        clientkernelModulesApi.ServiceEventType = function(type) {
            this.type = type;
        };
        clientkernelModulesApi.ServiceEventType.__name__ = ["clientkernelModulesApi", "ServiceEventType"];
        clientkernelModulesApi.ServiceEventType.prototype.type = null;
        clientkernelModulesApi.ServiceEventType.prototype.__class__ = clientkernelModulesApi.ServiceEventType;
        clientkernelModulesApi.KernelEventType.STARTED = new clientkernelModulesApi.KernelEventType(1);;
        clientkernelModulesApi.KernelEventType.ERROR = new clientkernelModulesApi.KernelEventType(2);;
        clientkernelModulesApi.KernelEventType.WARNING = new clientkernelModulesApi.KernelEventType(3);;
        clientkernelModulesApi.KernelEventType.INFO = new clientkernelModulesApi.KernelEventType(4);;
        clientkernelModulesApi.KernelEventType.STOPPED = new clientkernelModulesApi.KernelEventType(5);;
        clientkernelModulesApi.ModuleEventType.INSTALLED = new clientkernelModulesApi.ModuleEventType(1);;
        clientkernelModulesApi.ModuleEventType.STARTED = new clientkernelModulesApi.ModuleEventType(2);;
        clientkernelModulesApi.ModuleEventType.STOPPED = new clientkernelModulesApi.ModuleEventType(3);;
        clientkernelModulesApi.ModuleEventType.RESOLVED = new clientkernelModulesApi.ModuleEventType(4);;
        clientkernelModulesApi.ModuleEventType.UNRESOLVED = new clientkernelModulesApi.ModuleEventType(5);;
        clientkernelModulesApi.ModuleEventType.STARTING = new clientkernelModulesApi.ModuleEventType(6);;
        clientkernelModulesApi.ModuleEventType.STOPPING = new clientkernelModulesApi.ModuleEventType(7);;
        clientkernelModulesApi.ModuleState.UNINSTALLED = new clientkernelModulesApi.ModuleState(1);;
        clientkernelModulesApi.ModuleState.INSTALLED = new clientkernelModulesApi.ModuleState(2);;
        clientkernelModulesApi.ModuleState.RESOLVED = new clientkernelModulesApi.ModuleState(3);;
        clientkernelModulesApi.ModuleState.STARTING = new clientkernelModulesApi.ModuleState(4);;
        clientkernelModulesApi.ModuleState.STOPPING = new clientkernelModulesApi.ModuleState(5);;
        clientkernelModulesApi.ModuleState.ACTIVE = new clientkernelModulesApi.ModuleState(6);;
        clientkernelModulesApi.ServiceEventType.REGISTERED = new clientkernelModulesApi.ServiceEventType(1);;
        return {
            exports: clientkernelModulesApi
        };
    });
//# sourceURL=modulesApi.js
(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
// Add Page Visibility API support to old browsers by focus/blur hack.
//
// Include this script _before_ Visibility.js.
//
// Note, that this hack doesn’t correctly emulate Page Visibility API:
// when user change focus from browser to another window (browser and your
// page may stay visible), this hack will decide, that you page is hidden.
//
// For Firefox 5–9 it will be better to use MozVisibility hack without
// this issue. See <https://github.com/private-face/mozvisibility>.
;
(function(document) {
    "use strict";

    if (document.visibilityState || document.webkitVisibilityState) {
        return;
    }

    document.hidden = false;
    document.visibilityState = 'visible';

    var event = null
    var i = 0
    var fireEvent = function() {
        if (document.createEvent) {
            if (!event) {
                event = document.createEvent('HTMLEvents');
                event.initEvent('visibilitychange', true, true);
            }
            document.dispatchEvent(event);
        } else {
            if (typeof(Visibility) == 'object') {
                Visibility._change.call(Visibility, {});
            }
        }
    }

    var onFocus = function() {
        document.hidden = false;
        document.visibilityState = 'visible';
        fireEvent();
    };
    var onBlur = function() {
        document.hidden = true;
        document.visibilityState = 'hidden';
        fireEvent();
    }

    if (document.addEventListener) {
        window.addEventListener('focus', onFocus, true);
        window.addEventListener('blur', onBlur, true);
    } else {
        document.attachEvent('onfocusin', onFocus);
        document.attachEvent('onfocusout', onBlur);
    }
})(document);

;
(function(global) {
    "use strict";

    var lastId = -1;

    // Visibility.js allow you to know, that your web page is in the background
    // tab and thus not visible to the user. This library is wrap under
    // Page Visibility API. It fix problems with different vendor prefixes and
    // add high-level useful functions.
    var self = {

        // Call callback only when page become to visible for user or
        // call it now if page is visible now or Page Visibility API
        // doesn’t supported.
        //
        // Return false if API isn’t supported, true if page is already visible
        // or listener ID (you can use it in `unbind` method) if page isn’t
        // visible now.
        //
        //   Visibility.onVisible(function () {
        //       startIntroAnimation();
        //   });
        onVisible: function(callback) {
            var support = self.isSupported();
            if (!support || !self.hidden()) {
                callback();
                return support;
            }

            var listener = self.change(function(e, state) {
                if (!self.hidden()) {
                    self.unbind(listener);
                    callback();
                }
            });
            return listener;
        },

        // Call callback when visibility will be changed. First argument for
        // callback will be original event object, second will be visibility
        // state name.
        //
        // Return listener ID to unbind listener by `unbind` method.
        //
        // If Page Visibility API doesn’t supported method will be return false
        // and callback never will be called.
        //
        //   Visibility.change(function(e, state) {
        //       Statistics.visibilityChange(state);
        //   });
        //
        // It is just proxy to `visibilitychange` event, but use vendor prefix.
        change: function(callback) {
            if (!self.isSupported()) {
                return false;
            }
            lastId += 1;
            var number = lastId;
            self._callbacks[number] = callback;
            self._listen();
            return number;
        },

        // Remove `change` listener by it ID.
        //
        //   var id = Visibility.change(function(e, state) {
        //       firstChangeCallback();
        //       Visibility.unbind(id);
        //   });
        unbind: function(id) {
            delete self._callbacks[id];
        },

        // Call `callback` in any state, expect “prerender”. If current state
        // is “prerender” it will wait until state will be changed.
        // If Page Visibility API doesn’t supported, it will call `callback`
        // immediately.
        //
        // Return false if API isn’t supported, true if page is already after
        // prerendering or listener ID (you can use it in `unbind` method)
        // if page is prerended now.
        //
        //   Visibility.afterPrerendering(function () {
        //       Statistics.countVisitor();
        //   });
        afterPrerendering: function(callback) {
            var support = self.isSupported();
            var prerender = 'prerender';

            if (!support || prerender != self.state()) {
                callback();
                return support;
            }

            var listener = self.change(function(e, state) {
                if (prerender != state) {
                    self.unbind(listener);
                    callback();
                }
            });
            return listener;
        },

        // Return true if page now isn’t visible to user.
        //
        //   if ( !Visibility.hidden() ) {
        //       VideoPlayer.play();
        //   }
        //
        // It is just proxy to `document.hidden`, but use vendor prefix.
        hidden: function() {
            return !!(self._doc.hidden || self._doc.webkitHidden);
        },

        // Return visibility state: 'visible', 'hidden' or 'prerender'.
        //
        //   if ( 'prerender' == Visibility.state() ) {
        //       Statistics.pageIsPrerendering();
        //   }
        //
        // Don’t use `Visibility.state()` to detect, is page visible, because
        // visibility states can extend in next API versions.
        // Use more simpler and general `Visibility.hidden()` for this cases.
        //
        // It is just proxy to `document.visibilityState`, but use
        // vendor prefix.
        state: function() {
            return self._doc.visibilityState ||
                self._doc.webkitVisibilityState ||
                'visible';
        },

        // Return true if browser support Page Visibility API.
        //
        //   if ( Visibility.isSupported() ) {
        //       Statistics.startTrackingVisibility();
        //       Visibility.change(function(e, state)) {
        //           Statistics.trackVisibility(state);
        //       });
        //   }
        isSupported: function() {
            return !!(self._doc.visibilityState ||
                self._doc.webkitVisibilityState);
        },

        // Link to document object to change it in tests.
        _doc: document || {},

        // Callbacks from `change` method, that wait visibility changes.
        _callbacks: {},

        // Listener for `visibilitychange` event.
        _change: function(event) {
            var state = self.state();

            for (var i in self._callbacks) {
                self._callbacks[i].call(self._doc, event, state);
            }
        },

        // Set listener for `visibilitychange` event.
        _listen: function() {
            if (self._init) {
                return;
            }

            var event = 'visibilitychange';
            if (self._doc.webkitVisibilityState) {
                event = 'webkit' + event;
            }

            var listener = function() {
                self._change.apply(self, arguments);
            };
            if (self._doc.addEventListener) {
                self._doc.addEventListener(event, listener);
            } else {
                self._doc.attachEvent(event, listener);
            }
            self._init = true;
        }

    };

    if (typeof(module) != 'undefined' && module.exports) {
        module.exports = self;
    } else {
        global.Visibility = self;
    }

})(this);

define.amd.module = "lodash";
/**
 * @license
 * lodash 3.10.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
 * Build: `lodash compat exports="amd" include="after,any,bind,clone,contains,debounce,defaults,each,extend,filter,find,include,isArray,isEqual,isPlainObject,keys,map,reduce,throttle,without"`
 */
;
(function() {
    function n(n, t, r) {
        if (t !== t) {
            n: {
                for (t = n.length, r += -1; ++r < t;) {
                    var e = n[r];
                    if (e !== e) {
                        n = r;
                        break n
                    }
                }
                n = -1
            }
            return n
        }
        for (r -= 1, e = n.length; ++r < e;)
            if (n[r] === t) return r;
        return -1
    }

    function t(n) {
        return !!n && typeof n == "object"
    }

    function r(n, t) {
        for (var r = -1, e = n.length, o = -1, u = []; ++r < e;) n[r] === t && (n[r] = Un, u[++o] = r);
        return u
    }

    function e() {}

    function o(n) {
        this.__wrapped__ = n, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = false, this.__iteratees__ = [], this.__takeCount__ = Bt, this.__views__ = []
    }

    function u(n) {
        var t = n ? n.length : 0;
        for (this.data = {
                hash: Ft(null),
                set: new Tt
            }; t--;) this.push(n[t])
    }

    function i(n, t) {
        var r = n.data;
        return (typeof t == "string" || hn(t) ? r.set.has(t) : r.hash[t]) ? 0 : -1
    }

    function a(n, t) {
        var r = -1,
            e = n.length;
        for (t || (t = Array(e)); ++r < e;) t[r] = n[r];
        return t
    }

    function c(n, t) {
        for (var r = -1, e = n.length; ++r < e && false !== t(n[r], r, n););
        return n
    }

    function f(n, t) {
        for (var r = -1, e = n.length, o = -1, u = []; ++r < e;) {
            var i = n[r];
            t(i, r, n) && (u[++o] = i)
        }
        return u
    }

    function l(n, t) {
        for (var r = -1, e = n.length, o = Array(e); ++r < e;) o[r] = t(n[r], r, n);
        return o
    }

    function s(n, t) {
        for (var r = -1, e = n.length; ++r < e;)
            if (t(n[r], r, n)) return true;
        return false
    }

    function p(n, t) {
        var r;
        if (null == t) r = n;
        else {
            r = sr(t);
            var e = n;
            e || (e = {});
            for (var o = -1, u = r.length; ++o < u;) {
                var i = r[o];
                e[i] = t[i]
            }
            r = e
        }
        return r
    }

    function h(n, t, r) {
        var e = typeof n;
        return "function" == e ? t === xn ? n : I(n, t, r) : null == n ? jn : "object" == e ? _(n) : t === xn ? On(n) : O(n, t)
    }

    function y(n, t, r, e, o, u, i) {
        var f;
        if (r && (f = o ? r(n, e, o) : r(n)), f !== xn) return f;
        if (!hn(n)) return n;
        if (e = cr(n)) {
            if (f = V(n), !t) return a(n, f)
        } else {
            var l = Ot.call(n),
                s = l == Dn;
            if (l != qn && l != Cn && (!s || o)) return st[l] ? z(n, l, t) : o ? n : {};
            if (bt(n)) return o ? n : {};
            if (f = Y(s ? {} : n), !t) return p(f, n)
        }
        for (u || (u = []), i || (i = []), o = u.length; o--;)
            if (u[o] == n) return i[o];
        return u.push(n), i.push(f), (e ? c : d)(n, function(e, o) {
            f[o] = y(e, t, r, o, n, u, i)
        }), f
    }

    function v(n, t) {
        var r = [];
        return Kt(n, function(n, e, o) {
            t(n, e, o) && r.push(n)
        }), r
    }

    function g(n, t, r) {
        var e;
        return r(n, function(n, r, o) {
            return t(n, r, o) ? (e = n, false) : void 0
        }), e
    }

    function b(n, t) {
        Qt(n, t, bn)
    }

    function d(n, t) {
        return Qt(n, t, sr)
    }

    function m(n, t, r) {
        if (null != n) {
            n = Z(n), r !== xn && r in n && (t = [r]), r = 0;
            for (var e = t.length; null != n && r < e;) n = Z(n)[t[r++]];
            return r && r == e ? n : xn
        }
    }

    function w(n, r, e, o, u, i) {
        if (n === r) n = true;
        else if (null == n || null == r || !hn(n) && !t(r)) n = n !== n && r !== r;
        else n: {
            var a = w,
                c = cr(n),
                f = cr(r),
                l = Nn,
                s = Nn;c || (l = Ot.call(n), l == Cn ? l = qn : l != qn && (c = gn(n))),
            f || (s = Ot.call(r), s == Cn ? s = qn : s != qn && gn(r));
            var p = l == qn && !bt(n),
                f = s == qn && !bt(r),
                s = l == s;
            if (!s || c || p) {
                if (!o && (l = p && _t.call(n, "__wrapped__"), f = f && _t.call(r, "__wrapped__"), l || f)) {
                    n = a(l ? n.value() : n, f ? r.value() : r, e, o, u, i);
                    break n
                }
                if (s) {
                    for (u || (u = []), i || (i = []), l = u.length; l--;)
                        if (u[l] == n) {
                            n = i[l] == r;
                            break n
                        }
                    u.push(n),
                        i.push(r), n = (c ? N : L)(n, r, a, e, o, u, i), u.pop(), i.pop()
                } else n = false
            } else n = W(n, r, l)
        }
        return n
    }

    function j(n, t) {
        var r = t.length,
            e = r;
        if (null == n) return !e;
        for (n = Z(n); r--;) {
            var o = t[r];
            if (o[2] ? o[1] !== n[o[0]] : !(o[0] in n)) return false
        }
        for (; ++r < e;) {
            var o = t[r],
                u = o[0],
                i = n[u],
                a = o[1];
            if (o[2]) {
                if (i === xn && !(u in n)) return false
            } else if (o = xn, o === xn ? !w(a, i, void 0, true) : !o) return false
        }
        return true
    }

    function A(n, t) {
        var r = -1,
            e = G(n) ? Array(n.length) : [];
        return Kt(n, function(n, o, u) {
            e[++r] = t(n, o, u)
        }), e
    }

    function _(n) {
        var t = R(n);
        if (1 == t.length && t[0][2]) {
            var r = t[0][0],
                e = t[0][1];
            return function(n) {
                return null == n ? false : (n = Z(n), n[r] === e && (e !== xn || r in n))
            }
        }
        return function(n) {
            return j(n, t)
        }
    }

    function O(n, t) {
        var r = cr(n),
            e = K(n) && t === t && !hn(t),
            o = n + "";
        return n = nn(n),
            function(u) {
                if (null == u) return false;
                var i = o;
                if (u = Z(u), !(!r && e || i in u)) {
                    if (1 != n.length) {
                        var i = n,
                            a = 0,
                            c = -1,
                            f = -1,
                            l = i.length,
                            a = null == a ? 0 : +a || 0;
                        for (0 > a && (a = -a > l ? 0 : l + a), c = c === xn || c > l ? l : +c || 0, 0 > c && (c += l), l = a > c ? 0 : c - a >>> 0, a >>>= 0, c = Array(l); ++f < l;) c[f] = i[f + a];
                        u = m(u, c)
                    }
                    if (null == u) return false;
                    i = rn(n), u = Z(u)
                }
                return u[i] === t ? t !== xn || i in u : w(t, u[i], xn, true);
            }
    }

    function x(n) {
        return function(t) {
            return null == t ? xn : Z(t)[n]
        }
    }

    function E(n) {
        var t = n + "";
        return n = nn(n),
            function(r) {
                return m(r, n, t)
            }
    }

    function S(n, t, r, e, o) {
        return o(n, function(n, o, u) {
            r = e ? (e = false, n) : t(r, n, o, u)
        }), r
    }

    function T(n, t) {
        var r;
        return Kt(n, function(n, e, o) {
            return r = t(n, e, o), !r
        }), !!r
    }

    function I(n, t, r) {
        if (typeof n != "function") return jn;
        if (t === xn) return n;
        switch (r) {
            case 1:
                return function(r) {
                    return n.call(t, r)
                };
            case 3:
                return function(r, e, o) {
                    return n.call(t, r, e, o)
                };
            case 4:
                return function(r, e, o, u) {
                    return n.call(t, r, e, o, u);
                };
            case 5:
                return function(r, e, o, u, i) {
                    return n.call(t, r, e, o, u, i)
                }
        }
        return function() {
            return n.apply(t, arguments)
        }
    }

    function k(n) {
        var t = new Et(n.byteLength);
        return new kt(t).set(new kt(n)), t
    }

    function P(n, t, r) {
        for (var e = r.length, o = -1, u = Nt(n.length - e, 0), i = -1, a = t.length, c = Array(a + u); ++i < a;) c[i] = t[i];
        for (; ++o < e;) c[r[o]] = n[o];
        for (; u--;) c[i++] = n[o++];
        return c
    }

    function F(n, t, r) {
        for (var e = -1, o = r.length, u = -1, i = Nt(n.length - o, 0), a = -1, c = t.length, f = Array(i + c); ++u < i;) f[u] = n[u];
        for (i = u; ++a < c;) f[i + a] = t[a];
        for (; ++e < o;) f[i + r[e]] = n[u++];
        return f
    }

    function $(n, t) {
        function r() {
            return (this && this !== gt && this instanceof r ? e : n).apply(t, arguments)
        }
        var e = M(n);
        return r
    }

    function M(n) {
        return function() {
            var t = arguments;
            switch (t.length) {
                case 0:
                    return new n;
                case 1:
                    return new n(t[0]);
                case 2:
                    return new n(t[0], t[1]);
                case 3:
                    return new n(t[0], t[1], t[2]);
                case 4:
                    return new n(t[0], t[1], t[2], t[3]);
                case 5:
                    return new n(t[0], t[1], t[2], t[3], t[4]);
                case 6:
                    return new n(t[0], t[1], t[2], t[3], t[4], t[5]);
                case 7:
                    return new n(t[0], t[1], t[2], t[3], t[4], t[5], t[6])
            }
            var r = Jt(n.prototype),
                t = n.apply(r, t);
            return hn(t) ? t : r
        }
    }

    function U(n, t, u, i, c, f, l, s, p, h) {
        function y() {
            for (var A = arguments.length, _ = A, O = Array(A); _--;) O[_] = arguments[_];
            if (i && (O = P(O, i, c)), f && (O = F(O, f, l)), d || w) {
                var _ = y.placeholder,
                    x = r(O, _),
                    A = A - x.length;
                if (A < h) {
                    var E = s ? a(s) : xn,
                        A = Nt(h - A, 0),
                        S = d ? x : xn,
                        x = d ? xn : x,
                        T = d ? O : xn,
                        O = d ? xn : O;
                    t |= d ? Pn : Fn, t &= ~(d ? Fn : Pn), m || (t &= ~(En | Sn)), O = [n, t, u, T, S, O, x, E, p, A], E = U.apply(xn, O);
                    n: for (A = n.name + "", x = (S = Yt[A]) ? S.length : 0; x--;) {
                        var T = S[x],
                            I = T.func;
                        if (null == I || I == n) {
                            A = T.name;
                            break n
                        }
                    }
                    return S = e[A], typeof S == "function" && A in o.prototype ? n === S ? A = true : (A = Zt(S),
                        A = !!A && n === A[0]) : A = false, A && tr(E, O), E.placeholder = _, E
                }
            }
            if (_ = g ? u : this, E = b ? _[n] : n, s)
                for (A = O.length, S = Wt(s.length, A), x = a(O); S--;) T = s[S], O[S] = H(T, A) ? x[T] : xn;
            return v && p < O.length && (O.length = p), this && this !== gt && this instanceof y && (E = j || M(n)), E.apply(_, O)
        }
        var v = t & $n,
            g = t & En,
            b = t & Sn,
            d = t & In,
            m = t & Tn,
            w = t & kn,
            j = b ? xn : M(n);
        return y
    }

    function C(n, t, r, e) {
        function o() {
            for (var t = -1, a = arguments.length, c = -1, f = e.length, l = Array(f + a); ++c < f;) l[c] = e[c];
            for (; a--;) l[c++] = arguments[++t];
            return (this && this !== gt && this instanceof o ? i : n).apply(u ? r : this, l);
        }
        var u = t & En,
            i = M(n);
        return o
    }

    function N(n, t, r, e, o, u, i) {
        var a = -1,
            c = n.length,
            f = t.length;
        if (c != f && (!o || f <= c)) return false;
        for (; ++a < c;) {
            var l = n[a],
                f = t[a],
                p = e ? e(o ? f : l, o ? l : f, a) : xn;
            if (p !== xn) {
                if (p) continue;
                return false
            }
            if (o) {
                if (!s(t, function(n) {
                        return l === n || r(l, n, e, o, u, i)
                    })) return false
            } else if (l !== f && !r(l, f, e, o, u, i)) return false
        }
        return true
    }

    function W(n, t, r) {
        switch (r) {
            case Wn:
            case Ln:
                return +n == +t;
            case Bn:
                return n.name == t.name && n.message == t.message;
            case Rn:
                return n != +n ? t != +t : n == +t;
            case Vn:
            case Yn:
                return n == t + ""
        }
        return false
    }

    function L(n, t, r, e, o, u, i) {
        var a = sr(n),
            c = a.length,
            f = sr(t).length;
        if (c != f && !o) return false;
        for (f = c; f--;) {
            var l = a[f];
            if (!(o ? l in t : _t.call(t, l))) return false
        }
        for (var s = o; ++f < c;) {
            var l = a[f],
                p = n[l],
                h = t[l],
                y = e ? e(o ? h : p, o ? p : h, l) : xn;
            if (y === xn ? !r(p, h, e, o, u, i) : !y) return false;
            s || (s = "constructor" == l)
        }
        return s || (r = n.constructor, e = t.constructor, !(r != e && "constructor" in n && "constructor" in t) || typeof r == "function" && r instanceof r && typeof e == "function" && e instanceof e) ? true : false
    }

    function B(n, t, r) {
        var o = e.callback || wn,
            o = o === wn ? h : o;
        return r ? o(n, t, r) : o
    }

    function D(t, r, o) {
        var u = e.indexOf || tn,
            u = u === tn ? n : u;
        return t ? u(t, r, o) : u
    }

    function R(n) {
        n = dn(n);
        for (var t = n.length; t--;) {
            var r = n[t][1];
            n[t][2] = r === r && !hn(r)
        }
        return n
    }

    function q(n, t) {
        var r = null == n ? xn : n[t];
        return yn(r) ? r : xn
    }

    function V(n) {
        var t = n.length,
            r = new n.constructor(t);
        return t && "string" == typeof n[0] && _t.call(n, "index") && (r.index = n.index, r.input = n.input), r
    }

    function Y(n) {
        return n = n.constructor, typeof n == "function" && n instanceof n || (n = Object), new n
    }

    function z(n, t, r) {
        var e = n.constructor;
        switch (t) {
            case zn:
                return k(n);
            case Wn:
            case Ln:
                return new e(+n);
            case Gn:
            case Hn:
            case Jn:
            case Kn:
            case Qn:
            case Xn:
            case Zn:
            case nt:
            case tt:
                return e instanceof e && (e = zt[t]), t = n.buffer, new e(r ? k(t) : t, n.byteOffset, n.length);
            case Rn:
            case Yn:
                return new e(n);
            case Vn:
                var o = new e(n.source, it.exec(n));
                o.lastIndex = n.lastIndex
        }
        return o
    }

    function G(n) {
        return null != n && Q(nr(n))
    }

    function H(n, t) {
        return n = typeof n == "number" || ct.test(n) ? +n : -1, t = null == t ? qt : t, -1 < n && 0 == n % 1 && n < t
    }

    function J(n, t, r) {
        if (!hn(r)) return false;
        var e = typeof t;
        return ("number" == e ? G(r) && H(t, r.length) : "string" == e && t in r) ? (t = r[t],
            n === n ? n === t : t !== t) : false
    }

    function K(n) {
        var t = typeof n;
        return "string" == t && et.test(n) || "number" == t ? true : cr(n) ? false : !rt.test(n) || false
    }

    function Q(n) {
        return typeof n == "number" && -1 < n && 0 == n % 1 && n <= qt
    }

    function X(n) {
        for (var t = bn(n), r = t.length, e = r && n.length, o = !!e && Q(e) && (cr(n) || ln(n) || vn(n)), u = -1, i = []; ++u < r;) {
            var a = t[u];
            (o && H(a, e) || _t.call(n, a)) && i.push(a)
        }
        return i
    }

    function Z(n) {
        if (e.support.unindexedChars && vn(n)) {
            for (var t = -1, r = n.length, o = Object(n); ++t < r;) o[t] = n.charAt(t);
            return o
        }
        return hn(n) ? n : Object(n)
    }

    function nn(n) {
        if (cr(n)) return n;
        var t = [];
        return (null == n ? "" : n + "").replace(ot, function(n, r, e, o) {
            t.push(e ? o.replace(ut, "$1") : r || n)
        }), t
    }

    function tn(t, r, e) {
        var o = t ? t.length : 0;
        if (!o) return -1;
        if (typeof e == "number") e = 0 > e ? Nt(o + e, 0) : e;
        else if (e) {
            e = 0;
            var u = t ? t.length : e;
            if (typeof r != "number" || r !== r || u > Rt) {
                u = jn, e = u(r);
                for (var i = 0, a = t ? t.length : 0, c = e !== e, f = null === e, l = e === xn; i < a;) {
                    var s = $t((i + a) / 2),
                        p = u(t[s]),
                        h = p !== xn,
                        y = p === p;
                    (c ? y : f ? y && h && null != p : l ? y && h : null == p ? 0 : p < e) ? i = s + 1: a = s
                }
                e = Wt(a, Dt)
            } else {
                for (; e < u;) {
                    var i = e + u >>> 1,
                        a = t[i];
                    a < r && null !== a ? e = i + 1 : u = i;
                }
                e = u
            }
            return e < o && (r === r ? r === t[e] : t[e] !== t[e]) ? e : -1
        }
        return n(t, r, e || 0)
    }

    function rn(n) {
        var t = n ? n.length : 0;
        return t ? n[t - 1] : xn
    }

    function en(n, t, r) {
        var e = cr(n) ? f : v;
        return t = B(t, r, 3), e(n, t)
    }

    function on(n, t, r, e) {
        var o = n ? nr(n) : 0;
        return Q(o) || (n = mn(n), o = n.length), r = typeof r != "number" || e && J(t, r, e) ? 0 : 0 > r ? Nt(o + r, 0) : r || 0, typeof n == "string" || !cr(n) && vn(n) ? r <= o && -1 < n.indexOf(t, r) : !!o && -1 < D(n, t, r)
    }

    function un(n, t, r) {
        var e = cr(n) ? l : A;
        return t = B(t, r, 3), e(n, t)
    }

    function an(n, t, r) {
        var e = cr(n) ? s : T;
        return r && J(n, t, r) && (t = xn),
            (typeof t != "function" || r !== xn) && (t = B(t, r, 3)), e(n, t)
    }

    function cn(n, t, r) {
        function e(t, r) {
            r && clearTimeout(r), c = p = h = xn, t && (y = ir(), f = n.apply(s, a), p || c || (a = s = xn))
        }

        function o() {
            var n = t - (ir() - l);
            0 >= n || n > t ? e(h, c) : p = setTimeout(o, n)
        }

        function u() {
            e(g, p)
        }

        function i() {
            if (a = arguments, l = ir(), s = this, h = g && (p || !b), false === v) var r = b && !p;
            else {
                c || b || (y = l);
                var e = v - (l - y),
                    i = 0 >= e || e > v;
                i ? (c && (c = clearTimeout(c)), y = l, f = n.apply(s, a)) : c || (c = setTimeout(u, e))
            }
            return i && p ? p = clearTimeout(p) : p || t === v || (p = setTimeout(o, t)), r && (i = true, f = n.apply(s, a)), !i || p || c || (a = s = xn), f
        }
        var a, c, f, l, s, p, h, y = 0,
            v = false,
            g = true;
        if (typeof n != "function") throw new TypeError(Mn);
        if (t = 0 > t ? 0 : +t || 0, true === r) var b = true,
            g = false;
        else hn(r) && (b = !!r.leading, v = "maxWait" in r && Nt(+r.maxWait || 0, t), g = "trailing" in r ? !!r.trailing : g);
        return i.cancel = function() {
            p && clearTimeout(p), c && clearTimeout(c), y = 0, c = p = h = xn
        }, i
    }

    function fn(n, t) {
        if (typeof n != "function") throw new TypeError(Mn);
        return t = Nt(t === xn ? n.length - 1 : +t || 0, 0),
            function() {
                for (var r = arguments, e = -1, o = Nt(r.length - t, 0), u = Array(o); ++e < o;) u[e] = r[t + e];
                switch (t) {
                    case 0:
                        return n.call(this, u);
                    case 1:
                        return n.call(this, r[0], u);
                    case 2:
                        return n.call(this, r[0], r[1], u)
                }
                for (o = Array(t + 1), e = -1; ++e < t;) o[e] = r[e];
                return o[t] = u, n.apply(this, o)
            }
    }

    function ln(n) {
        return t(n) && G(n) && _t.call(n, "callee") && !St.call(n, "callee")
    }

    function sn(n, t, r, e) {
        return e = (r = typeof r == "function" ? I(r, e, 3) : xn) ? r(n, t) : xn, e === xn ? w(n, t, r) : !!e
    }

    function pn(n) {
        return hn(n) && Ot.call(n) == Dn
    }

    function hn(n) {
        var t = typeof n;
        return !!n && ("object" == t || "function" == t)
    }

    function yn(n) {
        return null == n ? false : pn(n) ? xt.test(At.call(n)) : t(n) && (bt(n) ? xt : at).test(n);
    }

    function vn(n) {
        return typeof n == "string" || t(n) && Ot.call(n) == Yn
    }

    function gn(n) {
        return t(n) && Q(n.length) && !!lt[Ot.call(n)]
    }

    function bn(n) {
        if (null == n) return [];
        hn(n) || (n = Object(n));
        for (var t = n.length, r = e.support, t = t && Q(t) && (cr(n) || ln(n) || vn(n)) && t || 0, o = n.constructor, u = -1, o = pn(o) && o.prototype || wt, i = o === n, a = Array(t), c = 0 < t, f = r.enumErrorProps && (n === mt || n instanceof Error), l = r.enumPrototypes && pn(n); ++u < t;) a[u] = u + "";
        for (var s in n) l && "prototype" == s || f && ("message" == s || "name" == s) || c && H(s, t) || "constructor" == s && (i || !_t.call(n, s)) || a.push(s);
        if (r.nonEnumShadows && n !== wt)
            for (t = n === jt ? Yn : n === mt ? Bn : Ot.call(n), r = Gt[t] || Gt[qn], t == qn && (o = wt), t = ft.length; t--;) s = ft[t], u = r[s], i && u || (u ? !_t.call(n, s) : n[s] === o[s]) || a.push(s);
        return a
    }

    function dn(n) {
        n = Z(n);
        for (var t = -1, r = sr(n), e = r.length, o = Array(e); ++t < e;) {
            var u = r[t];
            o[t] = [u, n[u]]
        }
        return o
    }

    function mn(n) {
        for (var t = sr(n), r = -1, e = t.length, o = Array(e); ++r < e;) o[r] = n[t[r]];
        return o
    }

    function wn(n, r, e) {
        return e && J(n, r, e) && (r = xn), t(n) ? An(n) : h(n, r)
    }

    function jn(n) {
        return n
    }

    function An(n) {
        return _(y(n, true))
    }

    function _n() {}

    function On(n) {
        return K(n) ? x(n) : E(n)
    }
    var xn, En = 1,
        Sn = 2,
        Tn = 4,
        In = 8,
        kn = 16,
        Pn = 32,
        Fn = 64,
        $n = 128,
        Mn = "Expected a function",
        Un = "__lodash_placeholder__",
        Cn = "[object Arguments]",
        Nn = "[object Array]",
        Wn = "[object Boolean]",
        Ln = "[object Date]",
        Bn = "[object Error]",
        Dn = "[object Function]",
        Rn = "[object Number]",
        qn = "[object Object]",
        Vn = "[object RegExp]",
        Yn = "[object String]",
        zn = "[object ArrayBuffer]",
        Gn = "[object Float32Array]",
        Hn = "[object Float64Array]",
        Jn = "[object Int8Array]",
        Kn = "[object Int16Array]",
        Qn = "[object Int32Array]",
        Xn = "[object Uint8Array]",
        Zn = "[object Uint8ClampedArray]",
        nt = "[object Uint16Array]",
        tt = "[object Uint32Array]",
        rt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
        et = /^\w*$/,
        ot = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,
        ut = /\\(\\)?/g,
        it = /\w*$/,
        at = /^\[object .+?Constructor\]$/,
        ct = /^\d+$/,
        ft = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),
        lt = {};
    lt[Gn] = lt[Hn] = lt[Jn] = lt[Kn] = lt[Qn] = lt[Xn] = lt[Zn] = lt[nt] = lt[tt] = true, lt[Cn] = lt[Nn] = lt[zn] = lt[Wn] = lt[Ln] = lt[Bn] = lt[Dn] = lt["[object Map]"] = lt[Rn] = lt[qn] = lt[Vn] = lt["[object Set]"] = lt[Yn] = lt["[object WeakMap]"] = false;
    var st = {};
    st[Cn] = st[Nn] = st[zn] = st[Wn] = st[Ln] = st[Gn] = st[Hn] = st[Jn] = st[Kn] = st[Qn] = st[Rn] = st[qn] = st[Vn] = st[Yn] = st[Xn] = st[Zn] = st[nt] = st[tt] = true, st[Bn] = st[Dn] = st["[object Map]"] = st["[object Set]"] = st["[object WeakMap]"] = false;
    var pt = {
            "function": true,
            object: true
        },
        ht = pt[typeof module] && module && !module.nodeType && module,
        yt = pt[typeof self] && self && self.Object && self,
        vt = pt[typeof window] && window && window.Object && window,
        gt = pt[typeof exports] && exports && !exports.nodeType && exports && ht && typeof global == "object" && global && global.Object && global || vt !== (this && this.window) && vt || yt || this,
        bt = function() {
            try {
                Object({
                    toString: 0
                } + "")
            } catch (n) {
                return function() {
                    return false
                }
            }
            return function(n) {
                return typeof n.toString != "function" && typeof(n + "") == "string"
            }
        }(),
        dt = Array.prototype,
        mt = Error.prototype,
        wt = Object.prototype,
        jt = String.prototype,
        At = Function.prototype.toString,
        _t = wt.hasOwnProperty,
        Ot = wt.toString,
        xt = RegExp("^" + At.call(_t).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"),
        Et = gt.ArrayBuffer,
        St = wt.propertyIsEnumerable,
        Tt = q(gt, "Set"),
        It = dt.splice,
        kt = gt.Uint8Array,
        Pt = q(gt, "WeakMap"),
        Ft = q(Object, "create"),
        $t = Math.floor,
        Mt = q(Array, "isArray"),
        Ut = gt.isFinite,
        Ct = q(Object, "keys"),
        Nt = Math.max,
        Wt = Math.min,
        Lt = q(Date, "now"),
        Bt = Number.POSITIVE_INFINITY,
        Dt = 4294967294,
        Rt = 2147483647,
        qt = 9007199254740991,
        Vt = Pt && new Pt,
        Yt = {},
        zt = {};
    zt[Gn] = gt.Float32Array, zt[Hn] = gt.Float64Array, zt[Jn] = gt.Int8Array, zt[Kn] = gt.Int16Array, zt[Qn] = gt.Int32Array, zt[Xn] = kt, zt[Zn] = gt.Uint8ClampedArray, zt[nt] = gt.Uint16Array, zt[tt] = gt.Uint32Array;
    var Gt = {};
    Gt[Nn] = Gt[Ln] = Gt[Rn] = {
        constructor: true,
        toLocaleString: true,
        toString: true,
        valueOf: true
    }, Gt[Wn] = Gt[Yn] = {
        constructor: true,
        toString: true,
        valueOf: true
    }, Gt[Bn] = Gt[Dn] = Gt[Vn] = {
        constructor: true,
        toString: true
    }, Gt[qn] = {
        constructor: true
    }, c(ft, function(n) {
        for (var t in Gt)
            if (_t.call(Gt, t)) {
                var r = Gt[t];
                r[n] = _t.call(r, n)
            }
    });
    var Ht = e.support = {};
    ! function(n) {
        function t() {
            this.x = n
        }
        var r = {
                0: n,
                length: n
            },
            e = [];
        t.prototype = {
            valueOf: n,
            y: n
        };
        for (var o in new t) e.push(o);
        Ht.enumErrorProps = St.call(mt, "message") || St.call(mt, "name"), Ht.enumPrototypes = St.call(t, "prototype"), Ht.nonEnumShadows = !/valueOf/.test(e), Ht.ownLast = "x" != e[0], Ht.spliceObjects = (It.call(r, 0, 1), !r[0]), Ht.unindexedChars = "xx" != "x" [0] + Object("x")[0]
    }(1, 0);
    var Jt = function() {
            function n() {}
            return function(t) {
                if (hn(t)) {
                    n.prototype = t;
                    var r = new n;
                    n.prototype = xn
                }
                return r || {}
            }
        }(),
        Kt = function(n, t) {
            return function(r, e) {
                var o = r ? nr(r) : 0;
                if (!Q(o)) return n(r, e);
                for (var u = t ? o : -1, i = Z(r);
                    (t ? u-- : ++u < o) && false !== e(i[u], u, i););
                return r
            }
        }(d),
        Qt = function(n) {
            return function(t, r, e) {
                var o = Z(t);
                e = e(t);
                for (var u = e.length, i = n ? u : -1; n ? i-- : ++i < u;) {
                    var a = e[i];
                    if (false === r(o[a], a, o)) break
                }
                return t
            }
        }(),
        Xt = Vt ? function(n, t) {
            return Vt.set(n, t), n
        } : jn,
        Zt = Vt ? function(n) {
            return Vt.get(n)
        } : _n,
        nr = x("length"),
        tr = function() {
            var n = 0,
                t = 0;
            return function(r, e) {
                var o = ir(),
                    u = 16 - (o - t);
                if (t = o, 0 < u) {
                    if (150 <= ++n) return r
                } else n = 0;
                return Xt(r, e);
            }
        }(),
        rr = fn(function(t, r) {
            var e;
            if (G(t)) {
                e = r;
                var o = t ? t.length : 0,
                    a = [];
                if (o) {
                    var c = -1,
                        f = D(),
                        l = f === n,
                        s = l && 200 <= e.length && Ft && Tt ? new u(e) : null,
                        p = e.length;
                    s && (f = i, l = false, e = s);
                    n: for (; ++c < o;)
                        if (s = t[c], l && s === s) {
                            for (var h = p; h--;)
                                if (e[h] === s) continue n;
                            a.push(s)
                        } else 0 > f(e, s, 0) && a.push(s)
                }
                e = a
            } else e = [];
            return e
        }),
        er = function(n, t) {
            return function(r, e, o) {
                if (e = B(e, o, 3), cr(r)) {
                    n: {
                        o = r.length;
                        for (var u = t ? o : -1; t ? u-- : ++u < o;)
                            if (e(r[u], u, r)) {
                                e = u;
                                break n
                            }
                        e = -1
                    }
                    return -1 < e ? r[e] : xn
                }
                return g(r, e, n)
            }
        }(Kt),
        or = function(n, t) {
            return function(r, e, o) {
                return typeof e == "function" && o === xn && cr(r) ? n(r, e) : t(r, I(e, o, 3))
            }
        }(c, Kt),
        ur = function(n, t) {
            return function(r, e, o, u) {
                var i = 3 > arguments.length;
                return typeof e == "function" && u === xn && cr(r) ? n(r, e, o, i) : S(r, B(e, u, 4), o, i, t)
            }
        }(function(n, t, r, e) {
            var o = -1,
                u = n.length;
            for (e && u && (r = n[++o]); ++o < u;) r = t(r, n[o], o, n);
            return r
        }, Kt),
        ir = Lt || function() {
            return (new Date).getTime()
        },
        ar = fn(function(n, t, e) {
            var o = En;
            if (e.length) var u = r(e, ar.placeholder),
                o = o | Pn;
            var i, c = o,
                f = e,
                l = u,
                u = c & Sn;
            if (!u && typeof n != "function") throw new TypeError(Mn);
            if (e = f ? f.length : 0, e || (c &= ~(Pn | Fn), f = l = xn), e -= l ? l.length : 0, c & Fn) var s = f,
                p = l,
                f = l = xn;
            return o = u ? xn : Zt(n), t = [n, c, t, f, l, s, p, void 0, void 0, i], o && (s = t[1], i = o[1], c = s | i, p = i == $n && s == In || i == $n && 256 == s && t[7].length <= o[8] || i == (256 | $n) && s == In, (c < $n || p) && (i & En && (t[2] = o[2], c |= s & En ? 0 : Tn), (s = o[3]) && (p = t[3], t[3] = p ? P(p, s, o[4]) : a(s), t[4] = p ? r(t[3], Un) : a(o[4])), (s = o[5]) && (p = t[5], t[5] = p ? F(p, s, o[6]) : a(s), t[6] = p ? r(t[5], Un) : a(o[6])), (s = o[7]) && (t[7] = a(s)), i & $n && (t[8] = null == t[8] ? o[8] : Wt(t[8], o[8])), null == t[9] && (t[9] = o[9]), t[0] = o[0],
                t[1] = c), c = t[1], i = t[9]), t[9] = null == i ? u ? 0 : n.length : Nt(i - e, 0) || 0, (o ? Xt : tr)(c == En ? $(t[0], t[2]) : c != Pn && c != (En | Pn) || t[4].length ? U.apply(xn, t) : C.apply(xn, t), t)
        }),
        cr = Mt || function(n) {
            return t(n) && Q(n.length) && Ot.call(n) == Nn
        },
        fr = function(n) {
            return fn(function(t, r) {
                var e = -1,
                    o = null == t ? 0 : r.length,
                    u = 2 < o ? r[o - 2] : xn,
                    i = 2 < o ? r[2] : xn,
                    a = 1 < o ? r[o - 1] : xn;
                for (typeof u == "function" ? (u = I(u, a, 5), o -= 2) : (u = typeof a == "function" ? a : xn, o -= u ? 1 : 0), i && J(r[0], r[1], i) && (u = 3 > o ? xn : u, o = 1); ++e < o;)(i = r[e]) && n(t, i, u);
                return t
            })
        }(function(n, t, r) {
            if (r)
                for (var e = -1, o = sr(t), u = o.length; ++e < u;) {
                    var i = o[e],
                        a = n[i],
                        c = r(a, t[i], i, n, t);
                    (c === c ? c === a : a !== a) && (a !== xn || i in n) || (n[i] = c)
                } else n = p(n, t);
            return n
        }),
        lr = function(n, t) {
            return fn(function(r) {
                var e = r[0];
                return null == e ? e : (r.push(t), n.apply(xn, r))
            })
        }(fr, function(n, t) {
            return n === xn ? t : n
        }),
        sr = Ct ? function(n) {
            var t = null == n ? xn : n.constructor;
            return typeof t == "function" && t.prototype === n || (typeof n == "function" ? e.support.enumPrototypes : G(n)) ? X(n) : hn(n) ? Ct(n) : []
        } : X;
    o.prototype = Jt(function() {}.prototype), o.prototype.constructor = o,
        u.prototype.push = function(n) {
            var t = this.data;
            typeof n == "string" || hn(n) ? t.set.add(n) : t.hash[n] = true
        }, e.after = function(n, t) {
            if (typeof t != "function") {
                if (typeof n != "function") throw new TypeError(Mn);
                var r = n;
                n = t, t = r
            }
            return n = Ut(n = +n) ? n : 0,
                function() {
                    return 1 > --n ? t.apply(this, arguments) : void 0
                }
        }, e.assign = fr, e.bind = ar, e.callback = wn, e.debounce = cn, e.defaults = lr, e.filter = en, e.forEach = or, e.keys = sr, e.keysIn = bn, e.map = un, e.matches = An, e.pairs = dn, e.property = On, e.restParam = fn, e.throttle = function(n, t, r) {
            var e = true,
                o = true;
            if (typeof n != "function") throw new TypeError(Mn);
            return false === r ? e = false : hn(r) && (e = "leading" in r ? !!r.leading : e, o = "trailing" in r ? !!r.trailing : o), cn(n, t, {
                leading: e,
                maxWait: +t,
                trailing: o
            })
        }, e.values = mn, e.without = rr, e.collect = un, e.each = or, e.extend = fr, e.iteratee = wn, e.select = en, e.clone = function(n, t, r, e) {
            return t && typeof t != "boolean" && J(n, t, r) ? t = false : typeof t == "function" && (e = r, r = t, t = false), typeof r == "function" ? y(n, t, I(r, e, 3)) : y(n, t)
        }, e.find = er, e.identity = jn, e.includes = on, e.indexOf = tn, e.isArguments = ln, e.isArray = cr, e.isEqual = sn,
        e.isFunction = pn, e.isNative = yn, e.isObject = hn, e.isPlainObject = function(n) {
            var r;
            if (!t(n) || Ot.call(n) != qn || bt(n) || ln(n) || !(_t.call(n, "constructor") || (r = n.constructor, typeof r != "function" || r instanceof r))) return false;
            var o;
            return e.support.ownLast ? (b(n, function(n, t, r) {
                return o = _t.call(r, t), false
            }), false !== o) : (b(n, function(n, t) {
                o = t
            }), o === xn || _t.call(n, o))
        }, e.isString = vn, e.isTypedArray = gn, e.last = rn, e.noop = _n, e.now = ir, e.reduce = ur, e.some = an, e.any = an, e.contains = on, e.eq = sn, e.detect = er, e.foldl = ur, e.include = on, e.inject = ur,
        e.VERSION = "3.10.1", ar.placeholder = e, typeof define == "function" && typeof define.amd == "object" && define.amd && define(function() {
            return e
        })
}).call(this);
define.amd.module = "postal";
/**
 * postal - Pub/Sub library providing wildcard subscriptions, complex message handling, etc.  Works server and client-side.
 * Author: Jim Cowart (http://ifandelse.com)
 * Version: v1.0.7
 * Url: http://github.com/postaljs/postal.js
 * License(s): MIT
 */

(function(root, factory) {

    if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["lodash"], function(_) {
            return factory(_, root);
        });

    } else if (typeof module === "object" && module.exports) {
        // Node, or CommonJS-Like environments
        module.exports = factory(require("lodash"), this);
    } else {
        // Browser globals
        root.postal = factory(root._, root);
    }
}(this, function(_, global, undefined) {
    var prevPostal = global.postal;
    var _defaultConfig = {
        DEFAULT_CHANNEL: "/",
        SYSTEM_CHANNEL: "postal",
        enableSystemMessages: true,
        cacheKeyDelimiter: "|",
        autoCompactResolver: false
    };
    var postal = {
        configuration: _.extend({}, _defaultConfig)
    };
    var _config = postal.configuration;



    var ChannelDefinition = function(channelName, bus) {
        this.bus = bus;
        this.channel = channelName || _config.DEFAULT_CHANNEL;
    };

    ChannelDefinition.prototype.subscribe = function() {
        return this.bus.subscribe({
            channel: this.channel,
            topic: (arguments.length === 1 ? arguments[0].topic : arguments[0]),
            callback: (arguments.length === 1 ? arguments[0].callback : arguments[1])
        });
    };

    /*
        publish( envelope [, callback ] );
        publish( topic, data [, callback ] );
    */
    ChannelDefinition.prototype.publish = function() {
        var envelope = {};
        var callback;
        if (typeof arguments[0] === "string") {
            envelope.topic = arguments[0];
            envelope.data = arguments[1];
            callback = arguments[2];
        } else {
            envelope = arguments[0];
            callback = arguments[1];
        }
        if (typeof envelope !== "object") {
            throw new Error("The first argument to ChannelDefinition.publish should be either an envelope object or a string topic.");
        }
        envelope.channel = this.channel;
        this.bus.publish(envelope, callback);
    };


    var SubscriptionDefinition = function(channel, topic, callback) {
        if (arguments.length !== 3) {
            throw new Error("You must provide a channel, topic and callback when creating a SubscriptionDefinition instance.");
        }
        if (topic.length === 0) {
            throw new Error("Topics cannot be empty");
        }
        this.channel = channel;
        this.topic = topic;
        this.callback = callback;
        this.pipeline = [];
        this.cacheKeys = [];
        this._context = undefined;
    };

    var ConsecutiveDistinctPredicate = function() {
        var previous;
        return function(data) {
            var eq = false;
            if (typeof data === "string") {
                eq = data === previous;
                previous = data;
            } else {
                eq = _.isEqual(data, previous);
                previous = _.extend({}, data);
            }
            return !eq;
        };
    };

    var DistinctPredicate = function DistinctPredicateFactory() {
        var previous = [];
        return function DistinctPredicate(data) {
            var isDistinct = !_.any(previous, function(p) {
                return _.isEqual(data, p);
            });
            if (isDistinct) {
                previous.push(data);
            }
            return isDistinct;
        };
    };

    SubscriptionDefinition.prototype = {

        "catch": function(errorHandler) {
            var original = this.callback;
            var safeCallback = function() {
                try {
                    original.apply(this, arguments);
                } catch (err) {
                    errorHandler(err, arguments[0]);
                }
            };
            this.callback = safeCallback;
            return this;
        },

        defer: function defer() {
            return this.delay(0);
        },

        disposeAfter: function disposeAfter(maxCalls) {
            if (typeof maxCalls !== "number" || maxCalls <= 0) {
                throw new Error("The value provided to disposeAfter (maxCalls) must be a number greater than zero.");
            }
            var self = this;
            var dispose = _.after(maxCalls, _.bind(function() {
                self.unsubscribe();
            }));
            self.pipeline.push(function(data, env, next) {
                next(data, env);
                dispose();
            });
            return self;
        },

        distinct: function distinct() {
            return this.constraint(new DistinctPredicate());
        },

        distinctUntilChanged: function distinctUntilChanged() {
            return this.constraint(new ConsecutiveDistinctPredicate());
        },

        invokeSubscriber: function invokeSubscriber(data, env) {
            if (!this.inactive) {
                var self = this;
                var pipeline = self.pipeline;
                var len = pipeline.length;
                var context = self._context;
                var idx = -1;
                var invoked = false;
                if (!len) {
                    self.callback.call(context, data, env);
                    invoked = true;
                } else {
                    pipeline = pipeline.concat([self.callback]);
                    var step = function step(d, e) {
                        idx += 1;
                        if (idx < len) {
                            pipeline[idx].call(context, d, e, step);
                        } else {
                            self.callback.call(context, d, e);
                            invoked = true;
                        }
                    };
                    step(data, env, 0);
                }
                return invoked;
            }
        },

        logError: function logError() {

            if (console) {
                var report;
                if (console.warn) {
                    report = console.warn;
                } else {
                    report = console.log;
                }
                this.catch(report);
            }
            return this;
        },

        once: function once() {
            return this.disposeAfter(1);
        },

        subscribe: function subscribe(callback) {
            this.callback = callback;
            return this;
        },

        unsubscribe: function unsubscribe() {

            if (!this.inactive) {
                postal.unsubscribe(this);
            }
        },

        constraint: function constraint(predicate) {
            if (typeof predicate !== "function") {
                throw new Error("Predicate constraint must be a function");
            }
            this.pipeline.push(function(data, env, next) {
                if (predicate.call(this, data, env)) {
                    next(data, env);
                }
            });
            return this;
        },

        constraints: function constraints(predicates) {
            var self = this;

            _.each(predicates, function(predicate) {
                self.constraint(predicate);
            });
            return self;
        },

        context: function contextSetter(context) {
            this._context = context;
            return this;
        },

        debounce: function debounce(milliseconds, immediate) {
            if (typeof milliseconds !== "number") {
                throw new Error("Milliseconds must be a number");
            }
            this.pipeline.push(
                _.debounce(function(data, env, next) {
                        next(data, env);
                    },
                    milliseconds, !!immediate
                )
            );
            return this;
        },

        delay: function delay(milliseconds) {
            if (typeof milliseconds !== "number") {
                throw new Error("Milliseconds must be a number");
            }
            var self = this;
            self.pipeline.push(function(data, env, next) {
                setTimeout(function() {
                    next(data, env);
                }, milliseconds);
            });
            return this;
        },

        throttle: function throttle(milliseconds) {
            if (typeof milliseconds !== "number") {
                throw new Error("Milliseconds must be a number");
            }
            var fn = function(data, env, next) {
                next(data, env);
            };
            this.pipeline.push(_.throttle(fn, milliseconds));
            return this;
        }
    };

    // Backwards Compatibility
    // WARNING: these will be removed by version 0.13

    function warnOnDeprecation(oldMethod, newMethod) {
        return function() {
            if (console.warn || console.log) {
                var msg = "Warning, the " + oldMethod + " method has been deprecated. Please use " + newMethod + " instead.";
                if (console.warn) {
                    console.warn(msg);
                } else {
                    console.log(msg);
                }
            }
            return SubscriptionDefinition.prototype[newMethod].apply(this, arguments);
        };
    }
    var oldMethods = ["withConstraint", "withConstraints", "withContext", "withDebounce", "withDelay", "withThrottle"];
    var newMethods = ["constraint", "constraints", "context", "debounce", "delay", "throttle"];
    for (var i = 0; i < 6; i++) {
        var oldMethod = oldMethods[i];
        SubscriptionDefinition.prototype[oldMethod] = warnOnDeprecation(oldMethod, newMethods[i]);
    }




    var bindingsResolver = _config.resolver = {
        cache: {},
        regex: {},
        enableCache: true,

        compare: function compare(binding, topic, headerOptions) {
            var pattern;
            var rgx;
            var prevSegment;
            var cacheKey = topic + _config.cacheKeyDelimiter + binding;
            var result = (this.cache[cacheKey]);
            var opt = headerOptions || {};
            var saveToCache = this.enableCache && !opt.resolverNoCache;
            // result is cached?
            if (result === true) {
                return result;
            }
            // plain string matching?
            if (binding.indexOf("#") === -1 && binding.indexOf("*") === -1) {
                result = (topic === binding);
                if (saveToCache) {
                    this.cache[cacheKey] = result;
                }
                return result;
            }
            // ah, regex matching, then
            if (!(rgx = this.regex[binding])) {
                pattern = "^" + _.map(binding.split("."), function mapTopicBinding(segment) {
                    var res = "";
                    if (!!prevSegment) {
                        res = prevSegment !== "#" ? "\\.\\b" : "\\b";
                    }
                    if (segment === "#") {
                        res += "[\\s\\S]*";
                    } else if (segment === "*") {
                        res += "[^.]+";
                    } else {
                        res += segment;
                    }
                    prevSegment = segment;
                    return res;
                }).join("") + "$";
                rgx = this.regex[binding] = new RegExp(pattern);
            }
            result = rgx.test(topic);
            if (saveToCache) {
                this.cache[cacheKey] = result;
            }
            return result;
        },

        reset: function reset() {
            this.cache = {};
            this.regex = {};
        },

        purge: function(options) {
            var self = this;
            var keyDelimiter = _config.cacheKeyDelimiter;
            var matchPredicate = function(val, key) {
                var split = key.split(keyDelimiter);
                var topic = split[0];
                var binding = split[1];
                if ((typeof options.topic === "undefined" || options.topic === topic) &&
                    (typeof options.binding === "undefined" || options.binding === binding)) {
                    delete self.cache[key];
                }
            };

            var compactPredicate = function(val, key) {
                var split = key.split(keyDelimiter);
                if (postal.getSubscribersFor({
                        topic: split[0]
                    }).length === 0) {
                    delete self.cache[key];
                }
            };

            if (typeof options === "undefined") {
                this.reset();
            } else {
                var handler = options.compact === true ? compactPredicate : matchPredicate;
                _.each(this.cache, handler);
            }
        }
    };




    var pubInProgress = 0;
    var unSubQueue = [];
    var autoCompactIndex = 0;

    function clearUnSubQueue() {
        while (unSubQueue.length) {
            postal.unsubscribe(unSubQueue.shift());
        }
    }

    function getCachePurger(subDef, key, cache) {
        return function(sub, i, list) {
            if (sub === subDef) {
                list.splice(i, 1);
            }
            if (list.length === 0) {
                delete cache[key];
            }
        };
    }

    function getCacher(topic, pubCache, cacheKey, done, envelope) {
        var headers = envelope && envelope.headers || {};
        return function(subDef) {
            var cache;
            if (_config.resolver.compare(subDef.topic, topic, headers)) {
                if (!headers.resolverNoCache) {
                    cache = pubCache[cacheKey] = (pubCache[cacheKey] || []);
                    cache.push(subDef);
                }
                subDef.cacheKeys.push(cacheKey);
                if (done) {
                    done(subDef);
                }
            }
        };
    }

    function getSystemMessage(kind, subDef) {
        return {
            channel: _config.SYSTEM_CHANNEL,
            topic: "subscription." + kind,
            data: {
                event: "subscription." + kind,
                channel: subDef.channel,
                topic: subDef.topic
            }
        };
    }

    var sysCreatedMessage = _.bind(getSystemMessage, this, "created");
    var sysRemovedMessage = _.bind(getSystemMessage, this, "removed");

    function getPredicate(options, resolver) {
        if (typeof options === "function") {
            return options;
        } else if (!options) {
            return function() {
                return true;
            };
        } else {
            return function(sub) {
                var compared = 0;
                var matched = 0;
                _.each(options, function(val, prop) {
                    compared += 1;
                    if (
                        // We use the bindings resolver to compare the options.topic to subDef.topic
                        (prop === "topic" && resolver.compare(sub.topic, options.topic, {
                            resolverNoCache: true
                        })) ||
                        (prop === "context" && options.context === sub._context) ||
                        // Any other potential prop/value matching outside topic & context...
                        (sub[prop] === options[prop])) {
                        matched += 1;
                    }
                });
                return compared === matched;
            };
        }
    }

    _.extend(postal, {
        cache: {},
        subscriptions: {},
        wireTaps: [],

        ChannelDefinition: ChannelDefinition,
        SubscriptionDefinition: SubscriptionDefinition,

        channel: function channel(channelName) {
            return new ChannelDefinition(channelName, this);
        },

        addWireTap: function addWireTap(callback) {
            var self = this;
            self.wireTaps.push(callback);
            return function() {
                var idx = self.wireTaps.indexOf(callback);
                if (idx !== -1) {
                    self.wireTaps.splice(idx, 1);
                }
            };
        },

        noConflict: function noConflict() {

            if (typeof window === "undefined" || (typeof window !== "undefined" && typeof define === "function" && define.amd)) {
                throw new Error("noConflict can only be used in browser clients which aren't using AMD modules");
            }
            global.postal = prevPostal;
            return this;
        },

        getSubscribersFor: function getSubscribersFor(options) {
            var result = [];
            var self = this;
            _.each(self.subscriptions, function(channel) {
                _.each(channel, function(subList) {
                    result = result.concat(_.filter(subList, getPredicate(options, _config.resolver)));
                });
            });
            return result;
        },

        publish: function publish(envelope, cb) {
            ++pubInProgress;
            var channel = envelope.channel = envelope.channel || _config.DEFAULT_CHANNEL;
            var topic = envelope.topic;
            envelope.timeStamp = new Date();
            if (this.wireTaps.length) {
                _.each(this.wireTaps, function(tap) {
                    tap(envelope.data, envelope, pubInProgress);
                });
            }
            var cacheKey = channel + _config.cacheKeyDelimiter + topic;
            var cache = this.cache[cacheKey];
            var skipped = 0;
            var activated = 0;
            if (!cache) {
                var cacherFn = getCacher(
                    topic,
                    this.cache,
                    cacheKey,
                    function(candidate) {
                        if (candidate.invokeSubscriber(envelope.data, envelope)) {
                            activated++;
                        } else {
                            skipped++;
                        }
                    },
                    envelope
                );
                _.each(this.subscriptions[channel], function(candidates) {
                    _.each(candidates, cacherFn);
                });
            } else {
                _.each(cache, function(subDef) {
                    if (subDef.invokeSubscriber(envelope.data, envelope)) {
                        activated++;
                    } else {
                        skipped++;
                    }
                });
            }
            if (--pubInProgress === 0) {
                clearUnSubQueue();
            }
            if (cb) {
                cb({
                    activated: activated,
                    skipped: skipped
                });
            }
        },

        reset: function reset() {
            this.unsubscribeFor();
            _config.resolver.reset();
            this.subscriptions = {};
            this.cache = {};
        },

        subscribe: function subscribe(options) {
            var subscriptions = this.subscriptions;
            var subDef = new SubscriptionDefinition(options.channel || _config.DEFAULT_CHANNEL, options.topic, options.callback);
            var channel = subscriptions[subDef.channel];
            var channelLen = subDef.channel.length;
            var subs;
            if (!channel) {
                channel = subscriptions[subDef.channel] = {};
            }
            subs = subscriptions[subDef.channel][subDef.topic];
            if (!subs) {
                subs = subscriptions[subDef.channel][subDef.topic] = [];
            }
            // First, add the SubscriptionDefinition to the channel list
            subs.push(subDef);
            // Next, add the SubscriptionDefinition to any relevant existing cache(s)
            _.each(_.keys(this.cache), function(cacheKey) {
                if (cacheKey.substr(0, channelLen) === subDef.channel) {
                    getCacher(
                        cacheKey.split(_config.cacheKeyDelimiter)[1],
                        this.cache,
                        cacheKey)(subDef);
                }
            }, this);

            if (_config.enableSystemMessages) {
                this.publish(sysCreatedMessage(subDef));
            }
            return subDef;
        },

        unsubscribe: function unsubscribe() {
            var unSubLen = arguments.length;
            var unSubIdx = 0;
            var subDef;
            var channelSubs;
            var topicSubs;
            var idx;
            for (; unSubIdx < unSubLen; unSubIdx++) {
                subDef = arguments[unSubIdx];
                subDef.inactive = true;
                if (pubInProgress) {
                    unSubQueue.push(subDef);
                    return;
                }
                channelSubs = this.subscriptions[subDef.channel];
                topicSubs = channelSubs && channelSubs[subDef.topic];

                if (topicSubs) {
                    var len = topicSubs.length;
                    idx = 0;
                    // remove SubscriptionDefinition from channel list
                    while (idx < len) {

                        if (topicSubs[idx] === subDef) {
                            topicSubs.splice(idx, 1);
                            break;
                        }
                        idx += 1;
                    }
                    if (topicSubs.length === 0) {
                        delete channelSubs[subDef.topic];
                        if (!_.keys(channelSubs).length) {
                            delete this.subscriptions[subDef.channel];
                        }
                    }
                    // remove SubscriptionDefinition from postal cache
                    if (subDef.cacheKeys && subDef.cacheKeys.length) {
                        var key;
                        while (key = subDef.cacheKeys.pop()) {
                            _.each(this.cache[key], getCachePurger(subDef, key, this.cache));
                        }
                    }
                    if (typeof _config.resolver.purge === "function") {
                        // check to see if relevant resolver cache entries can be purged
                        var autoCompact = _config.autoCompactResolver === true ?
                            0 : typeof _config.autoCompactResolver === "number" ?
                            (_config.autoCompactResolver - 1) : false;
                        if (autoCompact >= 0 && autoCompactIndex === autoCompact) {
                            _config.resolver.purge({
                                compact: true
                            });
                            autoCompactIndex = 0;
                        } else if (autoCompact >= 0 && autoCompactIndex < autoCompact) {
                            autoCompactIndex += 1;
                        }
                    }
                }
                if (_config.enableSystemMessages) {
                    this.publish(sysRemovedMessage(subDef));
                }
            }
        },

        unsubscribeFor: function unsubscribeFor(options) {
            var toDispose = [];

            if (this.subscriptions) {
                toDispose = this.getSubscribersFor(options);
                this.unsubscribe.apply(this, toDispose);
            }
        }
    });



    if (global && Object.prototype.hasOwnProperty.call(global, "__postalReady__") && _.isArray(global.__postalReady__)) {
        while (global.__postalReady__.length) {
            global.__postalReady__.shift().onReady(postal);
        }
    }


    return postal;
}));

define.amd.module = "postal.federation";
/**
 * postal.federation - A base plugin for federating instances of postal.js across various boundaries.
 * Author: Jim Cowart (http://freshbrewedcode.com/jimcowart)
 * Version: v0.3.0-rc2
 * Url: http://github.com/postaljs/postal.federation
 * License(s): MIT
 */
(function(root, factory) {
    if (typeof module === "object" && module.exports) {
        // Node, or CommonJS-Like environments
        module.exports = function(postal) {
            return factory(require("lodash"), postal, require("riveter"));
        };
    } else if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["lodash", "postal", "riveter"], function(_, postal, riveter) {
            return factory(_, postal, riveter, root);
        });
    } else {
        // Browser globals
        root.postal = factory(root._, root.postal, root.riveter, root);
    }
}(this, function(_, postal, riveter, global, undefined) {
    if (!postal.createUUID) {
        postal.createUUID = function() {
            var s = [];
            var hexDigits = "0123456789abcdef";
            for (var i = 0; i < 36; i++) {
                s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
            }
            s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 
            s[8] = s[13] = s[18] = s[23] = "-";
            return s.join("");
        };
    }
    if (!postal.instanceId) {
        postal.instanceId = (function() {
            // THIS IS TEMPORARY UNTIL FSM IS BAKED-IN
            var _id, _oldId;
            return function(id) {
                if (id) {
                    _oldId = _id;
                    _id = id;
                    postal.publish({
                        channel: postal.configuration.SYSTEM_CHANNEL,
                        topic: "instanceId.changed",
                        data: {
                            oldId: _oldId,
                            newId: _id
                        }
                    });
                }
                return _id;
            };
        }());
    }
    var NO_OP = function() {},
        _ready = false,
        _inboundQueue = [],
        _outboundQueue = [],
        _signalQueue = [],
        _defaults = {
            enabled: true,
            filterMode: "whitelist",
            filterDirection: "both"
        },
        _config = _defaults,
        _matchesFilter = function(channel, topic, direction) {
            var channelPresent = Object.prototype.hasOwnProperty.call(postal.fedx.filters[direction], channel);
            var topicMatch = (channelPresent && _.any(postal.fedx.filters[direction][channel], function(binding) {
                return postal.configuration.resolver.compare(binding, topic);
            }));
            var blacklisting = _config.filterMode === "blacklist";
            return _config.enabled && ((blacklisting && (!channelPresent || (channelPresent && !topicMatch))) || (!blacklisting && channelPresent && topicMatch));
        },
        _packingSlips = {
            ping: function() {
                return {
                    type: "federation.ping",
                    instanceId: postal.instanceId(),
                    timeStamp: new Date(),
                    ticket: postal.createUUID()
                };
            },
            pong: function(ping) {
                return {
                    type: "federation.pong",
                    instanceId: postal.instanceId(),
                    timeStamp: new Date(),
                    pingData: {
                        instanceId: ping.instanceId,
                        timeStamp: ping.timeStamp,
                        ticket: ping.ticket
                    }
                };
            },
            message: function(env) {
                return {
                    type: "federation.message",
                    instanceId: postal.instanceId(),
                    timeStamp: new Date(),
                    envelope: env
                };
            },
            disconnect: function() {
                return {
                    type: "federation.disconnect",
                    instanceId: postal.instanceId(),
                    timeStamp: new Date()
                };
            },
            bundle: function(packingSlips) {
                return {
                    type: "federation.bundle",
                    instanceId: postal.instanceId(),
                    timeStamp: new Date(),
                    packingSlips: packingSlips
                };
            }
        },
        _handle = {
            "federation.ping": function(data /*, callback */ ) {
                data.source.setInstanceId(data.packingSlip.instanceId);
                if (data.source.handshakeComplete) {
                    data.source.sendPong(data.packingSlip);
                } else {
                    data.source.sendBundle([
                        postal.fedx.getPackingSlip("pong", data.packingSlip), postal.fedx.getPackingSlip("ping")
                    ]);
                }
            },
            "federation.pong": function(data) {
                data.source.handshakeComplete = true;
                data.source.setInstanceId(data.packingSlip.instanceId);
                if (data.source.pings[data.packingSlip.pingData.ticket]) {
                    data.source.pings[data.packingSlip.pingData.ticket].callback({
                        ticket: data.packingSlip.pingData.ticket,
                        instanceId: data.packingSlip.instanceId,
                        source: data.source
                    });
                    data.source.pings[data.packingSlip.pingData.ticket] = undefined;
                }
                if (!_.contains(postal.fedx.clients, data.packingSlip.instanceId)) {
                    postal.fedx.clients.push(data.packingSlip.instanceId);
                }
                postal.publish({
                    channel: "postal.federation",
                    topic: "client.federated",
                    data: {
                        remoteId: data.source.instanceId,
                        localId: postal.instanceId(),
                        transport: data.transport
                    }
                });
            },
            "federation.disconnect": function(data) {
                postal.fedx.clients = _.without(postal.fedx.clients, data.source.instanceId);
                postal.fedx.disconnect({
                    transport: data.source.transportName,
                    instanceId: data.source.instanceId,
                    doNotNotify: true
                });
            },
            "federation.message": function(data) {
                var env = data.packingSlip.envelope;
                if (_matchesFilter(env.channel, env.topic, "in")) {
                    env.lastSender = data.packingSlip.instanceId;
                    postal.publish(env);
                }
            },
            "federation.bundle": function(data) {
                _.each(data.packingSlip.packingSlips, function(slip) {
                    postal.fedx.onFederatedMsg(_.extend({}, data, {
                        packingSlip: slip
                    }));
                });
            }
        },
        FederationClient = function(target, options, instanceId) {
            //this.transportName = undefined;
            this.target = target;
            this.options = options || {};
            this.pings = {};
            this.instanceId = instanceId;
            this.handshakeComplete = false;
        };
    FederationClient.prototype.sendPing = function(callback) {
        var packingSlip = postal.fedx.getPackingSlip("ping");
        this.pings[packingSlip.ticket] = {
            ticket: packingSlip.ticket,
            callback: callback || NO_OP
        };
        this.send(packingSlip);
    };
    FederationClient.prototype.sendPong = function(origPackingSlip) {
        this.send(postal.fedx.getPackingSlip("pong", origPackingSlip));
    };
    FederationClient.prototype.sendBundle = function(slips) {
        this.send(postal.fedx.getPackingSlip("bundle", slips));
    };
    FederationClient.prototype.sendMessage = function(envelope) {
        if (!this.handshakeComplete) {
            return;
        }
        envelope.originId = envelope.originId || postal.instanceId();
        var env = _.clone(envelope);
        if (this.instanceId && this.instanceId !== env.lastSender && (!env.knownIds || !env.knownIds.length || (env.knownIds && !_.include(env.knownIds, this.instanceId)))) {
            env.knownIds = (env.knownIds || []).concat(_.without(postal.fedx.clients, this.instanceId));
            this.send(postal.fedx.getPackingSlip("message", env));
        }
    };
    FederationClient.prototype.disconnect = function() {
        this.send(postal.fedx.getPackingSlip("disconnect"));
    };
    FederationClient.prototype.onMessage = function(packingSlip) {
        if (this.shouldProcess()) {
            postal.fedx.onFederatedMsg({
                transport: this.transportName,
                packingSlip: packingSlip,
                source: this
            });
        }
    };
    FederationClient.prototype.shouldProcess = function() {
        return true;
    };
    FederationClient.prototype.send = function( /* msg */ ) {
        throw new Error("An object deriving from FederationClient must provide an implementation for 'send'.");
    };
    FederationClient.prototype.setInstanceId = function(id) {
        this.instanceId = id;
    };
    riveter(FederationClient);
    postal.fedx = _.extend({
        FederationClient: FederationClient,
        packingSlips: _packingSlips,
        handlers: _handle,
        clients: [],
        transports: {},
        // in is a reserved word (IE 8)
        filters: {
            "in": {},
            "out": {}
        },
        addFilter: function(filters) {
            filters = _.isArray(filters) ? filters : [filters];
            _.each(filters, function(filter) {
                filter.direction = filter.direction || _config.filterDirection;
                _.each((filter.direction === "both") ? ["in", "out"] : [filter.direction], function(dir) {
                    if (!this.filters[dir][filter.channel]) {
                        this.filters[dir][filter.channel] = [filter.topic];
                    } else if (!(_.include(this.filters[dir][filter.channel], filter.topic))) {
                        this.filters[dir][filter.channel].push(filter.topic);
                    }
                }, this);
            }, this);
        },
        removeFilter: function(filters) {
            filters = _.isArray(filters) ? filters : [filters];
            _.each(filters, function(filter) {
                filter.direction = filter.direction || _config.filterDirection;
                _.each((filter.direction === "both") ? ["in", "out"] : [filter.direction], function(dir) {
                    if (this.filters[dir][filter.channel] && _.include(this.filters[dir][filter.channel], filter.topic)) {
                        this.filters[dir][filter.channel] = _.without(this.filters[dir][filter.channel], filter.topic);
                    }
                }, this);
            }, this);
        },
        canSendRemote: function(channel, topic) {
            return _matchesFilter(channel, topic, "out");
        },
        configure: function(cfg) {
            if (cfg && cfg.filterMode && cfg.filterMode !== "blacklist" && cfg.filterMode !== "whitelist") {
                throw new Error("postal.fedx filterMode must be 'blacklist' or 'whitelist'.");
            }
            if (cfg) {
                _config = _.defaults(cfg, _defaults);
            }
            return _config;
        },
        getPackingSlip: function(type /*, env */ ) {
            if (Object.prototype.hasOwnProperty.call(_packingSlips, type)) {
                return _packingSlips[type].apply(this, Array.prototype.slice.call(arguments, 1));
            }
        },
        onFederatedMsg: function(data) {
            if (!_ready) {
                _inboundQueue.push(data);
                return;
            }
            if (Object.prototype.hasOwnProperty.call(_handle, data.packingSlip.type)) {
                _handle[data.packingSlip.type](data);
            } else {
                throw new Error("postal.federation does not have a message handler for '" + data.packingSlip.type + "'.");
            }
        },
        sendMessage: function(envelope) {
            if (!_ready) {
                _outboundQueue.push(arguments);
                return;
            }
            _.each(this.transports, function(transport) {
                transport.sendMessage(envelope);
            });
        },
        disconnect: function(options) {
            options = options || {};
            var transports = this.transports;
            if (options.transport) {
                transports = {};
                transports[options.transport] = this.transports[options.transport];
            }
            _.each(transports, function(transport) {
                transport.disconnect({
                    target: options.target,
                    instanceId: options.instanceId,
                    doNotNotify: !!options.doNotNotify
                });
            }, this);
        },
        _getTransports: function() {
            return _.reduce(this.transports, function(memo, transport, name) {
                memo[name] = true;
                return memo;
            }, {});
        },
        /*
        	signalReady( callback );
        	signalReady( "transportName" );
        	signalReady( "transportName", callback );
        	signalReady( "transportName", targetInstance, callback ); <-- this is NEW
        	signalReady( { transportNameA: targetsForA, transportNameB: targetsForB, transportC: true }, callback);
        	*/
        signalReady: function(transport, target, callback) {
            if (!_ready) {
                _signalQueue.push(arguments);
                return;
            }
            var transports = this._getTransports();
            switch (arguments.length) {
                case 1:
                    if (typeof transport === "function") {
                        callback = transport;
                    } else if (typeof transport === "string") {
                        transports = {};
                        transports[transport] = this.transports[transport];
                        callback = NO_OP;
                    }
                    break;
                case 2:
                    if (typeof transport === "string") {
                        transports = {};
                        transports[transport] = this.transports[transport];
                    } else {
                        transports = transport;
                    }
                    callback = target || NO_OP;
                    break;
                case 3:
                    transports = {};
                    transports[transport] = [target];
                    break;
            }
            _.each(transports, function(targets, name) {
                targets = typeof targets === "boolean" ? [] : targets;
                this.transports[name].signalReady(targets, callback);
            }, this);
        }
    }, postal.fedx);
    postal.addWireTap(function(data, envelope) {
        if (postal.fedx.canSendRemote(envelope.channel, envelope.topic)) {
            postal.fedx.sendMessage(envelope);
        }
    });

    function processSignalQ(args) {
        postal.fedx.signalReady.apply(this, args);
    }

    function processOutboundQ(args) {
        postal.fedx.send.apply(this, args);
    }

    function processInboundQ(msg) {
        postal.fedx.onFederatedMsg.call(this, msg);
    }
    postal.subscribe({
        channel: postal.configuration.SYSTEM_CHANNEL,
        topic: "instanceId.changed",
        callback: function() {
            _ready = true;
            while (_signalQueue.length) {
                processSignalQ(_signalQueue.shift());
            }
            while (_outboundQueue.length) {
                processOutboundQ(_outboundQueue.shift());
            }
            while (_inboundQueue.length) {
                processInboundQ(_inboundQueue.shift());
            }
        }
    });
    if (postal.instanceId() !== undefined) {
        _ready = true;
    }
    return postal;
}));
define.amd.module = "postal.request-response";
/**
 * postal.request-response - postal.js add-on that provides a request/response pattern API.
 * Author: Jim Cowart (http://ifandelse.com)
 * Version: v0.3.1
 * Url: https://github.com/postaljs/postal.request-response
 * License(s): MIT
 */
(function(root, factory) { /* istanbul ignore if  */
    if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["lodash", "postal"], function(_, postal) {
            return factory(_, postal, root);
        }); /* istanbul ignore else */
    } else if (typeof module === "object" && module.exports) {
        // Node, or CommonJS-Like environments
        module.exports = function(postal) {
            return factory(require("lodash"), postal, this);
        };
    } else {
        // Browser globals
        root.postal = factory(root._, root.postal, root);
    }
}(this, function(_, postal, global, undefined) {
    var REQ_RES_CHANNEL = "postal.request-response";
    // I want this lib to be compatible with nearly any
    // promises-A-spec-compliant promise lib. For that
    // to happen, though, you have to provide a factory
    // method implementation that returns a promise
    postal.configuration.promise = {
        createDeferred: function() {
            //Promise that we use in Haxe: haxe.js.Promise -> returns a deferred/promise instance.
            return Promise.defer();
        },
        getPromise: function(deferedObject) {
            //Promise that we use in Haxe: haxe.js.Promise -> returns a promise safe for consuming APIs to use.
            return deferedObject.promise;
        },
        fulfill: "resolve",
        fail: "reject",
    };
    /**
     * Fast UUID generator, RFC4122 version 4 compliant.
     * @author Jeff Ward (jcward.com).
     * @license MIT license
     * @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
     **/
    var UUID = (function() {
        var self = {};
        var lut = [];
        for (var i = 0; i < 256; i++) {
            lut[i] = (i < 16 ? "0" : "") + (i).toString(16);
        }
        self.create = function() {
            var d0 = Math.random() * 0xffffffff | 0;
            var d1 = Math.random() * 0xffffffff | 0;
            var d2 = Math.random() * 0xffffffff | 0;
            var d3 = Math.random() * 0xffffffff | 0;
            return lut[d0 & 0xff] + lut[d0 >> 8 & 0xff] + lut[d0 >> 16 & 0xff] + lut[d0 >> 24 & 0xff] + "-" + lut[d1 & 0xff] + lut[d1 >> 8 & 0xff] + "-" + lut[d1 >> 16 & 0x0f | 0x40] + lut[d1 >> 24 & 0xff] + "-" + lut[d2 & 0x3f | 0x80] + lut[d2 >> 8 & 0xff] + "-" + lut[d2 >> 16 & 0xff] + lut[d2 >> 24 & 0xff] + lut[d3 & 0xff] + lut[d3 >> 8 & 0xff] + lut[d3 >> 16 & 0xff] + lut[d3 >> 24 & 0xff];
        };
        return self;
    })();
    postal.ChannelDefinition.prototype.request = function(options) {
        var env = options.envelope ? options.envelope : {
            topic: options.topic,
            data: options.data,
            headers: options.headers
        };
        var requestId = UUID.create();
        var replyTopic = options.replyTopic || requestId;
        var replyChannel = options.replyChannel || REQ_RES_CHANNEL;
        var timeout;
        var promise = postal.configuration.promise.createDeferred();
        env.headers = env.headers || {};
        env.headers.replyable = true;
        env.headers.requestId = requestId;
        env.headers.replyTopic = replyTopic;
        env.headers.replyChannel = replyChannel;
        var sub = postal.subscribe({
            channel: replyChannel,
            topic: replyTopic,
            callback: function(data, env) {
                if (env.headers && env.headers.isError) {
                    promise[postal.configuration.promise.fail](data);
                } else {
                    promise[postal.configuration.promise.fulfill](data);
                }
            }
        }).once();
        if (options.timeout) {
            timeout = setTimeout(function() {
                promise[postal.configuration.promise.fail](new Error("Timeout limit exceeded for request."));
            }, options.timeout);
        }
        this.publish(env);
        return postal.configuration.promise.getPromise(promise);
    };
    var oldPub = postal.publish;
    postal.publish = function(envelope) {
        if (envelope.headers && envelope.headers.replyable) {
            envelope.reply = function(err, data) {
                postal.publish({
                    channel: envelope.headers.replyChannel,
                    topic: envelope.headers.replyTopic,
                    headers: {
                        isReply: true,
                        isError: !!err,
                        requestId: envelope.headers.requestId,
                        resolverNoCache: true
                    },
                    data: err || data
                });
            };
        }
        oldPub.call(this, envelope);
    };
    return postal;
}));
define.amd.module = "postal.xframe";
/**
 * postal.xframe - postal.js/postal.federation plugin for federating instances of postal.js across iframe/window boundaries.
 * Author: Jim Cowart (http://freshbrewedcode.com/jimcowart)
 * Version: v0.3.2
 * Url: http://github.com/postaljs/postal.xframe
 * License(s): MIT
 */
(function(root, factory) {
    if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["lodash", "postal.federation"], function(_, postal) {
            return factory(_, postal, root);
        });
    } else if (typeof module === "object" && module.exports) {
        // Node, or CommonJS-Like environments
        module.exports = function(postalFed) {
            return factory(require("lodash"), postalFed);
        };
    } else {
        // Browser globals
        root.postal = factory(root._, root.postal, root);
    }
}(this, function(_, postal, global, undefined) {
    var _origin = location.origin || location.protocol + "//" + location.host;

    function listener() {
        plugin.routeMessage.apply(plugin, arguments);
    }

    function safeSerialize(envelope) {
        for (var k in envelope) {
            if (envelope.hasOwnProperty(k)) {
                if (typeof envelope[k] === "function") {
                    delete envelope[k];
                }
                if (_.isPlainObject(envelope[k])) {
                    safeSerialize(envelope[k]);
                }
                if (_.isArray(envelope[k])) {
                    _.each(envelope[k], safeSerialize);
                }
            }
        }
        return envelope;
    }
    // I know, I KNOW. The alternative was very expensive perf & time-wise
    // so I saved you a perf hit by checking the stinking UA. Sigh.
    // I sought the opinion of several other devs. We all traveled
    // to the far east to consult with the wisdom of a monk - turns
    // out he didn"t know JavaScript, and our passports were stolen on the
    // return trip. We stowed away aboard a freighter headed back to the
    // US and by the time we got back, no one had heard of IE 8 or 9. True story.
    var useEagerSerialize = /MSIE [8,9]/.test(navigator.userAgent);
    var _memoRemoteByInstanceId = function(memo, instanceId) {
        var proxy = _.find(this.remotes, function(x) {
            return x.instanceId === instanceId;
        });
        if (proxy) {
            memo.push(proxy);
        }
        return memo;
    };
    var _memoRemoteByTarget = function(memo, tgt) {
        var proxy = _.find(this.remotes, function(x) {
            return x.target === tgt;
        });
        if (proxy) {
            memo.push(proxy);
        }
        return memo;
    };
    var _disconnectClient = function(client) {
        client.disconnect();
    };
    var _envIsWorker = (typeof window === "undefined") && postMessage && location;
    var _workers = [];
    var XFRAME = "xframe",
        NO_OP = function() {},
        _defaults = {
            allowedOrigins: [_origin],
            enabled: true,
            defaultOriginUrl: "*",
            safeSerialize: false
        },
        _config = _.extend({}, _defaults),
        XFrameClient = postal.fedx.FederationClient.extend({
            transportName: "xframe",
            shouldProcess: function() {
                var hasDomainFilters = !!_config.allowedOrigins.length;
                return _config.enabled &&
                    // another frame/window
                    ((this.options.origin === "*" || (hasDomainFilters && _.contains(_config.allowedOrigins, this.options.origin) || !hasDomainFilters)) ||
                        // worker
                        (this.options.isWorker && _.contains(_workers, this.target)) ||
                        // we are in a worker
                        _envIsWorker);
            },
            send: function(packingSlip) {
                var args;
                var context;
                if (this.shouldProcess()) {
                    context = _envIsWorker ? null : this.target;
                    args = [postal.fedx.transports[XFRAME].wrapForTransport(packingSlip)];
                    if (!this.options.isWorker && !_envIsWorker) {
                        args.push(this.options.origin);
                    }
                    if (!_envIsWorker) {
                        if (args.length === 1) {
                            this.target.postMessage(args[0]);
                        } else {
                            this.target.postMessage(args[0], args[1]);
                        }
                    } else {
                        this.target.postMessage.apply(context, args);
                    }
                }
            }
        }, {
            getInstance: function(source, origin, instanceId) {
                var client = new XFrameClient(source, {
                    origin: origin,
                    isWorker: (typeof Worker !== "undefined" && source instanceof Worker)
                }, instanceId);
                if (client.options.isWorker) {
                    plugin.listenToWorker(client.target);
                }
                return client;
            }
        }),
        plugin = postal.fedx.transports[XFRAME] = {
            eagerSerialize: useEagerSerialize,
            XFrameClient: XFrameClient,
            configure: function(cfg) {
                if (cfg) {
                    _config = _.defaults(_.extend(_config, cfg), _defaults);
                }
                return _config;
            },
            clearConfiguration: function() {
                _config = _.extend({}, _defaults);
            },
            //find all iFrames and the parent window if in an iframe
            getTargets: _envIsWorker ?
                function() {
                    return [{
                        target: {
                            postMessage: postMessage
                        }
                    }]; // TODO: look into this...
                } : function() {
                    var targets = _.map(document.getElementsByTagName("iframe"), function(i) {
                        var urlHack = document.createElement("a");
                        urlHack.href = i.src;
                        var origin = urlHack.protocol + "//" + urlHack.host;
                        // The following condition fixes the IE issue of setting the origin while the iframe is 'empty':
                        // if the iframe has no 'src' set to some meaningful url (at this very moment),
                        // then the urlHack returns neither protocol nor host information.
                        if (origin === "//") {
                            origin = null;
                        }
                        return {
                            target: i.contentWindow,
                            origin: origin || _config.defaultOriginUrl
                        };
                    });
                    if (window.parent && window.parent !== window) {
                        targets.push({
                            target: window.parent,
                            origin: "*"
                        });
                    }
                    return targets.concat(_workers);
                },
            remotes: [],
            wrapForTransport: useEagerSerialize ?
                function(packingSlip) {
                    return JSON.stringify({
                        postal: true,
                        packingSlip: packingSlip
                    });
                } : function(packingSlip) {
                    return {
                        postal: true,
                        packingSlip: packingSlip
                    };
                },
            unwrapFromTransport: function(msgData) {
                if (typeof msgData === "string" && (useEagerSerialize || msgData.indexOf('"postal":true') !== -1)) {
                    try {
                        return JSON.parse(msgData);
                    } catch (ex) {
                        return {};
                    }
                } else {
                    return msgData;
                }
            },
            routeMessage: function(event) {
                // source = remote window or worker?
                var source = event.source || event.currentTarget;
                var parsed = this.unwrapFromTransport(event.data);
                if (parsed.postal) {
                    if (postal.instanceId() === "worker") {
                        console.log("parsed: " + JSON.stringify(parsed));
                    }
                    var remote = _.find(this.remotes, function(x) {
                        return x.target === source;
                    });
                    if (!remote) {
                        remote = XFrameClient.getInstance(source, event.origin, parsed.packingSlip.instanceId);
                        this.remotes.push(remote);
                    }
                    remote.onMessage(parsed.packingSlip);
                }
            },
            sendMessage: function(env) {
                var envelope = env;
                if (_config.safeSerialize) {
                    envelope = safeSerialize(_.cloneDeep(env));
                }
                _.each(this.remotes, function(remote) {
                    remote.sendMessage(envelope);
                });
            },
            disconnect: function(options) {
                options = options || {};
                var clients = options.instanceId ?
                    // an instanceId value or array was provided, let's get the client proxy instances for the id(s)
                    _.reduce(_.isArray(options.instanceId) ? options.instanceId : [options.instanceId], _memoRemoteByInstanceId, [], this) :
                    // Ok so we don't have instanceId(s), let's try target(s)
                    options.target ?
                    // Ok, so we have a targets array, we need to iterate over it and get a list of the proxy/client instances
                    _.reduce(_.isArray(options.target) ? options.target : [options.target], _memoRemoteByTarget, [], this) :
                    // aww, heck - we don't have instanceId(s) or target(s), so it's ALL THE REMOTES
                    this.remotes;
                if (!options.doNotNotify) {
                    _.each(clients, _disconnectClient, this);
                }
                this.remotes = _.without.apply(null, [this.remotes].concat(clients));
            },
            signalReady: function(targets, callback) {
                targets = _.isArray(targets) ? targets : [targets];
                targets = targets.length ? targets : this.getTargets();
                callback = callback || NO_OP;
                _.each(targets, function(def) {
                    if (def.target) {
                        def.origin = def.origin || _config.defaultOriginUrl;
                        var remote = _.find(this.remotes, function(x) {
                            return x.target === def.target;
                        });
                        if (!remote) {
                            remote = XFrameClient.getInstance(def.target, def.origin);
                            this.remotes.push(remote);
                        }
                        remote.sendPing(callback);
                    }
                }, this);
            },
            addEventListener: _envIsWorker ?
                function() {
                    addEventListener("message", listener);
                } : function(obj, eventName, handler, bubble) {
                    // in normal browser context
                    if (typeof window !== "undefined") {
                        if ("addEventListener" in obj) { // W3C
                            obj.addEventListener(eventName, handler, bubble);
                        } else { // IE8
                            obj.attachEvent("on" + eventName, handler);
                        }
                    }
                },
            listenToWorker: function(worker) {
                if (!_.include(_workers, worker)) {
                    worker.addEventListener("message", listener);
                    _workers.push(worker);
                }
            },
            stopListeningToWorker: function(worker) {
                if (worker) {
                    worker.removeEventListener("message", listener);
                    _workers = _.without(_workers, worker);
                } else {
                    while (_workers.length) {
                        _workers.pop().removeEventListener("message", listener);
                    }
                }
            }
        };
    plugin.addEventListener(this, "message", listener, false);
    return postal;
}));
define.amd.module = "riveter";
/**
 * riveter - Mix-in, inheritance and constructor extend behavior for your JavaScript enjoyment.
 * © 2012 - Copyright appendTo, LLC 
 * Author(s): Jim Cowart, Nicholas Cloud, Doug Neiner
 * Version: v0.1.2
 * Url: https://github.com/a2labs/riveter
 * License(s): MIT
 */
(function(root, factory) {
    if (typeof module === "object" && module.exports) {
        // Node, or CommonJS-Like environments
        module.exports = factory(require("underscore"));
    } else if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["underscore"], function(_) {
            return factory(_, root);
        });
    } else {
        // Browser globals
        root.riveter = factory(root._, root);
    }
}(this, function(_, global, undefined) {
    var slice = Array.prototype.slice;
    var riveter = function() {
        var args = slice.call(arguments, 0);
        while (args.length) {
            riveter.rivet(args.shift());
        }
    };
    riveter.rivet = function(fn) {
        if (!fn.hasOwnProperty("extend")) {
            fn.extend = function(props, ctorProps) {
                return riveter.extend(fn, props, ctorProps);
            };
        }
        if (!fn.hasOwnProperty("compose")) {
            fn.compose = function() {
                return riveter.compose.apply(this, [fn].concat(slice.call(arguments, 0)));
            };
        }
        if (!fn.hasOwnProperty("inherits")) {
            fn.inherits = function(parent, ctorProps) {
                riveter.inherits(fn, parent, ctorProps);
            };
        }
        if (!fn.hasOwnProperty("mixin")) {
            fn.mixin = function() {
                riveter.mixin.apply(this, ([fn].concat(slice.call(arguments, 0))));
            };
        }
    };
    riveter.inherits = function(child, parent, ctorProps) {
        var childProto;
        var TmpCtor = function() {};
        var Child = function() {
            parent.apply(this, arguments);
        };
        if (typeof child === "object") {
            if (child.hasOwnProperty("constructor")) {
                Child = child.constructor;
            }
            childProto = child;
        } else {
            Child = child;
            childProto = child.prototype;
        }
        riveter.rivet(Child);
        _.defaults(Child, parent, ctorProps);
        TmpCtor.prototype = parent.prototype;
        Child.prototype = new TmpCtor();
        _.extend(Child.prototype, childProto, {
            constructor: Child
        });
        Child.__super = parent;
        // Next line is all about Backbone compatibility
        Child.__super__ = parent.prototype;
        return Child;
    };
    riveter.extend = function(ctor, props, ctorProps) {
        return riveter.inherits(props, ctor, ctorProps);
    };
    riveter.compose = function() {
        var args = slice.call(arguments, 0);
        var ctor = args.shift();
        riveter.rivet(ctor);
        var mixin = _.reduce(args, function(memo, val) {
            if (val.hasOwnProperty("_preInit")) {
                memo.preInit.push(val._preInit);
            }
            if (val.hasOwnProperty("_postInit")) {
                memo.postInit.push(val._postInit);
            }
            val = val.mixin || val;
            memo.items.push(val);
            return memo;
        }, {
            items: [],
            preInit: [],
            postInit: []
        });
        var res = ctor.extend({
            constructor: function( /* options */ ) {
                var args = slice.call(arguments, 0);
                _.each(mixin.preInit, function(initializer) {
                    initializer.apply(this, args);
                }, this);
                ctor.prototype.constructor.apply(this, args);
                _.each(mixin.postInit, function(initializer) {
                    initializer.apply(this, args);
                }, this);
            }
        });
        riveter.rivet(res);
        _.defaults(res.prototype, _.extend.apply(null, [{}].concat(mixin.items)));
        return res;
    };
    riveter.mixin = function() {
        var args = slice.call(arguments, 0);
        var ctor = args.shift();
        riveter.rivet(ctor);
        _.defaults(ctor.prototype, _.extend.apply(null, [{}].concat(args)));
    };
    return riveter;
}));
//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.
(function() {
    function n(n) {
        function t(t, r, e, u, i, o) {
            for (; i >= 0 && o > i; i += n) {
                var a = u ? u[i] : i;
                e = r(e, t[a], a, t)
            }
            return e
        }
        return function(r, e, u, i) {
            e = b(e, i, 4);
            var o = !k(r) && m.keys(r),
                a = (o || r).length,
                c = n > 0 ? 0 : a - 1;
            return arguments.length < 3 && (u = r[o ? o[c] : c], c += n), t(r, e, u, o, c, a)
        }
    }

    function t(n) {
        return function(t, r, e) {
            r = x(r, e);
            for (var u = O(t), i = n > 0 ? 0 : u - 1; i >= 0 && u > i; i += n)
                if (r(t[i], i, t)) return i;
            return -1
        }
    }

    function r(n, t, r) {
        return function(e, u, i) {
            var o = 0,
                a = O(e);
            if ("number" == typeof i) n > 0 ? o = i >= 0 ? i : Math.max(i + a, o) : a = i >= 0 ? Math.min(i + 1, a) : i + a + 1;
            else if (r && i && a) return i = r(e, u), e[i] === u ? i : -1;
            if (u !== u) return i = t(l.call(e, o, a), m.isNaN), i >= 0 ? i + o : -1;
            for (i = n > 0 ? o : a - 1; i >= 0 && a > i; i += n)
                if (e[i] === u) return i;
            return -1
        }
    }

    function e(n, t) {
        var r = I.length,
            e = n.constructor,
            u = m.isFunction(e) && e.prototype || a,
            i = "constructor";
        for (m.has(n, i) && !m.contains(t, i) && t.push(i); r--;) i = I[r], i in n && n[i] !== u[i] && !m.contains(t, i) && t.push(i)
    }
    var u = this,
        i = u._,
        o = Array.prototype,
        a = Object.prototype,
        c = Function.prototype,
        f = o.push,
        l = o.slice,
        s = a.toString,
        p = a.hasOwnProperty,
        h = Array.isArray,
        v = Object.keys,
        g = c.bind,
        y = Object.create,
        d = function() {},
        m = function(n) {
            return n instanceof m ? n : this instanceof m ? void(this._wrapped = n) : new m(n)
        };
    "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = m), exports._ = m) : u._ = m, m.VERSION = "1.8.3";
    var b = function(n, t, r) {
            if (t === void 0) return n;
            switch (null == r ? 3 : r) {
                case 1:
                    return function(r) {
                        return n.call(t, r)
                    };
                case 2:
                    return function(r, e) {
                        return n.call(t, r, e)
                    };
                case 3:
                    return function(r, e, u) {
                        return n.call(t, r, e, u)
                    };
                case 4:
                    return function(r, e, u, i) {
                        return n.call(t, r, e, u, i)
                    }
            }
            return function() {
                return n.apply(t, arguments)
            }
        },
        x = function(n, t, r) {
            return null == n ? m.identity : m.isFunction(n) ? b(n, t, r) : m.isObject(n) ? m.matcher(n) : m.property(n)
        };
    m.iteratee = function(n, t) {
        return x(n, t, 1 / 0)
    };
    var _ = function(n, t) {
            return function(r) {
                var e = arguments.length;
                if (2 > e || null == r) return r;
                for (var u = 1; e > u; u++)
                    for (var i = arguments[u], o = n(i), a = o.length, c = 0; a > c; c++) {
                        var f = o[c];
                        t && r[f] !== void 0 || (r[f] = i[f])
                    }
                return r
            }
        },
        j = function(n) {
            if (!m.isObject(n)) return {};
            if (y) return y(n);
            d.prototype = n;
            var t = new d;
            return d.prototype = null, t
        },
        w = function(n) {
            return function(t) {
                return null == t ? void 0 : t[n]
            }
        },
        A = Math.pow(2, 53) - 1,
        O = w("length"),
        k = function(n) {
            var t = O(n);
            return "number" == typeof t && t >= 0 && A >= t
        };
    m.each = m.forEach = function(n, t, r) {
        t = b(t, r);
        var e, u;
        if (k(n))
            for (e = 0, u = n.length; u > e; e++) t(n[e], e, n);
        else {
            var i = m.keys(n);
            for (e = 0, u = i.length; u > e; e++) t(n[i[e]], i[e], n)
        }
        return n
    }, m.map = m.collect = function(n, t, r) {
        t = x(t, r);
        for (var e = !k(n) && m.keys(n), u = (e || n).length, i = Array(u), o = 0; u > o; o++) {
            var a = e ? e[o] : o;
            i[o] = t(n[a], a, n)
        }
        return i
    }, m.reduce = m.foldl = m.inject = n(1), m.reduceRight = m.foldr = n(-1), m.find = m.detect = function(n, t, r) {
        var e;
        return e = k(n) ? m.findIndex(n, t, r) : m.findKey(n, t, r), e !== void 0 && e !== -1 ? n[e] : void 0
    }, m.filter = m.select = function(n, t, r) {
        var e = [];
        return t = x(t, r), m.each(n, function(n, r, u) {
            t(n, r, u) && e.push(n)
        }), e
    }, m.reject = function(n, t, r) {
        return m.filter(n, m.negate(x(t)), r)
    }, m.every = m.all = function(n, t, r) {
        t = x(t, r);
        for (var e = !k(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) {
            var o = e ? e[i] : i;
            if (!t(n[o], o, n)) return !1
        }
        return !0
    }, m.some = m.any = function(n, t, r) {
        t = x(t, r);
        for (var e = !k(n) && m.keys(n), u = (e || n).length, i = 0; u > i; i++) {
            var o = e ? e[i] : i;
            if (t(n[o], o, n)) return !0
        }
        return !1
    }, m.contains = m.includes = m.include = function(n, t, r, e) {
        return k(n) || (n = m.values(n)), ("number" != typeof r || e) && (r = 0), m.indexOf(n, t, r) >= 0
    }, m.invoke = function(n, t) {
        var r = l.call(arguments, 2),
            e = m.isFunction(t);
        return m.map(n, function(n) {
            var u = e ? t : n[t];
            return null == u ? u : u.apply(n, r)
        })
    }, m.pluck = function(n, t) {
        return m.map(n, m.property(t))
    }, m.where = function(n, t) {
        return m.filter(n, m.matcher(t))
    }, m.findWhere = function(n, t) {
        return m.find(n, m.matcher(t))
    }, m.max = function(n, t, r) {
        var e, u, i = -1 / 0,
            o = -1 / 0;
        if (null == t && null != n) {
            n = k(n) ? n : m.values(n);
            for (var a = 0, c = n.length; c > a; a++) e = n[a], e > i && (i = e)
        } else t = x(t, r), m.each(n, function(n, r, e) {
            u = t(n, r, e), (u > o || u === -1 / 0 && i === -1 / 0) && (i = n, o = u)
        });
        return i
    }, m.min = function(n, t, r) {
        var e, u, i = 1 / 0,
            o = 1 / 0;
        if (null == t && null != n) {
            n = k(n) ? n : m.values(n);
            for (var a = 0, c = n.length; c > a; a++) e = n[a], i > e && (i = e)
        } else t = x(t, r), m.each(n, function(n, r, e) {
            u = t(n, r, e), (o > u || 1 / 0 === u && 1 / 0 === i) && (i = n, o = u)
        });
        return i
    }, m.shuffle = function(n) {
        for (var t, r = k(n) ? n : m.values(n), e = r.length, u = Array(e), i = 0; e > i; i++) t = m.random(0, i), t !== i && (u[i] = u[t]), u[t] = r[i];
        return u
    }, m.sample = function(n, t, r) {
        return null == t || r ? (k(n) || (n = m.values(n)), n[m.random(n.length - 1)]) : m.shuffle(n).slice(0, Math.max(0, t))
    }, m.sortBy = function(n, t, r) {
        return t = x(t, r), m.pluck(m.map(n, function(n, r, e) {
            return {
                value: n,
                index: r,
                criteria: t(n, r, e)
            }
        }).sort(function(n, t) {
            var r = n.criteria,
                e = t.criteria;
            if (r !== e) {
                if (r > e || r === void 0) return 1;
                if (e > r || e === void 0) return -1
            }
            return n.index - t.index
        }), "value")
    };
    var F = function(n) {
        return function(t, r, e) {
            var u = {};
            return r = x(r, e), m.each(t, function(e, i) {
                var o = r(e, i, t);
                n(u, e, o)
            }), u
        }
    };
    m.groupBy = F(function(n, t, r) {
        m.has(n, r) ? n[r].push(t) : n[r] = [t]
    }), m.indexBy = F(function(n, t, r) {
        n[r] = t
    }), m.countBy = F(function(n, t, r) {
        m.has(n, r) ? n[r]++ : n[r] = 1
    }), m.toArray = function(n) {
        return n ? m.isArray(n) ? l.call(n) : k(n) ? m.map(n, m.identity) : m.values(n) : []
    }, m.size = function(n) {
        return null == n ? 0 : k(n) ? n.length : m.keys(n).length
    }, m.partition = function(n, t, r) {
        t = x(t, r);
        var e = [],
            u = [];
        return m.each(n, function(n, r, i) {
            (t(n, r, i) ? e : u).push(n)
        }), [e, u]
    }, m.first = m.head = m.take = function(n, t, r) {
        return null == n ? void 0 : null == t || r ? n[0] : m.initial(n, n.length - t)
    }, m.initial = function(n, t, r) {
        return l.call(n, 0, Math.max(0, n.length - (null == t || r ? 1 : t)))
    }, m.last = function(n, t, r) {
        return null == n ? void 0 : null == t || r ? n[n.length - 1] : m.rest(n, Math.max(0, n.length - t))
    }, m.rest = m.tail = m.drop = function(n, t, r) {
        return l.call(n, null == t || r ? 1 : t)
    }, m.compact = function(n) {
        return m.filter(n, m.identity)
    };
    var S = function(n, t, r, e) {
        for (var u = [], i = 0, o = e || 0, a = O(n); a > o; o++) {
            var c = n[o];
            if (k(c) && (m.isArray(c) || m.isArguments(c))) {
                t || (c = S(c, t, r));
                var f = 0,
                    l = c.length;
                for (u.length += l; l > f;) u[i++] = c[f++]
            } else r || (u[i++] = c)
        }
        return u
    };
    m.flatten = function(n, t) {
        return S(n, t, !1)
    }, m.without = function(n) {
        return m.difference(n, l.call(arguments, 1))
    }, m.uniq = m.unique = function(n, t, r, e) {
        m.isBoolean(t) || (e = r, r = t, t = !1), null != r && (r = x(r, e));
        for (var u = [], i = [], o = 0, a = O(n); a > o; o++) {
            var c = n[o],
                f = r ? r(c, o, n) : c;
            t ? (o && i === f || u.push(c), i = f) : r ? m.contains(i, f) || (i.push(f), u.push(c)) : m.contains(u, c) || u.push(c)
        }
        return u
    }, m.union = function() {
        return m.uniq(S(arguments, !0, !0))
    }, m.intersection = function(n) {
        for (var t = [], r = arguments.length, e = 0, u = O(n); u > e; e++) {
            var i = n[e];
            if (!m.contains(t, i)) {
                for (var o = 1; r > o && m.contains(arguments[o], i); o++);
                o === r && t.push(i)
            }
        }
        return t
    }, m.difference = function(n) {
        var t = S(arguments, !0, !0, 1);
        return m.filter(n, function(n) {
            return !m.contains(t, n)
        })
    }, m.zip = function() {
        return m.unzip(arguments)
    }, m.unzip = function(n) {
        for (var t = n && m.max(n, O).length || 0, r = Array(t), e = 0; t > e; e++) r[e] = m.pluck(n, e);
        return r
    }, m.object = function(n, t) {
        for (var r = {}, e = 0, u = O(n); u > e; e++) t ? r[n[e]] = t[e] : r[n[e][0]] = n[e][1];
        return r
    }, m.findIndex = t(1), m.findLastIndex = t(-1), m.sortedIndex = function(n, t, r, e) {
        r = x(r, e, 1);
        for (var u = r(t), i = 0, o = O(n); o > i;) {
            var a = Math.floor((i + o) / 2);
            r(n[a]) < u ? i = a + 1 : o = a
        }
        return i
    }, m.indexOf = r(1, m.findIndex, m.sortedIndex), m.lastIndexOf = r(-1, m.findLastIndex), m.range = function(n, t, r) {
        null == t && (t = n || 0, n = 0), r = r || 1;
        for (var e = Math.max(Math.ceil((t - n) / r), 0), u = Array(e), i = 0; e > i; i++, n += r) u[i] = n;
        return u
    };
    var E = function(n, t, r, e, u) {
        if (!(e instanceof t)) return n.apply(r, u);
        var i = j(n.prototype),
            o = n.apply(i, u);
        return m.isObject(o) ? o : i
    };
    m.bind = function(n, t) {
        if (g && n.bind === g) return g.apply(n, l.call(arguments, 1));
        if (!m.isFunction(n)) throw new TypeError("Bind must be called on a function");
        var r = l.call(arguments, 2),
            e = function() {
                return E(n, e, t, this, r.concat(l.call(arguments)))
            };
        return e
    }, m.partial = function(n) {
        var t = l.call(arguments, 1),
            r = function() {
                for (var e = 0, u = t.length, i = Array(u), o = 0; u > o; o++) i[o] = t[o] === m ? arguments[e++] : t[o];
                for (; e < arguments.length;) i.push(arguments[e++]);
                return E(n, r, this, this, i)
            };
        return r
    }, m.bindAll = function(n) {
        var t, r, e = arguments.length;
        if (1 >= e) throw new Error("bindAll must be passed function names");
        for (t = 1; e > t; t++) r = arguments[t], n[r] = m.bind(n[r], n);
        return n
    }, m.memoize = function(n, t) {
        var r = function(e) {
            var u = r.cache,
                i = "" + (t ? t.apply(this, arguments) : e);
            return m.has(u, i) || (u[i] = n.apply(this, arguments)), u[i]
        };
        return r.cache = {}, r
    }, m.delay = function(n, t) {
        var r = l.call(arguments, 2);
        return setTimeout(function() {
            return n.apply(null, r)
        }, t)
    }, m.defer = m.partial(m.delay, m, 1), m.throttle = function(n, t, r) {
        var e, u, i, o = null,
            a = 0;
        r || (r = {});
        var c = function() {
            a = r.leading === !1 ? 0 : m.now(), o = null, i = n.apply(e, u), o || (e = u = null)
        };
        return function() {
            var f = m.now();
            a || r.leading !== !1 || (a = f);
            var l = t - (f - a);
            return e = this, u = arguments, 0 >= l || l > t ? (o && (clearTimeout(o), o = null), a = f, i = n.apply(e, u), o || (e = u = null)) : o || r.trailing === !1 || (o = setTimeout(c, l)), i
        }
    }, m.debounce = function(n, t, r) {
        var e, u, i, o, a, c = function() {
            var f = m.now() - o;
            t > f && f >= 0 ? e = setTimeout(c, t - f) : (e = null, r || (a = n.apply(i, u), e || (i = u = null)))
        };
        return function() {
            i = this, u = arguments, o = m.now();
            var f = r && !e;
            return e || (e = setTimeout(c, t)), f && (a = n.apply(i, u), i = u = null), a
        }
    }, m.wrap = function(n, t) {
        return m.partial(t, n)
    }, m.negate = function(n) {
        return function() {
            return !n.apply(this, arguments)
        }
    }, m.compose = function() {
        var n = arguments,
            t = n.length - 1;
        return function() {
            for (var r = t, e = n[t].apply(this, arguments); r--;) e = n[r].call(this, e);
            return e
        }
    }, m.after = function(n, t) {
        return function() {
            return --n < 1 ? t.apply(this, arguments) : void 0
        }
    }, m.before = function(n, t) {
        var r;
        return function() {
            return --n > 0 && (r = t.apply(this, arguments)), 1 >= n && (t = null), r
        }
    }, m.once = m.partial(m.before, 2);
    var M = !{
            toString: null
        }.propertyIsEnumerable("toString"),
        I = ["valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
    m.keys = function(n) {
        if (!m.isObject(n)) return [];
        if (v) return v(n);
        var t = [];
        for (var r in n) m.has(n, r) && t.push(r);
        return M && e(n, t), t
    }, m.allKeys = function(n) {
        if (!m.isObject(n)) return [];
        var t = [];
        for (var r in n) t.push(r);
        return M && e(n, t), t
    }, m.values = function(n) {
        for (var t = m.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = n[t[u]];
        return e
    }, m.mapObject = function(n, t, r) {
        t = x(t, r);
        for (var e, u = m.keys(n), i = u.length, o = {}, a = 0; i > a; a++) e = u[a], o[e] = t(n[e], e, n);
        return o
    }, m.pairs = function(n) {
        for (var t = m.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = [t[u], n[t[u]]];
        return e
    }, m.invert = function(n) {
        for (var t = {}, r = m.keys(n), e = 0, u = r.length; u > e; e++) t[n[r[e]]] = r[e];
        return t
    }, m.functions = m.methods = function(n) {
        var t = [];
        for (var r in n) m.isFunction(n[r]) && t.push(r);
        return t.sort()
    }, m.extend = _(m.allKeys), m.extendOwn = m.assign = _(m.keys), m.findKey = function(n, t, r) {
        t = x(t, r);
        for (var e, u = m.keys(n), i = 0, o = u.length; o > i; i++)
            if (e = u[i], t(n[e], e, n)) return e
    }, m.pick = function(n, t, r) {
        var e, u, i = {},
            o = n;
        if (null == o) return i;
        m.isFunction(t) ? (u = m.allKeys(o), e = b(t, r)) : (u = S(arguments, !1, !1, 1), e = function(n, t, r) {
            return t in r
        }, o = Object(o));
        for (var a = 0, c = u.length; c > a; a++) {
            var f = u[a],
                l = o[f];
            e(l, f, o) && (i[f] = l)
        }
        return i
    }, m.omit = function(n, t, r) {
        if (m.isFunction(t)) t = m.negate(t);
        else {
            var e = m.map(S(arguments, !1, !1, 1), String);
            t = function(n, t) {
                return !m.contains(e, t)
            }
        }
        return m.pick(n, t, r)
    }, m.defaults = _(m.allKeys, !0), m.create = function(n, t) {
        var r = j(n);
        return t && m.extendOwn(r, t), r
    }, m.clone = function(n) {
        return m.isObject(n) ? m.isArray(n) ? n.slice() : m.extend({}, n) : n
    }, m.tap = function(n, t) {
        return t(n), n
    }, m.isMatch = function(n, t) {
        var r = m.keys(t),
            e = r.length;
        if (null == n) return !e;
        for (var u = Object(n), i = 0; e > i; i++) {
            var o = r[i];
            if (t[o] !== u[o] || !(o in u)) return !1
        }
        return !0
    };
    var N = function(n, t, r, e) {
        if (n === t) return 0 !== n || 1 / n === 1 / t;
        if (null == n || null == t) return n === t;
        n instanceof m && (n = n._wrapped), t instanceof m && (t = t._wrapped);
        var u = s.call(n);
        if (u !== s.call(t)) return !1;
        switch (u) {
            case "[object RegExp]":
            case "[object String]":
                return "" + n == "" + t;
            case "[object Number]":
                return +n !== +n ? +t !== +t : 0 === +n ? 1 / +n === 1 / t : +n === +t;
            case "[object Date]":
            case "[object Boolean]":
                return +n === +t
        }
        var i = "[object Array]" === u;
        if (!i) {
            if ("object" != typeof n || "object" != typeof t) return !1;
            var o = n.constructor,
                a = t.constructor;
            if (o !== a && !(m.isFunction(o) && o instanceof o && m.isFunction(a) && a instanceof a) && "constructor" in n && "constructor" in t) return !1
        }
        r = r || [], e = e || [];
        for (var c = r.length; c--;)
            if (r[c] === n) return e[c] === t;
        if (r.push(n), e.push(t), i) {
            if (c = n.length, c !== t.length) return !1;
            for (; c--;)
                if (!N(n[c], t[c], r, e)) return !1
        } else {
            var f, l = m.keys(n);
            if (c = l.length, m.keys(t).length !== c) return !1;
            for (; c--;)
                if (f = l[c], !m.has(t, f) || !N(n[f], t[f], r, e)) return !1
        }
        return r.pop(), e.pop(), !0
    };
    m.isEqual = function(n, t) {
        return N(n, t)
    }, m.isEmpty = function(n) {
        return null == n ? !0 : k(n) && (m.isArray(n) || m.isString(n) || m.isArguments(n)) ? 0 === n.length : 0 === m.keys(n).length
    }, m.isElement = function(n) {
        return !(!n || 1 !== n.nodeType)
    }, m.isArray = h || function(n) {
        return "[object Array]" === s.call(n)
    }, m.isObject = function(n) {
        var t = typeof n;
        return "function" === t || "object" === t && !!n
    }, m.each(["Arguments", "Function", "String", "Number", "Date", "RegExp", "Error"], function(n) {
        m["is" + n] = function(t) {
            return s.call(t) === "[object " + n + "]"
        }
    }), m.isArguments(arguments) || (m.isArguments = function(n) {
        return m.has(n, "callee")
    }), "function" != typeof /./ && "object" != typeof Int8Array && (m.isFunction = function(n) {
        return "function" == typeof n || !1
    }), m.isFinite = function(n) {
        return isFinite(n) && !isNaN(parseFloat(n))
    }, m.isNaN = function(n) {
        return m.isNumber(n) && n !== +n
    }, m.isBoolean = function(n) {
        return n === !0 || n === !1 || "[object Boolean]" === s.call(n)
    }, m.isNull = function(n) {
        return null === n
    }, m.isUndefined = function(n) {
        return n === void 0
    }, m.has = function(n, t) {
        return null != n && p.call(n, t)
    }, m.noConflict = function() {
        return u._ = i, this
    }, m.identity = function(n) {
        return n
    }, m.constant = function(n) {
        return function() {
            return n
        }
    }, m.noop = function() {}, m.property = w, m.propertyOf = function(n) {
        return null == n ? function() {} : function(t) {
            return n[t]
        }
    }, m.matcher = m.matches = function(n) {
        return n = m.extendOwn({}, n),
            function(t) {
                return m.isMatch(t, n)
            }
    }, m.times = function(n, t, r) {
        var e = Array(Math.max(0, n));
        t = b(t, r, 1);
        for (var u = 0; n > u; u++) e[u] = t(u);
        return e
    }, m.random = function(n, t) {
        return null == t && (t = n, n = 0), n + Math.floor(Math.random() * (t - n + 1))
    }, m.now = Date.now || function() {
        return (new Date).getTime()
    };
    var B = {
            "&": "&amp;",
            "<": "&lt;",
            ">": "&gt;",
            '"': "&quot;",
            "'": "&#x27;",
            "`": "&#x60;"
        },
        T = m.invert(B),
        R = function(n) {
            var t = function(t) {
                    return n[t]
                },
                r = "(?:" + m.keys(n).join("|") + ")",
                e = RegExp(r),
                u = RegExp(r, "g");
            return function(n) {
                return n = null == n ? "" : "" + n, e.test(n) ? n.replace(u, t) : n
            }
        };
    m.escape = R(B), m.unescape = R(T), m.result = function(n, t, r) {
        var e = null == n ? void 0 : n[t];
        return e === void 0 && (e = r), m.isFunction(e) ? e.call(n) : e
    };
    var q = 0;
    m.uniqueId = function(n) {
        var t = ++q + "";
        return n ? n + t : t
    }, m.templateSettings = {
        evaluate: /<%([\s\S]+?)%>/g,
        interpolate: /<%=([\s\S]+?)%>/g,
        escape: /<%-([\s\S]+?)%>/g
    };
    var K = /(.)^/,
        z = {
            "'": "'",
            "\\": "\\",
            "\r": "r",
            "\n": "n",
            "\u2028": "u2028",
            "\u2029": "u2029"
        },
        D = /\\|'|\r|\n|\u2028|\u2029/g,
        L = function(n) {
            return "\\" + z[n]
        };
    m.template = function(n, t, r) {
        !t && r && (t = r), t = m.defaults({}, t, m.templateSettings);
        var e = RegExp([(t.escape || K).source, (t.interpolate || K).source, (t.evaluate || K).source].join("|") + "|$", "g"),
            u = 0,
            i = "__p+='";
        n.replace(e, function(t, r, e, o, a) {
            return i += n.slice(u, a).replace(D, L), u = a + t.length, r ? i += "'+\n((__t=(" + r + "))==null?'':_.escape(__t))+\n'" : e ? i += "'+\n((__t=(" + e + "))==null?'':__t)+\n'" : o && (i += "';\n" + o + "\n__p+='"), t
        }), i += "';\n", t.variable || (i = "with(obj||{}){\n" + i + "}\n"), i = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + i + "return __p;\n";
        try {
            var o = new Function(t.variable || "obj", "_", i)
        } catch (a) {
            throw a.source = i, a
        }
        var c = function(n) {
                return o.call(this, n, m)
            },
            f = t.variable || "obj";
        return c.source = "function(" + f + "){\n" + i + "}", c
    }, m.chain = function(n) {
        var t = m(n);
        return t._chain = !0, t
    };
    var P = function(n, t) {
        return n._chain ? m(t).chain() : t
    };
    m.mixin = function(n) {
        m.each(m.functions(n), function(t) {
            var r = m[t] = n[t];
            m.prototype[t] = function() {
                var n = [this._wrapped];
                return f.apply(n, arguments), P(this, r.apply(m, n))
            }
        })
    }, m.mixin(m), m.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(n) {
        var t = o[n];
        m.prototype[n] = function() {
            var r = this._wrapped;
            return t.apply(r, arguments), "shift" !== n && "splice" !== n || 0 !== r.length || delete r[0], P(this, r)
        }
    }), m.each(["concat", "join", "slice"], function(n) {
        var t = o[n];
        m.prototype[n] = function() {
            return P(this, t.apply(this._wrapped, arguments))
        }
    }), m.prototype.value = function() {
        return this._wrapped
    }, m.prototype.valueOf = m.prototype.toJSON = m.prototype.value, m.prototype.toString = function() {
        return "" + this._wrapped
    }, "function" == typeof define && define.amd && define("underscore", [], function() {
        return m
    })
}).call(this);

define("clientkernelEventbusApi", [],
    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, '');
        };
        if (typeof clientkernelEventbusApi == 'undefined') {
            var clientkernelEventbusApi = {};
        };

        clientkernelEventbusApi.IEvent = function() {}
        clientkernelEventbusApi.IEvent.prototype = {

            getTopic: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getChannel: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getPayload: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.IEventBus = function() {}
        clientkernelEventbusApi.IEventBus.prototype = {

            getChannels: function() {
                return {
                    arguments: [],
                    returns: "array"
                };
            },
            getChannel: function(channel) {
                return {
                    arguments: ["string"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.IEventBusChannel = function() {}
        clientkernelEventbusApi.IEventBusChannel.prototype = {

            publish: function(topic, payload) {
                return {
                    arguments: ["string", "*"],
                    returns: "*"
                };
            },
            subscribe: function(topic, callback, payloadType) {
                return {
                    arguments: ["string", "*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "*"
                };
            },
            subscribeToRequest: function(topic, callback, payloadType) {
                return {
                    arguments: ["string", "*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "*"
                };
            },
            request: function(topic, payload, timeout) {
                return {
                    arguments: ["string", "*", "number"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.IPublishable = function() {}
        clientkernelEventbusApi.IPublishable.prototype = {

            publish: function(payload) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.IRequestEvent = function() {}
        clientkernelEventbusApi.IRequestEvent.prototype = {

            reply: function(data) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            reject: function(error) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelEventbusApi.IRequestSubscribable = function() {}
        clientkernelEventbusApi.IRequestSubscribable.prototype = {

            subscribe: function(callback) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.IRequestable = function() {}
        clientkernelEventbusApi.IRequestable.prototype = {

            request: function(payload, timeout) {
                return {
                    arguments: ["*", "number"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.ISubscribeable = function() {}
        clientkernelEventbusApi.ISubscribeable.prototype = {

            subscribe: function(callback) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };

        clientkernelEventbusApi.ISubscription = function() {}
        clientkernelEventbusApi.ISubscription.prototype = {

            unsubscribe: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            }
        };
        clientkernelEventbusApi.Request = function(topic) {
            this.topic = topic;
        };
        clientkernelEventbusApi.Request = ck_implements(clientkernelEventbusApi.Request, clientkernelEventbusApi.IRequestSubscribable);
        clientkernelEventbusApi.Request = ck_implements(clientkernelEventbusApi.Request, clientkernelEventbusApi.IRequestable);
        clientkernelEventbusApi.Request.__interfaces__ = [clientkernelEventbusApi.IRequestSubscribable, clientkernelEventbusApi.IRequestable];
        clientkernelEventbusApi.Request.__name__ = ["clientkernelEventbusApi", "Request"];
        clientkernelEventbusApi.Request.prototype.channel = null;
        clientkernelEventbusApi.Request.prototype.topic = null;
        clientkernelEventbusApi.Request.prototype.connect = function(channel) {
            this.channel = channel;
        };
        clientkernelEventbusApi.Request.prototype.subscribe = function(callback) {
            return this.channel.subscribeToRequest(this.topic, callback);
        };
        clientkernelEventbusApi.Request.prototype.request = function(payload, timeout) {
            return this.channel.request(this.topic, payload, timeout);
        };
        clientkernelEventbusApi.Request.prototype.getId = function() {
            return this.topic;
        };
        clientkernelEventbusApi.Request.prototype.__class__ = clientkernelEventbusApi.Request;
        clientkernelEventbusApi.RequestWithoutPayload = function(topic) {
            clientkernelEventbusApi.Request.call(this, topic);
        };
        clientkernelEventbusApi.RequestWithoutPayload.__name__ = ["clientkernelEventbusApi", "RequestWithoutPayload"];
        clientkernelEventbusApi.RequestWithoutPayload.__super__ = clientkernelEventbusApi.Request;
        for (var k in clientkernelEventbusApi.Request.prototype) clientkernelEventbusApi.RequestWithoutPayload.prototype[k] = clientkernelEventbusApi.Request.prototype[k];
        clientkernelEventbusApi.RequestWithoutPayload.prototype.__class__ = clientkernelEventbusApi.RequestWithoutPayload;
        clientkernelEventbusApi.Topic = function(topic) {
            this.topic = topic;
        };
        clientkernelEventbusApi.Topic = ck_implements(clientkernelEventbusApi.Topic, clientkernelEventbusApi.ISubscribeable);
        clientkernelEventbusApi.Topic = ck_implements(clientkernelEventbusApi.Topic, clientkernelEventbusApi.IPublishable);
        clientkernelEventbusApi.Topic.__interfaces__ = [clientkernelEventbusApi.ISubscribeable, clientkernelEventbusApi.IPublishable];
        clientkernelEventbusApi.Topic.__name__ = ["clientkernelEventbusApi", "Topic"];
        clientkernelEventbusApi.Topic.prototype.channel = null;
        clientkernelEventbusApi.Topic.prototype.topic = null;
        clientkernelEventbusApi.Topic.prototype.connect = function(channel) {
            this.channel = channel;
        };
        clientkernelEventbusApi.Topic.prototype.subscribe = function(callback) {
            return this.channel.subscribe(this.topic, callback);
        };
        clientkernelEventbusApi.Topic.prototype.publish = function(payload) {
            return this.channel.publish(this.topic, payload);
        };
        clientkernelEventbusApi.Topic.prototype.getId = function() {
            return this.topic;
        };
        clientkernelEventbusApi.Topic.prototype.__class__ = clientkernelEventbusApi.Topic;
        clientkernelEventbusApi.TopicWithoutPayload = function(topic) {
            clientkernelEventbusApi.Topic.call(this, topic);
        };
        clientkernelEventbusApi.TopicWithoutPayload.__name__ = ["clientkernelEventbusApi", "TopicWithoutPayload"];
        clientkernelEventbusApi.TopicWithoutPayload.__super__ = clientkernelEventbusApi.Topic;
        for (var k in clientkernelEventbusApi.Topic.prototype) clientkernelEventbusApi.TopicWithoutPayload.prototype[k] = clientkernelEventbusApi.Topic.prototype[k];
        clientkernelEventbusApi.TopicWithoutPayload.prototype.__class__ = clientkernelEventbusApi.TopicWithoutPayload;
        return {
            exports: clientkernelEventbusApi
        };
    });
//# sourceURL=eventbusApi.js
define("clientkernelEventbus", ["clientkernelLoaderApi", "clientkernelEventbusApi", "postal", "clientkernelModulesApi", "clientkernelLoggerApi"],
    function(clientkernelLoaderApi, clientkernelEventbusApi, postal, clientkernelModulesApi, 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 clientkernelEventbus == 'undefined') {
            var clientkernelEventbus = {};
        };
        clientkernelEventbus.Activator = function() {
            this.timeoutTime = 6000;
        };
        clientkernelEventbus.Activator = ck_implements(clientkernelEventbus.Activator, clientkernelModulesApi.IModuleActivator);
        clientkernelEventbus.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        clientkernelEventbus.Activator.__name__ = ["clientkernelEventbus", "Activator"];
        clientkernelEventbus.Activator.prototype.signalReadyTimer = null;
        clientkernelEventbus.Activator.prototype.timeoutTime = null;
        clientkernelEventbus.Activator.prototype.context = null;
        clientkernelEventbus.Activator.prototype.lf = null;
        clientkernelEventbus.Activator.prototype.psetup = null;
        clientkernelEventbus.Activator.prototype.start = function(context) {
            var _g = this;
            this.context = context;
            context.getServiceTracker([clientkernelLoggerApi.ILoggerFactory, clientkernelLoaderApi.IVariableRegistry]).then(function(context1) {
                _g.lf = context1.getAnyService(clientkernelLoggerApi.ILoggerFactory, null);
                _g.psetup = postal;
                if (window.location.search.indexOf("debug=0") == -1) {
                    postal.addWireTap(function(data, envelope, pubInProgress) {
                        try {
                            console.debug('topic:' + envelope.topic + ';channel:' + envelope.channel + ';data=' + JSON.stringify(envelope.data));
                        } catch (e) {
                            console.debug('topic:' + envelope.topic + ';channel:' + envelope.channel);
                        }
                    });
                }
                if (window.location.search.indexOf("pf=0") != -1) {
                    context1.registerService(new clientkernelEventbus.EventBus(_g.lf.getLogger("EventBus")), clientkernelEventbusApi.IEventBus, null);
                    return;
                }
                var varRegistry = context1.getAnyService(clientkernelLoaderApi.IVariableRegistry);
                if (varRegistry.get("postal.timeout") != null) _g.timeoutTime = _hcmn_.Std.parseInt(varRegistry.get("postal.timeout"));
                _g.psetup.instanceId("Game");
                _g.psetup.fedx.transports.xframe.configure({
                    allowedOrigins: varRegistry.get("postal.allowedOrigins"),
                    defaultOriginUrl: varRegistry.get("postal.defaultOrigin")
                });
                _g.waitForSignalReady();
                _g.psetup.fedx.addFilter([{
                    channel: "ConsoleService",
                    topic: "#",
                    direction: "both"
                }, {
                    channel: "ClientService",
                    topic: "#",
                    direction: "both"
                }, {
                    channel: "Kernel",
                    topic: "#",
                    direction: "both"
                }, {
                    channel: "Game",
                    topic: "#",
                    direction: "both"
                }, {
                    channel: "postal.request-response",
                    topic: "#",
                    direction: "both"
                }]);
            });
        };
        clientkernelEventbus.Activator.prototype.waitForSignalReady = function() {
            var _g = this;
            this.signalReadyTimer = new _hcmn_.haxe_Timer(this.timeoutTime);
            this.signalReadyTimer.run = $bind(this, this.signalReadyTimeout);
            this.psetup.fedx.signalReady(function(data) {
                _g.context.registerService(new clientkernelEventbus.EventBus(_g.lf.getLogger("EventBus")), clientkernelEventbusApi.IEventBus, null);
                _g.signalReadyTimer.stop();
            });
        };
        clientkernelEventbus.Activator.prototype.signalReadyTimeout = function() {
            this.signalReadyTimer.stop();
            throw new Error("psetup.fedx.signalReady timeout after " + this.timeoutTime + " msecs");
        };
        clientkernelEventbus.Activator.prototype.stop = function(context) {};
        clientkernelEventbus.Activator.main = function() {};
        clientkernelEventbus.Activator.prototype.__class__ = clientkernelEventbus.Activator;
        clientkernelEventbus.Event = function(envelope) {
            this.envelope = envelope;
        };
        clientkernelEventbus.Event = ck_implements(clientkernelEventbus.Event, clientkernelEventbusApi.IEvent);
        clientkernelEventbus.Event.__interfaces__ = [clientkernelEventbusApi.IEvent];
        clientkernelEventbus.Event.__name__ = ["clientkernelEventbus", "Event"];
        clientkernelEventbus.Event.prototype.envelope = null;
        clientkernelEventbus.Event.prototype.getChannel = function() {
            return this.envelope.channel;
        };
        clientkernelEventbus.Event.prototype.getPayload = function() {
            return this.envelope.data;
        };
        clientkernelEventbus.Event.prototype.getTopic = function() {
            return this.envelope.topic;
        };
        clientkernelEventbus.Event.prototype.__class__ = clientkernelEventbus.Event;
        clientkernelEventbus.EventBus = function(logger) {
            this.logger = logger;
            this.channels = new _hcmn_.haxe_ds_StringMap();
        };
        clientkernelEventbus.EventBus = ck_implements(clientkernelEventbus.EventBus, clientkernelModulesApi.IService);
        clientkernelEventbus.EventBus = ck_implements(clientkernelEventbus.EventBus, clientkernelEventbusApi.IEventBus);
        clientkernelEventbus.EventBus.__interfaces__ = [clientkernelModulesApi.IService, clientkernelEventbusApi.IEventBus];
        clientkernelEventbus.EventBus.__name__ = ["clientkernelEventbus", "EventBus"];
        clientkernelEventbus.EventBus.prototype.channels = null;
        clientkernelEventbus.EventBus.prototype.logger = null;
        clientkernelEventbus.EventBus.prototype.getChannel = function(channel) {
            if (!this.channels.exists(channel)) {
                var value = new clientkernelEventbus.EventBusChannel(channel, this.logger);
                this.channels.set(channel, value);
            }
            return this.channels.get(channel);
        };
        clientkernelEventbus.EventBus.prototype.getChannels = function() {
            var ret = [];
            var $it0 = this.channels.keys();
            while ($it0.hasNext()) {
                var i = $it0.next();
                ret.push(i);
            }
            return ret;
        };
        clientkernelEventbus.EventBus.prototype.__class__ = clientkernelEventbus.EventBus;
        clientkernelEventbus.EventBusChannel = function(name, logger) {
            this.postal_channel = postal.channel(name);
            this.logger = logger;
            this.name = name;
        };
        clientkernelEventbus.EventBusChannel = ck_implements(clientkernelEventbus.EventBusChannel, clientkernelEventbusApi.IEventBusChannel);
        clientkernelEventbus.EventBusChannel.__interfaces__ = [clientkernelEventbusApi.IEventBusChannel];
        clientkernelEventbus.EventBusChannel.__name__ = ["clientkernelEventbus", "EventBusChannel"];
        clientkernelEventbus.EventBusChannel.prototype.postal_channel = null;
        clientkernelEventbus.EventBusChannel.prototype.logger = null;
        clientkernelEventbus.EventBusChannel.prototype.name = null;
        clientkernelEventbus.EventBusChannel.prototype.publish = function(topic, payload) {
            return new clientkernelEventbus.Event(this.postal_channel.publish(topic, payload));
        };
        clientkernelEventbus.EventBusChannel.prototype.subscribe = function(topic, callback, payloadType) {
            return new clientkernelEventbus.Subscription(this.postal_channel, topic, callback, payloadType);
        };
        clientkernelEventbus.EventBusChannel.prototype.subscribeToRequest = function(topic, callback, payloadType) {
            return new clientkernelEventbus.RequestSubscription(this.postal_channel, topic, callback, payloadType);
        };
        clientkernelEventbus.EventBusChannel.prototype.request = function(topic, payload, timeout) {
            var jsPromise = this.postal_channel.request(new clientkernelEventbus.RequestOptions(topic, payload, timeout));
            var result;
            result = _hcmn_.js_Boot.__cast(jsPromise, Promise);
            return result;
        };
        clientkernelEventbus.EventBusChannel.prototype.__class__ = clientkernelEventbus.EventBusChannel;
        clientkernelEventbus.RequestEvent = function(envelope) {
            clientkernelEventbus.Event.call(this, envelope);
        };
        clientkernelEventbus.RequestEvent = ck_implements(clientkernelEventbus.RequestEvent, clientkernelEventbusApi.IEvent);
        clientkernelEventbus.RequestEvent = ck_implements(clientkernelEventbus.RequestEvent, clientkernelEventbusApi.IRequestEvent);
        clientkernelEventbus.RequestEvent.__interfaces__ = [clientkernelEventbusApi.IEvent, clientkernelEventbusApi.IRequestEvent];
        clientkernelEventbus.RequestEvent.__name__ = ["clientkernelEventbus", "RequestEvent"];
        clientkernelEventbus.RequestEvent.__super__ = clientkernelEventbus.Event;
        for (var k in clientkernelEventbus.Event.prototype) clientkernelEventbus.RequestEvent.prototype[k] = clientkernelEventbus.Event.prototype[k];
        clientkernelEventbus.RequestEvent.prototype.reply = function(data) {
            this.envelope.reply(null, data);
        };
        clientkernelEventbus.RequestEvent.prototype.reject = function(error) {
            this.envelope.reply(error, null);
        };
        clientkernelEventbus.RequestEvent.prototype.__class__ = clientkernelEventbus.RequestEvent;
        clientkernelEventbus.RequestOptions = function(topic, data, timeout) {
            this.topic = topic;
            this.data = data;
            this.timeout = timeout;
        };
        clientkernelEventbus.RequestOptions.__name__ = ["clientkernelEventbus", "RequestOptions"];
        clientkernelEventbus.RequestOptions.prototype.topic = null;
        clientkernelEventbus.RequestOptions.prototype.data = null;
        clientkernelEventbus.RequestOptions.prototype.timeout = null;
        clientkernelEventbus.RequestOptions.prototype.__class__ = clientkernelEventbus.RequestOptions;
        clientkernelEventbus.RequestSubscription = function(postal_channel, topic, callback, payloadType) {
            this.postal_channel = postal_channel;
            this.callback = callback;
            this.payloadType = payloadType;
            this.handle = postal_channel.subscribe(topic, $bind(this, this.checkcallback));
        };
        clientkernelEventbus.RequestSubscription = ck_implements(clientkernelEventbus.RequestSubscription, clientkernelEventbusApi.ISubscription);
        clientkernelEventbus.RequestSubscription.__interfaces__ = [clientkernelEventbusApi.ISubscription];
        clientkernelEventbus.RequestSubscription.__name__ = ["clientkernelEventbus", "RequestSubscription"];
        clientkernelEventbus.RequestSubscription.prototype.callback = null;
        clientkernelEventbus.RequestSubscription.prototype.handle = null;
        clientkernelEventbus.RequestSubscription.prototype.postal_channel = null;
        clientkernelEventbus.RequestSubscription.prototype.payloadType = null;
        clientkernelEventbus.RequestSubscription.prototype.checkcallback = function(data, envelope) {
            if (this.payloadType == null) this.callback(new clientkernelEventbus.RequestEvent(envelope));
            else if (data instanceof payloadType) this.callback(new clientkernelEventbus.RequestEvent(envelope));
            else null;
        };
        clientkernelEventbus.RequestSubscription.prototype.unsubscribe = function() {
            if (this.handle != null) {
                this.handle.unsubscribe();
                this.handle = null;
            }
        };
        clientkernelEventbus.RequestSubscription.prototype.__class__ = clientkernelEventbus.RequestSubscription;
        clientkernelEventbus.Subscription = function(postal_channel, topic, callback, payloadType) {
            this.postal_channel = postal_channel;
            this.callback = callback;
            this.payloadType = payloadType;
            this.handle = postal_channel.subscribe(topic, $bind(this, this.checkcallback));
        };
        clientkernelEventbus.Subscription = ck_implements(clientkernelEventbus.Subscription, clientkernelEventbusApi.ISubscription);
        clientkernelEventbus.Subscription.__interfaces__ = [clientkernelEventbusApi.ISubscription];
        clientkernelEventbus.Subscription.__name__ = ["clientkernelEventbus", "Subscription"];
        clientkernelEventbus.Subscription.prototype.callback = null;
        clientkernelEventbus.Subscription.prototype.handle = null;
        clientkernelEventbus.Subscription.prototype.postal_channel = null;
        clientkernelEventbus.Subscription.prototype.payloadType = null;
        clientkernelEventbus.Subscription.prototype.checkcallback = function(data, envelope) {
            if (this.payloadType == null) this.callback(new clientkernelEventbus.Event(envelope));
            else if (data instanceof payloadType) this.callback(new clientkernelEventbus.Event(envelope));
            else null;
        };
        clientkernelEventbus.Subscription.prototype.unsubscribe = function() {
            if (this.handle != null) {
                this.handle.unsubscribe();
                this.handle = null;
            }
        };
        clientkernelEventbus.Subscription.prototype.__class__ = clientkernelEventbus.Subscription;
        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;
        return {
            exports: clientkernelEventbus,
            activator: clientkernelEventbus.Activator
        };
    });
//# sourceURL=eventbus.js
define("clientkernelLoggerApi", [],
    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, '');
        };
        if (typeof clientkernelLoggerApi == 'undefined') {
            var clientkernelLoggerApi = {};
        };

        clientkernelLoggerApi.ILogger = function() {}
        clientkernelLoggerApi.ILogger.prototype = {

            error: function(message) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            warn: function(message) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            info: function(message) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            debug: function(message) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            trace: function(message) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };

        clientkernelLoggerApi.ILoggerFactory = function() {}
        clientkernelLoggerApi.ILoggerFactory.prototype = {

            getLogger: function(modulename) {
                return {
                    arguments: ["string"],
                    returns: "*"
                };
            },
            getDefaultLogger: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };
        return {
            exports: clientkernelLoggerApi
        };
    });
//# sourceURL=loggerApi.js
define("clientKernelLogger", ["clientkernelLoaderApi", "clientkernelEventbusApi", "clientkernelModulesApi", "clientkernelLoggerApi"],
    function(clientkernelLoaderApi, clientkernelEventbusApi, clientkernelModulesApi, 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 clientKernelLogger == 'undefined') {
            var clientKernelLogger = {};
        };
        clientKernelLogger.Activator = function() {};
        clientKernelLogger.Activator = ck_implements(clientKernelLogger.Activator, clientkernelModulesApi.IModuleActivator);
        clientKernelLogger.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        clientKernelLogger.Activator.__name__ = ["clientKernelLogger", "Activator"];
        clientKernelLogger.Activator.prototype.start = function(context) {
            var logserver = false;
            var loguser = "";
            if (window != null) {
                logserver = (function($this) {
                    var $r;
                    var this1 = haxe.web.Request.getParams();
                    $r = this1.get("kernel");
                    return $r;
                }(this)) != null && ((function($this) {
                    var $r;
                    var this2 = haxe.web.Request.getParams();
                    $r = this2.get("kernel");
                    return $r;
                }(this))).indexOf("l") != -1;
                if (logserver) {
                    var this3 = haxe.web.Request.getParams();
                    loguser = this3.get("loguser");
                    if (loguser == null) loguser = "ND";
                }
            }
            context.registerService(new clientKernelLogger.LoggerFactory(logserver, loguser, context), clientkernelLoggerApi.ILoggerFactory, null);
        };
        clientKernelLogger.Activator.prototype.stop = function(context) {};
        clientKernelLogger.Activator.main = function() {};
        clientKernelLogger.Activator.prototype.__class__ = clientKernelLogger.Activator;
        clientKernelLogger.Logger = function(modulename, logserver, loguser, context) {
            this.logurl = null;
            var _g = this;
            this.logserver = logserver;
            this.modulename = modulename;
            this.loguser = loguser;
            if (logserver) context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry]).then(function(context1) {
                _g.assetRegistry = context1.getAnyService(clientkernelLoaderApi.IAssetRegistry);
                _g.updateUrl();
            });
        };
        clientKernelLogger.Logger = ck_implements(clientKernelLogger.Logger, clientkernelLoggerApi.ILogger);
        clientKernelLogger.Logger.__interfaces__ = [clientkernelLoggerApi.ILogger];
        clientKernelLogger.Logger.__name__ = ["clientKernelLogger", "Logger"];
        clientKernelLogger.Logger.prototype.modulename = null;
        clientKernelLogger.Logger.prototype.logserver = null;
        clientKernelLogger.Logger.prototype.logurl = null;
        clientKernelLogger.Logger.prototype.loguser = null;
        clientKernelLogger.Logger.prototype.assetRegistry = null;
        clientKernelLogger.Logger.prototype.updateUrl = function() {
            var _g = this;
            if (this.assetRegistry.getAsset("logger-impl") == null) {
                _hcmn_.haxe_Timer.delay($bind(this, this.updateUrl), 100);
                return;
            }
            this.assetRegistry.getAsset("logger-impl").getContent().then(function(data) {
                _g.logurl = _hcmn_.Reflect.field(data, "loggerUrl");
            });
        };
        clientKernelLogger.Logger.prototype.debug = function(message) {
            if (this.logserver) this.log("debug", message);
            else if (typeof(console.debug) == 'function') window.console.debug("[" + this.modulename + "] " + _hcmn_.Std.string(message));
            else window.console.log("[" + this.modulename + "] " + _hcmn_.Std.string(message));
        };
        clientKernelLogger.Logger.prototype.error = function(message) {
            if (this.logserver) this.log("error", message);
            else window.console.error("[" + this.modulename + "] " + _hcmn_.Std.string(message));
        };
        clientKernelLogger.Logger.prototype.info = function(message) {
            if (this.logserver) this.log("info", message);
            else window.console.info("[" + this.modulename + "] " + _hcmn_.Std.string(message));
        };
        clientKernelLogger.Logger.prototype.trace = function(message) {
            if (this.logserver) this.log("trace", message);
            else window.console.trace();
        };
        clientKernelLogger.Logger.prototype.warn = function(message) {
            if (this.logserver) this.log("warn", message);
            else window.console.warn("[" + this.modulename + "] " + _hcmn_.Std.string(message));
        };
        clientKernelLogger.Logger.prototype.log = function(level, message) {
            if (this.logurl != null) {
                var loader = new XMLHttpRequest();
                loader.open("GET", this.logurl + ("?level=" + level + "&module=" + this.modulename + "&message=" + message + "&user=" + this.loguser));
                loader.send();
            }
        };
        clientKernelLogger.Logger.prototype.__class__ = clientKernelLogger.Logger;
        clientKernelLogger.LoggerFactory = function(logserver, loguser, context) {
            this.context = context;
            this.logserver = logserver;
            this.loguser = loguser;
        };
        clientKernelLogger.LoggerFactory = ck_implements(clientKernelLogger.LoggerFactory, clientkernelModulesApi.IService);
        clientKernelLogger.LoggerFactory = ck_implements(clientKernelLogger.LoggerFactory, clientkernelLoggerApi.ILoggerFactory);
        clientKernelLogger.LoggerFactory.__interfaces__ = [clientkernelModulesApi.IService, clientkernelLoggerApi.ILoggerFactory];
        clientKernelLogger.LoggerFactory.__name__ = ["clientKernelLogger", "LoggerFactory"];
        clientKernelLogger.LoggerFactory.prototype.context = null;
        clientKernelLogger.LoggerFactory.prototype.logserver = null;
        clientKernelLogger.LoggerFactory.prototype.loguser = null;
        clientKernelLogger.LoggerFactory.prototype.getDefaultLogger = function() {
            return new clientKernelLogger.Logger(null, this.logserver, this.loguser, this.context);
        };
        clientKernelLogger.LoggerFactory.prototype.getLogger = function(modulename) {
            if (modulename != null && modulename != "") return new clientKernelLogger.Logger(modulename, this.logserver, this.loguser, this.context);
            return null;
        };
        clientKernelLogger.LoggerFactory.prototype.__class__ = clientKernelLogger.LoggerFactory;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        if (!haxe.web) {
            haxe.web = {};
        };
        haxe.web.Request = function() {};
        haxe.web.Request.__name__ = ["haxe", "web", "Request"];
        haxe.web.Request.getParams = function() {
            var get;
            var _this = window.location.search;
            get = _hcmn_.HxOverrides.substr(_this, 1, null);
            var params = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = new _hcmn_.EReg("[&;]", "g").split(get);
            while (_g < _g1.length) {
                var p = _g1[_g];
                ++_g;
                var pl = p.split("=");
                if (pl.length < 2) continue;
                var name = pl.shift();
                params.set(decodeURIComponent(name.split("+").join(" ")), _hcmn_.StringTools.urlDecode(pl.join("=")));
            }
            return params;
        };
        haxe.web.Request.prototype.__class__ = haxe.web.Request;
        return {
            exports: clientKernelLogger,
            activator: clientKernelLogger.Activator
        };
    });
//# sourceURL=logger.js
define("clientkernelTestableApi", ["clientkernelModulesApi"],
    function(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 clientkernelTestableApi == 'undefined') {
            var clientkernelTestableApi = {};
        };

        clientkernelTestableApi.ITestable = function() {}
        clientkernelTestableApi.ITestable.prototype = {

            getLogger: function(context) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };

        clientkernelTestableApi.ITestableLogger = function() {}
        clientkernelTestableApi.ITestableLogger.prototype = {

            info: function(object, payload) {
                return {
                    arguments: ["string", "*"],
                    returns: "void"
                };
            }
        };
        return {
            exports: clientkernelTestableApi
        };
    });
//# sourceURL=testableApi.js
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
        };
    });
//# sourceURL=testable.js
define("clientkernelLoaderApi", ["clientkernelEventbusApi"],
    function(clientkernelEventbusApi) {
        "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 clientkernelLoaderApi == 'undefined') {
            var clientkernelLoaderApi = {};
        };

        clientkernelLoaderApi.IAsset = function() {}
        clientkernelLoaderApi.IAsset.prototype = {

            getId: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getType: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getUrl: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            isLoaded: function() {
                return {
                    arguments: [],
                    returns: "boolean"
                };
            },
            getContent: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getChildAsset: function(id) {
                return {
                    arguments: ["string"],
                    returns: "*"
                };
            },
            getAllContent: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelLoaderApi.IAssetRegistry = function() {}
        clientkernelLoaderApi.IAssetRegistry.prototype = {

            getAsset: function(id) {
                return {
                    arguments: ["string"],
                    returns: "*"
                };
            },
            getAssetsContent: function(ids) {
                return {
                    arguments: ["array"],
                    returns: "*"
                };
            },
            assetLoaded: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            progress: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelLoaderApi.ILoadProgress = function() {}
        clientkernelLoaderApi.ILoadProgress.prototype = {

            getId: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getItems: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            },
            getCurrent: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            },
            getComplete: function() {
                return {
                    arguments: [],
                    returns: "boolean"
                };
            }
        };

        clientkernelLoaderApi.ILoadingProgress = function() {}
        clientkernelLoaderApi.ILoadingProgress.prototype = {

            getFiles: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            },
            getFilesLoaded: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            },
            getFilesSize: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            },
            getFilesSizeLoaded: function() {
                return {
                    arguments: [],
                    returns: "number"
                };
            }
        };

        clientkernelLoaderApi.IVariableRegistry = function() {}
        clientkernelLoaderApi.IVariableRegistry.prototype = {

            get: function(name, defaultValue) {
                return {
                    arguments: ["string", {
                        type: "*",
                        opt: true
                    }],
                    returns: "string"
                };
            }
        };
        clientkernelLoaderApi.AssetLoadedTopic = function() {
            clientkernelEventbusApi.Topic.call(this, "assetLoaded");
        };
        clientkernelLoaderApi.AssetLoadedTopic.__name__ = ["clientkernelLoaderApi", "AssetLoadedTopic"];
        clientkernelLoaderApi.AssetLoadedTopic.__super__ = clientkernelEventbusApi.Topic;
        for (var k in clientkernelEventbusApi.Topic.prototype) clientkernelLoaderApi.AssetLoadedTopic.prototype[k] = clientkernelEventbusApi.Topic.prototype[k];
        clientkernelLoaderApi.AssetLoadedTopic.prototype.__class__ = clientkernelLoaderApi.AssetLoadedTopic;
        clientkernelLoaderApi.HideDefaultPreloaderTopic = function() {
            clientkernelEventbusApi.Topic.call(this, "hideDefaultPreloader");
        };
        clientkernelLoaderApi.HideDefaultPreloaderTopic.__name__ = ["clientkernelLoaderApi", "HideDefaultPreloaderTopic"];
        clientkernelLoaderApi.HideDefaultPreloaderTopic.__super__ = clientkernelEventbusApi.Topic;
        for (var k in clientkernelEventbusApi.Topic.prototype) clientkernelLoaderApi.HideDefaultPreloaderTopic.prototype[k] = clientkernelEventbusApi.Topic.prototype[k];
        clientkernelLoaderApi.HideDefaultPreloaderTopic.prototype.__class__ = clientkernelLoaderApi.HideDefaultPreloaderTopic;
        clientkernelLoaderApi.LoadProgressTopic = function() {
            clientkernelEventbusApi.Topic.call(this, "LoadProgress");
        };
        clientkernelLoaderApi.LoadProgressTopic.__name__ = ["clientkernelLoaderApi", "LoadProgressTopic"];
        clientkernelLoaderApi.LoadProgressTopic.__super__ = clientkernelEventbusApi.Topic;
        for (var k in clientkernelEventbusApi.Topic.prototype) clientkernelLoaderApi.LoadProgressTopic.prototype[k] = clientkernelEventbusApi.Topic.prototype[k];
        clientkernelLoaderApi.LoadProgressTopic.prototype.__class__ = clientkernelLoaderApi.LoadProgressTopic;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        return {
            exports: clientkernelLoaderApi
        };
    });
//# sourceURL=loaderApi.js
define("clientkernelLoaderApiPlugins", ["clientkernelLoaderApi", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(clientkernelLoaderApi, 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 clientkernelLoaderApiPlugins == 'undefined') {
            var clientkernelLoaderApiPlugins = {};
        };

        clientkernelLoaderApiPlugins.IAssetAccess = function() {}
        clientkernelLoaderApiPlugins.IAssetAccess.prototype = {

            setContent: function(content) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            setProgress: function(loadedBytes, ofSize) {
                return {
                    arguments: ["number", "number"],
                    returns: "void"
                };
            },
            add: function(id, url, type, onrequest) {
                return {
                    arguments: [{
                        type: "*",
                        opt: true
                    }, "string", "string", "*"],
                    returns: "*"
                };
            }
        };

        clientkernelLoaderApiPlugins.IAssetLoader = function() {}
        clientkernelLoaderApiPlugins.IAssetLoader.prototype = {

            setup: function(lc, id, type, url, config, onrequest) {
                return {
                    arguments: ["*", "string", "string", "string", "*", "*"],
                    returns: "void"
                };
            },
            load: function(onfinish) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            unload: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            }
        };

        clientkernelLoaderApiPlugins.IAssetPlugin = function() {}
        clientkernelLoaderApiPlugins.IAssetPlugin.prototype = {

            getAssetTypes: function() {
                return {
                    arguments: [],
                    returns: "array"
                };
            },
            createLoader: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelLoaderApiPlugins.IAssetRegistryAccess = function() {}
        clientkernelLoaderApiPlugins.IAssetRegistryAccess.prototype = {

            add: function(id, url, type, onrequest) {
                return {
                    arguments: [{
                        type: "*",
                        opt: true
                    }, "string", "string", "*"],
                    returns: "*"
                };
            },
            remove: function(id) {
                return {
                    arguments: ["string"],
                    returns: "void"
                };
            }
        };

        clientkernelLoaderApiPlugins.IConfigurationPlugin = function() {}
        clientkernelLoaderApiPlugins.IConfigurationPlugin.prototype = {

            getSection: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            resolve: function(lc, config) {
                return {
                    arguments: ["*", "*"],
                    returns: "void"
                };
            }
        };

        clientkernelLoaderApiPlugins.ILoader = function() {}
        clientkernelLoaderApiPlugins.ILoader.prototype = {

            addQueue: function(id, config, baseUrl, onFinished) {
                return {
                    arguments: ["string", "*", "string", "*"],
                    returns: "void"
                };
            }
        };

        clientkernelLoaderApiPlugins.ILoaderContext = function() {}
        clientkernelLoaderApiPlugins.ILoaderContext.prototype = {

            getVars: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getAssets: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getLoader: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getModuleContext: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        clientkernelLoaderApiPlugins.IVariables = function() {}
        clientkernelLoaderApiPlugins.IVariables.prototype = {

            get: function(name, defaultValue) {
                return {
                    arguments: ["string", {
                        type: "*",
                        opt: true
                    }],
                    returns: "string"
                };
            },
            set: function(name, value) {
                return {
                    arguments: ["string", "string"],
                    returns: "void"
                };
            },
            expand: function(value) {
                return {
                    arguments: ["string"],
                    returns: "string"
                };
            }
        };
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        return {
            exports: clientkernelLoaderApiPlugins
        };
    });
//# sourceURL=loaderApiPlugins.js
define.amd.module = "preloadjs";
define.amd.shim = "createjs";
/*!
 * @license PreloadJS
 * Visit http://createjs.com/ for documentation, updates and examples.
 *
 * Copyright (c) 2011-2015 gskinner.com, inc.
 *
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.html
 *
 * This notice shall be included in all copies or substantial portions of the Software.
 */
this.createjs = this.createjs || {},
    function() {
        "use strict";
        var a = createjs.PreloadJS = createjs.PreloadJS || {};
        a.version = "0.6.2", a.buildDate = "Wed, 13 Apr 2016 14:17:15 GMT"
    }(), this.createjs = this.createjs || {}, createjs.extend = function(a, b) {
        "use strict";

        function c() {
            this.constructor = a
        }
        return c.prototype = b.prototype, a.prototype = new c
    }, this.createjs = this.createjs || {}, createjs.promote = function(a, b) {
        "use strict";
        var c = a.prototype,
            d = Object.getPrototypeOf && Object.getPrototypeOf(c) || c.__proto__;
        if (d) {
            c[(b += "_") + "constructor"] = d.constructor;
            for (var e in d) c.hasOwnProperty(e) && "function" == typeof d[e] && (c[b + e] = d[e])
        }
        return a
    }, this.createjs = this.createjs || {},
    function() {
        "use strict";
        createjs.proxy = function(a, b) {
            var c = Array.prototype.slice.call(arguments, 2);
            return function() {
                return a.apply(b, Array.prototype.slice.call(arguments, 0).concat(c))
            }
        }
    }(), this.createjs = this.createjs || {}, createjs.indexOf = function(a, b) {
        "use strict";
        for (var c = 0, d = a.length; d > c; c++)
            if (b === a[c]) return c;
        return -1
    }, this.createjs = this.createjs || {},
    function() {
        "use strict";

        function Event(a, b, c) {
            this.type = a, this.target = null, this.currentTarget = null, this.eventPhase = 0, this.bubbles = !!b, this.cancelable = !!c, this.timeStamp = (new Date).getTime(), this.defaultPrevented = !1, this.propagationStopped = !1, this.immediatePropagationStopped = !1, this.removed = !1
        }
        var a = Event.prototype;
        a.preventDefault = function() {
            this.defaultPrevented = this.cancelable && !0
        }, a.stopPropagation = function() {
            this.propagationStopped = !0
        }, a.stopImmediatePropagation = function() {
            this.immediatePropagationStopped = this.propagationStopped = !0
        }, a.remove = function() {
            this.removed = !0
        }, a.clone = function() {
            return new Event(this.type, this.bubbles, this.cancelable)
        }, a.set = function(a) {
            for (var b in a) this[b] = a[b];
            return this
        }, a.toString = function() {
            return "[Event (type=" + this.type + ")]"
        }, createjs.Event = Event
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function ErrorEvent(a, b, c) {
            this.Event_constructor("error"), this.title = a, this.message = b, this.data = c
        }
        var a = createjs.extend(ErrorEvent, createjs.Event);
        a.clone = function() {
            return new createjs.ErrorEvent(this.title, this.message, this.data)
        }, createjs.ErrorEvent = createjs.promote(ErrorEvent, "Event")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function EventDispatcher() {
            this._listeners = null, this._captureListeners = null
        }
        var a = EventDispatcher.prototype;
        EventDispatcher.initialize = function(b) {
            b.addEventListener = a.addEventListener, b.on = a.on, b.removeEventListener = b.off = a.removeEventListener, b.removeAllEventListeners = a.removeAllEventListeners, b.hasEventListener = a.hasEventListener, b.dispatchEvent = a.dispatchEvent, b._dispatchEvent = a._dispatchEvent, b.willTrigger = a.willTrigger
        }, a.addEventListener = function(a, b, c) {
            var d;
            d = c ? this._captureListeners = this._captureListeners || {} : this._listeners = this._listeners || {};
            var e = d[a];
            return e && this.removeEventListener(a, b, c), e = d[a], e ? e.push(b) : d[a] = [b], b
        }, a.on = function(a, b, c, d, e, f) {
            return b.handleEvent && (c = c || b, b = b.handleEvent), c = c || this, this.addEventListener(a, function(a) {
                b.call(c, a, e), d && a.remove()
            }, f)
        }, a.removeEventListener = function(a, b, c) {
            var d = c ? this._captureListeners : this._listeners;
            if (d) {
                var e = d[a];
                if (e)
                    for (var f = 0, g = e.length; g > f; f++)
                        if (e[f] == b) {
                            1 == g ? delete d[a] : e.splice(f, 1);
                            break
                        }
            }
        }, a.off = a.removeEventListener, a.removeAllEventListeners = function(a) {
            a ? (this._listeners && delete this._listeners[a], this._captureListeners && delete this._captureListeners[a]) : this._listeners = this._captureListeners = null
        }, a.dispatchEvent = function(a, b, c) {
            if ("string" == typeof a) {
                var d = this._listeners;
                if (!(b || d && d[a])) return !0;
                a = new createjs.Event(a, b, c)
            } else a.target && a.clone && (a = a.clone());
            try {
                a.target = this
            } catch (e) {}
            if (a.bubbles && this.parent) {
                for (var f = this, g = [f]; f.parent;) g.push(f = f.parent);
                var h, i = g.length;
                for (h = i - 1; h >= 0 && !a.propagationStopped; h--) g[h]._dispatchEvent(a, 1 + (0 == h));
                for (h = 1; i > h && !a.propagationStopped; h++) g[h]._dispatchEvent(a, 3)
            } else this._dispatchEvent(a, 2);
            return !a.defaultPrevented
        }, a.hasEventListener = function(a) {
            var b = this._listeners,
                c = this._captureListeners;
            return !!(b && b[a] || c && c[a])
        }, a.willTrigger = function(a) {
            for (var b = this; b;) {
                if (b.hasEventListener(a)) return !0;
                b = b.parent
            }
            return !1
        }, a.toString = function() {
            return "[EventDispatcher]"
        }, a._dispatchEvent = function(a, b) {
            var c, d = 1 == b ? this._captureListeners : this._listeners;
            if (a && d) {
                var e = d[a.type];
                if (!e || !(c = e.length)) return;
                try {
                    a.currentTarget = this
                } catch (f) {}
                try {
                    a.eventPhase = b
                } catch (f) {}
                a.removed = !1, e = e.slice();
                for (var g = 0; c > g && !a.immediatePropagationStopped; g++) {
                    var h = e[g];
                    h.handleEvent ? h.handleEvent(a) : h(a), a.removed && (this.off(a.type, h, 1 == b), a.removed = !1)
                }
            }
        }, createjs.EventDispatcher = EventDispatcher
    }(), this.createjs = this.createjs || {},
    function(a) {
        "use strict";

        function ProgressEvent(a, b) {
            this.Event_constructor("progress"), this.loaded = a, this.total = null == b ? 1 : b, this.progress = 0 == b ? 0 : this.loaded / this.total
        }
        var b = createjs.extend(ProgressEvent, createjs.Event);
        b.clone = function() {
            return new createjs.ProgressEvent(this.loaded, this.total)
        }, createjs.ProgressEvent = createjs.promote(ProgressEvent, "Event")
    }(window),
    function() {
        function a(b, d) {
            function f(a) {
                if (f[a] !== q) return f[a];
                var b;
                if ("bug-string-char-index" == a) b = "a" != "a" [0];
                else if ("json" == a) b = f("json-stringify") && f("json-parse");
                else {
                    var c, e = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
                    if ("json-stringify" == a) {
                        var i = d.stringify,
                            k = "function" == typeof i && t;
                        if (k) {
                            (c = function() {
                                return 1
                            }).toJSON = c;
                            try {
                                k = "0" === i(0) && "0" === i(new g) && '""' == i(new h) && i(s) === q && i(q) === q && i() === q && "1" === i(c) && "[1]" == i([c]) && "[null]" == i([q]) && "null" == i(null) && "[null,null,null]" == i([q, s, null]) && i({
                                    a: [c, !0, !1, null, "\x00\b\n\f\r	"]
                                }) == e && "1" === i(null, c) && "[\n 1,\n 2\n]" == i([1, 2], null, 1) && '"-271821-04-20T00:00:00.000Z"' == i(new j(-864e13)) && '"+275760-09-13T00:00:00.000Z"' == i(new j(864e13)) && '"-000001-01-01T00:00:00.000Z"' == i(new j(-621987552e5)) && '"1969-12-31T23:59:59.999Z"' == i(new j(-1))
                            } catch (l) {
                                k = !1
                            }
                        }
                        b = k
                    }
                    if ("json-parse" == a) {
                        var m = d.parse;
                        if ("function" == typeof m) try {
                            if (0 === m("0") && !m(!1)) {
                                c = m(e);
                                var n = 5 == c.a.length && 1 === c.a[0];
                                if (n) {
                                    try {
                                        n = !m('"	"')
                                    } catch (l) {}
                                    if (n) try {
                                        n = 1 !== m("01")
                                    } catch (l) {}
                                    if (n) try {
                                        n = 1 !== m("1.")
                                    } catch (l) {}
                                }
                            }
                        } catch (l) {
                            n = !1
                        }
                        b = n
                    }
                }
                return f[a] = !!b
            }
            b || (b = e.Object()), d || (d = e.Object());
            var g = b.Number || e.Number,
                h = b.String || e.String,
                i = b.Object || e.Object,
                j = b.Date || e.Date,
                k = b.SyntaxError || e.SyntaxError,
                l = b.TypeError || e.TypeError,
                m = b.Math || e.Math,
                n = b.JSON || e.JSON;
            "object" == typeof n && n && (d.stringify = n.stringify, d.parse = n.parse);
            var o, p, q, r = i.prototype,
                s = r.toString,
                t = new j(-0xc782b5b800cec);
            try {
                t = -109252 == t.getUTCFullYear() && 0 === t.getUTCMonth() && 1 === t.getUTCDate() && 10 == t.getUTCHours() && 37 == t.getUTCMinutes() && 6 == t.getUTCSeconds() && 708 == t.getUTCMilliseconds()
            } catch (u) {}
            if (!f("json")) {
                var v = "[object Function]",
                    w = "[object Date]",
                    x = "[object Number]",
                    y = "[object String]",
                    z = "[object Array]",
                    A = "[object Boolean]",
                    B = f("bug-string-char-index");
                if (!t) var C = m.floor,
                    D = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
                    E = function(a, b) {
                        return D[b] + 365 * (a - 1970) + C((a - 1969 + (b = +(b > 1))) / 4) - C((a - 1901 + b) / 100) + C((a - 1601 + b) / 400)
                    };
                if ((o = r.hasOwnProperty) || (o = function(a) {
                        var b, c = {};
                        return (c.__proto__ = null, c.__proto__ = {
                            toString: 1
                        }, c).toString != s ? o = function(a) {
                            var b = this.__proto__,
                                c = a in (this.__proto__ = null, this);
                            return this.__proto__ = b, c
                        } : (b = c.constructor, o = function(a) {
                            var c = (this.constructor || b).prototype;
                            return a in this && !(a in c && this[a] === c[a])
                        }), c = null, o.call(this, a)
                    }), p = function(a, b) {
                        var d, e, f, g = 0;
                        (d = function() {
                            this.valueOf = 0
                        }).prototype.valueOf = 0, e = new d;
                        for (f in e) o.call(e, f) && g++;
                        return d = e = null, g ? p = 2 == g ? function(a, b) {
                            var c, d = {},
                                e = s.call(a) == v;
                            for (c in a) e && "prototype" == c || o.call(d, c) || !(d[c] = 1) || !o.call(a, c) || b(c)
                        } : function(a, b) {
                            var c, d, e = s.call(a) == v;
                            for (c in a) e && "prototype" == c || !o.call(a, c) || (d = "constructor" === c) || b(c);
                            (d || o.call(a, c = "constructor")) && b(c)
                        } : (e = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"], p = function(a, b) {
                            var d, f, g = s.call(a) == v,
                                h = !g && "function" != typeof a.constructor && c[typeof a.hasOwnProperty] && a.hasOwnProperty || o;
                            for (d in a) g && "prototype" == d || !h.call(a, d) || b(d);
                            for (f = e.length; d = e[--f]; h.call(a, d) && b(d));
                        }), p(a, b)
                    }, !f("json-stringify")) {
                    var F = {
                            92: "\\\\",
                            34: '\\"',
                            8: "\\b",
                            12: "\\f",
                            10: "\\n",
                            13: "\\r",
                            9: "\\t"
                        },
                        G = "000000",
                        H = function(a, b) {
                            return (G + (b || 0)).slice(-a)
                        },
                        I = "\\u00",
                        J = function(a) {
                            for (var b = '"', c = 0, d = a.length, e = !B || d > 10, f = e && (B ? a.split("") : a); d > c; c++) {
                                var g = a.charCodeAt(c);
                                switch (g) {
                                    case 8:
                                    case 9:
                                    case 10:
                                    case 12:
                                    case 13:
                                    case 34:
                                    case 92:
                                        b += F[g];
                                        break;
                                    default:
                                        if (32 > g) {
                                            b += I + H(2, g.toString(16));
                                            break
                                        }
                                        b += e ? f[c] : a.charAt(c)
                                }
                            }
                            return b + '"'
                        },
                        K = function(a, b, c, d, e, f, g) {
                            var h, i, j, k, m, n, r, t, u, v, B, D, F, G, I, L;
                            try {
                                h = b[a]
                            } catch (M) {}
                            if ("object" == typeof h && h)
                                if (i = s.call(h), i != w || o.call(h, "toJSON")) "function" == typeof h.toJSON && (i != x && i != y && i != z || o.call(h, "toJSON")) && (h = h.toJSON(a));
                                else if (h > -1 / 0 && 1 / 0 > h) {
                                if (E) {
                                    for (m = C(h / 864e5), j = C(m / 365.2425) + 1970 - 1; E(j + 1, 0) <= m; j++);
                                    for (k = C((m - E(j, 0)) / 30.42); E(j, k + 1) <= m; k++);
                                    m = 1 + m - E(j, k), n = (h % 864e5 + 864e5) % 864e5, r = C(n / 36e5) % 24, t = C(n / 6e4) % 60, u = C(n / 1e3) % 60, v = n % 1e3
                                } else j = h.getUTCFullYear(), k = h.getUTCMonth(), m = h.getUTCDate(), r = h.getUTCHours(), t = h.getUTCMinutes(), u = h.getUTCSeconds(), v = h.getUTCMilliseconds();
                                h = (0 >= j || j >= 1e4 ? (0 > j ? "-" : "+") + H(6, 0 > j ? -j : j) : H(4, j)) + "-" + H(2, k + 1) + "-" + H(2, m) + "T" + H(2, r) + ":" + H(2, t) + ":" + H(2, u) + "." + H(3, v) + "Z"
                            } else h = null;
                            if (c && (h = c.call(b, a, h)), null === h) return "null";
                            if (i = s.call(h), i == A) return "" + h;
                            if (i == x) return h > -1 / 0 && 1 / 0 > h ? "" + h : "null";
                            if (i == y) return J("" + h);
                            if ("object" == typeof h) {
                                for (G = g.length; G--;)
                                    if (g[G] === h) throw l();
                                if (g.push(h), B = [], I = f, f += e, i == z) {
                                    for (F = 0, G = h.length; G > F; F++) D = K(F, h, c, d, e, f, g), B.push(D === q ? "null" : D);
                                    L = B.length ? e ? "[\n" + f + B.join(",\n" + f) + "\n" + I + "]" : "[" + B.join(",") + "]" : "[]"
                                } else p(d || h, function(a) {
                                    var b = K(a, h, c, d, e, f, g);
                                    b !== q && B.push(J(a) + ":" + (e ? " " : "") + b)
                                }), L = B.length ? e ? "{\n" + f + B.join(",\n" + f) + "\n" + I + "}" : "{" + B.join(",") + "}" : "{}";
                                return g.pop(), L
                            }
                        };
                    d.stringify = function(a, b, d) {
                        var e, f, g, h;
                        if (c[typeof b] && b)
                            if ((h = s.call(b)) == v) f = b;
                            else if (h == z) {
                            g = {};
                            for (var i, j = 0, k = b.length; k > j; i = b[j++], h = s.call(i), (h == y || h == x) && (g[i] = 1));
                        }
                        if (d)
                            if ((h = s.call(d)) == x) {
                                if ((d -= d % 1) > 0)
                                    for (e = "", d > 10 && (d = 10); e.length < d; e += " ");
                            } else h == y && (e = d.length <= 10 ? d : d.slice(0, 10));
                        return K("", (i = {}, i[""] = a, i), f, g, e, "", [])
                    }
                }
                if (!f("json-parse")) {
                    var L, M, N = h.fromCharCode,
                        O = {
                            92: "\\",
                            34: '"',
                            47: "/",
                            98: "\b",
                            116: "	",
                            110: "\n",
                            102: "\f",
                            114: "\r"
                        },
                        P = function() {
                            throw L = M = null, k()
                        },
                        Q = function() {
                            for (var a, b, c, d, e, f = M, g = f.length; g > L;) switch (e = f.charCodeAt(L)) {
                                case 9:
                                case 10:
                                case 13:
                                case 32:
                                    L++;
                                    break;
                                case 123:
                                case 125:
                                case 91:
                                case 93:
                                case 58:
                                case 44:
                                    return a = B ? f.charAt(L) : f[L], L++, a;
                                case 34:
                                    for (a = "@", L++; g > L;)
                                        if (e = f.charCodeAt(L), 32 > e) P();
                                        else if (92 == e) switch (e = f.charCodeAt(++L)) {
                                        case 92:
                                        case 34:
                                        case 47:
                                        case 98:
                                        case 116:
                                        case 110:
                                        case 102:
                                        case 114:
                                            a += O[e], L++;
                                            break;
                                        case 117:
                                            for (b = ++L, c = L + 4; c > L; L++) e = f.charCodeAt(L), e >= 48 && 57 >= e || e >= 97 && 102 >= e || e >= 65 && 70 >= e || P();
                                            a += N("0x" + f.slice(b, L));
                                            break;
                                        default:
                                            P()
                                    } else {
                                        if (34 == e) break;
                                        for (e = f.charCodeAt(L), b = L; e >= 32 && 92 != e && 34 != e;) e = f.charCodeAt(++L);
                                        a += f.slice(b, L)
                                    }
                                    if (34 == f.charCodeAt(L)) return L++, a;
                                    P();
                                default:
                                    if (b = L, 45 == e && (d = !0, e = f.charCodeAt(++L)), e >= 48 && 57 >= e) {
                                        for (48 == e && (e = f.charCodeAt(L + 1), e >= 48 && 57 >= e) && P(), d = !1; g > L && (e = f.charCodeAt(L), e >= 48 && 57 >= e); L++);
                                        if (46 == f.charCodeAt(L)) {
                                            for (c = ++L; g > c && (e = f.charCodeAt(c), e >= 48 && 57 >= e); c++);
                                            c == L && P(), L = c
                                        }
                                        if (e = f.charCodeAt(L), 101 == e || 69 == e) {
                                            for (e = f.charCodeAt(++L), 43 != e && 45 != e || L++, c = L; g > c && (e = f.charCodeAt(c), e >= 48 && 57 >= e); c++);
                                            c == L && P(), L = c
                                        }
                                        return +f.slice(b, L)
                                    }
                                    if (d && P(), "true" == f.slice(L, L + 4)) return L += 4, !0;
                                    if ("false" == f.slice(L, L + 5)) return L += 5, !1;
                                    if ("null" == f.slice(L, L + 4)) return L += 4, null;
                                    P()
                            }
                            return "$"
                        },
                        R = function(a) {
                            var b, c;
                            if ("$" == a && P(), "string" == typeof a) {
                                if ("@" == (B ? a.charAt(0) : a[0])) return a.slice(1);
                                if ("[" == a) {
                                    for (b = []; a = Q(), "]" != a; c || (c = !0)) c && ("," == a ? (a = Q(), "]" == a && P()) : P()), "," == a && P(), b.push(R(a));
                                    return b
                                }
                                if ("{" == a) {
                                    for (b = {}; a = Q(), "}" != a; c || (c = !0)) c && ("," == a ? (a = Q(), "}" == a && P()) : P()), "," != a && "string" == typeof a && "@" == (B ? a.charAt(0) : a[0]) && ":" == Q() || P(), b[a.slice(1)] = R(Q());
                                    return b
                                }
                                P()
                            }
                            return a
                        },
                        S = function(a, b, c) {
                            var d = T(a, b, c);
                            d === q ? delete a[b] : a[b] = d
                        },
                        T = function(a, b, c) {
                            var d, e = a[b];
                            if ("object" == typeof e && e)
                                if (s.call(e) == z)
                                    for (d = e.length; d--;) S(e, d, c);
                                else p(e, function(a) {
                                    S(e, a, c)
                                });
                            return c.call(a, b, e)
                        };
                    d.parse = function(a, b) {
                        var c, d;
                        return L = 0, M = "" + a, c = R(Q()), "$" != Q() && P(), L = M = null, b && s.call(b) == v ? T((d = {}, d[""] = c, d), "", b) : c
                    }
                }
            }
            return d.runInContext = a, d
        }
        var b = "function" == typeof define && define.amd,
            c = {
                "function": !0,
                object: !0
            },
            d = c[typeof exports] && exports && !exports.nodeType && exports,
            e = c[typeof window] && window || this,
            f = d && c[typeof module] && module && !module.nodeType && "object" == typeof global && global;
        if (!f || f.global !== f && f.window !== f && f.self !== f || (e = f), d && !b) a(e, d);
        else {
            var g = e.JSON,
                h = e.JSON3,
                i = !1,
                j = a(e, e.JSON3 = {
                    noConflict: function() {
                        return i || (i = !0, e.JSON = g, e.JSON3 = h, g = h = null), j
                    }
                });
            e.JSON = {
                parse: j.parse,
                stringify: j.stringify
            }
        }
        b && define(function() {
            return j
        })
    }.call(this),
    function() {
        var a = {};
        a.appendToHead = function(b) {
            a.getHead().appendChild(b)
        }, a.getHead = function() {
            return document.head || document.getElementsByTagName("head")[0]
        }, a.getBody = function() {
            return document.body || document.getElementsByTagName("body")[0]
        }, createjs.DomUtils = a
    }(),
    function() {
        var a = {};
        a.parseXML = function(a, b) {
            var c = null;
            try {
                if (window.DOMParser) {
                    var d = new DOMParser;
                    c = d.parseFromString(a, b)
                }
            } catch (e) {}
            if (!c) try {
                c = new ActiveXObject("Microsoft.XMLDOM"), c.async = !1, c.loadXML(a)
            } catch (e) {
                c = null
            }
            return c
        }, a.parseJSON = function(a) {
            if (null == a) return null;
            try {
                return JSON.parse(a)
            } catch (b) {
                throw b
            }
        }, createjs.DataUtils = a
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function LoadItem() {
            this.src = null, this.type = null, this.id = null, this.maintainOrder = !1, this.callback = null, this.data = null, this.method = createjs.LoadItem.GET, this.values = null, this.headers = null, this.withCredentials = !1, this.mimeType = null, this.crossOrigin = null, this.loadTimeout = b.LOAD_TIMEOUT_DEFAULT
        }
        var a = LoadItem.prototype = {},
            b = LoadItem;
        b.LOAD_TIMEOUT_DEFAULT = 8e3, b.create = function(a) {
            if ("string" == typeof a) {
                var c = new LoadItem;
                return c.src = a, c
            }
            if (a instanceof b) return a;
            if (a instanceof Object && a.src) return null == a.loadTimeout && (a.loadTimeout = b.LOAD_TIMEOUT_DEFAULT), a;
            throw new Error("Type not recognized.")
        }, a.set = function(a) {
            for (var b in a) this[b] = a[b];
            return this
        }, createjs.LoadItem = b
    }(),
    function() {
        var a = {};
        a.ABSOLUTE_PATT = /^(?:\w+:)?\/{2}/i, a.RELATIVE_PATT = /^[./]*?\//i, a.EXTENSION_PATT = /\/?[^/]+\.(\w{1,5})$/i, a.parseURI = function(b) {
            var c = {
                absolute: !1,
                relative: !1
            };
            if (null == b) return c;
            var d = b.indexOf("?");
            d > -1 && (b = b.substr(0, d));
            var e;
            return a.ABSOLUTE_PATT.test(b) ? c.absolute = !0 : a.RELATIVE_PATT.test(b) && (c.relative = !0), (e = b.match(a.EXTENSION_PATT)) && (c.extension = e[1].toLowerCase()), c
        }, a.formatQueryString = function(a, b) {
            if (null == a) throw new Error("You must specify data.");
            var c = [];
            for (var d in a) c.push(d + "=" + escape(a[d]));
            return b && (c = c.concat(b)), c.join("&")
        }, a.buildPath = function(a, b) {
            if (null == b) return a;
            var c = [],
                d = a.indexOf("?");
            if (-1 != d) {
                var e = a.slice(d + 1);
                c = c.concat(e.split("&"))
            }
            return -1 != d ? a.slice(0, d) + "?" + this.formatQueryString(b, c) : a + "?" + this.formatQueryString(b, c)
        }, a.isCrossDomain = function(a) {
            var b = document.createElement("a");
            b.href = a.src;
            var c = document.createElement("a");
            c.href = location.href;
            var d = "" != b.hostname && (b.port != c.port || b.protocol != c.protocol || b.hostname != c.hostname);
            return d
        }, a.isLocal = function(a) {
            var b = document.createElement("a");
            return b.href = a.src, "" == b.hostname && "file:" == b.protocol
        }, a.isBinary = function(a) {
            switch (a) {
                case createjs.AbstractLoader.IMAGE:
                case createjs.AbstractLoader.BINARY:
                    return !0;
                default:
                    return !1
            }
        }, a.isImageTag = function(a) {
            return a instanceof HTMLImageElement
        }, a.isAudioTag = function(a) {
            return window.HTMLAudioElement ? a instanceof HTMLAudioElement : !1
        }, a.isVideoTag = function(a) {
            return window.HTMLVideoElement ? a instanceof HTMLVideoElement : !1
        }, a.isText = function(a) {
            switch (a) {
                case createjs.AbstractLoader.TEXT:
                case createjs.AbstractLoader.JSON:
                case createjs.AbstractLoader.MANIFEST:
                case createjs.AbstractLoader.XML:
                case createjs.AbstractLoader.CSS:
                case createjs.AbstractLoader.SVG:
                case createjs.AbstractLoader.JAVASCRIPT:
                case createjs.AbstractLoader.SPRITESHEET:
                    return !0;
                default:
                    return !1
            }
        }, a.getTypeByExtension = function(a) {
            if (null == a) return createjs.AbstractLoader.TEXT;
            switch (a.toLowerCase()) {
                case "jpeg":
                case "jpg":
                case "gif":
                case "png":
                case "webp":
                case "bmp":
                    return createjs.AbstractLoader.IMAGE;
                case "ogg":
                case "mp3":
                case "webm":
                    return createjs.AbstractLoader.SOUND;
                case "mp4":
                case "webm":
                case "ts":
                    return createjs.AbstractLoader.VIDEO;
                case "json":
                    return createjs.AbstractLoader.JSON;
                case "xml":
                    return createjs.AbstractLoader.XML;
                case "css":
                    return createjs.AbstractLoader.CSS;
                case "js":
                    return createjs.AbstractLoader.JAVASCRIPT;
                case "svg":
                    return createjs.AbstractLoader.SVG;
                default:
                    return createjs.AbstractLoader.TEXT
            }
        }, createjs.RequestUtils = a
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function AbstractLoader(a, b, c) {
            this.EventDispatcher_constructor(), this.loaded = !1, this.canceled = !1, this.progress = 0, this.type = c, this.resultFormatter = null, a ? this._item = createjs.LoadItem.create(a) : this._item = null, this._preferXHR = b, this._result = null, this._rawResult = null, this._loadedItems = null, this._tagSrcAttribute = null, this._tag = null
        }
        var a = createjs.extend(AbstractLoader, createjs.EventDispatcher),
            b = AbstractLoader;
        b.POST = "POST", b.GET = "GET", b.BINARY = "binary", b.CSS = "css", b.IMAGE = "image", b.JAVASCRIPT = "javascript", b.JSON = "json", b.JSONP = "jsonp", b.MANIFEST = "manifest", b.SOUND = "sound", b.VIDEO = "video", b.SPRITESHEET = "spritesheet", b.SVG = "svg", b.TEXT = "text", b.XML = "xml", a.getItem = function() {
            return this._item
        }, a.getResult = function(a) {
            return a ? this._rawResult : this._result
        }, a.getTag = function() {
            return this._tag
        }, a.setTag = function(a) {
            this._tag = a
        }, a.load = function() {
            this._createRequest(), this._request.on("complete", this, this), this._request.on("progress", this, this), this._request.on("loadStart", this, this), this._request.on("abort", this, this), this._request.on("timeout", this, this), this._request.on("error", this, this);
            var a = new createjs.Event("initialize");
            a.loader = this._request, this.dispatchEvent(a), this._request.load()
        }, a.cancel = function() {
            this.canceled = !0, this.destroy()
        }, a.destroy = function() {
            this._request && (this._request.removeAllEventListeners(), this._request.destroy()), this._request = null, this._item = null, this._rawResult = null, this._result = null, this._loadItems = null, this.removeAllEventListeners()
        }, a.getLoadedItems = function() {
            return this._loadedItems
        }, a._createRequest = function() {
            this._preferXHR ? this._request = new createjs.XHRRequest(this._item) : this._request = new createjs.TagRequest(this._item, this._tag || this._createTag(), this._tagSrcAttribute)
        }, a._createTag = function(a) {
            return null
        }, a._sendLoadStart = function() {
            this._isCanceled() || this.dispatchEvent("loadstart")
        }, a._sendProgress = function(a) {
            if (!this._isCanceled()) {
                var b = null;
                "number" == typeof a ? (this.progress = a, b = new createjs.ProgressEvent(this.progress)) : (b = a, this.progress = a.loaded / a.total, b.progress = this.progress, (isNaN(this.progress) || this.progress == 1 / 0) && (this.progress = 0)), this.hasEventListener("progress") && this.dispatchEvent(b)
            }
        }, a._sendComplete = function() {
            if (!this._isCanceled()) {
                this.loaded = !0;
                var a = new createjs.Event("complete");
                a.rawResult = this._rawResult, null != this._result && (a.result = this._result), this.dispatchEvent(a)
            }
        }, a._sendError = function(a) {
            !this._isCanceled() && this.hasEventListener("error") && (null == a && (a = new createjs.ErrorEvent("PRELOAD_ERROR_EMPTY")), this.dispatchEvent(a))
        }, a._isCanceled = function() {
            return !(null != window.createjs && !this.canceled)
        }, a.resultFormatter = null, a.handleEvent = function(a) {
            switch (a.type) {
                case "complete":
                    this._rawResult = a.target._response;
                    var b = this.resultFormatter && this.resultFormatter(this);
                    b instanceof Function ? b.call(this, createjs.proxy(this._resultFormatSuccess, this), createjs.proxy(this._resultFormatFailed, this)) : (this._result = b || this._rawResult, this._sendComplete());
                    break;
                case "progress":
                    this._sendProgress(a);
                    break;
                case "error":
                    this._sendError(a);
                    break;
                case "loadstart":
                    this._sendLoadStart();
                    break;
                case "abort":
                case "timeout":
                    this._isCanceled() || this.dispatchEvent(new createjs.ErrorEvent("PRELOAD_" + a.type.toUpperCase() + "_ERROR"))
            }
        }, a._resultFormatSuccess = function(a) {
            this._result = a, this._sendComplete()
        }, a._resultFormatFailed = function(a) {
            this._sendError(a)
        }, a.buildPath = function(a, b) {
            return createjs.RequestUtils.buildPath(a, b)
        }, a.toString = function() {
            return "[PreloadJS AbstractLoader]"
        }, createjs.AbstractLoader = createjs.promote(AbstractLoader, "EventDispatcher")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function AbstractMediaLoader(a, b, c) {
            this.AbstractLoader_constructor(a, b, c), this.resultFormatter = this._formatResult, this._tagSrcAttribute = "src", this.on("initialize", this._updateXHR, this)
        }
        var a = createjs.extend(AbstractMediaLoader, createjs.AbstractLoader);
        a.load = function() {
            this._tag || (this._tag = this._createTag(this._item.src)), this._tag.preload = "auto", this._tag.load(), this.AbstractLoader_load()
        }, a._createTag = function() {}, a._createRequest = function() {
            this._preferXHR ? this._request = new createjs.XHRRequest(this._item) : this._request = new createjs.MediaTagRequest(this._item, this._tag || this._createTag(), this._tagSrcAttribute)
        }, a._updateXHR = function(a) {
            a.loader.setResponseType && a.loader.setResponseType("blob")
        }, a._formatResult = function(a) {
            if (this._tag.removeEventListener && this._tag.removeEventListener("canplaythrough", this._loadedHandler), this._tag.onstalled = null, this._preferXHR) {
                var b = window.URL || window.webkitURL,
                    c = a.getResult(!0);
                a.getTag().src = b.createObjectURL(c)
            }
            return a.getTag()
        }, createjs.AbstractMediaLoader = createjs.promote(AbstractMediaLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";
        var AbstractRequest = function(a) {
                this._item = a
            },
            a = createjs.extend(AbstractRequest, createjs.EventDispatcher);
        a.load = function() {}, a.destroy = function() {}, a.cancel = function() {}, createjs.AbstractRequest = createjs.promote(AbstractRequest, "EventDispatcher")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function TagRequest(a, b, c) {
            this.AbstractRequest_constructor(a), this._tag = b, this._tagSrcAttribute = c, this._loadedHandler = createjs.proxy(this._handleTagComplete, this), this._addedToDOM = !1, this._startTagVisibility = null
        }
        var a = createjs.extend(TagRequest, createjs.AbstractRequest);
        a.load = function() {
            this._tag.onload = createjs.proxy(this._handleTagComplete, this), this._tag.onreadystatechange = createjs.proxy(this._handleReadyStateChange, this), this._tag.onerror = createjs.proxy(this._handleError, this);
            var a = new createjs.Event("initialize");
            a.loader = this._tag, this.dispatchEvent(a), this._hideTag(), this._loadTimeout = setTimeout(createjs.proxy(this._handleTimeout, this), this._item.loadTimeout), this._tag[this._tagSrcAttribute] = this._item.src, null == this._tag.parentNode && (window.document.body.appendChild(this._tag), this._addedToDOM = !0)
        }, a.destroy = function() {
            this._clean(), this._tag = null, this.AbstractRequest_destroy()
        }, a._handleReadyStateChange = function() {
            clearTimeout(this._loadTimeout);
            var a = this._tag;
            "loaded" != a.readyState && "complete" != a.readyState || this._handleTagComplete()
        }, a._handleError = function() {
            this._clean(), this.dispatchEvent("error")
        }, a._handleTagComplete = function() {
            this._rawResult = this._tag, this._result = this.resultFormatter && this.resultFormatter(this) || this._rawResult, this._clean(), this._showTag(), this.dispatchEvent("complete")
        }, a._handleTimeout = function() {
            this._clean(), this.dispatchEvent(new createjs.Event("timeout"))
        }, a._clean = function() {
            this._tag.onload = null, this._tag.onreadystatechange = null, this._tag.onerror = null, this._addedToDOM && null != this._tag.parentNode && this._tag.parentNode.removeChild(this._tag), clearTimeout(this._loadTimeout)
        }, a._hideTag = function() {
            this._startTagVisibility = this._tag.style.visibility, this._tag.style.visibility = "hidden"
        }, a._showTag = function() {
            this._tag.style.visibility = this._startTagVisibility
        }, a._handleStalled = function() {}, createjs.TagRequest = createjs.promote(TagRequest, "AbstractRequest")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function MediaTagRequest(a, b, c) {
            this.AbstractRequest_constructor(a), this._tag = b, this._tagSrcAttribute = c, this._loadedHandler = createjs.proxy(this._handleTagComplete, this)
        }
        var a = createjs.extend(MediaTagRequest, createjs.TagRequest);
        a.load = function() {
            var a = createjs.proxy(this._handleStalled, this);
            this._stalledCallback = a;
            var b = createjs.proxy(this._handleProgress, this);
            this._handleProgress = b, this._tag.addEventListener("stalled", a), this._tag.addEventListener("progress", b), this._tag.addEventListener && this._tag.addEventListener("canplaythrough", this._loadedHandler, !1), this.TagRequest_load()
        }, a._handleReadyStateChange = function() {
            clearTimeout(this._loadTimeout);
            var a = this._tag;
            "loaded" != a.readyState && "complete" != a.readyState || this._handleTagComplete()
        }, a._handleStalled = function() {}, a._handleProgress = function(a) {
            if (a && !(a.loaded > 0 && 0 == a.total)) {
                var b = new createjs.ProgressEvent(a.loaded, a.total);
                this.dispatchEvent(b)
            }
        }, a._clean = function() {
            this._tag.removeEventListener && this._tag.removeEventListener("canplaythrough", this._loadedHandler), this._tag.removeEventListener("stalled", this._stalledCallback), this._tag.removeEventListener("progress", this._progressCallback), this.TagRequest__clean()
        }, createjs.MediaTagRequest = createjs.promote(MediaTagRequest, "TagRequest")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function XHRRequest(a) {
            this.AbstractRequest_constructor(a), this._request = null, this._loadTimeout = null, this._xhrLevel = 1, this._response = null, this._rawResponse = null, this._canceled = !1, this._handleLoadStartProxy = createjs.proxy(this._handleLoadStart, this), this._handleProgressProxy = createjs.proxy(this._handleProgress, this), this._handleAbortProxy = createjs.proxy(this._handleAbort, this), this._handleErrorProxy = createjs.proxy(this._handleError, this), this._handleTimeoutProxy = createjs.proxy(this._handleTimeout, this), this._handleLoadProxy = createjs.proxy(this._handleLoad, this), this._handleReadyStateChangeProxy = createjs.proxy(this._handleReadyStateChange, this), !this._createXHR(a)
        }
        var a = createjs.extend(XHRRequest, createjs.AbstractRequest);
        XHRRequest.ACTIVEX_VERSIONS = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], a.getResult = function(a) {
            return a && this._rawResponse ? this._rawResponse : this._response
        }, a.cancel = function() {
            this.canceled = !0, this._clean(), this._request.abort()
        }, a.load = function() {
            if (null == this._request) return void this._handleError();
            null != this._request.addEventListener ? (this._request.addEventListener("loadstart", this._handleLoadStartProxy, !1), this._request.addEventListener("progress", this._handleProgressProxy, !1), this._request.addEventListener("abort", this._handleAbortProxy, !1), this._request.addEventListener("error", this._handleErrorProxy, !1), this._request.addEventListener("timeout", this._handleTimeoutProxy, !1), this._request.addEventListener("load", this._handleLoadProxy, !1), this._request.addEventListener("readystatechange", this._handleReadyStateChangeProxy, !1)) : (this._request.onloadstart = this._handleLoadStartProxy, this._request.onprogress = this._handleProgressProxy, this._request.onabort = this._handleAbortProxy, this._request.onerror = this._handleErrorProxy, this._request.ontimeout = this._handleTimeoutProxy, this._request.onload = this._handleLoadProxy, this._request.onreadystatechange = this._handleReadyStateChangeProxy), 1 == this._xhrLevel && (this._loadTimeout = setTimeout(createjs.proxy(this._handleTimeout, this), this._item.loadTimeout));
            try {
                this._item.values && this._item.method != createjs.AbstractLoader.GET ? this._item.method == createjs.AbstractLoader.POST && this._request.send(createjs.RequestUtils.formatQueryString(this._item.values)) : this._request.send()
            } catch (a) {
                this.dispatchEvent(new createjs.ErrorEvent("XHR_SEND", null, a))
            }
        }, a.setResponseType = function(a) {
            "blob" === a && (a = window.URL ? "blob" : "arraybuffer", this._responseType = a), this._request.responseType = a
        }, a.getAllResponseHeaders = function() {
            return this._request.getAllResponseHeaders instanceof Function ? this._request.getAllResponseHeaders() : null
        }, a.getResponseHeader = function(a) {
            return this._request.getResponseHeader instanceof Function ? this._request.getResponseHeader(a) : null
        }, a._handleProgress = function(a) {
            if (a && !(a.loaded > 0 && 0 == a.total)) {
                var b = new createjs.ProgressEvent(a.loaded, a.total);
                this.dispatchEvent(b)
            }
        }, a._handleLoadStart = function(a) {
            clearTimeout(this._loadTimeout), this.dispatchEvent("loadstart")
        }, a._handleAbort = function(a) {
            this._clean(), this.dispatchEvent(new createjs.ErrorEvent("XHR_ABORTED", null, a))
        }, a._handleError = function(a) {
            this._clean(), this.dispatchEvent(new createjs.ErrorEvent(a.message))
        }, a._handleReadyStateChange = function(a) {
            4 == this._request.readyState && this._handleLoad()
        }, a._handleLoad = function(a) {
            if (!this.loaded) {
                this.loaded = !0;
                var b = this._checkError();
                if (b) return void this._handleError(b);
                if (this._response = this._getResponse(), "arraybuffer" === this._responseType) try {
                    this._response = new Blob([this._response])
                } catch (c) {
                    if (window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, "TypeError" === c.name && window.BlobBuilder) {
                        var d = new BlobBuilder;
                        d.append(this._response), this._response = d.getBlob()
                    }
                }
                this._clean(), this.dispatchEvent(new createjs.Event("complete"))
            }
        }, a._handleTimeout = function(a) {
            this._clean(), this.dispatchEvent(new createjs.ErrorEvent("PRELOAD_TIMEOUT", null, a))
        }, a._checkError = function() {
            var a = parseInt(this._request.status);
            switch (a) {
                case 404:
                case 0:
                    return new Error(a)
            }
            return null
        }, a._getResponse = function() {
            if (null != this._response) return this._response;
            if (null != this._request.response) return this._request.response;
            try {
                if (null != this._request.responseText) return this._request.responseText
            } catch (a) {}
            try {
                if (null != this._request.responseXML) return this._request.responseXML
            } catch (a) {}
            return null
        }, a._createXHR = function(a) {
            var b = createjs.RequestUtils.isCrossDomain(a),
                c = {},
                d = null;
            if (window.XMLHttpRequest) d = new XMLHttpRequest, b && void 0 === d.withCredentials && window.XDomainRequest && (d = new XDomainRequest);
            else {
                for (var e = 0, f = s.ACTIVEX_VERSIONS.length; f > e; e++) {
                    var g = s.ACTIVEX_VERSIONS[e];
                    try {
                        d = new ActiveXObject(g);
                        break
                    } catch (h) {}
                }
                if (null == d) return !1
            }
            null == a.mimeType && createjs.RequestUtils.isText(a.type) && (a.mimeType = "text/plain; charset=utf-8"), a.mimeType && d.overrideMimeType && d.overrideMimeType(a.mimeType), this._xhrLevel = "string" == typeof d.responseType ? 2 : 1;
            var i = null;
            if (i = a.method == createjs.AbstractLoader.GET ? createjs.RequestUtils.buildPath(a.src, a.values) : a.src, d.open(a.method || createjs.AbstractLoader.GET, i, !0), b && d instanceof XMLHttpRequest && 1 == this._xhrLevel && (c.Origin = location.origin), a.values && a.method == createjs.AbstractLoader.POST && (c["Content-Type"] = "application/x-www-form-urlencoded"), b || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest"), a.headers)
                for (var j in a.headers) c[j] = a.headers[j];
            for (j in c) d.setRequestHeader(j, c[j]);
            return d instanceof XMLHttpRequest && void 0 !== a.withCredentials && (d.withCredentials = a.withCredentials), this._request = d, !0
        }, a._clean = function() {
            clearTimeout(this._loadTimeout), null != this._request.removeEventListener ? (this._request.removeEventListener("loadstart", this._handleLoadStartProxy), this._request.removeEventListener("progress", this._handleProgressProxy), this._request.removeEventListener("abort", this._handleAbortProxy), this._request.removeEventListener("error", this._handleErrorProxy), this._request.removeEventListener("timeout", this._handleTimeoutProxy), this._request.removeEventListener("load", this._handleLoadProxy), this._request.removeEventListener("readystatechange", this._handleReadyStateChangeProxy)) : (this._request.onloadstart = null, this._request.onprogress = null, this._request.onabort = null, this._request.onerror = null, this._request.ontimeout = null, this._request.onload = null, this._request.onreadystatechange = null)
        }, a.toString = function() {
            return "[PreloadJS XHRRequest]"
        }, createjs.XHRRequest = createjs.promote(XHRRequest, "AbstractRequest")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function LoadQueue(a, b, c) {
            this.AbstractLoader_constructor(), this._plugins = [], this._typeCallbacks = {}, this._extensionCallbacks = {}, this.next = null, this.maintainScriptOrder = !0, this.stopOnError = !1, this._maxConnections = 1, this._availableLoaders = [createjs.ImageLoader, createjs.JavaScriptLoader, createjs.CSSLoader, createjs.JSONLoader, createjs.JSONPLoader, createjs.SoundLoader, createjs.ManifestLoader, createjs.SpriteSheetLoader, createjs.XMLLoader, createjs.SVGLoader, createjs.BinaryLoader, createjs.VideoLoader, createjs.TextLoader],
                this._defaultLoaderLength = this._availableLoaders.length, this.init(a, b, c)
        }
        var a = createjs.extend(LoadQueue, createjs.AbstractLoader),
            b = LoadQueue;
        a.init = function(a, b, c) {
            this.useXHR = !0, this.preferXHR = !0, this._preferXHR = !0, this.setPreferXHR(a), this._paused = !1, this._basePath = b, this._crossOrigin = c, this._loadStartWasDispatched = !1, this._currentlyLoadingScript = null, this._currentLoads = [], this._loadQueue = [], this._loadQueueBackup = [], this._loadItemsById = {}, this._loadItemsBySrc = {}, this._loadedResults = {}, this._loadedRawResults = {}, this._numItems = 0, this._numItemsLoaded = 0, this._scriptOrder = [], this._loadedScripts = [], this._lastProgress = NaN
        }, b.loadTimeout = 8e3, b.LOAD_TIMEOUT = 0, b.BINARY = createjs.AbstractLoader.BINARY, b.CSS = createjs.AbstractLoader.CSS, b.IMAGE = createjs.AbstractLoader.IMAGE, b.JAVASCRIPT = createjs.AbstractLoader.JAVASCRIPT, b.JSON = createjs.AbstractLoader.JSON, b.JSONP = createjs.AbstractLoader.JSONP, b.MANIFEST = createjs.AbstractLoader.MANIFEST, b.SOUND = createjs.AbstractLoader.SOUND, b.VIDEO = createjs.AbstractLoader.VIDEO, b.SVG = createjs.AbstractLoader.SVG, b.TEXT = createjs.AbstractLoader.TEXT, b.XML = createjs.AbstractLoader.XML, b.POST = createjs.AbstractLoader.POST, b.GET = createjs.AbstractLoader.GET, a.registerLoader = function(a) {
            if (!a || !a.canLoadItem) throw new Error("loader is of an incorrect type.");
            if (-1 != this._availableLoaders.indexOf(a)) throw new Error("loader already exists.");
            this._availableLoaders.unshift(a)
        }, a.unregisterLoader = function(a) {
            var b = this._availableLoaders.indexOf(a); - 1 != b && b < this._defaultLoaderLength - 1 && this._availableLoaders.splice(b, 1)
        }, a.setUseXHR = function(a) {
            return this.setPreferXHR(a)
        }, a.setPreferXHR = function(a) {
            return this.preferXHR = 0 != a && null != window.XMLHttpRequest, this.preferXHR
        }, a.removeAll = function() {
            this.remove()
        }, a.remove = function(a) {
            var b = null;
            if (a && !Array.isArray(a)) b = [a];
            else if (a) b = a;
            else if (arguments.length > 0) return;
            var c = !1;
            if (b) {
                for (; b.length;) {
                    var d = b.pop(),
                        e = this.getResult(d);
                    for (f = this._loadQueue.length - 1; f >= 0; f--)
                        if (g = this._loadQueue[f].getItem(), g.id == d || g.src == d) {
                            this._loadQueue.splice(f, 1)[0].cancel();
                            break
                        }
                    for (f = this._loadQueueBackup.length - 1; f >= 0; f--)
                        if (g = this._loadQueueBackup[f].getItem(), g.id == d || g.src == d) {
                            this._loadQueueBackup.splice(f, 1)[0].cancel();
                            break
                        }
                    if (e) this._disposeItem(this.getItem(d));
                    else
                        for (var f = this._currentLoads.length - 1; f >= 0; f--) {
                            var g = this._currentLoads[f].getItem();
                            if (g.id == d || g.src == d) {
                                this._currentLoads.splice(f, 1)[0].cancel(), c = !0;
                                break
                            }
                        }
                }
                c && this._loadNext()
            } else {
                this.close();
                for (var h in this._loadItemsById) this._disposeItem(this._loadItemsById[h]);
                this.init(this.preferXHR, this._basePath)
            }
        }, a.reset = function() {
            this.close();
            for (var a in this._loadItemsById) this._disposeItem(this._loadItemsById[a]);
            for (var b = [], c = 0, d = this._loadQueueBackup.length; d > c; c++) b.push(this._loadQueueBackup[c].getItem());
            this.loadManifest(b, !1)
        }, a.installPlugin = function(a) {
            if (null != a && null != a.getPreloadHandlers) {
                this._plugins.push(a);
                var b = a.getPreloadHandlers();
                if (b.scope = a, null != b.types)
                    for (var c = 0, d = b.types.length; d > c; c++) this._typeCallbacks[b.types[c]] = b;
                if (null != b.extensions)
                    for (c = 0, d = b.extensions.length; d > c; c++) this._extensionCallbacks[b.extensions[c]] = b
            }
        }, a.setMaxConnections = function(a) {
            this._maxConnections = a, !this._paused && this._loadQueue.length > 0 && this._loadNext()
        }, a.loadFile = function(a, b, c) {
            if (null == a) {
                var d = new createjs.ErrorEvent("PRELOAD_NO_FILE");
                return void this._sendError(d)
            }
            this._addItem(a, null, c), b !== !1 ? this.setPaused(!1) : this.setPaused(!0)
        }, a.loadManifest = function(a, c, d) {
            var e = null,
                f = null;
            if (Array.isArray(a)) {
                if (0 == a.length) {
                    var g = new createjs.ErrorEvent("PRELOAD_MANIFEST_EMPTY");
                    return void this._sendError(g)
                }
                e = a
            } else if ("string" == typeof a) e = [{
                src: a,
                type: b.MANIFEST
            }];
            else {
                if ("object" != typeof a) {
                    var g = new createjs.ErrorEvent("PRELOAD_MANIFEST_NULL");
                    return void this._sendError(g)
                }
                if (void 0 !== a.src) {
                    if (null == a.type) a.type = b.MANIFEST;
                    else if (a.type != b.MANIFEST) {
                        var g = new createjs.ErrorEvent("PRELOAD_MANIFEST_TYPE");
                        this._sendError(g)
                    }
                    e = [a]
                } else void 0 !== a.manifest && (e = a.manifest, f = a.path)
            }
            for (var h = 0, i = e.length; i > h; h++) this._addItem(e[h], f, d);
            c !== !1 ? this.setPaused(!1) : this.setPaused(!0)
        }, a.load = function() {
            this.setPaused(!1)
        }, a.getItem = function(a) {
            return this._loadItemsById[a] || this._loadItemsBySrc[a]
        }, a.getResult = function(a, b) {
            var c = this._loadItemsById[a] || this._loadItemsBySrc[a];
            if (null == c) return null;
            var d = c.id;
            return b && this._loadedRawResults[d] ? this._loadedRawResults[d] : this._loadedResults[d]
        }, a.getItems = function(a) {
            var b = [];
            for (var c in this._loadItemsById) {
                var d = this._loadItemsById[c],
                    e = this.getResult(c);
                a === !0 && null == e || b.push({
                    item: d,
                    result: e,
                    rawResult: this.getResult(c, !0)
                })
            }
            return b
        }, a.setPaused = function(a) {
            this._paused = a, this._paused || this._loadNext()
        }, a.close = function() {
            for (; this._currentLoads.length;) this._currentLoads.pop().cancel();
            this._scriptOrder.length = 0, this._loadedScripts.length = 0, this.loadStartWasDispatched = !1, this._itemCount = 0, this._lastProgress = NaN
        }, a._addItem = function(a, b, c) {
            var d = this._createLoadItem(a, b, c);
            if (null != d) {
                var e = this._createLoader(d);
                null != e && ("plugins" in e && (e.plugins = this._plugins), d._loader = e, this._loadQueue.push(e), this._loadQueueBackup.push(e), this._numItems++, this._updateProgress(), (this.maintainScriptOrder && d.type == createjs.LoadQueue.JAVASCRIPT || d.maintainOrder === !0) && (this._scriptOrder.push(d), this._loadedScripts.push(null)))
            }
        }, a._createLoadItem = function(a, b, c) {
            var d = createjs.LoadItem.create(a);
            if (null == d) return null;
            var e = "",
                f = c || this._basePath;
            if (d.src instanceof Object) {
                if (!d.type) return null;
                if (b) {
                    e = b;
                    var g = createjs.RequestUtils.parseURI(b);
                    null == f || g.absolute || g.relative || (e = f + e)
                } else null != f && (e = f)
            } else {
                var h = createjs.RequestUtils.parseURI(d.src);
                h.extension && (d.ext = h.extension), null == d.type && (d.type = createjs.RequestUtils.getTypeByExtension(d.ext));
                var i = d.src;
                if (!h.absolute && !h.relative)
                    if (b) {
                        e = b;
                        var g = createjs.RequestUtils.parseURI(b);
                        i = b + i, null == f || g.absolute || g.relative || (e = f + e)
                    } else null != f && (e = f);
                d.src = e + d.src
            }
            d.path = e, void 0 !== d.id && null !== d.id && "" !== d.id || (d.id = i);
            var j = this._typeCallbacks[d.type] || this._extensionCallbacks[d.ext];
            if (j) {
                var k = j.callback.call(j.scope, d, this);
                if (k === !1) return null;
                k === !0 || null != k && (d._loader = k), h = createjs.RequestUtils.parseURI(d.src), null != h.extension && (d.ext = h.extension)
            }
            return this._loadItemsById[d.id] = d, this._loadItemsBySrc[d.src] = d, null == d.crossOrigin && (d.crossOrigin = this._crossOrigin), d
        }, a._createLoader = function(a) {
            if (null != a._loader) return a._loader;
            for (var b = this.preferXHR, c = 0; c < this._availableLoaders.length; c++) {
                var d = this._availableLoaders[c];
                if (d && d.canLoadItem(a)) return new d(a, b)
            }
            return null
        }, a._loadNext = function() {
            if (!this._paused) {
                this._loadStartWasDispatched || (this._sendLoadStart(), this._loadStartWasDispatched = !0), this._numItems == this._numItemsLoaded ? (this.loaded = !0, this._sendComplete(), this.next && this.next.load && this.next.load()) : this.loaded = !1;
                for (var a = 0; a < this._loadQueue.length && !(this._currentLoads.length >= this._maxConnections); a++) {
                    var b = this._loadQueue[a];
                    this._canStartLoad(b) && (this._loadQueue.splice(a, 1), a--, this._loadItem(b))
                }
            }
        }, a._loadItem = function(a) {
            a.on("fileload", this._handleFileLoad, this), a.on("progress", this._handleProgress, this), a.on("complete", this._handleFileComplete, this), a.on("error", this._handleError, this), a.on("fileerror", this._handleFileError, this), this._currentLoads.push(a), this._sendFileStart(a.getItem()), a.load()
        }, a._handleFileLoad = function(a) {
            a.target = null, this.dispatchEvent(a)
        }, a._handleFileError = function(a) {
            var b = new createjs.ErrorEvent("FILE_LOAD_ERROR", null, a.item);
            this._sendError(b)
        }, a._handleError = function(a) {
            var b = a.target;
            this._numItemsLoaded++, this._finishOrderedItem(b, !0), this._updateProgress();
            var c = new createjs.ErrorEvent("FILE_LOAD_ERROR", null, b.getItem());
            this._sendError(c), this.stopOnError ? this.setPaused(!0) : (this._removeLoadItem(b), this._cleanLoadItem(b), this._loadNext())
        }, a._handleFileComplete = function(a) {
            var b = a.target,
                c = b.getItem(),
                d = b.getResult();
            this._loadedResults[c.id] = d;
            var e = b.getResult(!0);
            null != e && e !== d && (this._loadedRawResults[c.id] = e), this._saveLoadedItems(b), this._removeLoadItem(b), this._finishOrderedItem(b) || this._processFinishedLoad(c, b), this._cleanLoadItem(b)
        }, a._saveLoadedItems = function(a) {
            var b = a.getLoadedItems();
            if (null !== b)
                for (var c = 0; c < b.length; c++) {
                    var d = b[c].item;
                    this._loadItemsBySrc[d.src] = d, this._loadItemsById[d.id] = d, this._loadedResults[d.id] = b[c].result, this._loadedRawResults[d.id] = b[c].rawResult
                }
        }, a._finishOrderedItem = function(a, b) {
            var c = a.getItem();
            if (this.maintainScriptOrder && c.type == createjs.LoadQueue.JAVASCRIPT || c.maintainOrder) {
                a instanceof createjs.JavaScriptLoader && (this._currentlyLoadingScript = !1);
                var d = createjs.indexOf(this._scriptOrder, c);
                return -1 == d ? !1 : (this._loadedScripts[d] = b === !0 ? !0 : c, this._checkScriptLoadOrder(), !0)
            }
            return !1
        }, a._checkScriptLoadOrder = function() {
            for (var a = this._loadedScripts.length, b = 0; a > b; b++) {
                var c = this._loadedScripts[b];
                if (null === c) break;
                if (c !== !0) {
                    var d = this._loadedResults[c.id];
                    c.type == createjs.LoadQueue.JAVASCRIPT && createjs.DomUtils.appendToHead(d);
                    var e = c._loader;
                    this._processFinishedLoad(c, e), this._loadedScripts[b] = !0
                }
            }
        }, a._processFinishedLoad = function(a, b) {
            if (this._numItemsLoaded++, !this.maintainScriptOrder && a.type == createjs.LoadQueue.JAVASCRIPT) {
                var c = b.getTag();
                createjs.DomUtils.appendToHead(c)
            }
            this._updateProgress(), this._sendFileComplete(a, b), this._loadNext()
        }, a._canStartLoad = function(a) {
            if (!this.maintainScriptOrder || a.preferXHR) return !0;
            var b = a.getItem();
            if (b.type != createjs.LoadQueue.JAVASCRIPT) return !0;
            if (this._currentlyLoadingScript) return !1;
            for (var c = this._scriptOrder.indexOf(b), d = 0; c > d;) {
                var e = this._loadedScripts[d];
                if (null == e) return !1;
                d++
            }
            return this._currentlyLoadingScript = !0, !0
        }, a._removeLoadItem = function(a) {
            for (var b = this._currentLoads.length, c = 0; b > c; c++)
                if (this._currentLoads[c] == a) {
                    this._currentLoads.splice(c, 1);
                    break
                }
        }, a._cleanLoadItem = function(a) {
            var b = a.getItem();
            b && delete b._loader
        }, a._handleProgress = function(a) {
            var b = a.target;
            this._sendFileProgress(b.getItem(), b.progress), this._updateProgress()
        }, a._updateProgress = function() {
            var a = this._numItemsLoaded / this._numItems,
                b = this._numItems - this._numItemsLoaded;
            if (b > 0) {
                for (var c = 0, d = 0, e = this._currentLoads.length; e > d; d++) c += this._currentLoads[d].progress;
                a += c / b * (b / this._numItems)
            }
            this._lastProgress != a && (this._sendProgress(a), this._lastProgress = a)
        }, a._disposeItem = function(a) {
            delete this._loadedResults[a.id], delete this._loadedRawResults[a.id], delete this._loadItemsById[a.id], delete this._loadItemsBySrc[a.src]
        }, a._sendFileProgress = function(a, b) {
            if (!this._isCanceled() && !this._paused && this.hasEventListener("fileprogress")) {
                var c = new createjs.Event("fileprogress");
                c.progress = b, c.loaded = b, c.total = 1, c.item = a, this.dispatchEvent(c)
            }
        }, a._sendFileComplete = function(a, b) {
            if (!this._isCanceled() && !this._paused) {
                var c = new createjs.Event("fileload");
                c.loader = b, c.item = a, c.result = this._loadedResults[a.id], c.rawResult = this._loadedRawResults[a.id], a.completeHandler && a.completeHandler(c), this.hasEventListener("fileload") && this.dispatchEvent(c)
            }
        }, a._sendFileStart = function(a) {
            var b = new createjs.Event("filestart");
            b.item = a, this.hasEventListener("filestart") && this.dispatchEvent(b)
        }, a.toString = function() {
            return "[PreloadJS LoadQueue]"
        }, createjs.LoadQueue = createjs.promote(LoadQueue, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function TextLoader(a) {
            this.AbstractLoader_constructor(a, !0, createjs.AbstractLoader.TEXT)
        }
        var a = (createjs.extend(TextLoader, createjs.AbstractLoader), TextLoader);
        a.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.TEXT
        }, createjs.TextLoader = createjs.promote(TextLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function BinaryLoader(a) {
            this.AbstractLoader_constructor(a, !0, createjs.AbstractLoader.BINARY), this.on("initialize", this._updateXHR, this)
        }
        var a = createjs.extend(BinaryLoader, createjs.AbstractLoader),
            b = BinaryLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.BINARY
        }, a._updateXHR = function(a) {
            a.loader.setResponseType("arraybuffer")
        }, createjs.BinaryLoader = createjs.promote(BinaryLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function CSSLoader(a, b) {
            this.AbstractLoader_constructor(a, b, createjs.AbstractLoader.CSS), this.resultFormatter = this._formatResult, this._tagSrcAttribute = "href", b ? this._tag = document.createElement("style") : this._tag = document.createElement("link"), this._tag.rel = "stylesheet", this._tag.type = "text/css"
        }
        var a = createjs.extend(CSSLoader, createjs.AbstractLoader),
            b = CSSLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.CSS
        }, a._formatResult = function(a) {
            if (this._preferXHR) {
                var b = a.getTag();
                if (b.styleSheet) b.styleSheet.cssText = a.getResult(!0);
                else {
                    var c = document.createTextNode(a.getResult(!0));
                    b.appendChild(c)
                }
            } else b = this._tag;
            return createjs.DomUtils.appendToHead(b), b
        }, createjs.CSSLoader = createjs.promote(CSSLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function ImageLoader(a, b) {
            this.AbstractLoader_constructor(a, b, createjs.AbstractLoader.IMAGE), this.resultFormatter = this._formatResult, this._tagSrcAttribute = "src", createjs.RequestUtils.isImageTag(a) ? this._tag = a : createjs.RequestUtils.isImageTag(a.src) ? this._tag = a.src : createjs.RequestUtils.isImageTag(a.tag) && (this._tag = a.tag), null != this._tag ? this._preferXHR = !1 : this._tag = document.createElement("img"), this.on("initialize", this._updateXHR, this)
        }
        var a = createjs.extend(ImageLoader, createjs.AbstractLoader),
            b = ImageLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.IMAGE
        }, a.load = function() {
            if ("" != this._tag.src && this._tag.complete) return void this._sendComplete();
            var a = this._item.crossOrigin;
            1 == a && (a = "Anonymous"), null == a || createjs.RequestUtils.isLocal(this._item.src) || (this._tag.crossOrigin = a), this.AbstractLoader_load()
        }, a._updateXHR = function(a) {
            a.loader.mimeType = "text/plain; charset=x-user-defined-binary", a.loader.setResponseType && a.loader.setResponseType("blob")
        }, a._formatResult = function(a) {
            return this._formatImage
        }, a._formatImage = function(a, b) {
            var c = this._tag,
                d = window.URL || window.webkitURL;
            if (this._preferXHR)
                if (d) {
                    var e = d.createObjectURL(this.getResult(!0));
                    c.src = e, c.addEventListener("load", this._cleanUpURL, !1), c.addEventListener("error", this._cleanUpURL, !1)
                } else c.src = this._item.src;
            else;
            c.complete ? a(c) : (c.onload = createjs.proxy(function() {
                a(this._tag)
            }, this), c.onerror = createjs.proxy(function() {
                b(_this._tag)
            }, this))
        }, a._cleanUpURL = function(a) {
            var b = window.URL || window.webkitURL;
            b.revokeObjectURL(a.target.src)
        }, createjs.ImageLoader = createjs.promote(ImageLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function JavaScriptLoader(a, b) {
            this.AbstractLoader_constructor(a, b, createjs.AbstractLoader.JAVASCRIPT), this.resultFormatter = this._formatResult, this._tagSrcAttribute = "src", this.setTag(document.createElement("script"))
        }
        var a = createjs.extend(JavaScriptLoader, createjs.AbstractLoader),
            b = JavaScriptLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.JAVASCRIPT
        }, a._formatResult = function(a) {
            var b = a.getTag();
            return this._preferXHR && (b.text = a.getResult(!0)), b
        }, createjs.JavaScriptLoader = createjs.promote(JavaScriptLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function JSONLoader(a) {
            this.AbstractLoader_constructor(a, !0, createjs.AbstractLoader.JSON), this.resultFormatter = this._formatResult
        }
        var a = createjs.extend(JSONLoader, createjs.AbstractLoader),
            b = JSONLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.JSON
        }, a._formatResult = function(a) {
            var b = null;
            try {
                b = createjs.DataUtils.parseJSON(a.getResult(!0))
            } catch (c) {
                var d = new createjs.ErrorEvent("JSON_FORMAT", null, c);
                return this._sendError(d), c
            }
            return b
        }, createjs.JSONLoader = createjs.promote(JSONLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function JSONPLoader(a) {
            this.AbstractLoader_constructor(a, !1, createjs.AbstractLoader.JSONP), this.setTag(document.createElement("script")), this.getTag().type = "text/javascript"
        }
        var a = createjs.extend(JSONPLoader, createjs.AbstractLoader),
            b = JSONPLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.JSONP
        }, a.cancel = function() {
            this.AbstractLoader_cancel(), this._dispose()
        }, a.load = function() {
            if (null == this._item.callback) throw new Error("callback is required for loading JSONP requests.");
            if (null != window[this._item.callback]) throw new Error("JSONP callback '" + this._item.callback + "' already exists on window. You need to specify a different callback or re-name the current one.");
            window[this._item.callback] = createjs.proxy(this._handleLoad, this), window.document.body.appendChild(this._tag), this._loadTimeout = setTimeout(createjs.proxy(this._handleTimeout, this), this._item.loadTimeout), this._tag.src = this._item.src
        }, a._handleLoad = function(a) {
            this._result = this._rawResult = a, this._sendComplete(), this._dispose()
        }, a._handleTimeout = function() {
            this._dispose(), this.dispatchEvent(new createjs.ErrorEvent("timeout"))
        }, a._dispose = function() {
            window.document.body.removeChild(this._tag), delete window[this._item.callback], clearTimeout(this._loadTimeout)
        }, createjs.JSONPLoader = createjs.promote(JSONPLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function ManifestLoader(a) {
            this.AbstractLoader_constructor(a, null, createjs.AbstractLoader.MANIFEST), this.plugins = null, this._manifestQueue = null
        }
        var a = createjs.extend(ManifestLoader, createjs.AbstractLoader),
            b = ManifestLoader;
        b.MANIFEST_PROGRESS = .25, b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.MANIFEST
        }, a.load = function() {
            this.AbstractLoader_load()
        }, a._createRequest = function() {
            var a = this._item.callback;
            null != a ? this._request = new createjs.JSONPLoader(this._item) : this._request = new createjs.JSONLoader(this._item)
        }, a.handleEvent = function(a) {
            switch (a.type) {
                case "complete":
                    return this._rawResult = a.target.getResult(!0), this._result = a.target.getResult(), this._sendProgress(b.MANIFEST_PROGRESS), void this._loadManifest(this._result);
                case "progress":
                    return a.loaded *= b.MANIFEST_PROGRESS, this.progress = a.loaded / a.total, (isNaN(this.progress) || this.progress == 1 / 0) && (this.progress = 0), void this._sendProgress(a)
            }
            this.AbstractLoader_handleEvent(a)
        }, a.destroy = function() {
            this.AbstractLoader_destroy(), this._manifestQueue.close()
        }, a._loadManifest = function(a) {
            if (a && a.manifest) {
                var b = this._manifestQueue = new createjs.LoadQueue;
                b.on("fileload", this._handleManifestFileLoad, this), b.on("progress", this._handleManifestProgress, this), b.on("complete", this._handleManifestComplete, this, !0), b.on("error", this._handleManifestError, this, !0);
                for (var c = 0, d = this.plugins.length; d > c; c++) b.installPlugin(this.plugins[c]);
                b.loadManifest(a)
            } else this._sendComplete()
        }, a._handleManifestFileLoad = function(a) {
            a.target = null, this.dispatchEvent(a)
        }, a._handleManifestComplete = function(a) {
            this._loadedItems = this._manifestQueue.getItems(!0), this._sendComplete()
        }, a._handleManifestProgress = function(a) {
            this.progress = a.progress * (1 - b.MANIFEST_PROGRESS) + b.MANIFEST_PROGRESS, this._sendProgress(this.progress)
        }, a._handleManifestError = function(a) {
            var b = new createjs.Event("fileerror");
            b.item = a.data, this.dispatchEvent(b)
        }, createjs.ManifestLoader = createjs.promote(ManifestLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function SoundLoader(a, b) {
            this.AbstractMediaLoader_constructor(a, b, createjs.AbstractLoader.SOUND), createjs.RequestUtils.isAudioTag(a) ? this._tag = a : createjs.RequestUtils.isAudioTag(a.src) ? this._tag = a : createjs.RequestUtils.isAudioTag(a.tag) && (this._tag = createjs.RequestUtils.isAudioTag(a) ? a : a.src), null != this._tag && (this._preferXHR = !1)
        }
        var a = createjs.extend(SoundLoader, createjs.AbstractMediaLoader),
            b = SoundLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.SOUND
        }, a._createTag = function(a) {
            var b = document.createElement("audio");
            return b.autoplay = !1, b.preload = "none", b.src = a, b
        }, createjs.SoundLoader = createjs.promote(SoundLoader, "AbstractMediaLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function VideoLoader(a, b) {
            this.AbstractMediaLoader_constructor(a, b, createjs.AbstractLoader.VIDEO), createjs.RequestUtils.isVideoTag(a) || createjs.RequestUtils.isVideoTag(a.src) ? (this.setTag(createjs.RequestUtils.isVideoTag(a) ? a : a.src), this._preferXHR = !1) : this.setTag(this._createTag())
        }
        var a = createjs.extend(VideoLoader, createjs.AbstractMediaLoader),
            b = VideoLoader;
        a._createTag = function() {
            return document.createElement("video")
        }, b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.VIDEO
        }, createjs.VideoLoader = createjs.promote(VideoLoader, "AbstractMediaLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function SpriteSheetLoader(a, b) {
            this.AbstractLoader_constructor(a, b, createjs.AbstractLoader.SPRITESHEET), this._manifestQueue = null
        }
        var a = createjs.extend(SpriteSheetLoader, createjs.AbstractLoader),
            b = SpriteSheetLoader;
        b.SPRITESHEET_PROGRESS = .25, b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.SPRITESHEET
        }, a.destroy = function() {
            this.AbstractLoader_destroy, this._manifestQueue.close()
        }, a._createRequest = function() {
            var a = this._item.callback;
            null != a ? this._request = new createjs.JSONPLoader(this._item) : this._request = new createjs.JSONLoader(this._item)
        }, a.handleEvent = function(a) {
            switch (a.type) {
                case "complete":
                    return this._rawResult = a.target.getResult(!0), this._result = a.target.getResult(), this._sendProgress(b.SPRITESHEET_PROGRESS), void this._loadManifest(this._result);
                case "progress":
                    return a.loaded *= b.SPRITESHEET_PROGRESS, this.progress = a.loaded / a.total, (isNaN(this.progress) || this.progress == 1 / 0) && (this.progress = 0), void this._sendProgress(a)
            }
            this.AbstractLoader_handleEvent(a)
        }, a._loadManifest = function(a) {
            if (a && a.images) {
                var b = this._manifestQueue = new createjs.LoadQueue(this._preferXHR, this._item.path, this._item.crossOrigin);
                b.on("complete", this._handleManifestComplete, this, !0), b.on("fileload", this._handleManifestFileLoad, this), b.on("progress", this._handleManifestProgress, this), b.on("error", this._handleManifestError, this, !0), b.loadManifest(a.images)
            }
        }, a._handleManifestFileLoad = function(a) {
            var b = a.result;
            if (null != b) {
                var c = this.getResult().images,
                    d = c.indexOf(a.item.src);
                c[d] = b
            }
        }, a._handleManifestComplete = function(a) {
            this._result = new createjs.SpriteSheet(this._result), this._loadedItems = this._manifestQueue.getItems(!0), this._sendComplete()
        }, a._handleManifestProgress = function(a) {
            this.progress = a.progress * (1 - b.SPRITESHEET_PROGRESS) + b.SPRITESHEET_PROGRESS, this._sendProgress(this.progress)
        }, a._handleManifestError = function(a) {
            var b = new createjs.Event("fileerror");
            b.item = a.data, this.dispatchEvent(b)
        }, createjs.SpriteSheetLoader = createjs.promote(SpriteSheetLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function SVGLoader(a, b) {
            this.AbstractLoader_constructor(a, b, createjs.AbstractLoader.SVG), this.resultFormatter = this._formatResult, this._tagSrcAttribute = "data", b ? this.setTag(document.createElement("svg")) : (this.setTag(document.createElement("object")), this.getTag().type = "image/svg+xml")
        }
        var a = createjs.extend(SVGLoader, createjs.AbstractLoader),
            b = SVGLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.SVG
        }, a._formatResult = function(a) {
            var b = createjs.DataUtils.parseXML(a.getResult(!0), "text/xml"),
                c = a.getTag();
            return !this._preferXHR && document.body.contains(c) && document.body.removeChild(c), null != b.documentElement ? (c.appendChild(b.documentElement), c.style.visibility = "visible", c) : b
        }, createjs.SVGLoader = createjs.promote(SVGLoader, "AbstractLoader")
    }(), this.createjs = this.createjs || {},
    function() {
        "use strict";

        function XMLLoader(a) {
            this.AbstractLoader_constructor(a, !0, createjs.AbstractLoader.XML), this.resultFormatter = this._formatResult
        }
        var a = createjs.extend(XMLLoader, createjs.AbstractLoader),
            b = XMLLoader;
        b.canLoadItem = function(a) {
            return a.type == createjs.AbstractLoader.XML
        }, a._formatResult = function(a) {
            return createjs.DataUtils.parseXML(a.getResult(!0), "text/xml")
        }, createjs.XMLLoader = createjs.promote(XMLLoader, "AbstractLoader")
    }();
define.amd.module = "font";
define.amd.shim = "font";
/**

  Font.js v2012.01.25
  (c) Mike "Pomax" Kamermans, 2012
  Licensed under MIT ("expat" flavour) license.
  Hosted on http://github.com/Pomax/Font.js

  This library adds Font objects to the general pool
  of available JavaScript objects, so that you can load
  fonts through a JavaScript object similar to loading
  images through a new Image() object.

  Font.js is compatible with all browsers that support
  <canvas> and Object.defineProperty - This includes
  all versions of Firefox, Chrome, Opera, IE and Safari
  that were 'current' (Firefox 9, Chrome 16, Opera 11.6,
  IE9, Safari 5.1) at the time Font.js was released.

  Font.js will not work on IE8 or below due to the lack
  of Object.defineProperty - I recommend using the
  solution outlined in http://ie6update.com/ for websites
  that are not corporate intranet sites, because as a home
  user you have no excuse not to have upgraded to Internet
  Explorer 9 yet, or simply not using Internet Explorer if
  you're still using Windows XP. If you have friends or
  family that still use IE8 or below: intervene.

  You may remove every line in this header except for
  the first block of four lines, for the purposes of
  saving space and minification. If minification strips
  the header, you'll have to paste that paragraph back in.

  Issue tracker: https://github.com/Pomax/Font.js/issues

**/

(function(window) {

    // 1) Do we have a mechanism for binding implicit get/set?
    if (!Object.defineProperty) {
        throw ("Font.js requires Object.defineProperty, which this browser does not support.");
    }

    // 2) Do we have Canvas2D available?
    if (!document.createElement("canvas").getContext) {
        throw ("Font.js requires <canvas> and the Canvas2D API, which this browser does not support.");
    }

    // Make sure type arrays are available in IE9
    // Code borrowed from pdf.js (https://gist.github.com/1057924)
    (function(window) {
        try {
            var a = new Uint8Array(1);
            return;
        } catch (e) {}

        function subarray(start, end) {
            return this.slice(start, end);
        }

        function set_(array, offset) {
            var i, n = array.length;
            if (arguments.length < 2) {
                offset = 0;
            }
            for (i = 0; i < n; ++i, ++offset) {
                this[offset] = array[i] & 0xFF;
            }
        }

        function TypedArray(arg1) {
            var result, i;
            if (typeof arg1 === "number") {
                result = new Array(arg1);
                for (i = 0; i < arg1; ++i) {
                    result[i] = 0;
                }
            } else {
                result = arg1.slice(0);
            }
            result.subarray = subarray;
            result.buffer = result;
            result.byteLength = result.length;
            result.set = set_;
            if (typeof arg1 === "object" && arg1.buffer) {
                result.buffer = arg1.buffer;
            }
            return result;
        }
        window.Uint8Array = TypedArray;
        window.Uint32Array = TypedArray;
        window.Int32Array = TypedArray;
    }(window));

    // Also make sure XHR understands typing.
    // Code based on pdf.js (https://gist.github.com/1057924)
    (function(window) {
        // shortcut for Opera - it's already fine
        if (window.opera) return;
        // shortcuts for browsers that already implement XHR minetyping
        if ("response" in XMLHttpRequest.prototype ||
            "mozResponseArrayBuffer" in XMLHttpRequest.prototype ||
            "mozResponse" in XMLHttpRequest.prototype ||
            "responseArrayBuffer" in XMLHttpRequest.prototype) {
            return;
        }
        var getter;
        // If we have access to the VBArray (i.e., we're in IE), use that
        if (window.VBArray) {
            getter = function() {
                return new Uint8Array(new VBArray(this.responseBody).toArray());
            }
        }
        // Okay... umm.. untyped arrays? This may break completely.
        // (Android browser 2.3 and 3 don't do typed arrays)
        else {
            getter = function() {
                this.responseBody;
            }
        }
        Object.defineProperty(XMLHttpRequest.prototype, "response", {
            get: getter
        });
    }(window));


    // IE9 does not have binary-to-ascii built in O_O
    if (!window.btoa) {
        // Code borrowed from PHP.js (http://phpjs.org/functions/base64_encode:358)
        window.btoa = function(data) {
            var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
                ac = 0,
                enc = "",
                tmp_arr = [];
            if (!data) {
                return data;
            }
            do { // pack three octets into four hexets
                o1 = data.charCodeAt(i++);
                o2 = data.charCodeAt(i++);
                o3 = data.charCodeAt(i++);
                bits = o1 << 16 | o2 << 8 | o3;
                h1 = bits >> 18 & 0x3f;
                h2 = bits >> 12 & 0x3f;
                h3 = bits >> 6 & 0x3f;
                h4 = bits & 0x3f;
                // use hexets to index into b64, and append result to encoded string
                tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
            } while (i < data.length);
            enc = tmp_arr.join('');
            var r = data.length % 3;
            return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
        };
    }

    /**

      Not-borrowed-code starts here!

     **/
    function Font() {
        // if this is not specified, a random name is used
        this.fontFamily = "fjs" + (999999 * Math.random() | 0);
    }

    // the font resource URL
    Font.prototype.url = "";

    // the font's format ('truetype' for TT-OTF or 'opentype' for CFF-OTF)
    Font.prototype.format = "";

    // the font's byte code
    Font.prototype.data = "";

    // custom font, implementing the letter 'A' as zero-width letter.
    Font.prototype.base64 = "AAEAAAAKAIAAAwAgT1MvMgAAAAAAAACsAAAAWGNtYXAA" +
        "AAAAAAABBAAAACxnbHlmAAAAAAAAATAAAAAQaGVhZAAAA" +
        "AAAAAFAAAAAOGhoZWEAAAAAAAABeAAAACRobXR4AAAAAA" +
        "AAAZwAAAAIbG9jYQAAAAAAAAGkAAAACG1heHAAAAAAAAA" +
        "BrAAAACBuYW1lAAAAAAAAAcwAAAAgcG9zdAAAAAAAAAHs" +
        "AAAAEAAEAAEAZAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
        "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
        "AAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAMAAQA" +
        "AAAwABAAgAAAABAAEAAEAAABB//8AAABB////wAABAAAA" +
        "AAABAAAAAAAAAAAAAAAAMQAAAQAAAAAAAAAAAABfDzz1A" +
        "AAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAEAAg" +
        "AAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAA" +
        "AAAAAAAAAAQAAAAAAAAAAAAAAAAAIAAAAAQAAAAIAAQAB" +
        "AAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAIAHgADAAEEC" +
        "QABAAAAAAADAAEECQACAAIAAAAAAAEAAAAAAAAAAAAAAA" +
        "AAAA==";

    // these metrics represent the font-indicated values,
    // not the values pertaining to text as it is rendered
    // on the page (use fontmetrics.js for this instead).
    Font.prototype.metrics = {
        quadsize: 0,
        leading: 0,
        ascent: 0,
        descent: 0,
        weightclass: 400
    };

    // Will this be a remote font, or a system font?
    Font.prototype.systemfont = false;

    // internal indicator that the font is done loading
    Font.prototype.loaded = false;

    /**
     * This function gets called once the font is done
     * loading, its metrics have been determined, and it
     * has been parsed for use on-page. By default, this
     * function does nothing, and users can bind their
     * own handler function.
     */
    Font.prototype.onload = function() {};

    /**
     * This function gets called when there is a problem
     * loading the font.
     */
    Font.prototype.onerror = function() {};

    // preassigned quad × quad context, for measurements
    Font.prototype.canvas = false;
    Font.prototype.context = false;

    /**
     * validation function to see if the zero-width styled
     * text is no longer zero-width. If this is true, the
     * font is properly done loading. If this is false, the
     * function calls itself via a timeout
     */
    Font.prototype.validate = function(target, zero, mark, font, timeout) {
        if (timeout !== false && timeout < 0) {
            this.onerror("Requested system font '" + this.fontFamily + "' could not be loaded (it may not be installed).");
            return;
        }

        var computedStyle = document.defaultView.getComputedStyle(target, '');
        var width = computedStyle.getPropertyValue("width").replace("px", '');
        // font has finished loading - remove the zero-width and
        // validation paragraph, but leave the actual font stylesheet (mark);
        if (width > 0) {
            document.head.removeChild(zero);
            document.body.removeChild(target);
            this.loaded = true;
            this.onload();
            this.canvas.width = 10;
            this.canvas.height = 10;
            delete(this.canvas);
            delete(this.context);

        }
        // font has not finished loading - wait 50ms and try again
        else {
            setTimeout(function() {
                font.validate(target, zero, mark, font, timeout === false ? false : timeout - 50);
            }, 50);
        }
    };

    /**
     * This gets called when the file is done downloading.
     */
    Font.prototype.ondownloaded = function() {
        var instance = this;

        // decimal to character
        var chr = function(val) {
            return String.fromCharCode(val);
        };

        // decimal to ushort
        var chr16 = function(val) {
            if (val < 256) {
                return chr(0) + chr(val);
            }
            var b1 = val >> 8;
            var b2 = val & 0xFF;
            return chr(b1) + chr(b2);
        };

        // decimal to hexadecimal
        // See http://phpjs.org/functions/dechex:382
        var dechex = function(val) {
            if (val < 0) {
                val = 0xFFFFFFFF + val + 1;
            }
            return parseInt(val, 10).toString(16);
        };

        // unsigned short to decimal
        var ushort = function(b1, b2) {
            return 256 * b1 + b2;
        };

        // signed short to decimal
        var fword = function(b1, b2) {
            var negative = b1 >> 7 === 1,
                val;
            b1 = b1 & 0x7F;
            val = 256 * b1 + b2;
            // positive numbers are already done
            if (!negative) {
                return val;
            }
            // negative numbers need the two's complement treatment
            return val - 0x8000;
        };

        // unsigned long to decimal
        var ulong = function(b1, b2, b3, b4) {
            return 16777216 * b1 + 65536 * b2 + 256 * b3 + b4;
        };

        // unified error handling
        var error = function(msg) {
            instance.onerror(msg);
        };

        // we know about TTF (0x00010000) and CFF ('OTTO') fonts
        var ttf = chr(0) + chr(1) + chr(0) + chr(0);
        var cff = "OTTO";

        // so what kind of font is this?
        var data = this.data;
        var version = chr(data[0]) + chr(data[1]) + chr(data[2]) + chr(data[3]);
        var isTTF = (version === ttf);
        var isCFF = (isTTF ? false : version === cff);
        if (isTTF) {
            this.format = "truetype";
        } else if (isCFF) {
            this.format = "opentype";
        }
        // terminal error: stop running code
        else {
            error("Error: file at " + this.url + " cannot be interpreted as OpenType font.");
            return;
        }

        // ================================================================
        // if we get here, this is a legal font. Extract some font metrics,
        // and then wait for the font to be available for on-page styling.
        // ================================================================

        // first, we parse the SFNT header data
        var numTables = ushort(data[4], data[5]),
            tagStart = 12,
            ptr, end = tagStart + 16 * numTables,
            tags = {},
            tag;
        for (ptr = tagStart; ptr < end; ptr += 16) {
            tag = chr(data[ptr]) + chr(data[ptr + 1]) + chr(data[ptr + 2]) + chr(data[ptr + 3]);
            tags[tag] = {
                name: tag,
                checksum: ulong(data[ptr + 4], data[ptr + 5], data[ptr + 6], data[ptr + 7]),
                offset: ulong(data[ptr + 8], data[ptr + 9], data[ptr + 10], data[ptr + 11]),
                length: ulong(data[ptr + 12], data[ptr + 13], data[ptr + 14], data[ptr + 15])
            };
        }

        // first we define a quick error shortcut function:
        var checkTableError = function(tag) {
            if (!tags[tag]) {
                error("Error: font is missing the required OpenType '" + tag + "' table.");
                // return false, so that the result of this function can be used to stop running code
                return false;
            }
            return tag;
        };

        // Then we access the HEAD table for the "font units per EM" value.
        tag = checkTableError("head");
        if (tag === false) {
            return;
        }
        ptr = tags[tag].offset;
        tags[tag].version = "" + data[ptr] + data[ptr + 1] + data[ptr + 2] + data[ptr + 3];
        var unitsPerEm = ushort(data[ptr + 18], data[ptr + 19]);
        this.metrics.quadsize = unitsPerEm;

        // We follow up by checking the HHEA table for ascent, descent, and leading values.
        tag = checkTableError("hhea");
        if (tag === false) {
            return;
        }
        ptr = tags[tag].offset;
        tags[tag].version = "" + data[ptr] + data[ptr + 1] + data[ptr + 2] + data[ptr + 3];
        this.metrics.ascent = fword(data[ptr + 4], data[ptr + 5]) / unitsPerEm;
        this.metrics.descent = fword(data[ptr + 6], data[ptr + 7]) / unitsPerEm;
        this.metrics.leading = fword(data[ptr + 8], data[ptr + 9]) / unitsPerEm;

        // And then finally we check the OS/2 table for the font-indicated weight class.
        tag = checkTableError("OS/2");
        if (tag === false) {
            return;
        }
        ptr = tags[tag].offset;
        tags[tag].version = "" + data[ptr] + data[ptr + 1];
        this.metrics.weightclass = ushort(data[ptr + 4], data[ptr + 5]);

        // ==================================================================
        // Then the mechanism for determining whether the font is not
        // just done downloading, but also fully parsed and ready for
        // use on the page for typesetting: we pick a letter that we know
        // is supported by the font, and generate a font that implements
        // only that letter, as a zero-width glyph. We can then test
        // whether the font is available by checking whether a paragraph
        // consisting of just that letter, styled with "desiredfont, zwfont"
        // has zero width, or a real width. As long as it's zero width, the
        // font has not finished loading yet.
        // ==================================================================

        // To find a letter, we must consult the character map ("cmap") table
        tag = checkTableError("cmap");
        if (tag === false) {
            return;
        }
        ptr = tags[tag].offset;
        tags[tag].version = "" + data[ptr] + data[ptr + 1];
        numTables = ushort(data[ptr + 2], data[ptr + 3]);

        // For the moment, we only look for windows/unicode records, with
        // a cmap subtable format 4 because OTS (the sanitiser used in
        // Chrome and Firefox) does not actually support anything else
        // at the moment.
        //
        // When http://code.google.com/p/chromium/issues/detail?id=110175
        // is resolved, remember to stab me to add support for the other
        // maps, too.
        //
        var encodingRecord, rptr, platformID, encodingID, offset, cmap314 = false;
        for (var encodingRecord = 0; encodingRecord < numTables; encodingRecord++) {
            rptr = ptr + 4 + encodingRecord * 8;
            platformID = ushort(data[rptr], data[rptr + 1]);
            encodingID = ushort(data[rptr + 2], data[rptr + 3]);
            offset = ulong(data[rptr + 4], data[rptr + 5], data[rptr + 6], data[rptr + 7]);
            if (platformID === 3 && encodingID === 1) {
                cmap314 = offset;
            }
        }

        // This is our fallback font - a minimal font that implements
        // the letter "A". We can transform this font to implementing
        // any character between 0x0000 and 0xFFFF by altering a
        // handful of letters.
        var printChar = "A";

        // Now, if we found a format 4 {windows/unicode} cmap subtable,
        // we can find a suitable glyph and modify the 'base64' content.
        if (cmap314 !== false) {
            ptr += cmap314;
            version = ushort(data[ptr], data[ptr + 1]);
            if (version === 4) {
                // First find the number of segments in this map
                var segCount = ushort(data[ptr + 6], data[ptr + 7]) / 2;

                // Then, find the segment end characters. We'll use
                // whichever of those isn't a whitespace character
                // for our verification font, which we check based
                // on the list of Unicode 6.0 whitespace code points:
                var printable = function(chr) {
                    return [0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0,
                        0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
                        0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F,
                        0x205F, 0x3000
                    ].indexOf(chr) === -1;
                }

                // Loop through the segments in search of a usable character code:
                var i = ptr + 14,
                    e = ptr + 14 + 2 * segCount,
                    endChar = false;
                for (; i < e; i += 2) {
                    endChar = ushort(data[i], data[i + 1]);
                    if (printable(endChar)) {
                        break;
                    }
                    endChar = false;
                }

                if (endChar !== false) {
                    // We now have a printable character to validate with!
                    // We need to make sure to encode the correct "idDelta"
                    // value for this character, because our "glyph" will
                    // always be at index 1 (index 0 is reserved for .notdef).
                    // As such, we need to set up a delta value such that:
                    //
                    //   [character code] + [delta value] == 1
                    //
                    printChar = String.fromCharCode(endChar);
                    var delta = -(endChar - 1) + 65536;

                    // Now we need to substitute the values in our
                    // base64 font template. The CMAP modification
                    // consists of generating a new base64 string
                    // for the bit that indicates the encoded char.
                    // In our 'A'-encoding font, this is:
                    //
                    //   0x00 0x41 0xFF 0xFF 0x00 0x00
                    //   0x00 0x41 0xFF 0xFF 0xFF 0xC0
                    //
                    // which is the 20 letter base64 string at [380]:
                    //
                    //   AABB//8AAABB////wAAB
                    //
                    // We replace this with our new character:
                    //
                    //   [hexchar] 0xFF 0xFF 0x00 0x00
                    //   [hexchar] 0xFF 0xFF [ delta ]
                    //
                    // Note: in order to do so properly, we need to
                    // make sure that the bytes are base64 aligned, so
                    // we have to add a leading 0x00:
                    var newhex = btoa(chr(0) + // base64 padding byte
                        chr16(endChar) + chr16(0xFFFF) + // "endCount" array
                        chr16(0) + // cmap required padding
                        chr16(endChar) + chr16(0xFFFF) + // "startCount" array
                        chr16(delta) + // delta value
                        chr16(1)); // delta terminator

                    // And now we replace the text in 'base64' at
                    // position 380 with this new base64 string:
                    this.base64 = this.base64.substring(0, 380) + newhex +
                        this.base64.substring(380 + newhex.length);
                }
            }
        }

        this.bootstrapValidation(printChar, false);
    }

    Font.prototype.bootstrapValidation = function(printChar, timeout) {
        // Create a stylesheet for using the zero-width font:
        var tfName = this.fontFamily + " testfont";
        var zerowidth = document.createElement("style");
        zerowidth.setAttribute("type", "text/css");
        zerowidth.innerHTML = "@font-face {\n" +
            "  font-family: '" + tfName + "';\n" +
            "  src: url('data:application/x-font-ttf;base64," + this.base64 + "')\n" +
            "       format('truetype');}";
        document.head.appendChild(zerowidth);

        // Create a validation stylesheet for the requested font, if it's a remote font:
        var realfont = false;
        if (!this.systemfont) {
            realfont = this.toStyleNode();
            document.head.appendChild(realfont);
        }

        // Create a validation paragraph, consisting of the zero-width character
        var para = document.createElement("p");
        para.style.cssText = "position: absolute; top: 0; left: 0; opacity: 0;";
        para.style.fontFamily = "'" + this.fontFamily + "', '" + tfName + "'";
        para.innerHTML = printChar + printChar + printChar + printChar + printChar +
            printChar + printChar + printChar + printChar + printChar;
        document.body.appendChild(para);

        // Quasi-error: if there is no getComputedStyle, claim loading is done.
        if (!document.defaultView.getComputedStyle) {
            this.onload();
            this.canvas.width = 10;
            this.canvas.height = 10;
            delete(this.canvas);
            delete(this.context);

            error("Error: document.defaultView.getComputedStyle is not supported by this browser.\n" +
                "Consequently, Font.onload() cannot be trusted.");
        }

        // If there is getComputedStyle, we do proper load completion verification.
        else {
            // If this is a remote font, we rely on the indicated quad size
            // for measurements. If it's a system font there will be no known
            // quad size, so we simply fix it at 1000 pixels.
            var quad = this.systemfont ? 1000 : this.metrics.quadsize;

            // Because we need to 'preload' a canvas with this
            // font, we have no idea how much surface area
            // we'll need for text measurements later on. So
            // be safe, we assign a surface that is quad² big,
            // and then when measureText is called, we'll
            // actually build a quick <span> to see how much
            // of that surface we don't need to look at.
            this.canvas = document.createElement("canvas");
            this.canvas.width = quad;
            this.canvas.height = quad;
            //this.canvas = canvas;

            // The reason we preload is because some browsers
            // will also take a few milliseconds to assign a font
            // to a Canvas2D context, so if measureText is called
            // later, without this preloaded context, there is no
            // time for JavaScript to "pause" long enough for the
            // context to properly load the font, and metrics may
            // be completely wrong. The solution is normally to
            // add in a setTimeout call, to give the browser a bit
            // of a breather, but then we can't do synchronous
            // data returns, and we need a callback just to get
            // string metrics, which is about as far from desired
            // as is possible.
            this.context = this.canvas.getContext("2d");
            this.context.font = "1em '" + this.fontFamily + "'";
            this.context.fillStyle = "white";
            this.context.fillRect(-1, -1, quad + 2, quad + 2);
            this.context.fillStyle = "black";
            this.context.fillText("test text", 50, quad / 2);
            //this.context = context;

            // ===================================================
            // Thanks to Opera and Firefox, we need to add in more
            // "you can do your thing, browser" moments. If we
            // call validate() as a straight function call, the
            // browser doesn't get the breathing space to perform
            // page styling. This is a bit mad, but until there's
            // a JS function for "make the browser update the page
            // RIGHT NOW", we're stuck with this.
            // ===================================================

            // We need to alias "this" because the keyword "this"
            // becomes the global context after the timeout.
            var local = this;
            var delayedValidate = function() {
                local.validate(para, zerowidth, realfont, local, timeout);
            };
            setTimeout(delayedValidate, 50);
        }
    };

    /**
     * We take a different path for System fonts, because
     * we cannot inspect the actual byte code.
     */
    Font.prototype.processSystemFont = function() {
        // Mark system font use-case
        this.systemfont = true;
        // There are font-declared metrics to work with.
        this.metrics = false;
        // However, we do need to check whether the font
        // is actually installed.
        this.bootstrapValidation("A", 1000);
    }

    /**
     * This gets called when font.src is set, (the binding
     * for which is at the end of this file).
     */
    Font.prototype.loadFont = function() {
        var font = this;

        // System font?
        if (this.url.indexOf(".") === -1) {
            setTimeout(function() {
                font.processSystemFont();
            }, 10);
            return;
        }

        // Remote font.
        var xhr = new XMLHttpRequest();
        xhr.open('GET', font.url, true);
        xhr.responseType = "arraybuffer";
        xhr.onload = function(evt) {
            var arrayBuffer = xhr.response;
            if (arrayBuffer) {
                font.data = new Uint8Array(arrayBuffer);
                font.ondownloaded();
            } else {
                font.onerror("Error downloading font resource from " + font.url);
            }
        };
        xhr.send(null);
    };

    // The stylenode can be added to the document head
    // to make the font available for on-page styling,
    // but it should be requested with .toStyleNode()
    Font.prototype.styleNode = false;

    /**
     * Get the DOM node associated with this Font
     * object, for page-injection.
     */
    Font.prototype.toStyleNode = function() {
        // If we already built it, pass that reference.
        if (this.styleNode) {
            return this.styleNode;
        }
        // If not, build a style element
        this.styleNode = document.createElement("style");
        this.styleNode.type = "text/css";
        var styletext = "@font-face {\n";
        styletext += "  font-family: '" + this.fontFamily + "';\n";
        styletext += "  src: url('" + this.url + "') format('" + this.format + "');\n";
        styletext += "}";
        this.styleNode.innerHTML = styletext;
        return this.styleNode;
    }

    /**
     * Measure a specific string of text, given this font.
     * If the text is too wide for our preallocated canvas,
     * it will be chopped up and the segments measured
     * separately.
     */
    Font.prototype.measureText = function(textString, fontSize) {
        // error shortcut
        if (!this.loaded) {
            error("measureText() was called while the font was not yet loaded");
            return false;
        }

        // Set up the right font size.
        this.context.font = fontSize + "px '" + this.fontFamily + "'";

        // Get the initial string width through our preloaded Canvas2D context
        var metrics = this.context.measureText(textString);

        // Assign the remaining default values, because the
        // TextMetrics object is horribly deficient.
        metrics.fontsize = fontSize;
        metrics.ascent = 0;
        metrics.descent = 0;
        metrics.bounds = {
            minx: 0,
            maxx: metrics.width,
            miny: 0,
            maxy: 0
        };
        metrics.height = 0;

        // Does the text fit on the canvas? If not, we have to
        // chop it up and measure each segment separately.
        var segments = [],
            minSegments = metrics.width / this.metrics.quadsize;
        if (minSegments <= 1) {
            segments.push(textString);
        } else {
            // TODO: add the chopping code here. For now this
            // code acts as placeholder
            segments.push(textString);
        }

        // run through all segments, updating the metrics as we go.
        var segmentLength = segments.length,
            i;
        for (i = 0; i < segmentLength; i++) {
            this.measureSegment(segments[i], fontSize, metrics);
        }
        return metrics;
    };

    /**
     * Measure a section of text, given this font, that is
     * guaranteed to fit on our preallocated canvas.
     */
    Font.prototype.measureSegment = function(textSegment, fontSize, metrics) {
        // Shortcut function for getting computed CSS values
        var getCSSValue = function(element, property) {
            return document.defaultView.getComputedStyle(element, null).getPropertyValue(property);
        };

        // We are going to be using you ALL over the place, little variable.
        var i;

        // For text leading values, we measure a multiline
        // text container as built by the browser.
        var leadDiv = document.createElement("div");
        leadDiv.style.position = "absolute";
        leadDiv.style.opacity = 0;
        leadDiv.style.font = fontSize + "px '" + this.fontFamily + "'";
        var numLines = 10;
        leadDiv.innerHTML = textSegment;
        for (i = 1; i < numLines; i++) {
            leadDiv.innerHTML += "<br/>" + textSegment;
        }
        document.body.appendChild(leadDiv);

        // First we guess at the leading value, using the standard TeX ratio.
        metrics.leading = 1.2 * fontSize;

        // We then try to get the real value based on how
        // the browser renders the text.
        var leadDivHeight = getCSSValue(leadDiv, "height");
        leadDivHeight = leadDivHeight.replace("px", "");
        if (leadDivHeight >= fontSize * numLines) {
            metrics.leading = (leadDivHeight / numLines) | 0;
        }
        document.body.removeChild(leadDiv);

        // If we're not with a white-space-only string,
        // this is all we will be able to do.
        if (/^\s*$/.test(textSegment)) {
            return metrics;
        }

        // If we're not, let's try some more things.
        var canvas = this.canvas,
            ctx = this.context,
            quad = this.systemfont ? 1000 : this.metrics.quadsize,
            w = quad,
            h = quad,
            baseline = quad / 2,
            padding = 50,
            xpos = (quad - metrics.width) / 2;

        // SUPER IMPORTANT, HARDCORE NECESSARY STEP:
        // xpos may be a fractional number at this point, and
        // that will *complete* screw up line scanning, because
        // cropping a canvas on fractional coordiantes does
        // really funky edge interpolation. As such, we force
        // it to an integer.
        if (xpos !== (xpos | 0)) {
            xpos = xpos | 0;
        }

        // Set all canvas pixeldata values to 255, with all the content
        // data being 0. This lets us scan for data[i] != 255.
        ctx.fillStyle = "white";
        ctx.fillRect(-padding, -padding, w + 2 * padding, h + 2 * padding);
        // Then render the text centered on the canvas surface.
        ctx.fillStyle = "black";
        ctx.fillText(textSegment, xpos, baseline);

        // Rather than getting all four million+ subpixels, we
        // instead get a (much smaller) subset that we know
        // contains our text. Canvas pixel data is w*4 by h*4,
        // because {R,G,B,A} is stored as separate channels in
        // the array. Hence the factor 4.
        var scanwidth = (metrics.width + padding) | 0,
            scanheight = 4 * fontSize,
            x_offset = xpos - padding / 2,
            y_offset = baseline - scanheight / 2,
            pixelData = ctx.getImageData(x_offset, y_offset, scanwidth, scanheight).data;

        // Set up our scanline variables
        var i = 0,
            j = 0,
            w4 = scanwidth * 4,
            len = pixelData.length,
            mid = scanheight / 2;

        // Scan 1: find the ascent using a normal, forward scan
        while (++i < len && pixelData[i] === 255) {}
        var ascent = (i / w4) | 0;

        // Scan 2: find the descent using a reverse scan
        i = len - 1;
        while (--i > 0 && pixelData[i] === 255) {}
        var descent = (i / w4) | 0;

        // Scan 3: find the min-x value, using a forward column scan
        for (i = 0, j = 0; j < scanwidth && pixelData[i] === 255;) {
            i += w4;
            if (i >= len) {
                j++;
                i = (i - len) + 4;
            }
        }
        var minx = j;

        // Scan 3: find the max-x value, using a reverse column scan
        var step = 1;
        for (i = len - 3, j = 0; j < scanwidth && pixelData[i] === 255;) {
            i -= w4;
            if (i < 0) {
                j++;
                i = (len - 3) - (step++) * 4;
            }
        }
        var maxx = scanwidth - j;

        // We have all our metrics now, so fill in the
        // metrics object and return it to the user.
        metrics.ascent = (mid - ascent);
        metrics.descent = (descent - mid);
        metrics.bounds = {
            minx: minx - (padding / 2),
            maxx: maxx - (padding / 2),
            miny: -metrics.descent,
            maxy: metrics.ascent
        };
        metrics.height = 1 + (descent - ascent);
        return metrics;
    };

    /**
     * we want Font to do the same thing Image does when
     * we set the "src" property value, so we use the
     * Object.defineProperty function to bind a setter
     * that does more than just bind values.
     */
    Object.defineProperty(Font.prototype, "src", {
        set: function(url) {
            this.url = url;
            this.loadFont();
        }
    });


    /**
     * Bind to global scope
     */
    window.font = {};

    window.font.Font = Font;

}(window));
define(function() {});
define("clientkernelLoader", ["clientkernelLoaderApi", "clientkernelLoaderApiPlugins", "clientkernelEventbusApi", "clientkernelModulesApi", "preloadjs", "font"],
    function(clientkernelLoaderApi, clientkernelLoaderApiPlugins, clientkernelEventbusApi, clientkernelModulesApi, preloadjs, font) {
        "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 clientkernelLoader == 'undefined') {
            var clientkernelLoader = {};
        };
        clientkernelLoader.Activator = function() {};
        clientkernelLoader.Activator = ck_implements(clientkernelLoader.Activator, clientkernelModulesApi.IModuleActivator);
        clientkernelLoader.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        clientkernelLoader.Activator.__name__ = ["clientkernelLoader", "Activator"];
        clientkernelLoader.Activator.prototype.start = function(context) {
            var lc = new clientkernelLoader.LoaderContext(context);
            lc.initialize();
        };
        clientkernelLoader.Activator.prototype.stop = function(context) {};
        clientkernelLoader.Activator.main = function() {};
        clientkernelLoader.Activator.prototype.__class__ = clientkernelLoader.Activator;
        clientkernelLoader.LoaderConfiguration = function(lc) {
            this.lc = lc;
            this.sections = [];
            this.plugins = new _hcmn_.haxe_ds_StringMap();
        };
        clientkernelLoader.LoaderConfiguration.__name__ = ["clientkernelLoader", "LoaderConfiguration"];
        clientkernelLoader.LoaderConfiguration.prototype.sections = null;
        clientkernelLoader.LoaderConfiguration.prototype.plugins = null;
        clientkernelLoader.LoaderConfiguration.prototype.lc = null;
        clientkernelLoader.LoaderConfiguration.prototype.registerPlugin = function(plugin) {
            var key = plugin.getSection();
            this.plugins.set(key, plugin);
            if (ck_instanceof(plugin, clientkernelLoaderApiPlugins.ILoader)) {
                var x = ck_cast(plugin, clientkernelLoaderApiPlugins.ILoader);
                this.lc.installLoader(x);
            }
            this.resolvePendingSections();
        };
        clientkernelLoader.LoaderConfiguration.prototype.load = function(config) {
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(config);
            while (_g < _g1.length) {
                var field = _g1[_g];
                ++_g;
                this.sections.push({
                    id: field,
                    content: _hcmn_.Reflect.field(config, field)
                });
            }
            this.resolvePendingSections();
        };
        clientkernelLoader.LoaderConfiguration.prototype.resolvePendingSections = function() {
            while (this.sections.length != 0)
                if (this.plugins.exists(this.sections[0].id)) {
                    this.plugins.get(this.sections[0].id).resolve(this.lc, this.sections[0].content);
                    this.sections.splice(0, 1);
                } else return;
        };
        clientkernelLoader.LoaderConfiguration.prototype.__class__ = clientkernelLoader.LoaderConfiguration;
        clientkernelLoader.Asset = function(parent, id, url, type, onrequest) {
            this.parent = parent;
            this.id = id;
            this.url = url;
            this.type = type;
            this.content = null;
            this.loaded = false;
            this.onrequest = onrequest;
            this.promisses = [];
            this.loadedSize = 0;
            this.totalSize = 0;
        };
        clientkernelLoader.Asset = ck_implements(clientkernelLoader.Asset, clientkernelLoaderApiPlugins.IAssetAccess);
        clientkernelLoader.Asset = ck_implements(clientkernelLoader.Asset, clientkernelLoaderApi.IAsset);
        clientkernelLoader.Asset.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetAccess, clientkernelLoaderApi.IAsset];
        clientkernelLoader.Asset.__name__ = ["clientkernelLoader", "Asset"];
        clientkernelLoader.Asset.prototype.id = null;
        clientkernelLoader.Asset.prototype.url = null;
        clientkernelLoader.Asset.prototype.type = null;
        clientkernelLoader.Asset.prototype.content = null;
        clientkernelLoader.Asset.prototype.loaded = null;
        clientkernelLoader.Asset.prototype.onrequest = null;
        clientkernelLoader.Asset.prototype.promisses = null;
        clientkernelLoader.Asset.prototype.parent = null;
        clientkernelLoader.Asset.prototype.loadedSize = null;
        clientkernelLoader.Asset.prototype.totalSize = null;
        clientkernelLoader.Asset.prototype.setup = function(url, type, onrequest) {
            this.url = url;
            this.type = type;
            this.loaded = false;
            this.onrequest = onrequest;
        };
        clientkernelLoader.Asset.prototype.setContent = function(content) {
            this.content = content;
            this.loaded = true;
            var _g = 0;
            var _g1 = this.promisses;
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                i(this.content);
            }
            this.parent.triggerAssetLoaded(this);
            if (this.totalSize != 0) {
                this.parent.updateProgress(this.totalSize - this.loadedSize, 1, 0, 0);
                this.loadedSize = this.totalSize;
            }
        };
        clientkernelLoader.Asset.prototype.isLoaded = function() {
            return this.loaded;
        };
        clientkernelLoader.Asset.prototype.getId = function() {
            return this.id;
        };
        clientkernelLoader.Asset.prototype.getType = function() {
            return this.type;
        };
        clientkernelLoader.Asset.prototype.getUrl = function() {
            return this.url;
        };
        clientkernelLoader.Asset.prototype.getContent = function() {
            var _g = this;
            return new Promise(function(resolve, reject) {
                if (_g.isLoaded()) resolve(_g.content);
                else {
                    if (_g.onrequest != null) {
                        _g.onrequest();
                        _g.onrequest = null;
                    }
                    _g.promisses.push(resolve);
                }
            });
        };
        clientkernelLoader.Asset.prototype.setProgress = function(loadedBytes, ofSize) {
            if (this.totalSize == 0 && ofSize == 0) return;
            var deltaSize = ofSize - this.totalSize;
            var deltaCount = 0;
            if (ofSize == 0) deltaCount = -1;
            if (this.totalSize == 0) deltaCount = 1;
            if (loadedBytes > ofSize) loadedBytes = ofSize;
            var deltaLoaded = loadedBytes - this.loadedSize;
            this.totalSize = ofSize;
            this.loadedSize = loadedBytes;
        };
        clientkernelLoader.Asset.prototype.add = function(id, url, type, onrequest) {
            return this.parent.add(this.id + "/" + id, url, type, onrequest);
        };
        clientkernelLoader.Asset.prototype.getAllContent = function() {
            return this.parent.getSubContent(this.id);
        };
        clientkernelLoader.Asset.prototype.getChildAsset = function(id) {
            return this.parent.getAsset(this.id + "/" + id);
        };
        clientkernelLoader.Asset.prototype.__class__ = clientkernelLoader.Asset;
        clientkernelLoader.AssetGroup = function(parent, id, asset) {
            this.parent = parent;
            if (asset != null) {
                this.asset = asset;
                this.group = null;
            } else {
                this.asset = new clientkernelLoader.Asset(parent, id);
                this.group = new _hcmn_.haxe_ds_StringMap();
            }
        };
        clientkernelLoader.AssetGroup.__name__ = ["clientkernelLoader", "AssetGroup"];
        clientkernelLoader.AssetGroup.prototype.asset = null;
        clientkernelLoader.AssetGroup.prototype.group = null;
        clientkernelLoader.AssetGroup.prototype.parent = null;
        clientkernelLoader.AssetGroup.prototype.createGroup = function() {
            this.group = new _hcmn_.haxe_ds_StringMap();
        };
        clientkernelLoader.AssetGroup.prototype.getAsset = function() {
            return this.asset;
        };
        clientkernelLoader.AssetGroup.prototype.ids = function() {
            if (this.group != null) {
                var ret = [];
                var $it0 = this.group.keys();
                while ($it0.hasNext()) {
                    var i = $it0.next();
                    ret.push(this.asset.getId() + "/" + i);
                }
                return ret;
            } else return [];
        };
        clientkernelLoader.AssetGroup.prototype.exists = function(id) {
            var g = this.locateGroup(id);
            if (g == null) return false;
            var key = this.simpleId(id);
            if (_hcmn_.__map_reserved[key] != null) return g.existsReserved(key);
            else return g.h.hasOwnProperty(key);
        };
        clientkernelLoader.AssetGroup.prototype.get = function(id, auto) {
            if (auto == null) auto = false;
            var this1 = this.locateGroup(id, auto);
            var key = this.simpleId(id);
            return this1.get(key);
        };
        clientkernelLoader.AssetGroup.prototype.add = function(id, asset) {
            var this1 = this.locateGroup(id, true);
            var key = this.simpleId(id);
            var value = new clientkernelLoader.AssetGroup(this.parent, null, asset);
            this1.set(key, value);
        };
        clientkernelLoader.AssetGroup.prototype.remove = function(id) {
            var this1 = this.locateGroup(id);
            var key = this.simpleId(id);
            this1.remove(key);
        };
        clientkernelLoader.AssetGroup.prototype.simpleId = function(id) {
            if (id.indexOf("/") == -1) return id;
            else return id.substring(id.lastIndexOf("/") + 1);
        };
        clientkernelLoader.AssetGroup.prototype.locateGroup = function(id, auto) {
            if (auto == null) auto = false;
            var ret = this.group;
            var ids = id.split("/");
            ids.pop();
            var myid = ids.join("/");
            while (ids.length > 0) {
                if (!ret.exists(ids[0])) {
                    var value = new clientkernelLoader.AssetGroup(this.parent);
                    ret.set(ids[0], value);
                }
                if (ret.get(ids[0]).group == null && auto) ret.get(ids[0]).createGroup();
                ret = ret.get(ids[0]).group;
                ids.splice(0, 1);
            }
            return ret;
        };
        clientkernelLoader.AssetGroup.prototype.__class__ = clientkernelLoader.AssetGroup;
        clientkernelLoader.Assets = function() {
            this.loadedCount = 0;
            this.group = new clientkernelLoader.AssetGroup(this, "");
            this.totalItems = -1;
            this.sizeLoaded = 0;
            this.loadedTopic = new clientkernelLoaderApi.AssetLoadedTopic();
            this.progressTopic = new clientkernelLoaderApi.LoadProgressTopic();
            this.earlyRequests = [];
        };
        clientkernelLoader.Assets = ck_implements(clientkernelLoader.Assets, clientkernelModulesApi.IService);
        clientkernelLoader.Assets = ck_implements(clientkernelLoader.Assets, clientkernelLoaderApiPlugins.IAssetRegistryAccess);
        clientkernelLoader.Assets = ck_implements(clientkernelLoader.Assets, clientkernelLoaderApi.IAssetRegistry);
        clientkernelLoader.Assets.__interfaces__ = [clientkernelModulesApi.IService, clientkernelLoaderApiPlugins.IAssetRegistryAccess, clientkernelLoaderApi.IAssetRegistry];
        clientkernelLoader.Assets.__name__ = ["clientkernelLoader", "Assets"];
        clientkernelLoader.Assets.prototype.group = null;
        clientkernelLoader.Assets.prototype.totalItems = null;
        clientkernelLoader.Assets.prototype.sizeLoaded = null;
        clientkernelLoader.Assets.prototype.channel = null;
        clientkernelLoader.Assets.prototype.pfKernelChannel = null;
        clientkernelLoader.Assets.prototype.loadedTopic = null;
        clientkernelLoader.Assets.prototype.progressTopic = null;
        clientkernelLoader.Assets.prototype.loadedCount = null;
        clientkernelLoader.Assets.prototype.earlyRequests = null;
        clientkernelLoader.Assets.prototype.connect = function(channel, pfKernelChannel) {
            this.channel = channel;
            this.pfKernelChannel = pfKernelChannel;
            this.loadedTopic.connect(channel);
            this.progressTopic.connect(pfKernelChannel);
        };
        clientkernelLoader.Assets.prototype.add = function(id, url, type, onrequest) {
            if (this.group.exists(id)) {
                var a = this.group.get(id).getAsset();
                a.setup(url, type, onrequest);
                return a;
            } else if (this.group.exists(this.simpleId(id)) && this.isRequestedEarly(id)) {
                var a1 = this.group.get(this.simpleId(id)).getAsset();
                a1.setup(url, type, onrequest);
                var asset = new clientkernelLoader.Asset(this, id, url, type, onrequest);
                this.group.add(id, asset);
                return a1;
            } else {
                var asset1 = new clientkernelLoader.Asset(this, id, url, type, onrequest);
                this.group.add(id, asset1);
                if (id != this.simpleId(id)) this.group.add(this.simpleId(id), asset1);
                return asset1;
            }
        };
        clientkernelLoader.Assets.prototype.isRequestedEarly = function(id) {
            return _hcmn_.HxOverrides.indexOf(this.earlyRequests, id, 0) >= 0 || (function($this) {
                var $r;
                var x = $this.simpleId(id);
                $r = _hcmn_.HxOverrides.indexOf($this.earlyRequests, x, 0);
                return $r;
            }(this)) >= 0;
        };
        clientkernelLoader.Assets.prototype.simpleId = function(id) {
            if (id.indexOf("/") == -1) return id;
            else return id.substring(id.lastIndexOf("/") + 1);
        };
        clientkernelLoader.Assets.prototype.remove = function(id) {
            this.group.remove(id);
        };
        clientkernelLoader.Assets.prototype.getAsset = function(id) {
            if (this.group.get(id, true) != null) return this.group.get(id).getAsset();
            else {
                var asset = new clientkernelLoader.Asset(this, id);
                this.group.add(id, asset);
                this.earlyRequests.push(id);
                if (id != this.simpleId(id)) {
                    this.group.add(this.simpleId(id), asset);
                    this.earlyRequests.push(this.simpleId(id));
                }
                return asset;
            }
        };
        clientkernelLoader.Assets.prototype.getAssetsContent = function(ids) {
            var _g2 = this;
            var assets = [];
            var _g = 0;
            while (_g < ids.length) {
                var i = ids[_g];
                ++_g;
                var a = this.getAsset(i);
                if (a != null) assets.push(a.getContent());
                else throw new js._Boot.HaxeError("asset does not exist:" + i);
            }
            return Promise.all(assets).then(function(content) {
                var ret = new _hcmn_.haxe_ds_StringMap();
                var _g1 = 0;
                var _g3 = ids.length;
                while (_g1 < _g3) {
                    var i1 = _g1++;
                    var key = _g2.simpleId(ids[i1]);
                    var value = content[i1];
                    ret.set(key, value);
                }
                return ret;
            });
        };
        clientkernelLoader.Assets.prototype.assetLoaded = function() {
            return this.loadedTopic;
        };
        clientkernelLoader.Assets.prototype.progress = function() {
            return this.progressTopic;
        };
        clientkernelLoader.Assets.prototype.triggerAssetLoaded = function(asset) {
            if (this.channel != null) this.loadedTopic.publish(asset.getId());
        };
        clientkernelLoader.Assets.prototype.updateProgress = function(deltaSizeLoaded, deltaFilesLoaded, deltaSize, deltaFiles) {
            this.sizeLoaded += deltaSizeLoaded;
            if (this.loadedCount < this.totalItems) this.loadedCount++;
            if (this.totalItems > 0 && this.pfKernelChannel != null) this.progressTopic.publish(new clientkernelLoader.LoadProgress("game", this.totalItems, this.loadedCount, false));
        };
        clientkernelLoader.Assets.prototype.getSubContent = function(id) {
            var ag = this.group.get(id);
            return this.getAssetsContent(ag.ids());
        };
        clientkernelLoader.Assets.prototype.setTotalItems = function(totalItems) {
            this.totalItems = totalItems;
        };
        clientkernelLoader.Assets.prototype.__class__ = clientkernelLoader.Assets;
        clientkernelLoader.LoadProgress = function(id, items, current, complete) {
            this.id = id;
            this.items = items;
            this.current = current;
            this.complete = complete;
        };
        clientkernelLoader.LoadProgress = ck_implements(clientkernelLoader.LoadProgress, clientkernelLoaderApi.ILoadProgress);
        clientkernelLoader.LoadProgress.__interfaces__ = [clientkernelLoaderApi.ILoadProgress];
        clientkernelLoader.LoadProgress.__name__ = ["clientkernelLoader", "LoadProgress"];
        clientkernelLoader.LoadProgress.prototype.id = null;
        clientkernelLoader.LoadProgress.prototype.items = null;
        clientkernelLoader.LoadProgress.prototype.current = null;
        clientkernelLoader.LoadProgress.prototype.complete = null;
        clientkernelLoader.LoadProgress.prototype.getId = function() {
            return this.id;
        };
        clientkernelLoader.LoadProgress.prototype.getItems = function() {
            return this.items;
        };
        clientkernelLoader.LoadProgress.prototype.getCurrent = function() {
            return this.current;
        };
        clientkernelLoader.LoadProgress.prototype.getComplete = function() {
            return this.complete;
        };
        clientkernelLoader.LoadProgress.prototype.__class__ = clientkernelLoader.LoadProgress;
        clientkernelLoader.LoaderAnimation = function() {
            this.wheel2 = 2;
            this.wheel1 = 0;
            window.addEventListener("load", $bind(this, this.startPreloader));
            window.addEventListener("resize", $bind(this, this.resize));
        };
        clientkernelLoader.LoaderAnimation.__name__ = ["clientkernelLoader", "LoaderAnimation"];
        clientkernelLoader.LoaderAnimation.prototype.preloader = null;
        clientkernelLoader.LoaderAnimation.prototype.timer = null;
        clientkernelLoader.LoaderAnimation.prototype.image = null;
        clientkernelLoader.LoaderAnimation.prototype.left = null;
        clientkernelLoader.LoaderAnimation.prototype.top = null;
        clientkernelLoader.LoaderAnimation.prototype.wheel1 = null;
        clientkernelLoader.LoaderAnimation.prototype.wheel2 = null;
        clientkernelLoader.LoaderAnimation.prototype.touchmove = function(e) {
            e.preventDefault();
        };
        clientkernelLoader.LoaderAnimation.prototype.startPreloader = function() {
            window.document.body.addEventListener("touchmove", $bind(this, this.touchmove));
            var _this = window.document;
            this.preloader = _this.createElement("canvas");
            this.image = window.document.getElementById("preloader");
            window.document.body.removeChild(this.image);
            this.preloader.id = "preloader";
            this.preloader.style.zIndex = "9999";
            this.preloader.addEventListener("touchmove", $bind(this, this.touchmove));
            this.resize();
            window.document.body.appendChild(this.preloader);
            this.timer = new _hcmn_.haxe_Timer(330);
            this.timer.run = $bind(this, this.draw);
        };
        clientkernelLoader.LoaderAnimation.prototype.resize = function() {
            this.preloader.width = window.innerWidth;
            this.preloader.height = window.innerHeight;
            var ctx = this.preloader.getContext("2d", null);
            ctx.fillStyle = "black";
            ctx.fillRect(0, 0, this.preloader.width, this.preloader.height);
            this.left = this.preloader.width / 2 - clientkernelLoader.LoaderAnimation.imagewidth / 2;
            this.top = this.preloader.height / 2 - clientkernelLoader.LoaderAnimation.imageheight;
            ctx.drawImage(this.image, 0, 0, clientkernelLoader.LoaderAnimation.imagewidth, clientkernelLoader.LoaderAnimation.imageheight, this.left, this.top, clientkernelLoader.LoaderAnimation.imagewidth, clientkernelLoader.LoaderAnimation.imageheight);
            this.draw();
        };
        clientkernelLoader.LoaderAnimation.prototype.draw = function() {
            if (this.preloader.width != window.innerWidth || this.preloader.height != window.innerHeight) this.resize();
            var ctx = this.preloader.getContext("2d", null);
            this.wheel1 = (this.wheel1 + 1) % 4;
            this.wheel2 = (this.wheel2 + 1) % 4;
            ctx.drawImage(this.image, clientkernelLoader.LoaderAnimation.wheels[this.wheel1][0], clientkernelLoader.LoaderAnimation.wheels[this.wheel1][1], 26, 22, this.left + 30, this.top + 15, 26, 22);
            ctx.drawImage(this.image, clientkernelLoader.LoaderAnimation.wheels[this.wheel2][0], clientkernelLoader.LoaderAnimation.wheels[this.wheel2][1], 26, 22, this.left + 135, this.top + 15, 26, 22);
        };
        clientkernelLoader.LoaderAnimation.prototype.hide = function() {
            if (this.timer != null) {
                window.removeEventListener("resize", $bind(this, this.resize));
                window.document.body.removeEventListener("touchmove", $bind(this, this.touchmove));
                this.preloader.removeEventListener("touchmove", $bind(this, this.touchmove));
                this.timer.stop();
                this.timer = null;
                this.preloader.style.display = "none";
                window.document.body.removeChild(this.preloader);
                this.preloader = null;
            }
        };
        clientkernelLoader.LoaderAnimation.prototype.__class__ = clientkernelLoader.LoaderAnimation;
        clientkernelLoader.LoaderContext = function(context) {
            this.vars = new clientkernelLoader.Variables();
            this.assets = new clientkernelLoader.Assets();
            this.loader = null;
            this.loaderConfiguration = new clientkernelLoader.LoaderConfiguration(this);
            this.context = context;
            this.loaderAnimation = new clientkernelLoader.LoaderAnimation();
        };
        clientkernelLoader.LoaderContext = ck_implements(clientkernelLoader.LoaderContext, clientkernelModulesApi.IServiceListener);
        clientkernelLoader.LoaderContext = ck_implements(clientkernelLoader.LoaderContext, clientkernelLoaderApiPlugins.ILoaderContext);
        clientkernelLoader.LoaderContext.__interfaces__ = [clientkernelModulesApi.IServiceListener, clientkernelLoaderApiPlugins.ILoaderContext];
        clientkernelLoader.LoaderContext.__name__ = ["clientkernelLoader", "LoaderContext"];
        clientkernelLoader.LoaderContext.prototype.loaderConfiguration = null;
        clientkernelLoader.LoaderContext.prototype.loaderPlugin = null;
        clientkernelLoader.LoaderContext.prototype.vars = null;
        clientkernelLoader.LoaderContext.prototype.assets = null;
        clientkernelLoader.LoaderContext.prototype.context = null;
        clientkernelLoader.LoaderContext.prototype.loader = null;
        clientkernelLoader.LoaderContext.prototype.loaderAnimation = null;
        clientkernelLoader.LoaderContext.prototype.initialize = function() {
            var _g = this;
            this.loaderConfiguration.registerPlugin(new clientkernelLoader.VariablesConfigurationPlugin());
            this.loaderConfiguration.registerPlugin(new clientkernelLoader.ImportUrlVariablesConfigurationPlugin());
            this.loaderConfiguration.registerPlugin(new clientkernelLoader.PreloadVariablesConfigurationPlugin());
            this.loaderConfiguration.registerPlugin(this.loaderPlugin = new clientkernelLoader.LoaderPlugin($bind(this, this.finishedLoading)));
            this.loaderPlugin.registerPlugin(new clientkernelLoader.JSPlugin());
            this.loaderPlugin.registerPlugin(new clientkernelLoader.PreloadJSPlugin());
            this.loaderPlugin.registerPlugin(new clientkernelLoader.FontsPlugin());
            this.loaderPlugin.registerPlugin(new clientkernelLoader.PackPlugin());
            this.loaderPlugin.registerPlugin(new clientkernelLoader.ConfigPlugin());
            this.context.addServiceListener(this);
            this.loadEnvironmentProperties();
            this.context.getServiceTracker([clientkernelEventbusApi.IEventBus]).then(function(context) {
                var eb = context.getAnyService(clientkernelEventbusApi.IEventBus);
                _g.assets.connect(eb.getChannel(clientkernelLoader.LoaderContext.LOADER_CHANNEL), eb.getChannel(clientkernelLoader.LoaderContext.PF_KERNEL_CHANNEL));
                var hdpt = new clientkernelLoaderApi.HideDefaultPreloaderTopic();
                hdpt.connect(eb.getChannel(clientkernelLoader.LoaderContext.LOADER_CHANNEL));
                hdpt.subscribe($bind(_g, _g.hidePreloader));
                context.registerService(_g.assets, clientkernelLoaderApi.IAssetRegistry, null);
                _g.loaderConfiguration.load({
                    loader: [{
                        id: "startup.config",
                        type: "config",
                        url: "startup.config.js",
                        loadtype: "block"
                    }]
                });
            });
        };
        clientkernelLoader.LoaderContext.prototype.loadEnvironmentProperties = function() {
            var _g = this;
            this.loaderConfiguration.load({
                loader: [{
                    id: "environment",
                    type: "preload-asset",
                    url: "environment.json",
                    loadtype: "block"
                }]
            });
            this.assets.getAsset("environment").getContent().then(function(data) {
                try {
                    _g.vars.set("postal.allowedOrigins", data.postal.allowedOrigins);
                    _g.vars.set("postal.defaultOrigin", data.postal.defaultOrigin);
                    _g.vars.set("postal.timeout", data.postal.timeout);
                } catch (e) {
                    if (e instanceof js._Boot.HaxeError) e = e.val;
                    if (_hcmn_.js_Boot.__instanceof(e, Error)) {
                        throw new Error("error parsing environment.json: " + e.message);
                    } else throw (e);
                }
                _g.context.registerService(_g.vars, clientkernelLoaderApi.IVariableRegistry, null);
            });
        };
        clientkernelLoader.LoaderContext.prototype.autoHidePreloader = function() {
            if (this.vars.get("auto.hide.preloader", "false") == "true") this.hidePreloader(null);
        };
        clientkernelLoader.LoaderContext.prototype.hidePreloader = function(ev) {
            this.loaderAnimation.hide();
        };
        clientkernelLoader.LoaderContext.prototype.finishedLoading = function() {
            this.autoHidePreloader();
        };
        clientkernelLoader.LoaderContext.prototype.serviceChanged = function(event) {
            if (event.getInterface() == clientkernelLoaderApiPlugins.IConfigurationPlugin) this.loaderConfiguration.registerPlugin(event.getService());
            else if (event.getInterface() == clientkernelLoaderApiPlugins.IAssetPlugin) this.loaderPlugin.registerPlugin(event.getService());
        };
        clientkernelLoader.LoaderContext.prototype.getVars = function() {
            return this.vars;
        };
        clientkernelLoader.LoaderContext.prototype.getAssets = function() {
            return this.assets;
        };
        clientkernelLoader.LoaderContext.prototype.getLoader = function() {
            return this.loader;
        };
        clientkernelLoader.LoaderContext.prototype.getModuleContext = function() {
            return this.context;
        };
        clientkernelLoader.LoaderContext.prototype.installLoader = function(loader) {
            if (this.loader == null) this.loader = loader;
            else throw new Error("multiple loader instances");
        };
        clientkernelLoader.LoaderContext.prototype.setTotalItems = function(totalItems) {
            this.assets.setTotalItems(totalItems);
        };
        clientkernelLoader.LoaderContext.prototype.__class__ = clientkernelLoader.LoaderContext;
        clientkernelLoader.Variables = function() {
            this.vars = new _hcmn_.haxe_ds_StringMap();
        };
        clientkernelLoader.Variables = ck_implements(clientkernelLoader.Variables, clientkernelModulesApi.IService);
        clientkernelLoader.Variables = ck_implements(clientkernelLoader.Variables, clientkernelLoaderApi.IVariableRegistry);
        clientkernelLoader.Variables = ck_implements(clientkernelLoader.Variables, clientkernelLoaderApiPlugins.IVariables);
        clientkernelLoader.Variables.__interfaces__ = [clientkernelModulesApi.IService, clientkernelLoaderApi.IVariableRegistry, clientkernelLoaderApiPlugins.IVariables];
        clientkernelLoader.Variables.__name__ = ["clientkernelLoader", "Variables"];
        clientkernelLoader.Variables.prototype.vars = null;
        clientkernelLoader.Variables.prototype.get = function(name, defaultValue) {
            if (this.vars.exists(name)) return this.vars.get(name);
            else return defaultValue;
        };
        clientkernelLoader.Variables.prototype.set = function(name, value) {
            this.vars.set(name, value);
        };
        clientkernelLoader.Variables.prototype.expand = function(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 (this.vars.exists(name)) name = this.vars.get(name);
                else name = "${" + name + "}";
                var rl = ret.length;
                ret = _hcmn_.HxOverrides.substr(ret, 0, index) + name + _hcmn_.HxOverrides.substr(ret, indexe + 1, null);
                index = indexe - rl + ret.length;
            }
            return ret;
        };
        clientkernelLoader.Variables.prototype.__class__ = clientkernelLoader.Variables;
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin = function() {};
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin = ck_implements(clientkernelLoader.ImportUrlVariablesConfigurationPlugin, clientkernelLoaderApiPlugins.IConfigurationPlugin);
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IConfigurationPlugin];
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin.__name__ = ["clientkernelLoader", "ImportUrlVariablesConfigurationPlugin"];
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin.prototype.getSection = function() {
            return "importurlvariables";
        };
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin.prototype.resolve = function(lc, config) {
            var querystring = window.document.location.search;
            if (querystring == null || querystring == "") return;
            querystring = _hcmn_.HxOverrides.substr(querystring, 1, null);
            querystring = querystring.split("?").join("&");
            var qsArray = querystring.split("&");
            var qsPart;
            var _g = 0;
            while (_g < qsArray.length) {
                var qsPart1 = qsArray[_g];
                ++_g;
                if (qsPart1 != "") {
                    var variableArray = qsPart1.split("=");
                    if (variableArray.length < 2) continue;
                    var valueDecoded = decodeURIComponent(variableArray[1].split("+").join(" "));
                    lc.getVars().set(variableArray[0], valueDecoded);
                }
            }
        };
        clientkernelLoader.ImportUrlVariablesConfigurationPlugin.prototype.__class__ = clientkernelLoader.ImportUrlVariablesConfigurationPlugin;
        clientkernelLoader.LoaderPlugin = function(onFinished) {
            this.loadedRemaining = 0;
            this.assetPlugins = new _hcmn_.haxe_ds_StringMap();
            this.onFinished = onFinished;
            this.queue = new clientkernelLoader.LoadingQueue(null, this, null);
            this.queues = [];
            this.queues.push(this.queue);
        };
        clientkernelLoader.LoaderPlugin = ck_implements(clientkernelLoader.LoaderPlugin, clientkernelLoaderApiPlugins.ILoader);
        clientkernelLoader.LoaderPlugin = ck_implements(clientkernelLoader.LoaderPlugin, clientkernelLoaderApiPlugins.IConfigurationPlugin);
        clientkernelLoader.LoaderPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.ILoader, clientkernelLoaderApiPlugins.IConfigurationPlugin];
        clientkernelLoader.LoaderPlugin.__name__ = ["clientkernelLoader", "LoaderPlugin"];
        clientkernelLoader.LoaderPlugin.prototype.assetPlugins = null;
        clientkernelLoader.LoaderPlugin.prototype.queue = null;
        clientkernelLoader.LoaderPlugin.prototype.lc = null;
        clientkernelLoader.LoaderPlugin.prototype.onFinished = null;
        clientkernelLoader.LoaderPlugin.prototype.queues = null;
        clientkernelLoader.LoaderPlugin.prototype.loadedRemaining = null;
        clientkernelLoader.LoaderPlugin.prototype.getSection = function() {
            return "loader";
        };
        clientkernelLoader.LoaderPlugin.prototype.registerPlugin = function(alp) {
            var _g = 0;
            var _g1 = alp.getAssetTypes();
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                this.assetPlugins.set(i, alp);
                var _g2 = 0;
                var _g3 = this.queues;
                while (_g2 < _g3.length) {
                    var q = _g3[_g2];
                    ++_g2;
                    q.setPlugin(i, alp);
                }
            }
        };
        clientkernelLoader.LoaderPlugin.prototype.getAssetPlugin = function(type) {
            return this.assetPlugins.get(type);
        };
        clientkernelLoader.LoaderPlugin.prototype.resolve = function(lc, config) {
            this.lc = lc;
            this.queue.resolve(lc, config, this.onFinished);
        };
        clientkernelLoader.LoaderPlugin.prototype.addQueue = function(id, config, baseUrl, onFinished) {
            var _g = this;
            var q = new clientkernelLoader.LoadingQueue(id, this, baseUrl);
            this.queues.push(q);
            this.loadedRemaining++;
            var onFinishedCheck = function() {
                _g.loadedRemaining--;
                if (_g.loadedRemaining == 0) window.console.log("[ds] loaded");
                onFinished();
            };
            q.resolve(this.lc, config, onFinishedCheck);
        };
        clientkernelLoader.LoaderPlugin.prototype.__class__ = clientkernelLoader.LoaderPlugin;
        clientkernelLoader.LoadingAsset = function(lc, id, type, plugin, url, loadtype, condition, config, onLoaded, onRequested) {
            this.lc = lc;
            this.id = id;
            this.type = type;
            this.plugin = plugin;
            this.url = url;
            this.loadtype = loadtype;
            this.onLoaded = onLoaded;
            this.onRequested = onRequested;
            this.condition = condition;
            this.config = config;
            if (plugin != null) {
                this.loader = plugin.createLoader();
                this.loader.setup(lc, id, type, lc.getVars().expand(url), config, $bind(this, this.requested));
            } else this.loader = null;
        };
        clientkernelLoader.LoadingAsset.__name__ = ["clientkernelLoader", "LoadingAsset"];
        clientkernelLoader.LoadingAsset.prototype.id = null;
        clientkernelLoader.LoadingAsset.prototype.type = null;
        clientkernelLoader.LoadingAsset.prototype.plugin = null;
        clientkernelLoader.LoadingAsset.prototype.url = null;
        clientkernelLoader.LoadingAsset.prototype.loadtype = null;
        clientkernelLoader.LoadingAsset.prototype.condition = null;
        clientkernelLoader.LoadingAsset.prototype.config = null;
        clientkernelLoader.LoadingAsset.prototype.onLoaded = null;
        clientkernelLoader.LoadingAsset.prototype.onRequested = null;
        clientkernelLoader.LoadingAsset.prototype.lc = null;
        clientkernelLoader.LoadingAsset.prototype.loader = null;
        clientkernelLoader.LoadingAsset.prototype.getId = function() {
            return this.id;
        };
        clientkernelLoader.LoadingAsset.prototype.getType = function() {
            return this.type;
        };
        clientkernelLoader.LoadingAsset.prototype.getCondition = function() {
            if (this.condition == null || this.condition == "") return true;
            var c = this.lc.getVars().expand(this.condition);
            return eval(c);
        };
        clientkernelLoader.LoadingAsset.prototype.getPlugin = function() {
            return this.plugin;
        };
        clientkernelLoader.LoadingAsset.prototype.setPlugin = function(type, plugin) {
            if (this.plugin == null) {
                this.plugin = plugin;
                this.loader = this.plugin.createLoader();
                this.loader.setup(this.lc, this.id, type, this.lc.getVars().expand(this.url), this.config, $bind(this, this.requested));
            }
        };
        clientkernelLoader.LoadingAsset.prototype.getUrl = function() {
            return this.url;
        };
        clientkernelLoader.LoadingAsset.prototype.getLoadType = function() {
            return this.loadtype;
        };
        clientkernelLoader.LoadingAsset.prototype.load = function(loader) {
            if (loader != null) this.loader.load($bind(this, this.loaded));
        };
        clientkernelLoader.LoadingAsset.prototype.unload = function() {
            if (this.loader != null) this.loader.unload();
        };
        clientkernelLoader.LoadingAsset.prototype.loaded = function() {
            this.onLoaded(this);
        };
        clientkernelLoader.LoadingAsset.prototype.requested = function() {
            if (this.onRequested != null) this.onRequested(this);
        };
        clientkernelLoader.LoadingAsset.prototype.__class__ = clientkernelLoader.LoadingAsset;
        clientkernelLoader.LoadingQueue = function(id, lp, baseUrl) {
            this.max_parallel = 4;
            this.blocking = 0;
            if (id == null) this.id = "";
            else this.id = id;
            this.loaderPlugin = lp;
            this.queue = [];
            this.onRequestQueue = [];
            this.processing = [];
            this.baseUrl = baseUrl;
            if (this.baseUrl != null && this.baseUrl != "") {
                if (_hcmn_.HxOverrides.substr(this.baseUrl, this.baseUrl.length - 1, null) != "/") this.baseUrl += "/";
            }
        };
        clientkernelLoader.LoadingQueue.__name__ = ["clientkernelLoader", "LoadingQueue"];
        clientkernelLoader.LoadingQueue.prototype.loaderPlugin = null;
        clientkernelLoader.LoadingQueue.prototype.onRequestQueue = null;
        clientkernelLoader.LoadingQueue.prototype.queue = null;
        clientkernelLoader.LoadingQueue.prototype.processing = null;
        clientkernelLoader.LoadingQueue.prototype.blocking = null;
        clientkernelLoader.LoadingQueue.prototype.max_parallel = null;
        clientkernelLoader.LoadingQueue.prototype.onFinished = null;
        clientkernelLoader.LoadingQueue.prototype.baseUrl = null;
        clientkernelLoader.LoadingQueue.prototype.id = null;
        clientkernelLoader.LoadingQueue.prototype.resolve = function(lc, config, onFinished) {
            this.onFinished = onFinished;
            var addedToQueue = false;
            var cfg = config;
            var _g = 0;
            while (_g < cfg.length) {
                var i = cfg[_g];
                ++_g;
                var myid;
                if (this.id == "") myid = i.id;
                else myid = this.id + "/" + i.id;
                if (i.loadtype == "onrequest") this.onRequestQueue.push(new clientkernelLoader.LoadingAsset(lc, myid, i.type, this.loaderPlugin.getAssetPlugin(i.type), this.makeurl(i.url), i.loadtype, i.condition, i.config, $bind(this, this.finished), $bind(this, this.requested)));
                else {
                    addedToQueue = true;
                    this.queue.push(new clientkernelLoader.LoadingAsset(lc, myid, i.type, this.loaderPlugin.getAssetPlugin(i.type), this.makeurl(i.url), i.loadtype, i.condition, i.config, $bind(this, this.finished), null));
                }
            }
            if (addedToQueue) this.process();
        };
        clientkernelLoader.LoadingQueue.prototype.makeurl = function(url) {
            if (this.baseUrl == null) return url;
            if (url.indexOf("http:") == 0 || url.indexOf("https:") == 0 || url.indexOf("/") == 0) return url;
            return this.baseUrl + url;
        };
        clientkernelLoader.LoadingQueue.prototype.finished = function(la) {
            if (la.getLoadType() == "block") this.blocking--;
            _hcmn_.HxOverrides.remove(this.processing, la);
            this.process();
            if (this.queue.length == 0 && this.processing.length == 0 && this.onFinished != null) this.onFinished();
        };
        clientkernelLoader.LoadingQueue.prototype.requested = function(la) {
            if (_hcmn_.HxOverrides.indexOf(this.onRequestQueue, la, 0) != -1) {
                _hcmn_.HxOverrides.remove(this.onRequestQueue, la);
                this.queue.push(la);
            }
            this.process();
        };
        clientkernelLoader.LoadingQueue.prototype.process = function() {
            if (this.queue.length == 0) return;
            if (this.processing.length >= this.max_parallel) return;
            if (this.blocking > 0) return;
            var _g1 = 0;
            var _g = this.queue.length;
            while (_g1 < _g) {
                var index = _g1++;
                var i = this.queue[index];
                if (i.getPlugin() != null) {
                    if (i.getCondition()) {
                        var la = this.queue.splice(index, 1)[0];
                        if (la.getLoadType() == "block") this.blocking++;
                        this.processing.push(la);
                        la.load(this.loaderPlugin);
                        this.process();
                        return;
                    } else {
                        var la1 = this.queue.splice(index, 1)[0];
                        la1.unload();
                        this.finished(la1);
                        this.process();
                        return;
                    }
                } else if (i.getLoadType() == "block") return;
            }
        };
        clientkernelLoader.LoadingQueue.prototype.setPlugin = function(type, alp) {
            var _g = 0;
            var _g1 = this.queue;
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (i.getType() == type) i.setPlugin(type, alp);
            }
            var _g2 = 0;
            var _g11 = this.onRequestQueue;
            while (_g2 < _g11.length) {
                var j = _g11[_g2];
                ++_g2;
                if (j.getType() == type) j.setPlugin(type, alp);
            }
            this.process();
        };
        clientkernelLoader.LoadingQueue.prototype.__class__ = clientkernelLoader.LoadingQueue;
        clientkernelLoader.ConfigLoader = function() {
            this.isLoaded = false;
        };
        clientkernelLoader.ConfigLoader = ck_implements(clientkernelLoader.ConfigLoader, clientkernelLoaderApiPlugins.IAssetLoader);
        clientkernelLoader.ConfigLoader.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetLoader];
        clientkernelLoader.ConfigLoader.__name__ = ["clientkernelLoader", "ConfigLoader"];
        clientkernelLoader.ConfigLoader.prototype.lc = null;
        clientkernelLoader.ConfigLoader.prototype.id = null;
        clientkernelLoader.ConfigLoader.prototype.type = null;
        clientkernelLoader.ConfigLoader.prototype.url = null;
        clientkernelLoader.ConfigLoader.prototype.config = null;
        clientkernelLoader.ConfigLoader.prototype.onrequest = null;
        clientkernelLoader.ConfigLoader.prototype.onfinish = null;
        clientkernelLoader.ConfigLoader.prototype.isLoaded = null;
        clientkernelLoader.ConfigLoader.prototype.asset = null;
        clientkernelLoader.ConfigLoader.prototype.xmlloader = null;
        clientkernelLoader.ConfigLoader.prototype.setup = function(lc, id, type, url, config, onrequest) {
            this.lc = lc;
            this.id = id;
            this.type = type;
            this.url = url;
            this.config = config;
            this.onrequest = onrequest;
            this.asset = lc.getAssets().add(id, url, type, onrequest);
        };
        clientkernelLoader.ConfigLoader.prototype.load = function(onfinish) {
            this.onfinish = onfinish;
            this.xmlloader = new XMLHttpRequest();
            this.xmlloader.onload = $bind(this, this.handleComplete);
            this.xmlloader.onerror = $bind(this, this.onFinished);
            this.xmlloader.open("GET", this.url);
            this.xmlloader.send();
        };
        clientkernelLoader.ConfigLoader.prototype.unload = function() {
            this.lc.getAssets().remove(this.id);
        };
        clientkernelLoader.ConfigLoader.prototype.handleComplete = function(event) {
            var t = this.xmlloader.responseText;
            var config = null;
            eval('config=' + t);
            var cfg = config.variables;
            if (cfg != null) {
                var _g = 0;
                while (_g < cfg.length) {
                    var i = cfg[_g];
                    ++_g;
                    this.lc.getVars().set(i.name, i.value);
                }
            }
            if (config.importurlvariables != null) new clientkernelLoader.ImportUrlVariablesConfigurationPlugin().resolve(this.lc, null);
            if (config.preloadvariables != null) new clientkernelLoader.PreloadVariablesConfigurationPlugin().resolve(this.lc, config.preloadvariables);
            var baseUrl = this.url;
            baseUrl = baseUrl.split("?")[0];
            var len = baseUrl.lastIndexOf("/") + 1;
            baseUrl = _hcmn_.HxOverrides.substr(baseUrl, 0, len);
            this.lc.getLoader().addQueue(null, config.loader, baseUrl, $bind(this, this.onFinished));
        };
        clientkernelLoader.ConfigLoader.prototype.onFinished = function() {
            if (this.onfinish != null) {
                this.isLoaded = true;
                this.onfinish();
            }
        };
        clientkernelLoader.ConfigLoader.prototype.__class__ = clientkernelLoader.ConfigLoader;
        clientkernelLoader.ConfigPlugin = function() {};
        clientkernelLoader.ConfigPlugin = ck_implements(clientkernelLoader.ConfigPlugin, clientkernelLoaderApiPlugins.IAssetPlugin);
        clientkernelLoader.ConfigPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetPlugin];
        clientkernelLoader.ConfigPlugin.__name__ = ["clientkernelLoader", "ConfigPlugin"];
        clientkernelLoader.ConfigPlugin.prototype.getAssetTypes = function() {
            return ["config"];
        };
        clientkernelLoader.ConfigPlugin.prototype.createLoader = function() {
            return new clientkernelLoader.ConfigLoader();
        };
        clientkernelLoader.ConfigPlugin.prototype.__class__ = clientkernelLoader.ConfigPlugin;
        clientkernelLoader.FontsLoader = function() {};
        clientkernelLoader.FontsLoader = ck_implements(clientkernelLoader.FontsLoader, clientkernelLoaderApiPlugins.IAssetLoader);
        clientkernelLoader.FontsLoader.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetLoader];
        clientkernelLoader.FontsLoader.__name__ = ["clientkernelLoader", "FontsLoader"];
        clientkernelLoader.FontsLoader.prototype.font = null;
        clientkernelLoader.FontsLoader.prototype.lc = null;
        clientkernelLoader.FontsLoader.prototype.id = null;
        clientkernelLoader.FontsLoader.prototype.onfinish = null;
        clientkernelLoader.FontsLoader.prototype.url = null;
        clientkernelLoader.FontsLoader.prototype.asset = null;
        clientkernelLoader.FontsLoader.prototype.fontFamily = null;
        clientkernelLoader.FontsLoader.prototype.setup = function(lc, id, type, url, config, onrequest) {
            this.url = url;
            this.lc = lc;
            this.id = id;
            if (config != null) {
                if (Object.prototype.hasOwnProperty.call(config, "fontFamily")) this.fontFamily = _hcmn_.Reflect.field(config, "fontFamily");
            }
            this.asset = lc.getAssets().add(id, url, type, onrequest);
        };
        clientkernelLoader.FontsLoader.prototype.load = function(onfinish) {
            this.onfinish = onfinish;
            this.font = new font.Font();
            this.font.onload = $bind(this, this.handleComplete);
            this.font.src = this.url;
            this.font.fontFamily = this.fontFamily;
        };
        clientkernelLoader.FontsLoader.prototype.unload = function() {
            this.lc.getAssets().remove(this.id);
        };
        clientkernelLoader.FontsLoader.prototype.handleProgress = function(event) {};
        clientkernelLoader.FontsLoader.prototype.handleComplete = function() {
            this.asset.setContent(this.font);
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.FontsLoader.prototype.onFinished = function() {
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.FontsLoader.prototype.handleError = function(event) {};
        clientkernelLoader.FontsLoader.prototype.__class__ = clientkernelLoader.FontsLoader;
        clientkernelLoader.FontsPlugin = function() {};
        clientkernelLoader.FontsPlugin = ck_implements(clientkernelLoader.FontsPlugin, clientkernelLoaderApiPlugins.IAssetPlugin);
        clientkernelLoader.FontsPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetPlugin];
        clientkernelLoader.FontsPlugin.__name__ = ["clientkernelLoader", "FontsPlugin"];
        clientkernelLoader.FontsPlugin.prototype.getAssetTypes = function() {
            return ["font"];
        };
        clientkernelLoader.FontsPlugin.prototype.createLoader = function() {
            return new clientkernelLoader.FontsLoader();
        };
        clientkernelLoader.FontsPlugin.prototype.__class__ = clientkernelLoader.FontsPlugin;
        clientkernelLoader.JSLoader = function() {
            this.module = null;
            this.shim = null;
            this.tag = true;
        };
        clientkernelLoader.JSLoader = ck_implements(clientkernelLoader.JSLoader, clientkernelLoaderApiPlugins.IAssetLoader);
        clientkernelLoader.JSLoader.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetLoader];
        clientkernelLoader.JSLoader.__name__ = ["clientkernelLoader", "JSLoader"];
        clientkernelLoader.JSLoader.prototype.onfinish = null;
        clientkernelLoader.JSLoader.prototype.url = null;
        clientkernelLoader.JSLoader.prototype.tag = null;
        clientkernelLoader.JSLoader.prototype.shim = null;
        clientkernelLoader.JSLoader.prototype.module = null;
        clientkernelLoader.JSLoader.prototype.xmlloader = null;
        clientkernelLoader.JSLoader.prototype.asset = null;
        clientkernelLoader.JSLoader.prototype.lc = null;
        clientkernelLoader.JSLoader.prototype.id = null;
        clientkernelLoader.JSLoader.prototype.category = null;
        clientkernelLoader.JSLoader.prototype.setup = function(lc, id, type, url, config, onrequest) {
            this.url = url;
            this.lc = lc;
            this.id = id;
            if (config != null) {
                if (Object.prototype.hasOwnProperty.call(config, "tag")) this.tag = _hcmn_.Reflect.field(config, "tag");
                if (Object.prototype.hasOwnProperty.call(config, "shim")) this.shim = _hcmn_.Reflect.field(config, "shim");
                if (Object.prototype.hasOwnProperty.call(config, "module")) this.module = _hcmn_.Reflect.field(config, "module");
                if (Object.prototype.hasOwnProperty.call(config, "category")) this.category = _hcmn_.Reflect.field(config, "category");
            }
            if (this.module != null || this.shim != null) this.tag = false;
            this.asset = lc.getAssets().add(id, url, type, null);
        };
        clientkernelLoader.JSLoader.prototype.load = function(onfinish) {
            if (this.lc.getVars().get("bundle") == "true" && this.category != "bundle") {
                onfinish();
                return;
            }
            this.onfinish = onfinish;
            if (this.tag) {
                var script;
                var _this = window.document;
                script = _this.createElement("script");
                script.async = true;
                script.onload = $bind(this, this.onLoadedTag);
                script.src = this.url;
                window.document.head.appendChild(script);
            } else {
                this.xmlloader = new XMLHttpRequest();
                this.xmlloader.onload = $bind(this, this.handleComplete);
                this.xmlloader.onerror = onfinish;
                this.xmlloader.open("GET", this.url);
                this.xmlloader.onprogress = $bind(this, this.handleProgress);
                this.xmlloader.send();
            }
        };
        clientkernelLoader.JSLoader.prototype.unload = function() {
            this.lc.getAssets().remove(this.id);
        };
        clientkernelLoader.JSLoader.prototype.handleProgress = function(event) {
            if (event.lengthComputable) this.asset.setProgress(event.loaded, event.total);
            else this.asset.setProgress(0, 1);
        };
        clientkernelLoader.JSLoader.prototype.handleComplete = function(event) {
            var content = "";
            if (this.module != null) content += "define.amd.module=\"" + this.module + "\";";
            var shimaction = "";
            if (this.shim != null) {
                if (this.shim.indexOf(":") >= 0) {
                    var x = this.shim.split(":");
                    this.shim = x[1];
                    shimaction = x[0];
                }
                content += "define.amd.shim=\"" + this.shim + "\";";
            }
            content += this.xmlloader.responseText;
            if (this.shim != null) switch (shimaction) {
                case "import":
                    content += "define(function() {});";
                    break;
                default:
            }
            var script;
            var _this = window.document;
            script = _this.createElement("script");
            script.appendChild(window.document.createTextNode(content));
            window.document.head.appendChild(script);
            this.asset.setContent("<script/>");
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.JSLoader.prototype.onFinished = function() {
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.JSLoader.prototype.onLoadedTag = function() {
            if (this.onfinish != null) {
                this.asset.setContent("<script/>");
                this.onfinish();
            }
        };
        clientkernelLoader.JSLoader.prototype.__class__ = clientkernelLoader.JSLoader;
        clientkernelLoader.JSPlugin = function() {};
        clientkernelLoader.JSPlugin = ck_implements(clientkernelLoader.JSPlugin, clientkernelLoaderApiPlugins.IAssetPlugin);
        clientkernelLoader.JSPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetPlugin];
        clientkernelLoader.JSPlugin.__name__ = ["clientkernelLoader", "JSPlugin"];
        clientkernelLoader.JSPlugin.prototype.getAssetTypes = function() {
            return ["javascript"];
        };
        clientkernelLoader.JSPlugin.prototype.createLoader = function() {
            return new clientkernelLoader.JSLoader();
        };
        clientkernelLoader.JSPlugin.prototype.__class__ = clientkernelLoader.JSPlugin;
        clientkernelLoader.PackLoader = function() {};
        clientkernelLoader.PackLoader = ck_implements(clientkernelLoader.PackLoader, clientkernelLoaderApiPlugins.IAssetLoader);
        clientkernelLoader.PackLoader.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetLoader];
        clientkernelLoader.PackLoader.__name__ = ["clientkernelLoader", "PackLoader"];
        clientkernelLoader.PackLoader.prototype.lc = null;
        clientkernelLoader.PackLoader.prototype.id = null;
        clientkernelLoader.PackLoader.prototype.type = null;
        clientkernelLoader.PackLoader.prototype.url = null;
        clientkernelLoader.PackLoader.prototype.config = null;
        clientkernelLoader.PackLoader.prototype.onrequest = null;
        clientkernelLoader.PackLoader.prototype.onfinish = null;
        clientkernelLoader.PackLoader.prototype.asset = null;
        clientkernelLoader.PackLoader.prototype.setup = function(lc, id, type, url, config, onrequest) {
            this.lc = lc;
            this.id = id;
            this.type = type;
            this.url = url;
            this.config = config;
            this.onrequest = onrequest;
            this.asset = lc.getAssets().add(id, url, type, onrequest);
        };
        clientkernelLoader.PackLoader.prototype.load = function(onfinish) {
            this.onfinish = onfinish;
            this.lc.getLoader().addQueue(this.id, this.config.loader, this.url, $bind(this, this.onFinished));
        };
        clientkernelLoader.PackLoader.prototype.unload = function() {
            this.lc.getAssets().remove(this.id);
        };
        clientkernelLoader.PackLoader.prototype.onFinished = function() {
            if (this.onfinish != null) {
                this.asset.setContent(null);
                this.onfinish();
            }
        };
        clientkernelLoader.PackLoader.prototype.__class__ = clientkernelLoader.PackLoader;
        clientkernelLoader.PackPlugin = function() {
            this.loaders = [];
        };
        clientkernelLoader.PackPlugin = ck_implements(clientkernelLoader.PackPlugin, clientkernelLoaderApiPlugins.IAssetPlugin);
        clientkernelLoader.PackPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetPlugin];
        clientkernelLoader.PackPlugin.__name__ = ["clientkernelLoader", "PackPlugin"];
        clientkernelLoader.PackPlugin.prototype.loaders = null;
        clientkernelLoader.PackPlugin.prototype.getAssetTypes = function() {
            return ["pack"];
        };
        clientkernelLoader.PackPlugin.prototype.createLoader = function() {
            var loader = new clientkernelLoader.PackLoader();
            this.loaders.push(loader);
            return loader;
        };
        clientkernelLoader.PackPlugin.prototype.__class__ = clientkernelLoader.PackPlugin;
        clientkernelLoader.PreloadJSLoader = function() {};
        clientkernelLoader.PreloadJSLoader = ck_implements(clientkernelLoader.PreloadJSLoader, clientkernelLoaderApiPlugins.IAssetLoader);
        clientkernelLoader.PreloadJSLoader.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetLoader];
        clientkernelLoader.PreloadJSLoader.__name__ = ["clientkernelLoader", "PreloadJSLoader"];
        clientkernelLoader.PreloadJSLoader.prototype.lc = null;
        clientkernelLoader.PreloadJSLoader.prototype.id = null;
        clientkernelLoader.PreloadJSLoader.prototype.onfinish = null;
        clientkernelLoader.PreloadJSLoader.prototype.url = null;
        clientkernelLoader.PreloadJSLoader.prototype.loader = null;
        clientkernelLoader.PreloadJSLoader.prototype.asset = null;
        clientkernelLoader.PreloadJSLoader.prototype.setup = function(lc, id, type, url, config, onrequest) {
            this.url = url;
            this.lc = lc;
            this.id = id;
            this.asset = lc.getAssets().add(id, url, type, onrequest);
        };
        clientkernelLoader.PreloadJSLoader.prototype.load = function(onfinish) {
            this.onfinish = onfinish;
            this.loader = new preloadjs.LoadQueue();
            var manifest = [{
                id: this.asset.getId(),
                src: this.asset.getUrl()
            }];
            this.loader.addEventListener("complete", $bind(this, this.handleComplete));
            this.loader.addEventListener("error", $bind(this, this.handleError));
            this.loader.loadManifest(manifest);
            var loaderDynamic = this.loader;
            var loaderConcrete = loaderDynamic._loadQueueBackup[0];
            if (loaderConcrete != null && loaderConcrete._request != null) loaderConcrete._request.addEventListener("progress", $bind(this, this.handleProgress));
        };
        clientkernelLoader.PreloadJSLoader.prototype.unload = function() {
            this.lc.getAssets().remove(this.id);
        };
        clientkernelLoader.PreloadJSLoader.prototype.handleProgress = function(event) {
            if (event.lengthComputable) this.asset.setProgress(event.loaded, event.total);
            else this.asset.setProgress(0, 1);
        };
        clientkernelLoader.PreloadJSLoader.prototype.handleComplete = function(event) {
            this.asset.setContent(this.loader.getResult(this.asset.getId()));
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.PreloadJSLoader.prototype.onFinished = function() {
            if (this.onfinish != null) this.onfinish();
        };
        clientkernelLoader.PreloadJSLoader.prototype.handleError = function(event) {};
        clientkernelLoader.PreloadJSLoader.prototype.__class__ = clientkernelLoader.PreloadJSLoader;
        clientkernelLoader.PreloadJSPlugin = function() {};
        clientkernelLoader.PreloadJSPlugin = ck_implements(clientkernelLoader.PreloadJSPlugin, clientkernelLoaderApiPlugins.IAssetPlugin);
        clientkernelLoader.PreloadJSPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IAssetPlugin];
        clientkernelLoader.PreloadJSPlugin.__name__ = ["clientkernelLoader", "PreloadJSPlugin"];
        clientkernelLoader.PreloadJSPlugin.prototype.getAssetTypes = function() {
            return ["preload-asset", "font"];
        };
        clientkernelLoader.PreloadJSPlugin.prototype.createLoader = function() {
            return new clientkernelLoader.PreloadJSLoader();
        };
        clientkernelLoader.PreloadJSPlugin.prototype.__class__ = clientkernelLoader.PreloadJSPlugin;
        clientkernelLoader.PreloadVariablesConfigurationPlugin = function() {
            this.lc = null;
        };
        clientkernelLoader.PreloadVariablesConfigurationPlugin = ck_implements(clientkernelLoader.PreloadVariablesConfigurationPlugin, clientkernelLoaderApiPlugins.IConfigurationPlugin);
        clientkernelLoader.PreloadVariablesConfigurationPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IConfigurationPlugin];
        clientkernelLoader.PreloadVariablesConfigurationPlugin.__name__ = ["clientkernelLoader", "PreloadVariablesConfigurationPlugin"];
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.lc = null;
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.getSection = function() {
            return "preloadvariables";
        };
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.resolve = function(lc, config) {
            this.lc = lc;
            var cfg = config;
            var _g = 0;
            while (_g < cfg.length) {
                var i = cfg[_g];
                ++_g;
                lc.getVars().set(i.name, i.value);
            }
            this.extractClientInfoVariables();
            this.setTotalItemsForLoadProgress();
        };
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.extractClientInfoVariables = function() {
            var fullHDw = 1920;
            var w;
            if (window.screen.width > window.outerWidth) w = window.screen.width;
            else w = window.outerWidth;
            var h;
            if (window.screen.height > window.outerHeight) h = window.screen.height;
            else h = window.outerHeight;
            w *= window.devicePixelRatio;
            h *= window.devicePixelRatio;
            var realScale = _hcmn_.Math.max(w, h) / fullHDw;
            var scaleOptionsVarName = "skin.scaleoptions";
            var scaleOptionsVar = this.lc.getVars().get(scaleOptionsVarName);
            if (scaleOptionsVar == null) {
                this.lc.getVars().set("skin.scalepath", "");
                return;
            }
            var scaleOptionsArray;
            if (scaleOptionsVar != null) scaleOptionsArray = scaleOptionsVar.split(",");
            else scaleOptionsArray = [];
            var defaultScaleId = this.lc.getVars().get(scaleOptionsVarName + ".default");
            var nearestScaleId = defaultScaleId;
            var _g = 0;
            while (_g < scaleOptionsArray.length) {
                var scaleId = scaleOptionsArray[_g];
                ++_g;
                var nearestScaleFloat = _hcmn_.Std.parseFloat(this.lc.getVars().get(scaleOptionsVarName + "." + nearestScaleId)) / 100;
                var valForScaleId = _hcmn_.Std.parseFloat(this.lc.getVars().get(scaleOptionsVarName + "." + scaleId)) / 100;
                if (_hcmn_.Math.abs(valForScaleId - realScale) < _hcmn_.Math.abs(nearestScaleFloat - realScale)) nearestScaleId = scaleId;
            }
            var scalePath = "";
            var defaultScale = this.lc.getVars().get(scaleOptionsVarName + defaultScaleId);
            scalePath = nearestScaleId + "/";
            this.lc.getVars().set("skin.scalepath", scalePath);
            var RAFfps = 60;
            var targetFPSValue = this.lc.getVars().get("skin.targetfps." + nearestScaleId);
            if (targetFPSValue == null) targetFPSValue = RAFfps + "";
            this.lc.getVars().set("targetFPS", targetFPSValue);
            null;
        };
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.setTotalItemsForLoadProgress = function() {
            var totalItems = -1;
            var totalItemsString;
            var skin = this.lc.getVars().get("skin");
            var assetPack = this.lc.getVars().get("assetPack");
            if (skin != null && skin != "") {
                totalItemsString = this.lc.getVars().get("totalItems." + skin);
                totalItems = _hcmn_.Std.parseInt(totalItemsString);
            }
            if (this.lc.getVars().get("assetPack") != null) {
                totalItemsString = this.lc.getVars().get("totalItems." + assetPack);
                totalItems = _hcmn_.Std.parseInt(totalItemsString);
            }
            if (totalItems > 0)(_hcmn_.js_Boot.__cast(this.lc.getAssets(), clientkernelLoader.Assets)).setTotalItems(totalItems);
        };
        clientkernelLoader.PreloadVariablesConfigurationPlugin.prototype.__class__ = clientkernelLoader.PreloadVariablesConfigurationPlugin;
        clientkernelLoader.VariablesConfigurationPlugin = function() {};
        clientkernelLoader.VariablesConfigurationPlugin = ck_implements(clientkernelLoader.VariablesConfigurationPlugin, clientkernelLoaderApiPlugins.IConfigurationPlugin);
        clientkernelLoader.VariablesConfigurationPlugin.__interfaces__ = [clientkernelLoaderApiPlugins.IConfigurationPlugin];
        clientkernelLoader.VariablesConfigurationPlugin.__name__ = ["clientkernelLoader", "VariablesConfigurationPlugin"];
        clientkernelLoader.VariablesConfigurationPlugin.prototype.getSection = function() {
            return "variables";
        };
        clientkernelLoader.VariablesConfigurationPlugin.prototype.resolve = function(lc, config) {
            var cfg = config;
            var _g = 0;
            while (_g < cfg.length) {
                var i = cfg[_g];
                ++_g;
                lc.getVars().set(i.name, i.value);
            }
        };
        clientkernelLoader.VariablesConfigurationPlugin.prototype.__class__ = clientkernelLoader.VariablesConfigurationPlugin;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            },
            set: function(k, v) {
                return {
                    arguments: ["*", "*"],
                    returns: "void"
                };
            },
            remove: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            }
        };
        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;
        clientkernelLoader.LoaderAnimation.imagewidth = 192;;
        clientkernelLoader.LoaderAnimation.imageheight = 15;;
        clientkernelLoader.LoaderAnimation.wheels = [
            [0, 16],
            [26, 16],
            [52, 16],
            [78, 16]
        ];;
        clientkernelLoader.LoaderContext.LOADER_CHANNEL = "loader";;
        clientkernelLoader.LoaderContext.PF_KERNEL_CHANNEL = "Kernel";;
        return {
            exports: clientkernelLoader,
            activator: clientkernelLoader.Activator
        };
    });
//# sourceURL=loader.js