

window.TY = function (a) {

    // var t = arequire("../@babel/runtime/helpers/assertThisInitialized"),
    //     e = arequire("../@babel/runtime/helpers/get"),
    //     n = arequire("../@babel/runtime/helpers/getPrototypeOf"),
    //     i = arequire("../@babel/runtime/helpers/inherits"),
    //     s = arequire("../@babel/runtime/helpers/createSuper"),
    //     r = arequire("../@babel/runtime/helpers/classCallCheck"),
    //     o = arequire("../@babel/runtime/helpers/createClass");

    //#region 折叠代码
    Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {
        value: function (r, e) {
            if (null == this) throw new TypeError('"this" is null or not defined');
            var t = Object(this), n = t.length >>> 0;
            if (0 == n) return !1;
            for (var i, o, a = 0 | e, u = Math.max(0 <= a ? a : n - Math.abs(a), 0); u < n;) {
                if ((i = t[u]) === (o = r) || "number" == typeof i && "number" == typeof o && isNaN(i) && isNaN(o)) return !0;
                u++;
            }
            return !1;
        }
    });

    function _arrayLikeToArray2(r, a) {
        (null == a || a > r.length) && (a = r.length);
        for (var e = 0, n = new Array(a); e < a; e++) n[e] = r[e];
        return n;
    }

    function _arrayWithHoles2(r) {
        if (Array.isArray(r)) return r;
    }

    function _arrayWithoutHoles2(r) {
        if (Array.isArray(r)) return _arrayLikeToArray2(r);
    }

    function _assertThisInitialized2(e) {
        if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return e;
    }

    function _classCallCheck2(a, l) {
        if (!(a instanceof l)) throw new TypeError("Cannot call a class as a function");
    }

    function _construct2(t, e, r) {
        return _isNativeReflectConstruct2() ? /**/_construct2 = Reflect.construct : /**/_construct2 = function (t, e, r) {
            var o = [null];
            o.push.apply(o, e);
            var c = new (Function.bind.apply(t, o))();
            return r && _setPrototypeOf2(c, r.prototype), c;
        }, _construct2.apply(null, arguments);
    }

    function _defineProperties2(e, r) {
        for (var t = 0; t < r.length; t++) {
            var n = r[t];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
                Object.defineProperty(e, n.key, n);
        }
    }

    function _createClass2(e, r, t) {
        return r && _defineProperties2(e.prototype, r), t && _defineProperties2(e, t), e;
    }

    function _createForOfIteratorHelper2(r, e) {
        var t;
        if ("undefined" == typeof Symbol || null == r[Symbol.iterator]) {
            if (Array.isArray(r) || (t = _unsupportedIterableToArray2(r)) || e && r && "number" == typeof r.length) {
                t && (r = t);
                var n = 0, o = function () { };
                return {
                    s: o,
                    n: function () {
                        return n >= r.length ? {
                            done: !0
                        } : {
                            done: !1,
                            value: r[n++]
                        };
                    },
                    e: function (r) {
                        throw r;
                    },
                    f: o
                };
            }
            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }
        var a, u = !0, i = !1;
        return {
            s: function () {
                t = r[Symbol.iterator]();
            },
            n: function () {
                var r = t.next();
                return u = r.done, r;
            },
            e: function (r) {
                i = !0, a = r;
            },
            f: function () {
                try {
                    u || null == t.return || t.return();
                } finally {
                    if (i) throw a;
                }
            }
        };
    }

    function _createSuper2(t) {
        var e = _isNativeReflectConstruct2();
        return function () {
            var r, o = _getPrototypeOf2(t);
            if (e) {
                var s = _getPrototypeOf2(this).constructor;
                r = Reflect.construct(o, arguments, s);
            } else r = o.apply(this, arguments);
            return _possibleConstructorReturn2(this, r);
        };
    }

    function _defineProperty2(e, r, n) {
        return r in e ? Object.defineProperty(e, r, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[r] = n, e;
    }

    function _get2(e, t, r) {
        return "undefined" != typeof Reflect && Reflect.get ? /**/_get2 = Reflect.get : /**/_get2 = function (e, t, r) {
            var o = _superPropBase2(e, t);
            if (o) {
                var u = Object.getOwnPropertyDescriptor(o, t);
                return u.get ? u.get.call(r) : u.value;
            }
        }, _get2(e, t, r || e);
    }

    function _getPrototypeOf2(t) {
        return /**/_getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) {
            return t.__proto__ || Object.getPrototypeOf(t);
        }, _getPrototypeOf2(t);
    }

    function _inherits2(e, t) {
        if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
        e.prototype = Object.create(t && t.prototype, {
            constructor: {
                value: e,
                writable: !0,
                configurable: !0
            }
        }), t && _setPrototypeOf2(e, t);
    }

    function _interopRequireDefault(e) {
        return e && e.__esModule ? e : {
            default: e
        };
    }

    function _isNativeReflectConstruct2() {
        if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
        if (Reflect.construct.sham) return !1;
        if ("function" == typeof Proxy) return !0;
        try {
            return Date.prototype.toString.call(Reflect.construct(Date, [], function () { })),
                !0;
        } catch (t) {
            return !1;
        }
    }

    function _iterableToArray2(r) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) return Array.from(r);
    }

    function _iterableToArrayLimit2(r, t) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) {
            var e = [], i = !0, o = !1, l = void 0;
            try {
                for (var n, a = r[Symbol.iterator](); !(i = (n = a.next()).done) && (e.push(n.value),
                    !t || e.length !== t); i = !0);
            } catch (r) {
                o = !0, l = r;
            } finally {
                try {
                    i || null == a.return || a.return();
                } finally {
                    if (o) throw l;
                }
            }
            return e;
        }
    }

    function _nonIterableRest2() {
        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _nonIterableSpread2() {
        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _possibleConstructorReturn2(e, t) {
        return !t || "object" !== _typeof2(t) && "function" != typeof t ? _assertThisInitialized2(e) : t;
    }

    function set(e, r, t, i) {
        return (set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, i) {
            var n, o = _superPropBase2(e, r);
            if (o) {
                if ((n = Object.getOwnPropertyDescriptor(o, r)).set) return n.set.call(i, t), !0;
                if (!n.writable) return !1;
            }
            if (n = Object.getOwnPropertyDescriptor(i, r)) {
                if (!n.writable) return !1;
                n.value = t, Object.defineProperty(i, r, n);
            } else _defineProperty2(i, r, t);
            return !0;
        })(e, r, t, i);
    }

    function _set2(e, r, t, i, n) {
        if (!set(e, r, t, i || e) && n) throw new Error("failed to set property");
        return t;
    }

    function _setPrototypeOf2(t, o) {
        return /**/_setPrototypeOf2 = Object.setPrototypeOf || function (t, o) {
            return t.__proto__ = o, t;
        }, _setPrototypeOf2(t, o);
    }

    function _slicedToArray2(r, e) {
        return _arrayWithHoles2(r) || _iterableToArrayLimit2(r, e) || _unsupportedIterableToArray2(r, e) || _nonIterableRest2();
    }

    function _superPropBase2(e, r) {
        for (; !Object.prototype.hasOwnProperty.call(e, r) && null !== (e = _getPrototypeOf2(e)););
        return e;
    }

    function _toConsumableArray2(r) {
        return _arrayWithoutHoles2(r) || _iterableToArray2(r) || _unsupportedIterableToArray2(r) || nonIterableSpread();
    }

    function _typeof2(o) {
        return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? /**/_typeof2 = function (o) {
            return typeof o;
        } : /**/_typeof2 = function (o) {
            return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
        }, _typeof2(o);
    }

    function _unsupportedIterableToArray2(r, e) {
        if (r) {
            if ("string" == typeof r) return _arrayLikeToArray2(r, e);
            var t = Object.prototype.toString.call(r).slice(8, -1);
            return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray2(r, e) : void 0;
        }
    }

    var _regeneratorRequire;

    !function (t) {
        "use strict";
        _regeneratorRequire = {}
        var r, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol :
            {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator",
            c = o.toStringTag || "@@toStringTag", u = "object" == typeof module,
            h = t.regeneratorRuntime;
        if (h) u && (_regeneratorRequire = h);
        else {
            (h = t.regeneratorRuntime = _regeneratorRequire).wrap = w;
            var f = "suspendedStart", s = "suspendedYield", l = "executing", p = "completed", y = {}, v = {};
            v[i] = function () {
                return this;
            };
            var d = Object.getPrototypeOf, g = d && d(d(P([])));
            g && g !== e && n.call(g, i) && (v = g);
            var m = b.prototype = x.prototype = Object.create(v);
            E.prototype = m.constructor = b, b.constructor = E, b[c] = E.displayName = "GeneratorFunction",
                h.isGeneratorFunction = function (t) {
                    var r = "function" == typeof t && t.constructor;
                    return !!r && (r === E || "GeneratorFunction" === (r.displayName || r.name));
                }, h.mark = function (t) {
                    return Object.setPrototypeOf ? Object.setPrototypeOf(t, b) : (t.__proto__ = b, c in t || (t[c] = "GeneratorFunction")),
                        t.prototype = Object.create(m), t;
                }, h.awrap = function (t) {
                    return {
                        __await: t
                    };
                }, _(j.prototype), j.prototype[a] = function () {
                    return this;
                }, h.AsyncIterator = j, h.async = function (t, r, e, n) {
                    var o = new j(w(t, r, e, n));
                    return h.isGeneratorFunction(r) ? o : o.next().then(function (t) {
                        return t.done ? t.value : o.next();
                    });
                }, _(m), m[c] = "Generator", m[i] = function () {
                    return this;
                }, m.toString = function () {
                    return "[object Generator]";
                }, h.keys = function (t) {
                    var r = [];
                    for (var e in t) r.push(e);
                    return r.reverse(), function e() {
                        for (; r.length;) {
                            var n = r.pop();
                            if (n in t) return e.value = n, e.done = !1, e;
                        }
                        return e.done = !0, e;
                    };
                }, h.values = P, N.prototype = {
                    constructor: N,
                    reset: function (t) {
                        if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null,
                            this.method = "next", this.arg = r, this.tryEntries.forEach(G), !t) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r);
                    },
                    stop: function () {
                        this.done = !0;
                        var t = this.tryEntries[0].completion;
                        if ("throw" === t.type) throw t.arg;
                        return this.rval;
                    },
                    dispatchException: function (t) {
                        if (this.done) throw t;
                        var e = this;
                        function o(n, o) {
                            return c.type = "throw", c.arg = t, e.next = n, o && (e.method = "next", e.arg = r),
                                !!o;
                        }
                        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
                            var a = this.tryEntries[i], c = a.completion;
                            if ("root" === a.tryLoc) return o("end");
                            if (a.tryLoc <= this.prev) {
                                var u = n.call(a, "catchLoc"), h = n.call(a, "finallyLoc");
                                if (u && h) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                } else if (u) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                } else {
                                    if (!h) throw new Error("try statement without catch or finally");
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                }
                            }
                        }
                    },
                    abrupt: function (t, r) {
                        for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                            var o = this.tryEntries[e];
                            if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
                                var i = o;
                                break;
                            }
                        }
                        i && ("break" === t || "continue" === t) && i.tryLoc <= r && r <= i.finallyLoc && (i = null);
                        var a = i ? i.completion : {};
                        return a.type = t, a.arg = r, i ? (this.method = "next", this.next = i.finallyLoc,
                            y) : this.complete(a);
                    },
                    complete: function (t, r) {
                        if ("throw" === t.type) throw t.arg;
                        return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
                            this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r),
                            y;
                    },
                    finish: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.finallyLoc === t) return this.complete(e.completion, e.afterLoc), G(e), y;
                        }
                    },
                    catch: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.tryLoc === t) {
                                var n = e.completion;
                                if ("throw" === n.type) {
                                    var o = n.arg;
                                    G(e);
                                }
                                return o;
                            }
                        }
                        throw new Error("illegal catch attempt");
                    },
                    delegateYield: function (t, e, n) {
                        return this.delegate = {
                            iterator: P(t),
                            resultName: e,
                            nextLoc: n
                        }, "next" === this.method && (this.arg = r), y;
                    }
                };
        }
        function w(t, r, e, n) {
            var o = r && r.prototype instanceof x ? r : x, i = Object.create(o.prototype), a = new N(n || []);
            return i._invoke = function (t, r, e) {
                var n = f;
                return function (o, i) {
                    if (n === l) throw new Error("Generator is already running");
                    if (n === p) {
                        if ("throw" === o) throw i;
                        return F();
                    }
                    for (e.method = o, e.arg = i; ;) {
                        var a = e.delegate;
                        if (a) {
                            var c = O(a, e);
                            if (c) {
                                if (c === y) continue;
                                return c;
                            }
                        }
                        if ("next" === e.method) e.sent = e._sent = e.arg; else if ("throw" === e.method) {
                            if (n === f) throw n = p, e.arg;
                            e.dispatchException(e.arg);
                        } else "return" === e.method && e.abrupt("return", e.arg);
                        n = l;
                        var u = L(t, r, e);
                        if ("normal" === u.type) {
                            if (n = e.done ? p : s, u.arg === y) continue;
                            return {
                                value: u.arg,
                                done: e.done
                            };
                        }
                        "throw" === u.type && (n = p, e.method = "throw", e.arg = u.arg);
                    }
                };
            }(t, e, a), i;
        }
        function L(t, r, e) {
            try {
                return {
                    type: "normal",
                    arg: t.call(r, e)
                };
            } catch (t) {
                return {
                    type: "throw",
                    arg: t
                };
            }
        }
        function x() { }
        function E() { }
        function b() { }
        function _(t) {
            ["next", "throw", "return"].forEach(function (r) {
                t[r] = function (t) {
                    return this._invoke(r, t);
                };
            });
        }
        function j(t) {
            var r;
            this._invoke = function (e, o) {
                function i() {
                    return new Promise(function (r, i) {
                        !function r(e, o, i, a) {
                            var c = L(t[e], t, o);
                            if ("throw" !== c.type) {
                                var u = c.arg, h = u.value;
                                return h && "object" == typeof h && n.call(h, "__await") ? Promise.resolve(h.__await).then(function (t) {
                                    r("next", t, i, a);
                                }, function (t) {
                                    r("throw", t, i, a);
                                }) : Promise.resolve(h).then(function (t) {
                                    u.value = t, i(u);
                                }, function (t) {
                                    return r("throw", t, i, a);
                                });
                            }
                            a(c.arg);
                        }(e, o, r, i);
                    });
                }
                return r = r ? r.then(i, i) : i();
            };
        }
        function O(t, e) {
            var n = t.iterator[e.method];
            if (n === r) {
                if (e.delegate = null, "throw" === e.method) {
                    if (t.iterator.return && (e.method = "return", e.arg = r, O(t, e), "throw" === e.method)) return y;
                    e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method");
                }
                return y;
            }
            var o = L(n, t.iterator, e.arg);
            if ("throw" === o.type) return e.method = "throw", e.arg = o.arg, e.delegate = null,
                y;
            var i = o.arg;
            return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next",
                e.arg = r), e.delegate = null, y) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"),
                    e.delegate = null, y);
        }
        function k(t) {
            var r = {
                tryLoc: t[0]
            };
            1 in t && (r.catchLoc = t[1]), 2 in t && (r.finallyLoc = t[2], r.afterLoc = t[3]),
                this.tryEntries.push(r);
        }
        function G(t) {
            var r = t.completion || {};
            r.type = "normal", delete r.arg, t.completion = r;
        }
        function N(t) {
            this.tryEntries = [{
                tryLoc: "root"
            }], t.forEach(k, this), this.reset(!0);
        }
        function P(t) {
            if (t) {
                var e = t[i];
                if (e) return e.call(t);
                if ("function" == typeof t.next) return t;
                if (!isNaN(t.length)) {
                    var o = -1, a = function e() {
                        for (; ++o < t.length;) if (n.call(t, o)) return e.value = t[o], e.done = !1, e;
                        return e.value = r, e.done = !0, e;
                    };
                    return a.next = a;
                }
            }
            return {
                next: F
            };
        }
        function F() {
            return {
                value: r,
                done: !0
            };
        }
    }(function () {
        return this || "object" == typeof self && self;
    });

    var _regenerator = _interopRequireDefault(_regeneratorRequire);
    //#endregion

    var t = _assertThisInitialized2,
        e = _get2,
        n = _getPrototypeOf2,
        i = _inherits2,
        s = _createSuper2,
        r = _classCallCheck2,
        o = _createClass2;

    var u, h = function () {
        function t(e, n) {
            r(this, t), this.type = e, this.data = n;
        }
        return o(t, [{
            key: "stopImmediatePropagation",
            value: function () {
                this.isPropagationImmediateStopped = !0;
            }
        }, {
            key: "clean",
            value: function () {
                this.data = null, this.isPropagationImmediateStopped = !1;
            }
        }], [{
            key: "create",
            value: function (t, e) {
                var n;
                if (t.hasOwnProperty("eventPool") && (n = t.eventPool), n || (n = t.eventPool = []),
                    n.length) {
                    var i = n.pop();
                    return i.type = e, i;
                }
                return new t(e);
            }
        }, {
            key: "dispatchEvent",
            value: function (e, n, i) {
                var s = t.create(t, n);
                s.data = i, e.dispatchEvent(s), t.release(s);
            }
        }, {
            key: "release",
            value: function (t) {
                t.clean(), Object.getPrototypeOf(t).constructor.eventPool.push(t);
            }
        }]), t;
    }(), l = function () {
        function t() {
            r(this, t), this.dicEventListener = new Map(), this.onceList = new Array();
        }
        return o(t, [{
            key: "on",
            value: function (t, e, n, i, s) {
                var r;
                return this.hasEventListener(t) ? r = this.dicEventListener.get(t) : (r = new Array(),
                    this.dicEventListener.set(t, r)), this.insertEventBin(r, t, e, n, i, !!s), this;
            }
        }, {
            key: "once",
            value: function (t, e, n, i) {
                return this.on(t, e, n, i, !0), this;
            }
        }, {
            key: "off",
            value: function (t, e, n) {
                return this.removeListener(t, e, n), this;
            }
        }, {
            key: "offAll",
            value: function (t) {
                return t && this.hasEventListener(t) ? this.dicEventListener.delete(t) : this.dicEventListener.clear(),
                    this;
            }
        }, {
            key: "offAllCaller",
            value: function (t) {
                var e = new Array();
                this.dicEventListener.forEach(function (n) {
                    for (var i = 0; i < n.length; i++) {
                        var s = n[i];
                        s.thisObject == t && e.push(s);
                    }
                });
                for (var n = 0; n < e.length; n++) {
                    var i = e[n];
                    this.removeListener(i.type, i.listener, i.thisObject);
                }
                return this;
            }
        }, {
            key: "hasEventListener",
            value: function (t) {
                return this.dicEventListener.has(t);
            }
        }, {
            key: "dispatchEvent",
            value: function (t) {
                t.sender = this, this.notifyListener(t);
            }
        }, {
            key: "dispatchEventWith",
            value: function (t, e) {
                if (this.hasEventListener(t)) {
                    var n = h.create(h, t);
                    n.data = e, this.dispatchEvent(n), h.release(n);
                }
                return !0;
            }
        }, {
            key: "insertEventBin",
            value: function (t, e, n, i, s, r) {
                s = 0 | +s;
                for (var o = -1, a = t.length, u = 0; u < a; u++) {
                    var h = t[u];
                    if (h.listener == n && h.thisObject == i && h.target == this) return !1;
                    -1 == o && h.priority < s && (o = u);
                }
                var l = {
                    type: e,
                    listener: n,
                    thisObject: i,
                    priority: s,
                    target: this,
                    dispatchOnce: !!r
                };
                return -1 !== o ? t.splice(o, 0, l) : t.push(l), !0;
            }
        }, {
            key: "removeListener",
            value: function (t, e, n) {
                this.hasEventListener(t) && this.removeEventBin(this.dicEventListener.get(t), e, n);
            }
        }, {
            key: "removeEventBin",
            value: function (t, e, n) {
                for (var i = t.length, s = 0; s < i; s++) {
                    var r = t[s];
                    if (r.listener == e && r.thisObject == n && r.target == this) return t.splice(s, 1),
                        !0;
                }
                return !1;
            }
        }, {
            key: "notifyListener",
            value: function (t) {
                var e = this.dicEventListener.get(t.type);
                if (e && 0 != e.length) {
                    this.curNeedDispatcherListeners || (this.curNeedDispatcherListeners = []);
                    for (var n = 0; n < e.length;) {
                        var i = e[n];
                        null != i && (i.dispatchOnce && this.onceList.push(i), this.curNeedDispatcherListeners.push(i),
                            n++);
                    }
                    for (; this.curNeedDispatcherListeners.length > 0;) {
                        var s = this.curNeedDispatcherListeners.shift();
                        null != s && s.listener.call(s.thisObject, t);
                    }
                    for (; this.onceList.length;) {
                        var r = this.onceList.pop();
                        r.target.off(r.type, r.listener, r.thisObject);
                    }
                }
            }
        }]), t;
    }(), c = Object.freeze({
        __proto__: null,
        EventArgs: h,
        EventDispatcher: l
    }), v = function () {
        function t() {
            r(this, t), this.bindings = new Map(), this.instances = new Map(), this.aliases = new Map(),
                this.aliasesReverse = new Map(), this.resolving = new Array(), this.afterResloving = new Array(),
                this.resolved = new Array(), this.buildStack = [], this.releaseListeners = new Array(),
                this.instancesReverse = new Map();
        }
        return o(t, [{
            key: "bindByConcrete",
            value: function (t, e, n) {
                if (t = this.formatService(t), this.bindings.has(t)) throw new Error("绑定 [".concat(t, "] 已经存在"));
                if (this.instances.has(t)) throw new Error("实例 [".concat(t, "] 已经存在"));
                if (this.aliases.has(t)) throw new Error("别名 [".concat(t, "] 已经存在"));
                var i = new f(this, t, e, n);
                return this.bindings.set(t, i), this.isResolved(t) ? (this.make(t), i) : i;
            }
        }, {
            key: "bind",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
                return this.bindByConcrete(t, function () {
                    return e ? new e() : null;
                }, n);
            }
        }, {
            key: "onResolving",
            value: function (t) {
                return this.resolving.push(t), this;
            }
        }, {
            key: "onAfterResolving",
            value: function (t) {
                return this.afterResloving.push(t), this;
            }
        }, {
            key: "aliasToService",
            value: function (t) {
                return t = this.formatService(t), this.aliases.has(t) ? this.aliases.get(t) : t;
            }
        }, {
            key: "build",
            value: function (t) {
                if (t.concrete) {
                    for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) n[i - 1] = arguments[i];
                    var s = t.concrete.apply(t, [this].concat(n));
                    return this.inject(s);
                }
                throw new Error("构建服务".concat(t, "失败因为没有创建函数"));
            }
        }, {
            key: "inject",
            value: function (t) {
                var e = t.needServices, n = t.onServiceSet;
                if (e && n) {
                    for (var i = [], s = 0; s < e.length; s++) {
                        var r = e[s];
                        if (this.canMake(r)) {
                            var o = this.make(r);
                            i.push(o);
                        } else i.push(null);
                    }
                    n.apply(t, i);
                }
                return t;
            }
        }, {
            key: "formatService",
            value: function (t) {
                return t.trim();
            }
        }, {
            key: "triggerOnResolving",
            value: function (t, e) {
                return e = t.triggerResolving(e), t.triggerAfterResolving(e);
            }
        }, {
            key: "triggerOnRelease",
            value: function (e, n) {
                t.trigger(e, n, this.releaseListeners);
            }
        }, {
            key: "unbindByData",
            value: function (t) {
                var e = this;
                this.release(t.serivice), this.aliasesReverse.has(t.serivice) && (this.aliasesReverse.get(t.serivice).forEach(function (t) {
                    e.aliases.delete(t);
                }), this.aliasesReverse.delete(t.serivice)), this.bindings.delete(t.serivice);
            }
        }, {
            key: "getBind",
            value: function (t) {
                return t ? (t = this.aliasToService(t), this.bindings.has(t) ? this.bindings.get(t) : null) : null;
            }
        }, {
            key: "hasBind",
            value: function (t) {
                return null != this.getBind(t);
            }
        }, {
            key: "hasInstance",
            value: function (t) {
                return t = this.aliasToService(t), this.instances.has(t);
            }
        }, {
            key: "isResolved",
            value: function (t) {
                return t = this.aliasToService(t), -1 != this.resolved.indexOf(t) || this.instances.has(t);
            }
        }, {
            key: "canMake",
            value: function (t) {
                return this.hasBind(t) || this.hasInstance(t);
            }
        }, {
            key: "isSingleton",
            value: function (t) {
                var e = this.getBind(t);
                return null != e && e.isSingleton;
            }
        }, {
            key: "isAlias",
            value: function (t) {
                return t = this.formatService(t), this.aliases.has(t);
            }
        }, {
            key: "unBind",
            value: function (t) {
                t = this.aliasToService(t);
                var e = this.getBind(t);
                e && e.unBind();
            }
        }, {
            key: "instance",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
                t = this.aliasToService(t);
                var i = this.getBind(t);
                if (null != i) {
                    if (!i.isSingleton) throw new Error("服务 [".concat(i.serivice, "] 不是单例服务无法注册实例为服务对象"));
                } else i = new f(this, t, null, !0);
                return this.instances.set(t, e), n && (e = this.inject(e)), e = this.triggerOnResolving(i, e),
                    this.release(t), this.instances.set(t, e), null != e && this.instancesReverse.set(e, t),
                    e;
            }
        }, {
            key: "make",
            value: function (t) {
                if (t = this.aliasToService(t), this.instances.has(t)) return this.instances.get(t);
                if (-1 != this.buildStack.indexOf(t)) throw new Error("递归创建服务实例");
                this.buildStack.push(t);
                try {
                    var e = this.getBind(t);
                    if (null == e) throw new Error("服务没有注册[".concat(t, "]"));
                    for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++) i[s - 1] = arguments[s];
                    var r = this.build(e, i);
                    return e.isSingleton ? this.instance(t, r) : this.triggerOnResolving(e, r), this.resolved.push(e.serivice),
                        r;
                } finally {
                    this.buildStack.shift();
                }
            }
        }, {
            key: "release",
            value: function (t) {
                if (!t) return !1;
                var e, n = null;
                if ("string" == typeof t ? (e = this.aliasToService(t), this.instances.has(e) ? n = this.instances.get(e) : e = this.instancesReverse.has(t) ? this.instancesReverse.get(t) : null) : e = this.instancesReverse.has(t) ? this.instancesReverse.get(t) : null,
                    null == n && e && this.instances.has(e) && (n = this.instances.get(e)), null == n || !e) return !1;
                var i = this.getBind(e);
                return i || new f(this, e, null, !0), this.triggerOnRelease(i, n), this.instancesReverse.delete(n),
                    this.instances.delete(e), n = null, !0;
            }
        }, {
            key: "alias",
            value: function (t, e) {
                if (t == e) throw new Error("别名和服务名称不能一样 service:".concat(t));
                if (t = this.formatService(t), e = this.aliasToService(e), null != this.instances.get(t) && console.warn("试图设置一个别名 和已经存在的服务名称一致 可能会导致获取服务时得到不是是预想的服务"),
                    this.aliases.has(t)) throw new Error("别名已经存在不能重复 alias:".concat(t));
                if (this.bindings.has(t)) throw new Error("别名已经被绑定为服务 alias:".concat(t));
                this.aliases.set(t, e);
                var n = this.aliasesReverse.has(e) ? this.aliasesReverse.get(e) : null;
                return n || (n = [], this.aliasesReverse.set(e, n)), n.push(t), this;
            }
        }, {
            key: "onRelease",
            value: function (t) {
                return this.releaseListeners.push(t), this;
            }
        }, {
            key: "flush",
            value: function () {
                var t = this;
                try {
                    this.instances.forEach(function (e) {
                        t.release(e);
                    }), this.instances.clear(), this.releaseListeners.length = 0, this.aliases.clear(),
                        this.aliasesReverse.clear(), this.bindings.clear(), this.resolving.length = 0, this.releaseListeners.length = 0,
                        this.buildStack.length = 0;
                } catch (t) { }
            }
        }], [{
            key: "trigger",
            value: function (t, e, n) {
                return n && n.forEach(function (n) {
                    n(t, e);
                }), e;
            }
        }]), t;
    }(), f = function () {
        function t(e, n, i, s) {
            r(this, t), this.isDestroy = !1, this.container = e, this.concrete = i, this.isSingleton = s,
                this.mSerivice = n;
        }
        return o(t, [{
            key: "serivice",
            get: function () {
                return this.mSerivice;
            }
        }, {
            key: "alias",
            value: function (t) {
                return this.container.alias(t, this.mSerivice), this;
            }
        }, {
            key: "onResolving",
            value: function (t) {
                return this.resolving || (this.resolving = []), -1 == this.resolving.findIndex(function (e) {
                    return e == t;
                }) && this.resolving.push(t), this;
            }
        }, {
            key: "onAfterResolving",
            value: function (t) {
                return this.afterResolving || (this.afterResolving = []), -1 == this.afterResolving.findIndex(function (e) {
                    return e == t;
                }) && this.afterResolving.push(t), this;
            }
        }, {
            key: "onRelease",
            value: function (t) {
                return this.releaseListener || (this.releaseListener = []), -1 == this.releaseListener.findIndex(function (e) {
                    return e == t;
                }) && this.releaseListener.push(t), this;
            }
        }, {
            key: "triggerResolving",
            value: function (t) {
                return v.trigger(this, t, this.resolving);
            }
        }, {
            key: "triggerAfterResolving",
            value: function (t) {
                return v.trigger(this, t, this.afterResolving);
            }
        }, {
            key: "triggerRelease",
            value: function (t) {
                return v.trigger(this, t, this.releaseListener);
            }
        }, {
            key: "unBind",
            value: function () {
                this.isDestroy = !0, this.releaseBind();
            }
        }, {
            key: "releaseBind",
            value: function () {
                this.container.unbindByData(this);
            }
        }]), t;
    }(), d = Object.freeze({
        __proto__: null,
        BindData: f,
        Container: v
    });
    !function (t) {
        t[t.None = 0] = "None", t[t.Running = 1] = "Running", t[t.Success = 2] = "Success";
    }(u || (u = {}));
    var p = function () {
        function t() {
            r(this, t), this.state = u.None, this.mProgress = 0;
        }
        return o(t, [{
            key: "progress",
            get: function () {
                return this.mProgress;
            }
        }, {
            key: "isRunning",
            get: function () {
                return this.state == u.Running;
            }
        }, {
            key: "reset",
            value: function () {
                this.state = u.None;
            }
        }, {
            key: "stop",
            value: function () {
                this.state = u.None;
            }
        }, {
            key: "onStart",
            value: function (t) {
                return this.startListener || (this.startListener = []), this.startListener.includes(t) || this.startListener.push(t),
                    this;
            }
        }, {
            key: "onComplete",
            value: function (t) {
                return this.completeListener || (this.completeListener = []), this.completeListener.includes(t) || this.completeListener.push(t),
                    this;
            }
        }, {
            key: "onUpdate",
            value: function (t) {
                return this.updateListener || (this.updateListener = []), this.updateListener.includes(t) || this.updateListener.push(t),
                    this;
            }
        }, {
            key: "onException",
            value: function (t) {
                return this.exceptionListener || (this.exceptionListener = []), this.exceptionListener.includes(t) || this.exceptionListener.push(t),
                    this;
            }
        }, {
            key: "onProcess",
            value: function (t) {
                return this.state;
            }
        }, {
            key: "process",
            value: function (t) {
                this.state == u.None && this.start();
                try {
                    if (this.state = this.onProcess(t), this.updateListener) for (var e = 0; e < this.updateListener.length; e++) (0,
                        this.updateListener[e])(this.progress);
                    this.state == u.Success && (this.mProgress = 1, this.callCompleteListener(this.state));
                } catch (t) {
                    t = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(t);
                    this.callExceptionListener(t), console.error("error:", t);
                }
                return this.state;
            }
        }, {
            key: "run",
            value: function (t) {
                this.reset(), t.run(this);
            }
        }, {
            key: "callStartListener",
            value: function (t) {
                if (this.startListener) for (var e = 0; e < this.startListener.length; e++) (0,
                    this.startListener[e])(t);
            }
        }, {
            key: "callExceptionListener",
            value: function (t) {
                if (this.exceptionListener) for (var e = 0; e < this.exceptionListener.length; e++) (0,
                    this.exceptionListener[e])(t);
            }
        }, {
            key: "callCompleteListener",
            value: function (t) {
                if (this.completeListener) for (var e = 0; e < this.completeListener.length; e++) (0,
                    this.completeListener[e])(t);
            }
        }, {
            key: "start",
            value: function () {
                this.reset(), this.state = u.Running, this.mProgress = 0, this.onTaskStart(), this.callStartListener(this.state);
            }
        }, {
            key: "finish",
            value: function () {
                this.mProgress = 1, this.state = u.Success;
            }
        }, {
            key: "onTaskStart",
            value: function () { }
        }]), t;
    }(), g = function (t) {
        i(n, t);
        var e = s(n);
        function n() {
            var t, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
            return r(this, n), (t = e.call(this)).taskName = i, t.state = u.None, t.rawList = [],
                t.finishList = [], t.curRunTask = [], t;
        }
        return o(n, [{
            key: "currentTask",
            get: function () {
                return this.curRunTask;
            }
        }, {
            key: "progress",
            get: function () {
                if (this.state == u.Success) return 1;
                if (this.state == u.None) return 0;
                for (var t = this.finishList.length, e = 0; e < this.curRunTask.length; e++) t += this.curRunTask[e].progress;
                return t / this.rawList.length;
            }
        }, {
            key: "onProcess",
            value: function (t) {
                return this.runTasksAndCheckIfDone(t);
            }
        }, {
            key: "isRunning",
            get: function () {
                return this.state == u.Running;
            }
        }, {
            key: "addTask",
            value: function (t) {
                return this.rawList.push(t), this;
            }
        }, {
            key: "clear",
            value: function () {
                this.finishList.length = 0, this.rawList.length = 0, this.state = u.None;
            }
        }, {
            key: "reset",
            value: function () {
                this.finishList.length = 0, this.currentTask.length = 0, this.state = u.None, this.rawList.forEach(function (t) {
                    t.reset();
                });
            }
        }, {
            key: "stop",
            value: function () {
                this.finishList.length = 0, this.state = u.None;
                for (var t = 0; t < this.curRunTask.length; t++) this.curRunTask[t].stop();
                this.curRunTask.length = 0;
            }
        }]), n;
    }(p), y = o(function t() {
        r(this, t);
    }), _ = Object.freeze({
        __proto__: null,
        ParallelTaskCollection: function (t) {
            i(h, t);
            var a = s(h);
            function h() {
                var t;
                return r(this, h), (t = a.apply(this, arguments)).currentIndex = 0, t.parallelnum = 3,
                    t;
            }
            return o(h, [{
                key: "runTasksAndCheckIfDone",
                value: function (t) {
                    for (var e = u.Running, n = 0; n < this.currentTask.length; n++) {
                        var i = this.currentTask[n];
                        i.process(t) == u.Success && (this.currentTask.splice(n, 1), n--, this.finishList.push(i));
                    }
                    if (this.finishList.length >= this.rawList.length) e = u.Success; else if (this.curRunTask.length < this.parallelnum && this.currentIndex < this.rawList.length) for (var s = this.parallelnum - this.curRunTask.length, r = 0; r < s; r++) this.currentIndex < this.rawList.length && (this.curRunTask.push(this.rawList[this.currentIndex]),
                        this.currentIndex += 1);
                    return e;
                }
            }, {
                key: "reset",
                value: function () {
                    e(n(h.prototype), "reset", this).call(this), this.currentIndex = 0;
                }
            }, {
                key: "stop",
                value: function () {
                    e(n(h.prototype), "stop", this).call(this), this.currentIndex = 0;
                }
            }, {
                key: "clear",
                value: function () {
                    e(n(h.prototype), "clear", this).call(this), this.currentIndex = 0;
                }
            }]), h;
        }(g),
        SerialTaskCollection: function (t) {
            i(h, t);
            var a = s(h);
            function h() {
                var t;
                return r(this, h), (t = a.apply(this, arguments)).currentIndex = 0, t;
            }
            return o(h, [{
                key: "runTasksAndCheckIfDone",
                value: function (t) {
                    var e = u.Running;
                    if (this.rawList.length > 0) if (this.finishList.length == this.rawList.length) e = u.Success; else {
                        0 == this.curRunTask.length && this.curRunTask.push(this.rawList[this.currentIndex]);
                        var n = this.curRunTask[0];
                        n.process(t) == u.Success && (this.finishList.push(n), this.curRunTask.shift(),
                            this.currentIndex++);
                    } else e = u.Success;
                    return e;
                }
            }, {
                key: "reset",
                value: function () {
                    e(n(h.prototype), "reset", this).call(this), this.currentIndex = 0;
                }
            }, {
                key: "stop",
                value: function () {
                    e(n(h.prototype), "stop", this).call(this), this.currentIndex = 0;
                }
            }, {
                key: "clear",
                value: function () {
                    e(n(h.prototype), "clear", this).call(this), this.currentIndex = 0;
                }
            }]), h;
        }(g),
        TaskCollection: g,
        FlushingOperation: y,
        Process: function () {
            function t(e, n, i, s) {
                r(this, t), this.name = e, this.coroutines = n, this.readyTask = i, this.flushingOperation = s;
            }
            return o(t, [{
                key: "process",
                value: function (t) {
                    var e = !1;
                    if (this.flushingOperation.kill) e = !0; else {
                        for (var n = 0; n < this.readyTask.length; n++) this.coroutines.push(this.readyTask.shift());
                        if (0 == this.coroutines.length || this.flushingOperation.paused) e = !1; else {
                            var i = 0, s = !1;
                            do {
                                this.coroutines[i].process(t) == u.Success ? this.coroutines.splice(i, 1) : i++,
                                    s = 0 == this.coroutines.length || i >= this.coroutines.length;
                            } while (!s);
                        }
                    }
                    return e ? u.Success : u.Running;
                }
            }]), t;
        }(),
        Runner: function () {
            function t() {
                r(this, t), this.coroutines = [], this.readyTask = [], this.flushingOperation = new y();
            }
            return o(t, [{
                key: "isPaused",
                get: function () {
                    return this.flushingOperation.paused;
                },
                set: function (t) {
                    this.flushingOperation.paused = t;
                }
            }, {
                key: "isKilled",
                get: function () {
                    return this.flushingOperation.kill;
                }
            }, {
                key: "runningTaskNum",
                get: function () {
                    return this.coroutines.length;
                }
            }, {
                key: "needRunTaskNum",
                get: function () {
                    return this.readyTask.length;
                }
            }, {
                key: "run",
                value: function (t) {
                    this.readyTask.push(t);
                }
            }, {
                key: "stopAllTask",
                value: function () {
                    this.readyTask.length = 0, this.coroutines.forEach(function (t) {
                        t.stop();
                    }), this.coroutines.length = 0;
                }
            }, {
                key: "stopTask",
                value: function (t) {
                    var e = this.coroutines.indexOf(t);
                    -1 != e && (t.stop(), this.coroutines.splice(e, 1));
                }
            }, {
                key: "shutDown",
                value: function () {
                    this.isPaused = !1, this.flushingOperation.kill = !0, this.stopAllTask();
                }
            }]), t;
        }(),
        SyncRunner: function () {
            function t() {
                r(this, t);
            }
            return o(t, [{
                key: "shutDown",
                value: function () {
                    throw new Error("Method not implemented.");
                }
            }, {
                key: "stopAllTask",
                value: function () { }
            }, {
                key: "stopTask",
                value: function (t) { }
            }, {
                key: "isStoping",
                get: function () {
                    return !1;
                }
            }, {
                key: "isKilled",
                get: function () {
                    return !1;
                }
            }, {
                key: "runningTaskNum",
                get: function () {
                    return 0;
                }
            }, {
                key: "needRunTaskNum",
                get: function () {
                    return 0;
                }
            }, {
                key: "run",
                value: function (t) {
                    var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1, n = Date.now(), i = !1;
                    do {
                        i = t.process(0) == u.Success || e > 0 && Date.now() - n >= e;
                    } while (!i);
                }
            }, {
                key: "stopAll",
                value: function () {
                    throw new Error("Method not implemented.");
                }
            }]), t;
        }(),
        LoopTask: function () {
            function t(e) {
                var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
                r(this, t), this.updateFun = e, this.passTime = 0, this.intervalTime = n;
            }
            return o(t, [{
                key: "reset",
                value: function () { }
            }, {
                key: "stop",
                value: function () {
                    this.updateFun = null;
                }
            }, {
                key: "onComplete",
                value: function (t) {
                    return this;
                }
            }, {
                key: "onUpdate",
                value: function (t) {
                    throw new Error("Method not implemented.");
                }
            }, {
                key: "onException",
                value: function (t) {
                    throw new Error("Method not implemented.");
                }
            }, {
                key: "run",
                value: function (t) {
                    t.run(this);
                }
            }, {
                key: "process",
                value: function (t) {
                    return this.updateFun ? (0 == this.intervalTime ? this.updateFun(t) : (this.passTime = this.passTime + t,
                        this.passTime >= this.intervalTime && (this.updateFun(this.passTime), this.passTime = 0)),
                        u.Running) : u.Success;
                }
            }]), t;
        }(),
        DelayTask: function () {
            function t(e, n) {
                r(this, t), this.passTime = 0, this.isStop = !1, this.delayTime = e, this.endFun = n;
            }
            return o(t, [{
                key: "onComplete",
                value: function (t) {
                    return this;
                }
            }, {
                key: "onUpdate",
                value: function (t) {
                    throw new Error("Method not implemented.");
                }
            }, {
                key: "onException",
                value: function (t) {
                    throw new Error("Method not implemented.");
                }
            }, {
                key: "run",
                value: function (t) {
                    t.run(this);
                }
            }, {
                key: "process",
                value: function (t) {
                    return this.isStop ? u.Success : (this.passTime = this.passTime + t, this.passTime >= this.delayTime ? (this.endFun && (this.endFun(),
                        this.endFun = null), u.Success) : u.Running);
                }
            }, {
                key: "reset",
                value: function () {
                    this.isStop = !1, this.passTime = 0;
                }
            }, {
                key: "stop",
                value: function () {
                    this.isStop = !0;
                }
            }]), t;
        }(),
        Task: p,
        get Status() {
            return u;
        }
    }), k = function () {
        function t() {
            r(this, t), this.isStateMachine = !1, this.time = 0, this.needExitTime = !1;
        }
        return o(t, [{
            key: "elapsedTime",
            get: function () {
                return this.time;
            }
        }, {
            key: "init",
            value: function () { }
        }, {
            key: "onEnter",
            value: function (t, e) {
                this.time = 0;
            }
        }, {
            key: "onExit",
            value: function (t, e) { }
        }, {
            key: "onUpdate",
            value: function (t) {
                this.time += t;
            }
        }, {
            key: "requestExit",
            value: function () { }
        }]), t;
    }(), m = function (t) {
        i(u, t);
        var a = s(u);
        function u() {
            var t, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, o = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
            return r(this, u), (t = a.call(this)).needExitTime = o, t.onEnterFunc = e, t.onUpdateFunc = n,
                t.onExitFunc = i, t.canExitFunc = s, t;
        }
        return o(u, [{
            key: "onEnter",
            value: function (t, i) {
                e(n(u.prototype), "onEnter", this).call(this, t, i), this.onEnterFunc && this.onEnterFunc(this, t, i);
            }
        }, {
            key: "onExit",
            value: function (t, i) {
                e(n(u.prototype), "onExit", this).call(this, t, i), this.onExitFunc && this.onExitFunc(this, t, i);
            }
        }, {
            key: "onUpdate",
            value: function (t) {
                e(n(u.prototype), "onUpdate", this).call(this, t), this.onUpdateFunc && this.onUpdateFunc(this, t);
            }
        }, {
            key: "requestExit",
            value: function () {
                (!this.needExitTime || this.canExitFunc && this.canExitFunc(this)) && this.fsm.stateCanExit();
            }
        }]), u;
    }(k), T = function () {
        function t(e, n) {
            var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
            r(this, t), this.from = e, this.to = n, this.forceInstantly = i, this.data = s;
        }
        return o(t, [{
            key: "init",
            value: function () { }
        }, {
            key: "onEnter",
            value: function () { }
        }, {
            key: "shouldTransition",
            value: function () {
                return !0;
            }
        }]), t;
    }(), w = function (t) {
        i(u, t);
        var a = s(u);
        function u(t, e, n) {
            var i, s = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null;
            return r(this, u), (i = a.call(this, t, e, s, o)).condition = n, i;
        }
        return o(u, [{
            key: "shouldTransition",
            value: function () {
                return this.condition ? this.condition(this) : e(n(u.prototype), "shouldTransition", this).call(this);
            }
        }]), u;
    }(T), E = function () {
        function t() {
            r(this, t);
        }
        return o(t, [{
            key: "addTransition",
            value: function (t) {
                this.transitions || (this.transitions = []), -1 == this.transitions.indexOf(t) && this.transitions.push(t);
            }
        }, {
            key: "addTriggerTransition",
            value: function (t, e) {
                var n;
                this.triggerToTransitions || (this.triggerToTransitions = new Map()), this.triggerToTransitions.has(t) ? n = this.triggerToTransitions.get(t) : (n = [],
                    this.triggerToTransitions.set(t, n)), -1 == n.indexOf(e) && n.push(e);
            }
        }]), t;
    }(), A = Object.freeze({
        __proto__: null,
        StateBase: k,
        State: m,
        Transition: w,
        TransitionAfter: function (t) {
            i(n, t);
            var e = s(n);
            function n(t, i, s) {
                var o, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, u = arguments.length > 4 && void 0 !== arguments[4] && arguments[4], h = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null;
                return r(this, n), (o = e.call(this, t, i, a, u, h)).delay = s, o.time = Date.now(),
                    o;
            }
            return o(n, [{
                key: "runTime",
                get: function () {
                    return .001 * (Date.now() - this.time);
                }
            }, {
                key: "onEnter",
                value: function () {
                    this.time = Date.now();
                }
            }, {
                key: "shouldTransition",
                value: function () {
                    return !(this.runTime < this.delay) && (null == this.condition || this.condition(this));
                }
            }]), n;
        }(w),
        TransitionBase: T,
        StateMachine: function (t) {
            i(n, t);
            var e = s(n);
            function n() {
                var t;
                return r(this, n), (t = e.call(this)).isStateMachine = !0, t.startState = -1, t.pendingState = {
                    id: -1,
                    data: null
                }, t.transitionsFromAny = [], t.stateBundles = new Map(), t.triggerTransitionsFromAny = new Map(),
                    t;
            }
            return o(n, [{
                key: "isRootFsm",
                get: function () {
                    return null == this.fsm;
                }
            }, {
                key: "activeState",
                get: function () {
                    return this.mCurState;
                }
            }, {
                key: "activeID",
                get: function () {
                    return this.activeState ? this.activeState.stateId : -1;
                }
            }, {
                key: "setStartState",
                value: function (t) {
                    this.startState = t;
                }
            }, {
                key: "stateCanExit",
                value: function () {
                    -1 != this.pendingState.id && (this.changeState(this.pendingState.id, this.pendingState.data),
                        this.pendingState.id = -1, this.pendingState.data = null), this.fsm && this.fsm.stateCanExit();
                }
            }, {
                key: "requestExit",
                value: function () {
                    var t = this.getRealActiveState();
                    t && t.needExitTime ? t.requestExit() : this.fsm.stateCanExit();
                }
            }, {
                key: "getRealActiveState",
                value: function () {
                    if (!this.activeState) return null;
                    for (var t = this.activeState; t && t.isStateMachine;) t = t.activeState;
                    return t || null;
                }
            }, {
                key: "curStateNeedExitTime",
                value: function () {
                    var t = this.getRealActiveState();
                    return !!t && t.needExitTime;
                }
            }, {
                key: "requestStateChange",
                value: function (t, e, n) {
                    this.activeState && this.curStateNeedExitTime() && !n ? (this.pendingState.id = t,
                        this.pendingState.data = e, null != this.activeState && this.activeState.requestExit()) : this.changeState(t, e);
                }
            }, {
                key: "stop",
                value: function () {
                    -1 != this.pendingState.id && (this.pendingState.id = -1, this.pendingState.data = null),
                        null != this.mCurState && (this.mCurState.onExit(null), this.mCurState = null, this.curBundle = null);
                }
            }, {
                key: "init",
                value: function () {
                    this.isRootFsm && this.onEnter(null);
                }
            }, {
                key: "onEnter",
                value: function (t, e) {
                    this.changeState(this.startState, e);
                    for (var n = 0; n < this.transitionsFromAny.length; n++) this.transitionsFromAny[n].onEnter();
                    this.triggerTransitionsFromAny.forEach(function (t) {
                        t.forEach(function (t) {
                            t.onEnter();
                        });
                    });
                }
            }, {
                key: "onExit",
                value: function (t, e) {
                    null != this.activeState && (this.mCurState.onExit(null, e), this.mCurState = null,
                        this.curBundle = null);
                }
            }, {
                key: "onUpdate",
                value: function (t) {
                    if (this.activeState) {
                        for (var e = 0; e < this.transitionsFromAny.length; e++) {
                            var n = this.transitionsFromAny[e];
                            if (n.to != this.activeState.stateId && this.tryTransition(n)) break;
                        }
                        if (this.mCurState && this.curBundle) {
                            if (this.curBundle.transitions) for (var i = 0; i < this.curBundle.transitions.length; i++) {
                                var s = this.curBundle.transitions[i];
                                if (this.tryTransition(s)) break;
                            }
                            this.mCurState && this.mCurState.onUpdate(t);
                        }
                    }
                }
            }, {
                key: "addState",
                value: function (t, e) {
                    return e.fsm = this, e.stateId = t, e.init(), this.getOrCreateStateBundle(t).state = e,
                        -1 == this.startState && this.setStartState(t), this;
                }
            }, {
                key: "addStateFunc",
                value: function (t) {
                    var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null, r = arguments.length > 5 && void 0 !== arguments[5] && arguments[5];
                    return null == e && null == n && null == i && null == s ? this.addState(t, new k()) : this.addState(t, new m(e, n, i, s, r)),
                        this;
                }
            }, {
                key: "addTransition",
                value: function () {
                    var t = this, e = function (e) {
                        t.initTransition(e), t.getOrCreateStateBundle(e.from).addTransition(e);
                    };
                    if (1 == arguments.length) e(arguments[0]); else {
                        var n = arguments[0], i = arguments[1], s = arguments.length > 2 ? arguments[2] : null, r = arguments.length > 3 && arguments[3], o = arguments.length > 4 ? arguments[4] : null;
                        e(this.createOptimizedTransition(n, i, s, r, o));
                    }
                    return this;
                }
            }, {
                key: "addTransitionFromAny",
                value: function () {
                    var t;
                    if ("number" == typeof (arguments.length <= 0 ? void 0 : arguments[0])) {
                        var e = arguments.length <= 0 ? void 0 : arguments[0], n = arguments.length > 1 ? arguments.length <= 1 ? void 0 : arguments[1] : null, i = arguments.length > 2 && (arguments.length <= 2 ? void 0 : arguments[2]), s = arguments.length > 3 ? arguments.length <= 3 ? void 0 : arguments[3] : null;
                        t = this.createOptimizedTransition(-1, e, n, i, s);
                    } else t = arguments.length <= 0 ? void 0 : arguments[0];
                    return this.initTransition(t), -1 == this.transitionsFromAny.indexOf(t) && this.transitionsFromAny.push(t),
                        this;
                }
            }, {
                key: "addTriggerTransition",
                value: function () {
                    var t, e = arguments.length <= 0 ? void 0 : arguments[0];
                    if ("number" == typeof (arguments.length <= 1 ? void 0 : arguments[1])) {
                        var n = arguments.length <= 1 ? void 0 : arguments[1], i = arguments.length <= 2 ? void 0 : arguments[2], s = arguments.length > 3 ? arguments.length <= 3 ? void 0 : arguments[3] : null, r = arguments.length > 4 && (arguments.length <= 4 ? void 0 : arguments[4]), o = arguments.length > 5 && (arguments.length <= 5 ? void 0 : arguments[5]);
                        t = this.createOptimizedTransition(n, i, s, r, o);
                    } else t = arguments.length <= 1 ? void 0 : arguments[1];
                    return this.initTransition(t), this.getOrCreateStateBundle(t.from).addTriggerTransition(e, t),
                        this;
                }
            }, {
                key: "addTriggerTransitionFromAny",
                value: function () {
                    var t, e, n = arguments.length <= 0 ? void 0 : arguments[0];
                    if ("number" == typeof (arguments.length <= 1 ? void 0 : arguments[1])) {
                        var i = arguments.length <= 1 ? void 0 : arguments[1], s = arguments.length > 2 ? arguments.length <= 2 ? void 0 : arguments[2] : null, r = arguments.length > 3 && (arguments.length <= 3 ? void 0 : arguments[3]);
                        t = this.createOptimizedTransition(-1, i, s, r);
                    } else t = arguments.length <= 1 ? void 0 : arguments[1];
                    this.initTransition(t), this.triggerTransitionsFromAny.has(n) ? e = this.triggerTransitionsFromAny.get(n) : (e = [],
                        this.triggerTransitionsFromAny.set(n, e)), e.push(t);
                }
            }, {
                key: "trigger",
                value: function (t, e) {
                    var n = !1;
                    if (this.triggerTransitionsFromAny.has(t)) for (var i = this.triggerTransitionsFromAny.get(t), s = 0; s < i.length; s++) {
                        var r = i[s];
                        if ((-1 == this.activeID || r.to != this.activeID) && this.tryTransition(r, e)) {
                            n = !0;
                            break;
                        }
                    }
                    if (!n && this.activeState) {
                        var o = this.stateBundles.get(this.activeState.stateId);
                        if (o && o.triggerToTransitions && o.triggerToTransitions.has(t)) for (var a = o.triggerToTransitions.get(t), u = 0; u < a.length; u++) {
                            var h = a[u];
                            if (n = this.tryTransition(h)) break;
                        }
                    }
                    return !n && this.activeState && this.activeState.trigger && this.activeState.trigger(t),
                        n;
                }
            }, {
                key: "changeState",
                value: function (t) {
                    var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, n = this.stateBundles.has(t) ? this.stateBundles.get(t) : null;
                    if (n) {
                        var i = this.activeState;
                        if (i && i.onExit(n.state, e), this.mCurState = n.state, this.mCurState.onEnter(i, e),
                            this.curBundle = n, n.transitions) for (var s = 0; s < n.transitions.length; s++) n.transitions[s].onEnter();
                        n.triggerToTransitions && n.triggerToTransitions.forEach(function (t) {
                            t.forEach(function (t) {
                                t.onEnter();
                            });
                        });
                    } else console.warn("需要跳转到的状态:[".concat(t, "]不存在,维持现在状态不变"));
                }
            }, {
                key: "initTransition",
                value: function (t) {
                    t.fsm = this, t.init();
                }
            }, {
                key: "getOrCreateStateBundle",
                value: function (t) {
                    var e;
                    return this.stateBundles.has(t) ? e = this.stateBundles.get(t) : (e = new E(), this.stateBundles.set(t, e)),
                        e;
                }
            }, {
                key: "createOptimizedTransition",
                value: function (t, e) {
                    var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, i = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null;
                    return n ? new w(t, e, n, i, s) : new T(t, e, i, s);
                }
            }, {
                key: "tryTransition",
                value: function (t, e) {
                    var n = t.shouldTransition();
                    return n && this.requestStateChange(t.to, e || t.data, t.forceInstantly), n;
                }
            }]), n;
        }(k)
    }), S = function () {
        function t(e, n) {
            var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 3, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null, a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null;
            r(this, t), this.objs = [], this.poolFlag = e, this.initPool(e, n, i, s, o, a);
        }
        return o(t, [{
            key: "getObject",
            value: function () {
                for (var t, e = arguments.length, n = new Array(e), i = 0; i < e; i++) n[i] = arguments[i];
                if (this.objs.length > 0) t = this.objs.pop(); else if (null == (t = this.createFunc.apply(this, n))) throw new Error("对象池的创建函数返回的对象为null 对象池标记[".concat(this.poolFlag, "]"));
                return this.initFunc && (t = this.initFunc(t, n)), t["__InPool" + this.poolFlag] = !0,
                    t;
            }
        }, {
            key: "createObject",
            value: function () {
                for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++) e[n] = arguments[n];
                var i = this.createFunc.apply(this, e);
                return this.initFunc && (i = this.initFunc(i, e)), i["__InPool" + this.poolFlag] = !0,
                    i;
            }
        }, {
            key: "revert",
            value: function (t) {
                if (t) {
                    if (this.onRevertFunc && (t = this.onRevertFunc(t)), !t["__InPool" + this.poolFlag]) throw new Error("无法回收不属于本对象池生成的对象");
                    t["__InPool" + this.poolFlag] = !1, this.objs.push(t);
                }
            }
        }, {
            key: "clear",
            value: function () {
                var t = this;
                this.objs.forEach(function (e) {
                    e && (e["__InPool" + t.poolFlag] = !1), t.onDestroyFunc && t.onDestroyFunc(e);
                }), this.objs.length = 0;
            }
        }, {
            key: "initPool",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 3, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null, r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null;
                this.poolFlag = t, this.createFunc = e, this.initFunc = i, this.onRevertFunc = s,
                    this.onDestroyFunc = r;
                for (var o = 0; o < n; o++) {
                    var a = this.createObject();
                    this.revert(a);
                }
            }
        }]), t;
    }(), L = function () {
        function t() {
            r(this, t);
        }
        return o(t, null, [{
            key: "createPool",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 3, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null, r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null, o = null;
                return this.pools.has(t) ? (console.warn("想要创建的对象池已经存在[".concat(t, "]")), o = this.pools.get(t)) : (o = new S(t, e, n, i, s, r),
                    this.pools.set(t, o)), o;
            }
        }, {
            key: "createObj",
            value: function (t) {
                for (var e, n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++) i[s - 1] = arguments[s];
                return this.pools.has(t) ? (e = this.pools.get(t)).getObject.apply(e, i) : null;
            }
        }, {
            key: "revert",
            value: function (t, e) {
                this.pools.has(t) && this.pools.get(t).revert(e);
            }
        }, {
            key: "destroyPool",
            value: function (t) {
                this.pools.has(t) && (this.pools.get(t).clear(), this.pools.delete(t));
            }
        }]), t;
    }();
    L.pools = new Map();
    var b = Object.freeze({
        __proto__: null,
        Pool: S,
        PoolMgr: L
    }), I = function () {
        function t() {
            var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
            r(this, t), this._xd_ = !0, this._allocated_ = 8, this._pos_ = 0, this._length = 0,
                e ? (this._u8d_ = new Uint8Array(e), this._d_ = new DataView(this._u8d_.buffer),
                    this._length = this._d_.byteLength) : this._resizeBuffer(this._allocated_);
        }
        return o(t, [{
            key: "buffer",
            get: function () {
                var t = this._d_.buffer;
                return t.byteLength === this._length ? t : t.slice(0, this._length);
            }
        }, {
            key: "endian",
            get: function () {
                return this._xd_ ? t.LITTLE_ENDIAN : t.BIG_ENDIAN;
            },
            set: function (e) {
                this._xd_ = e === t.LITTLE_ENDIAN;
            }
        }, {
            key: "length",
            get: function () {
                return this._length;
            },
            set: function (t) {
                this._allocated_ < t ? this._resizeBuffer(this._allocated_ = Math.floor(Math.max(t, 2 * this._allocated_))) : this._allocated_ > t && this._resizeBuffer(this._allocated_ = t),
                    this._length = t;
            }
        }, {
            key: "_resizeBuffer",
            value: function (t) {
                try {
                    var e = new Uint8Array(t);
                    null != this._u8d_ && (this._u8d_.length <= t ? e.set(this._u8d_) : e.set(this._u8d_.subarray(0, t))),
                        this._u8d_ = e, this._d_ = new DataView(e.buffer);
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    throw "Invalid typed array length:" + t;
                }
            }
        }, {
            key: "getString",
            value: function () {
                return this.readString();
            }
        }, {
            key: "readString",
            value: function () {
                return this._rUTF(this.getUint16());
            }
        }, {
            key: "getFloat32Array",
            value: function (t, e) {
                return this.readFloat32Array(t, e);
            }
        }, {
            key: "readFloat32Array",
            value: function (t, e) {
                var n = t + e;
                n = n > this._length ? this._length : n;
                var i = new Float32Array(this._d_.buffer.slice(t, n));
                return this._pos_ = n, i;
            }
        }, {
            key: "getUint8Array",
            value: function (t, e) {
                return this.readUint8Array(t, e);
            }
        }, {
            key: "readUint8Array",
            value: function (t, e) {
                var n = t + e;
                n = n > this._length ? this._length : n;
                var i = new Uint8Array(this._d_.buffer.slice(t, n));
                return this._pos_ = n, i;
            }
        }, {
            key: "getInt16Array",
            value: function (t, e) {
                return this.readInt16Array(t, e);
            }
        }, {
            key: "readInt16Array",
            value: function (t, e) {
                var n = t + e;
                n = n > this._length ? this._length : n;
                var i = new Int16Array(this._d_.buffer.slice(t, n));
                return this._pos_ = n, i;
            }
        }, {
            key: "getFloat32",
            value: function () {
                return this.readFloat32();
            }
        }, {
            key: "readFloat32",
            value: function () {
                if (this._pos_ + 4 > this._length) throw "getFloat32 error - Out of bounds";
                var t = this._d_.getFloat32(this._pos_, this._xd_);
                return this._pos_ += 4, t;
            }
        }, {
            key: "getFloat64",
            value: function () {
                return this.readFloat64();
            }
        }, {
            key: "readFloat64",
            value: function () {
                if (this._pos_ + 8 > this._length) throw "getFloat64 error - Out of bounds";
                var t = this._d_.getFloat64(this._pos_, this._xd_);
                return this._pos_ += 8, t;
            }
        }, {
            key: "writeFloat32",
            value: function (t) {
                this._ensureWrite(this._pos_ + 4), this._d_.setFloat32(this._pos_, t, this._xd_),
                    this._pos_ += 4;
            }
        }, {
            key: "writeFloat64",
            value: function (t) {
                this._ensureWrite(this._pos_ + 8), this._d_.setFloat64(this._pos_, t, this._xd_),
                    this._pos_ += 8;
            }
        }, {
            key: "getInt32",
            value: function () {
                return this.readInt32();
            }
        }, {
            key: "readInt32",
            value: function () {
                if (this._pos_ + 4 > this._length) throw "getInt32 error - Out of bounds";
                var t = this._d_.getInt32(this._pos_, this._xd_);
                return this._pos_ += 4, t;
            }
        }, {
            key: "getUint32",
            value: function () {
                return this.readUint32();
            }
        }, {
            key: "readUint32",
            value: function () {
                if (this._pos_ + 4 > this._length) throw "getUint32 error - Out of bounds";
                var t = this._d_.getUint32(this._pos_, this._xd_);
                return this._pos_ += 4, t;
            }
        }, {
            key: "writeInt32",
            value: function (t) {
                this._ensureWrite(this._pos_ + 4), this._d_.setInt32(this._pos_, t, this._xd_),
                    this._pos_ += 4;
            }
        }, {
            key: "writeUint32",
            value: function (t) {
                this._ensureWrite(this._pos_ + 4), this._d_.setUint32(this._pos_, t, this._xd_),
                    this._pos_ += 4;
            }
        }, {
            key: "getInt16",
            value: function () {
                return this.readInt16();
            }
        }, {
            key: "readInt16",
            value: function () {
                if (this._pos_ + 2 > this._length) throw "getInt16 error - Out of bounds";
                var t = this._d_.getInt16(this._pos_, this._xd_);
                return this._pos_ += 2, t;
            }
        }, {
            key: "getUint16",
            value: function () {
                return this.readUint16();
            }
        }, {
            key: "readUint16",
            value: function () {
                if (this._pos_ + 2 > this._length) throw "getUint16 error - Out of bounds";
                var t = this._d_.getUint16(this._pos_, this._xd_);
                return this._pos_ += 2, t;
            }
        }, {
            key: "writeUint16",
            value: function (t) {
                this._ensureWrite(this._pos_ + 2), this._d_.setUint16(this._pos_, t, this._xd_),
                    this._pos_ += 2;
            }
        }, {
            key: "writeInt16",
            value: function (t) {
                this._ensureWrite(this._pos_ + 2), this._d_.setInt16(this._pos_, t, this._xd_),
                    this._pos_ += 2;
            }
        }, {
            key: "getUint8",
            value: function () {
                return this.readUint8();
            }
        }, {
            key: "readUint8",
            value: function () {
                if (this._pos_ + 1 > this._length) throw "getUint8 error - Out of bounds";
                return this._d_.getUint8(this._pos_++);
            }
        }, {
            key: "writeUint8",
            value: function (t) {
                this._ensureWrite(this._pos_ + 1), this._d_.setUint8(this._pos_, t), this._pos_++;
            }
        }, {
            key: "_getUInt8",
            value: function (t) {
                return this._readUInt8(t);
            }
        }, {
            key: "_readUInt8",
            value: function (t) {
                return this._d_.getUint8(t);
            }
        }, {
            key: "_getUint16",
            value: function (t) {
                return this._readUint16(t);
            }
        }, {
            key: "_readUint16",
            value: function (t) {
                return this._d_.getUint16(t, this._xd_);
            }
        }, {
            key: "_rUTF",
            value: function (t) {
                for (var e, n = "", i = this._pos_ + t, s = String.fromCharCode, r = this._u8d_; this._pos_ < i;) (e = r[this._pos_++]) < 128 ? 0 != e && (n += s(e)) : n += s(e < 224 ? (63 & e) << 6 | 127 & r[this._pos_++] : e < 240 ? (31 & e) << 12 | (127 & r[this._pos_++]) << 6 | 127 & r[this._pos_++] : (15 & e) << 18 | (127 & r[this._pos_++]) << 12 | r[this._pos_++] << 6 & 127 | 127 & r[this._pos_++]);
                return n;
            }
        }, {
            key: "getCustomString",
            value: function (t) {
                return this.readCustomString(t);
            }
        }, {
            key: "readCustomString",
            value: function (t) {
                for (var e, n = "", i = 0, s = String.fromCharCode, r = this._u8d_; t > 0;) if ((e = r[this._pos_]) < 128) n += s(e),
                    this._pos_++, t--; else for (i = e - 128, this._pos_++, t -= i; i > 0;) e = r[this._pos_++],
                        n += s(r[this._pos_++] << 8 | e), i--;
                return n;
            }
        }, {
            key: "pos",
            get: function () {
                return this._pos_;
            },
            set: function (t) {
                this._pos_ = t;
            }
        }, {
            key: "bytesAvailable",
            get: function () {
                return this._length - this._pos_;
            }
        }, {
            key: "clear",
            value: function () {
                this._pos_ = 0, this.length = 0;
            }
        }, {
            key: "__getBuffer",
            value: function () {
                return this._d_.buffer;
            }
        }, {
            key: "writeUTFBytes",
            value: function (t) {
                for (var e = 0, n = (t += "").length; e < n; e++) {
                    var i = t.charCodeAt(e);
                    i <= 127 ? this.writeByte(i) : i <= 2047 ? (this._ensureWrite(this._pos_ + 2), this._u8d_.set([192 | i >> 6, 128 | 63 & i], this._pos_),
                        this._pos_ += 2) : i <= 65535 ? (this._ensureWrite(this._pos_ + 3), this._u8d_.set([224 | i >> 12, 128 | i >> 6 & 63, 128 | 63 & i], this._pos_),
                            this._pos_ += 3) : (this._ensureWrite(this._pos_ + 4), this._u8d_.set([240 | i >> 18, 128 | i >> 12 & 63, 128 | i >> 6 & 63, 128 | 63 & i], this._pos_),
                                this._pos_ += 4);
                }
            }
        }, {
            key: "writeUTFString",
            value: function (t) {
                var e = this.pos;
                this.writeUint16(1), this.writeUTFBytes(t);
                var n = this.pos - e - 2;
                this._d_.setUint16(e, n, this._xd_);
            }
        }, {
            key: "readUTFString",
            value: function () {
                return this.readUTFBytes(this.getUint16());
            }
        }, {
            key: "getUTFString",
            value: function () {
                return this.readUTFString();
            }
        }, {
            key: "readUTFBytes",
            value: function () {
                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
                if (0 === t) return "";
                var e = this.bytesAvailable;
                if (t > e) throw "readUTFBytes error - Out of bounds";
                return t = t > 0 ? t : e, this._rUTF(t);
            }
        }, {
            key: "getUTFBytes",
            value: function () {
                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
                return this.readUTFBytes(t);
            }
        }, {
            key: "writeByte",
            value: function (t) {
                this._ensureWrite(this._pos_ + 1), this._d_.setInt8(this._pos_, t), this._pos_ += 1;
            }
        }, {
            key: "readByte",
            value: function () {
                if (this._pos_ + 1 > this._length) throw "readByte error - Out of bounds";
                return this._d_.getInt8(this._pos_++);
            }
        }, {
            key: "readBytes",
            value: function () {
                for (var t = [], e = this.readUint16(); e > 0;) t.push(this.readByte()), e--;
                return t;
            }
        }, {
            key: "getByte",
            value: function () {
                return this.readByte();
            }
        }, {
            key: "_ensureWrite",
            value: function (t) {
                this._length < t && (this._length = t), this._allocated_ < t && (this.length = t);
            }
        }, {
            key: "writeArrayBuffer",
            value: function (t) {
                var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
                if (e < 0 || n < 0) throw "writeArrayBuffer error - Out of bounds";
                0 == n && (n = t.byteLength - e), this._ensureWrite(this._pos_ + n);
                var i = new Uint8Array(t);
                this._u8d_.set(i.subarray(e, e + n), this._pos_), this._pos_ += n;
            }
        }], [{
            key: "getSystemEndian",
            value: function () {
                if (!t._sysEndian) {
                    var e = new ArrayBuffer(2);
                    new DataView(e).setInt16(0, 256, !0), t._sysEndian = 256 === new Int16Array(e)[0] ? t.LITTLE_ENDIAN : t.BIG_ENDIAN;
                }
                return t._sysEndian;
            }
        }]), t;
    }();
    function B(t) {
        return t < 0 ? 0 : t > 1 ? 1 : t;
    }
    function O(t, e, n) {
        return t < e ? t = e : t > n && (t = n), t;
    }
    function F(t, e) {
        return O(t - Math.floor(t / e) * e, 0, e);
    }
    I.BIG_ENDIAN = "bigEndian", I.LITTLE_ENDIAN = "littleEndian", I._sysEndian = null;
    var P, R, x, U = Object.freeze({
        __proto__: null,
        numberToTime: function (t) {
            var e = Math.floor(t / 60), n = t - 60 * e;
            return e < 10 && (e = "0" + e), n < 10 && (n = "0" + n), e + ":" + n;
        },
        random: function (t, e) {
            return Math.floor(Math.random() * (t - e) + e);
        },
        randomFloat: function (t, e) {
            return Math.random() * (t - e) + e;
        },
        clamp01: B,
        lerp: function (t, e, n) {
            return t + (e - t) * B(n);
        },
        clamp: O,
        repeat: F,
        pingPong: function (t, e) {
            return t = F(t, 2 * e), e - Math.abs(t - e);
        },
        inverseLerp: function (t, e, n) {
            return t != e ? B((n - t) / (e - t)) : 0;
        },
        GameFlag: function () {
            function t() {
                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
                r(this, t), this.mValue = 0, this.mValue = e;
            }
            return o(t, [{
                key: "value",
                get: function () {
                    return this.mValue;
                },
                set: function (t) {
                    this.mValue = t;
                }
            }, {
                key: "add",
                value: function (t) {
                    return this.has(t) || (this.mValue |= t), this;
                }
            }, {
                key: "remove",
                value: function (t) {
                    return this.has(t) && (this.mValue &= ~t), this;
                }
            }, {
                key: "has",
                value: function (t) {
                    return 0 != (this.mValue & t);
                }
            }]), t;
        }(),
        ByteBuffer: I
    }), C = function () {
        function t(e, n) {
            var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, s = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
            r(this, t), this.once = !1, this.func = e, this.thisObj = n, this.args = i, this.once = s;
        }
        return o(t, [{
            key: "run",
            value: function () {
                var t = null;
                if (this.func) {
                    for (var e, n = [], i = arguments.length, s = new Array(i), r = 0; r < i; r++) s[r] = arguments[r];
                    this.args && n.push(n), n.push(s), t = (e = this.func).call.apply(e, [this.thisObj].concat(n)),
                        this.once && this.revert();
                }
                return t;
            }
        }, {
            key: "revert",
            value: function () {
                t.pool.revert(this), this.func = null, this.thisObj = null;
            }
        }], [{
            key: "create",
            value: function (t, e, n) {
                var i = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
                return this.pool.getObject(t, e, n, i);
            }
        }]), t;
    }();
    C.pool = L.createPool("__ListenerFuncPool", function (t, e) {
        var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, i = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
        return new C(t, e, n, i);
    }, 10, function (t, e) {
        return t.func = e[0], t.thisObj = e[1], t.args = e[2], t.once = e[3], t;
    }, function (t) {
        return t.func = null, t.args = null, t.once = !1, t.thisObj = null, t;
    });
    var N = function () {
        function t() {
            r(this, t), this.func = new Array();
        }
        return o(t, [{
            key: "add",
            value: function (t) {
                var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                this.has(t, e) || this.func.push(new C(t, e));
            }
        }, {
            key: "removeAll",
            value: function () {
                this.func.length = 0;
            }
        }, {
            key: "remove",
            value: function (t) {
                for (var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, n = this.func.length - 1; n >= 0; n--) {
                    var i = this.func[n];
                    if (i.func == t && i.thisObj == e) {
                        this.func.splice(n, 1);
                        break;
                    }
                }
            }
        }, {
            key: "has",
            value: function (t, e) {
                return -1 != this.func.findIndex(function (n) {
                    return n.thisObj == e && n.func == t;
                });
            }
        }, {
            key: "run",
            value: function () {
                for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++) e[n] = arguments[n];
                for (var i = 0; i < this.func.length; i++) {
                    var s, r = this.func[i];
                    (s = r.func).call.apply(s, [r.thisObj].concat(e));
                }
            }
        }], [{
            key: "create",
            value: function () {
                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, i = new t();
                return e && i.add(e, n), i;
            }
        }]), t;
    }(), D = function () {
        function t() {
            r(this, t);
        }
        return o(t, null, [{
            key: "That",
            get: function () {
                return this.that;
            },
            set: function (t) {
                this.that = t;
                for (var e = 0; e < this.onNewApplication.length; e++) {
                    var n = this.onNewApplication[e];
                    null != n && n(this.that);
                }
            }
        }, {
            key: "addNewAppListener",
            value: function (t) {
                -1 == this.onNewApplication.indexOf(t) && this.onNewApplication.push(t), this.that && t(this.that);
            }
        }, {
            key: "removeNewAppListener",
            value: function (t) {
                var e = this.onNewApplication.indexOf(t);
                -1 != e && this.onNewApplication.splice(e, 1);
            }
        }, {
            key: "singleton",
            value: function (t, e) {
                return this.that.bind(t, e, !0);
            }
        }, {
            key: "singletonByCfun",
            value: function (t, e) {
                return this.that.bindByConcrete(t, e, !0);
            }
        }, {
            key: "bind",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
                return this.that.bind(t, e, n);
            }
        }, {
            key: "bindByConcrete",
            value: function (t, e, n) {
                return this.that.bindByConcrete(t, e, n);
            }
        }, {
            key: "alias",
            value: function (t, e) {
                return this.that.alias(t, e);
            }
        }, {
            key: "unBind",
            value: function (t) {
                return this.that.unBind(t);
            }
        }, {
            key: "instance",
            value: function (t, e) {
                var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
                return this.that.instance(t, e, n);
            }
        }, {
            key: "make",
            value: function (t) {
                for (var e, n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++) i[s - 1] = arguments[s];
                return (e = this.that).make.apply(e, [t].concat(i));
            }
        }, {
            key: "release",
            value: function (t) {
                return this.that.release(t);
            }
        }, {
            key: "isRegisted",
            value: function (t) {
                return this.that.isRegistered(t);
            }
        }, {
            key: "register",
            value: function (t) {
                this.that.register(t);
            }
        }, {
            key: "pause",
            value: function (t) {
                this.that.pause(t);
            }
        }, {
            key: "exit",
            value: function () {
                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
                this.that.exit(t);
            }
        }, {
            key: "on",
            value: function (t, e, n, i, s) {
                return this.That.on(t, e, n, i, s);
            }
        }, {
            key: "once",
            value: function (t, e, n, i) {
                return this.That.once(t, e, n, i);
            }
        }, {
            key: "off",
            value: function (t, e, n) {
                return this.That.off(t, e, n);
            }
        }, {
            key: "offAll",
            value: function (t) {
                return this.That.offAll(t);
            }
        }, {
            key: "offAllCaller",
            value: function (t) {
                return this.That.offAllCaller(t);
            }
        }, {
            key: "hasEventListener",
            value: function (t) {
                return this.That.hasEventListener(t);
            }
        }, {
            key: "dispatchEvent",
            value: function (t) {
                return this.That.dispatchEvent(t);
            }
        }, {
            key: "dispatchEventWith",
            value: function (t, e) {
                return this.That.dispatchEventWith(t, e);
            }
        }]), t;
    }();
    D.onNewApplication = [], a.AppProcess = void 0, (P = a.AppProcess || (a.AppProcess = {}))[P.Construct = 0] = "Construct",
        P[P.Bootstrap = 1] = "Bootstrap", P[P.Bootstrapping = 2] = "Bootstrapping", P[P.Bootstraped = 3] = "Bootstraped",
        P[P.Init = 4] = "Init", P[P.Initing = 5] = "Initing", P[P.Inited = 6] = "Inited",
        P[P.Running = 7] = "Running", P[P.Pause = 8] = "Pause", P[P.Terminate = 9] = "Terminate",
        P[P.Terminating = 10] = "Terminating", P[P.Terminated = 11] = "Terminated";
    var M = function (t) {
        i(n, t);
        var e = s(n);
        function n(t, i) {
            var s;
            return r(this, n), (s = e.call(this, i)).appliction = t, s;
        }
        return o(n);
    }(h), j = o(function t() {
        r(this, t);
    });
    j.OnBeforeBoot = "Appliction.OnBeforeBoot", j.OnBooting = "Appliction.OnBooting",
        j.OnAfterBoot = "Appliction.OnAfterBoot", j.OnRegisterProvider = "Appliction.OnRegisterProvider",
        j.OnBeforeInit = "Appliction.OnBeforeInit", j.OnInitProvider = "Appliction.OnInitProvider",
        j.OnAfterInit = "Appliction.OnAfterInit", j.OnStartCompleted = "Appliction.OnStartCompleted",
        j.OnBeforeTerminate = "Appliction.OnBeforeTerminate", j.OnAfterTerminate = "Appliction.OnAfterTerminate",
        j.OnPause = "Appliction.OnPause", j.OnResume = "Appliction.OnResume";
    var W = function (t) {
        i(n, t);
        var e = s(n);
        function n(t) {
            return r(this, n), e.call(this, t, j.OnAfterBoot);
        }
        return o(n);
    }(M), z = function (t) {
        i(n, t);
        var e = s(n);
        function n(t) {
            return r(this, n), e.call(this, t, j.OnAfterInit);
        }
        return o(n);
    }(M), q = function (t) {
        i(n, t);
        var e = s(n);
        function n(t, i) {
            var s;
            return r(this, n), (s = e.call(this, i, j.OnBeforeBoot)).mBootstraps = t, s;
        }
        return o(n, [{
            key: "bootstraps",
            get: function () {
                return this.mBootstraps;
            },
            set: function (t) {
                this.mBootstraps = t;
            }
        }]), n;
    }(M), V = function (t) {
        i(n, t);
        var e = s(n);
        function n(t) {
            return r(this, n), e.call(this, t, j.OnBeforeInit);
        }
        return o(n);
    }(M), G = function (t) {
        i(n, t);
        var e = s(n);
        function n(t, i) {
            var s;
            return r(this, n), (s = e.call(this, i, j.OnBooting)).bootstrap = t, s;
        }
        return o(n);
    }(M), K = function (t) {
        i(n, t);
        var e = s(n);
        function n(t, i) {
            var s;
            return r(this, n), (s = e.call(this, i, j.OnInitProvider)).mProvider = t, s;
        }
        return o(n, [{
            key: "provider",
            get: function () {
                return this.mProvider;
            }
        }]), n;
    }(M), Y = function (t) {
        i(n, t);
        var e = s(n);
        function n(t, i) {
            var s;
            return r(this, n), (s = e.call(this, i, j.OnRegisterProvider)).mProvider = t, s;
        }
        return o(n, [{
            key: "provider",
            get: function () {
                return this.mProvider;
            }
        }]), n;
    }(M), H = function (t) {
        i(n, t);
        var e = s(n);
        function n(t) {
            return r(this, n), e.call(this, t, j.OnStartCompleted);
        }
        return o(n);
    }(M);
    a.LogLevel = void 0, (R = a.LogLevel || (a.LogLevel = {}))[R.Log = 0] = "Log", R[R.Warn = 1] = "Warn",
        R[R.Error = 2] = "Error", R[R.None = 3] = "None", a.ProductMode = void 0, (x = a.ProductMode || (a.ProductMode = {}))[x.Develop = 0] = "Develop",
        x[x.Publish = 1] = "Publish";
    var J = o(function t() {
        r(this, t);
    });
    J.IEventDispatcher = "IEventDispatcher", J.Appliction = "Appliction";
    var Q = function (e) {
        i(u, e);
        var n = s(u);
        function u() {
            var e;
            return r(this, u), (e = n.call(this)).mLogLevel = a.LogLevel.Log, e.process = a.AppProcess.Construct,
                e.mProductMode = a.ProductMode.Develop, D.That = t(e), e.loadedProviders = [], e.registerBaseBindings(),
                e.process = a.AppProcess.Construct, e.mLogLevel = a.LogLevel.Log, e.mProductMode = a.ProductMode.Develop,
                e;
        }
        return o(u, [{
            key: "logLevel",
            get: function () {
                return this.mLogLevel;
            },
            set: function (t) {
                this.mLogLevel = t;
            }
        }, {
            key: "productMode",
            get: function () {
                return this.mProductMode;
            },
            set: function (t) {
                this.mProductMode = t;
            }
        }, {
            key: "on",
            value: function (t, e, n) {
                var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, s = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
                return this.dispatcherInst.on(t, e, n, i, s);
            }
        }, {
            key: "once",
            value: function (t, e, n) {
                var i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
                return this.dispatcherInst.once(t, e, n, i);
            }
        }, {
            key: "off",
            value: function (t, e, n) {
                return this.dispatcherInst.off(t, e, n);
            }
        }, {
            key: "offAll",
            value: function (t) {
                return this.dispatcherInst.offAll(t);
            }
        }, {
            key: "offAllCaller",
            value: function (t) {
                return this.dispatcherInst.offAllCaller(t);
            }
        }, {
            key: "hasEventListener",
            value: function (t) {
                return this.dispatcherInst.hasEventListener(t);
            }
        }, {
            key: "dispatchEventWith",
            value: function (t, e) {
                return this.dispatcherInst.dispatchEventWith(t, e);
            }
        }, {
            key: "dispatchEvent",
            value: function (t) {
                return this.dispatcher && this.dispatcher.dispatchEvent(t), t;
            }
        }, {
            key: "dispatcher",
            get: function () {
                return this.dispatcherInst;
            },
            set: function (t) {
                this.dispatcherInst = t, this.instance(J.IEventDispatcher, t);
            }
        }, {
            key: "serviceContainer",
            get: function () {
                return this;
            }
        }, {
            key: "bootstrap",
            value: function () {
                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
                if (t = t || [], this.process != a.AppProcess.Construct) throw new Error("应用已经启动过了无法再次启动");
                this.process = a.AppProcess.Bootstrap, t = this.dispatchEvent(new q(t, this)).bootstraps,
                    this.process = a.AppProcess.Bootstrapping;
                for (var e = [], n = 0; n < t.length; n++) {
                    for (var i = t[n], s = 0, r = 0; r < e.length; r++) {
                        var o = e[r];
                        if (i.priority && (!o.priority || o.priority > i.priority)) break;
                        s++;
                    }
                    e.splice(s, 0, i);
                }
                for (var u = [], h = 0; h < e.length; h++) {
                    var l = e[h];
                    if (l) {
                        if (-1 != u.indexOf(l)) throw new Error("这个引导已经注入过了不能再次引导");
                        u.push(l), this.dispatchEvent(new G(l, this)), l.bootstrap();
                    }
                }
                this.process = a.AppProcess.Bootstraped, this.dispatchEvent(new W(this));
            }
        }, {
            key: "init",
            value: function () {
                var t = this;
                if (this.process < a.AppProcess.Bootstraped) throw new Error("引导还未完成");
                if (this.process >= a.AppProcess.Inited) throw new Error("已经初始化完成");
                this.process = a.AppProcess.Init, this.dispatchEvent(new V(this)), this.process = a.AppProcess.Initing,
                    this.loadedProviders.forEach(function (e) {
                        t.initProvider(e);
                    }), this.process = a.AppProcess.Inited, this.dispatchEvent(new z(this)), this.process = a.AppProcess.Running,
                    this.dispatchEvent(new H(this));
            }
        }, {
            key: "register",
            value: function (t) {
                if (null == t) throw new Error("服务提供者为null");
                if (this.isRegistered(t)) throw console.log(this.loadedProviders), console.log(t),
                    new Error("服务提供者已经注册过了不能重复注册");
                if (this.process == a.AppProcess.Initing) throw new Error("正在执行服务初始化无法注册服务");
                if (this.process > a.AppProcess.Running) throw new Error("app已经停止无法注册服务");
                t.setApplication && t.setApplication(this), this.dispatchEvent(new Y(t, this)),
                    t.register(), this.loadedProviders.push(t), a.AppProcess.Inited && this.initProvider(t);
            }
        }, {
            key: "isRegistered",
            value: function (t) {
                return -1 != this.loadedProviders.indexOf(t);
            }
        }, {
            key: "pause",
            value: function (t) {
                t ? this.process == a.AppProcess.Running && (this.process = a.AppProcess.Pause,
                    this.dispatchEventWith(j.OnPause)) : this.process == a.AppProcess.Pause && (this.process = a.AppProcess.Running,
                        this.dispatchEventWith(j.OnResume));
            }
        }, {
            key: "initProvider",
            value: function (t) {
                this.dispatchEvent(new K(t, this)), t.init();
            }
        }, {
            key: "registerBaseBindings",
            value: function () {
                this.instance(J.Appliction, this), this.dispatcher = new l();
            }
        }, {
            key: "exit",
            value: function () { }
        }], [{
            key: "new",
            value: function () {
                var t = new u();
                return D.That = t, t;
            }
        }]), u;
    }(v);
    return a.AfterBootEventArgs = W, a.AfterInitEventArgs = z, a.AfterTerminateEventArgs = function (t) {
        i(n, t);
        var e = s(n);
        function n(t) {
            return r(this, n), e.call(this, t, j.OnAfterTerminate);
        }
        return o(n);
    }(M), a.App = D, a.Application = Q, a.ApplicationEvents = j, a.ApplictionEventArgs = M,
        a.BeforeBootEventArgs = q, a.BeforeInitEventArgs = V, a.BeforeTerminateEventArgs = function (t) {
            i(n, t);
            var e = s(n);
            function n(t) {
                return r(this, n), e.call(this, t, j.OnBeforeTerminate);
            }
            return o(n);
        }(M), a.BootingEventArgs = G, a.Container = d, a.EventDispatcher = c, a.Facade = function () {
            function t() {
                r(this, t);
            }
            return o(t, null, [{
                key: "getThat",
                value: function () {
                    return this.mInst || (this.mInst = D.make(this.serviceName)), this.mInst;
                }
            }]), t;
        }(), a.Func = C, a.InitProviderEventArgs = K, a.Listener = N, a.Pools = b, a.RegisterProviderEventArgs = Y,
        a.ServiceProvider = function () {
            function t() {
                r(this, t);
            }
            return o(t, [{
                key: "init",
                value: function () { }
            }, {
                key: "register",
                value: function () { }
            }, {
                key: "setApplication",
                value: function (t) {
                    this.app = t;
                }
            }]), t;
        }(), a.ServiceType = J, a.StartCompletedEventArgs = H, a.StateMechine = A, a.Task = _,
        a.Utils = U, Object.defineProperty(a, "__esModule", {
            value: !0
        }), a;
}({});