@eva/eva.js
Advanced tools
Comparing version 1.0.6 to 1.0.7-alpha.0
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).EVA={})}(this,(function(t){"use strict";var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}var u=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,i||t,s),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o<i;o++)s[o]=n[o].fn;return s},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,o,i,s){var a=r?r+t:t;if(!this._events[a])return!1;var c,u,h=this._events[a],l=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,o),!0;case 5:return h.fn.call(h.context,e,n,o,i),!0;case 6:return h.fn.call(h.context,e,n,o,i,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var p,f=h.length;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,n);break;case 4:h[u].fn.call(h[u].context,e,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];h[u].fn.apply(h[u].context,c)}}return!0},a.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||n&&a.context!==n||s(this,i);else{for(var c=0,u=[],h=a.length;c<h;c++)(a[c].fn!==e||o&&!a[c].once||n&&a[c].context!==n)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}));var h=function(t){function e(e){var r=t.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=e,r}return r(e,t),e}(u);function l(t,e){return t===e||t!=t&&e!=e}function p(t,e){for(var r=t.length;r--;)if(l(t[r][0],e))return r;return-1}var f=Array.prototype.splice;function d(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}d.prototype.clear=function(){this.__data__=[],this.size=0},d.prototype.delete=function(t){var e=this.__data__,r=p(e,t);return!(r<0)&&(r==e.length-1?e.pop():f.call(e,r,1),--this.size,!0)},d.prototype.get=function(t){var e=this.__data__,r=p(e,t);return r<0?void 0:e[r][1]},d.prototype.has=function(t){return p(this.__data__,t)>-1},d.prototype.set=function(t,e){var r=this.__data__,n=p(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var y="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m="object"==typeof y&&y&&y.Object===Object&&y,v="object"==typeof self&&self&&self.Object===Object&&self,_=m||v||Function("return this")(),b=_.Symbol,g=Object.prototype,w=g.hasOwnProperty,O=g.toString,E=b?b.toStringTag:void 0;var x=Object.prototype.toString;var j=b?b.toStringTag:void 0;function T(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":j&&j in Object(t)?function(t){var e=w.call(t,E),r=t[E];try{t[E]=void 0;var n=!0}catch(t){}var o=O.call(t);return n&&(e?t[E]=r:delete t[E]),o}(t):function(t){return x.call(t)}(t)}function A(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function S(t){if(!A(t))return!1;var e=T(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var C,P=_["__core-js_shared__"],k=(C=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var L=Function.prototype.toString;function R(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var D=/^\[object .+?Constructor\]$/,M=Function.prototype,N=Object.prototype,I=M.toString,B=N.hasOwnProperty,q=RegExp("^"+I.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function U(t){return!(!A(t)||(e=t,k&&k in e))&&(S(t)?q:D).test(R(t));var e}function V(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return U(r)?r:void 0}var z=V(_,"Map"),G=V(Object,"create");var F=Object.prototype.hasOwnProperty;var X=Object.prototype.hasOwnProperty;function J(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Y(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function $(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}J.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(G){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return F.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return G?void 0!==e[t]:X.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=G&&void 0===e?"__lodash_hash_undefined__":e,this},$.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(z||d),string:new J}},$.prototype.delete=function(t){var e=Y(this,t).delete(t);return this.size-=e?1:0,e},$.prototype.get=function(t){return Y(this,t).get(t)},$.prototype.has=function(t){return Y(this,t).has(t)},$.prototype.set=function(t,e){var r=Y(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function H(t){var e=this.__data__=new d(t);this.size=e.size}H.prototype.clear=function(){this.__data__=new d,this.size=0},H.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},H.prototype.get=function(t){return this.__data__.get(t)},H.prototype.has=function(t){return this.__data__.has(t)},H.prototype.set=function(t,e){var r=this.__data__;if(r instanceof d){var n=r.__data__;if(!z||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new $(n)}return r.set(t,e),this.size=r.size,this};function W(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new $;++e<r;)this.add(t[e])}function Q(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}W.prototype.add=W.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},W.prototype.has=function(t){return this.__data__.has(t)};function K(t,e,r,n,o,i){var s=1&r,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(t),h=i.get(e);if(u&&h)return u==e&&h==t;var l=-1,p=!0,f=2&r?new W:void 0;for(i.set(t,e),i.set(e,t);++l<a;){var d=t[l],y=e[l];if(n)var m=s?n(y,d,l,e,t,i):n(d,y,l,t,e,i);if(void 0!==m){if(m)continue;p=!1;break}if(f){if(!Q(e,(function(t,e){if(s=e,!f.has(s)&&(d===t||o(d,t,r,n,i)))return f.push(e);var s}))){p=!1;break}}else if(d!==y&&!o(d,y,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p}var Z=_.Uint8Array;function tt(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function et(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var rt=b?b.prototype:void 0,nt=rt?rt.valueOf:void 0;var ot=Array.isArray;var it=Object.prototype.propertyIsEnumerable,st=Object.getOwnPropertySymbols,at=st?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}(st(t),(function(e){return it.call(t,e)})))}:function(){return[]};function ct(t){return null!=t&&"object"==typeof t}function ut(t){return ct(t)&&"[object Arguments]"==T(t)}var ht=Object.prototype,lt=ht.hasOwnProperty,pt=ht.propertyIsEnumerable,ft=ut(function(){return arguments}())?ut:function(t){return ct(t)&<.call(t,"callee")&&!pt.call(t,"callee")};var dt="object"==typeof t&&t&&!t.nodeType&&t,yt=dt&&"object"==typeof module&&module&&!module.nodeType&&module,mt=yt&&yt.exports===dt?_.Buffer:void 0,vt=(mt?mt.isBuffer:void 0)||function(){return!1},_t=/^(?:0|[1-9]\d*)$/;function bt(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&_t.test(t))&&t>-1&&t%1==0&&t<e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var wt={};wt["[object Float32Array]"]=wt["[object Float64Array]"]=wt["[object Int8Array]"]=wt["[object Int16Array]"]=wt["[object Int32Array]"]=wt["[object Uint8Array]"]=wt["[object Uint8ClampedArray]"]=wt["[object Uint16Array]"]=wt["[object Uint32Array]"]=!0,wt["[object Arguments]"]=wt["[object Array]"]=wt["[object ArrayBuffer]"]=wt["[object Boolean]"]=wt["[object DataView]"]=wt["[object Date]"]=wt["[object Error]"]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Number]"]=wt["[object Object]"]=wt["[object RegExp]"]=wt["[object Set]"]=wt["[object String]"]=wt["[object WeakMap]"]=!1;var Ot,Et="object"==typeof t&&t&&!t.nodeType&&t,xt=Et&&"object"==typeof module&&module&&!module.nodeType&&module,jt=xt&&xt.exports===Et&&m.process,Tt=function(){try{var t=xt&&xt.require&&xt.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),At=Tt&&Tt.isTypedArray,St=At?(Ot=At,function(t){return Ot(t)}):function(t){return ct(t)&>(t.length)&&!!wt[T(t)]},Ct=Object.prototype.hasOwnProperty;function Pt(t,e){var r=ot(t),n=!r&&ft(t),o=!r&&!n&&vt(t),i=!r&&!n&&!o&&St(t),s=r||n||o||i,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var u in t)!e&&!Ct.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bt(u,c))||a.push(u);return a}var kt=Object.prototype;var Lt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Rt=Object.prototype.hasOwnProperty;function Dt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||kt))return Lt(t);var e,r,n=[];for(var o in Object(t))Rt.call(t,o)&&"constructor"!=o&&n.push(o);return n}function Mt(t){return null!=(e=t)&>(e.length)&&!S(e)?Pt(t):Dt(t);var e}function Nt(t){return function(t,e,r){var n=e(t);return ot(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Mt,at)}var It=Object.prototype.hasOwnProperty;var Bt=V(_,"DataView"),qt=V(_,"Promise"),Ut=V(_,"Set"),Vt=V(_,"WeakMap"),zt="[object Map]",Gt="[object Promise]",Ft="[object Set]",Xt="[object WeakMap]",Jt="[object DataView]",Yt=R(Bt),$t=R(z),Ht=R(qt),Wt=R(Ut),Qt=R(Vt),Kt=T;(Bt&&Kt(new Bt(new ArrayBuffer(1)))!=Jt||z&&Kt(new z)!=zt||qt&&Kt(qt.resolve())!=Gt||Ut&&Kt(new Ut)!=Ft||Vt&&Kt(new Vt)!=Xt)&&(Kt=function(t){var e=T(t),r="[object Object]"==e?t.constructor:void 0,n=r?R(r):"";if(n)switch(n){case Yt:return Jt;case $t:return zt;case Ht:return Gt;case Wt:return Ft;case Qt:return Xt}return e});var Zt,te=Kt,ee="[object Arguments]",re="[object Array]",ne="[object Object]",oe=Object.prototype.hasOwnProperty;function ie(t,e,r,n,o,i){var s=ot(t),a=ot(e),c=s?re:te(t),u=a?re:te(e),h=(c=c==ee?ne:c)==ne,p=(u=u==ee?ne:u)==ne,f=c==u;if(f&&vt(t)){if(!vt(e))return!1;s=!0,h=!1}if(f&&!h)return i||(i=new H),s||St(t)?K(t,e,r,n,o,i):function(t,e,r,n,o,i,s){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Z(t),new Z(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return l(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=tt;case"[object Set]":var c=1&n;if(a||(a=et),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=2,s.set(t,e);var h=K(a(t),a(e),n,o,i,s);return s.delete(t),h;case"[object Symbol]":if(nt)return nt.call(t)==nt.call(e)}return!1}(t,e,c,r,n,o,i);if(!(1&r)){var d=h&&oe.call(t,"__wrapped__"),y=p&&oe.call(e,"__wrapped__");if(d||y){var m=d?t.value():t,v=y?e.value():e;return i||(i=new H),o(m,v,r,n,i)}}return!!f&&(i||(i=new H),function(t,e,r,n,o,i){var s=1&r,a=Nt(t),c=a.length;if(c!=Nt(e).length&&!s)return!1;for(var u=c;u--;){var h=a[u];if(!(s?h in e:It.call(e,h)))return!1}var l=i.get(t),p=i.get(e);if(l&&p)return l==e&&p==t;var f=!0;i.set(t,e),i.set(e,t);for(var d=s;++u<c;){var y=t[h=a[u]],m=e[h];if(n)var v=s?n(m,y,h,e,t,i):n(y,m,h,t,e,i);if(!(void 0===v?y===m||o(y,m,r,n,i):v)){f=!1;break}d||(d="constructor"==h)}if(f&&!d){var _=t.constructor,b=e.constructor;_==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,r,n,o,i))}function se(t,e,r,n,o){return t===e||(null==t||null==e||!ct(t)&&!ct(e)?t!=t&&e!=e:ie(t,e,r,n,se,o))}function ae(t,e){return se(t,e)}t.OBSERVER_TYPE=void 0,(Zt=t.OBSERVER_TYPE||(t.OBSERVER_TYPE={})).ADD="ADD",Zt.REMOVE="REMOVE",Zt.CHANGE="CHANGE";var ce={},ue={},he={},le={};function pe(t,e){ce[t.gameObject.id]||(ce[t.gameObject.id]={});var r=ce[t.gameObject.id],n=t.name+"_"+e.join(",");if(r[n])return r[n];for(var o=e.length-1,i=t,s=0;s<o;s++)i=i[e[s]];return r[n]={property:i,key:e[o]},r[n]}function fe(t){var e=t.systemName,r=t.componentName,n=t.component,o=t.prop,i=t.type;ue[e].componentObserver.add({component:n,prop:o,type:i,componentName:r})}function de(e){var r,n,o=e.obj,i=e.key,a=e.prop,c=e.component,u=e.componentName;if(void 0!==o)if(i in o){if(Object.defineProperty(o,"_"+i,{enumerable:!1,writable:!0,value:o[i]}),a.deep&&A(o[i]))try{for(var h=s(Object.keys(o[i])),l=h.next();!l.done;l=h.next()){var p=l.value;de({obj:o[i],key:p,prop:a,component:c,componentName:u})}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}Object.defineProperty(o,i,{enumerable:!0,set:function(e){o["_"+i]!==e&&(o["_"+i]=e,function(e){var r=e.prop,n=e.component,o=e.componentName;for(var i in he){var s=(he[i]||{})[o];s&&s.findIndex((function(t){return ae(t,r)}))>-1&&fe({systemName:i,componentName:o,component:n,prop:r,type:t.OBSERVER_TYPE.CHANGE})}}({prop:a,component:c,componentName:u}))},get:function(){return o["_"+i]}})}else console.error("prop "+i+" not in component: "+u+", Can not observer")}function ye(e,r){for(var n in void 0===r&&(r=e.name),he){(he[n]||{})[r]&&ue[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.REMOVE,componentName:r})}!function(t){t.gameObject&&delete ce[t.gameObject.id]}(e)}function me(t,e){t.constructor.IDEProps||(t.constructor.IDEProps=[]),t.constructor.IDEProps.push(e)}var ve=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Transform",e._parent=null,e.inScene=!1,e.children=[],e.position={x:0,y:0},e.size={width:0,height:0},e.origin={x:0,y:0},e.anchor={x:0,y:0},e.scale={x:1,y:1},e.skew={x:0,y:0},e.rotation=0,e}return r(e,t),e.prototype.init=function(t){var e,r;void 0===t&&(t={});try{for(var n=s(["position","size","origin","anchor","scale","skew"]),o=n.next();!o.done;o=n.next()){var i=o.value;Object.assign(this[i],t[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}this.rotation=t.rotation||this.rotation},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},set:function(t){t?t.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t.parent===this){var e=this.children.findIndex((function(e){return e===t}));this.children.splice(e,1)}else t.parent&&t.parent.removeChild(t);t._parent=this,this.children.push(t)},e.prototype.removeChild=function(t){var e=this.children.findIndex((function(e){return e===t}));e>-1&&(this.children.splice(e,1),t._parent=null)},e.prototype.clearChildren=function(){this.children.length=0},e.componentName="Transform",n([me],e.prototype,"position",void 0),n([me],e.prototype,"size",void 0),n([me],e.prototype,"origin",void 0),n([me],e.prototype,"anchor",void 0),n([me],e.prototype,"scale",void 0),n([me],e.prototype,"skew",void 0),n([me],e.prototype,"rotation",void 0),e}(h),_e=0;var be,ge=function(){function e(t,e){this._componentCache={},this.components=[],this._name=t,this.id=++_e,this.addComponent(ve,e)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(ve.componentName)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(t){var e,r;if(this._scene!==t){var n=this._scene;if(this._scene=t,this.transform&&this.transform.children)try{for(var o=s(this.transform.children),i=o.next();!i.done;i=o.next()){i.value.gameObject.scene=t}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?t.addGameObject(this):n&&n.removeGameObject(this)}},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t&&t.transform&&t!==this){if(!(t instanceof e))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error("gameObject '"+this.name+"' has been destroy");t.transform.parent=this.transform,t.scene=this.scene}},e.prototype.removeChild=function(t){return t instanceof e&&t.parent&&t.parent===this?(t.transform.parent=null,t.scene=null,t):t},e.prototype.addComponent=function(e,r){var n=function(t){return t instanceof h?t.name:t instanceof Function?t.componentName:void 0}(e);if(!this._componentCache[n]){var o;if(e instanceof Function)o=new e(r);else{if(!(e instanceof h))throw new Error("addComponent recieve Component and Component Constructor");o=e}if(o.gameObject)throw new Error("component has been added on gameObject "+o.gameObject.name);return o.gameObject=this,o.init&&o.init(o.__componentDefaultParams),function(e,r){for(var n in void 0===r&&(r=e.name),he)(he[n]||{})[r]&&ue[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.ADD,componentName:r})}(o,o.name),function(t,e){var r,n;if(void 0===e&&(e=t.name),e&&le[e]){if(!(t&&(o=t,o&&o.constructor&&"componentName"in o.constructor)))throw new Error("component param must be an instance of Component");var o;if(!t.gameObject||!t.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var i=s(le[e]),a=i.next();!a.done;a=i.next()){var c=a.value,u=pe(t,c.prop);de({obj:u.property,key:u.key,prop:c,component:t,componentName:e})}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}(o,o.name),this.components.push(o),this._componentCache[n]=o,o.awake&&o.awake(),o}},e.prototype.removeComponent=function(t){var e;if("string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),"Transform"===e)throw new Error("Transform can't be removed");return this._removeComponent(e)},e.prototype._removeComponent=function(t){var e=this.components.findIndex((function(e){return e.name===t}));if(-1!==e){var r=this.components.splice(e,1)[0];return delete this._componentCache[t],r.onDestroy&&r.onDestroy(),ye(r,t),r.gameObject=void 0,r}},e.prototype.getComponent=function(t){var e;return"string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),void 0!==this._componentCache[e]?this._componentCache[e]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){for(var t in Array.from(this.transform.children).forEach((function(t){t.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(t);this.components.length=0},e}(),we=function(){function e(){this.events=[]}return e.prototype.add=function(e){var r=e.component,n=e.prop,o=e.type,i=e.componentName;o===t.OBSERVER_TYPE.REMOVE&&(this.events=this.events.filter((function(t){return t.component!==r})));var s=this.events.findIndex((function(t){return t.component===r&&ae(t.prop,n)&&t.type===o}));s>-1&&this.events.splice(s,1),this.events.push({gameObject:r.gameObject,component:r,prop:n,type:o,componentName:i})},e.prototype.getChanged=function(){return this.events},Object.defineProperty(e.prototype,"changed",{get:function(){return this.events},enumerable:!1,configurable:!0}),e.prototype.clear=function(){var t=this.events;return this.events=[],t},e}(),Oe=function(){function t(t){this.started=!1,this.componentObserver=new we,this.__systemDefaultParams=t,this.name=this.constructor.systemName}return t.prototype.destroy=function(){var t;this.componentObserver=null,this.__systemDefaultParams=null,null===(t=this.onDestroy)||void 0===t||t.call(this)},t}(),Ee={autoStart:!0,frameRate:60},xe=function(){function t(t){var e=this;t=Object.assign({},Ee,t),this._frameDuration=1e3/t.frameRate,this.autoStart=t.autoStart,this.frameRate=t.frameRate,this._tickers=new Set,this._requestId=null,this._blockTime=0,this._lastTime=Date.now(),this._frameCount=0,this._activeWithPause=!1,this._ticker=function(){e._started&&(e._requestId=requestAnimationFrame(e._ticker),e.update())},this.autoStart&&this.start(),this.bindEvent()}return t.prototype.update=function(){var t,e,r=Date.now();if(r-this._lastTime>=this._frameDuration){var n=r-this._lastTime,o={deltaTime:n,frameCount:++this._frameCount,time:r-this._blockTime,fps:Math.round(1e3/n)};try{for(var i=s(this._tickers),a=i.next();!a.done;a=i.next()){var c=a.value;"function"==typeof c&&c(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this._lastTime=r}},t.prototype.add=function(t){this._tickers.add(t)},t.prototype.remove=function(t){this._tickers.delete(t)},t.prototype.start=function(){this._started||(this._lastStopTime>0&&(this._blockTime=this._blockTime+Date.now()-this._lastStopTime,this._lastStopTime=0),this._started=!0,this._lastTime=Date.now(),this._requestId=requestAnimationFrame(this._ticker))},t.prototype.pause=function(){this._started=!1,this._lastStopTime=Date.now()},t.prototype.active=function(){this._activeWithPause||this.start(),this._activeWithPause=!1},t.prototype.background=function(){this._started?this.pause():this._activeWithPause=!0},t.prototype.bindEvent=function(){},t}(),je=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.gameObjects=[],n.scene=n,n}return r(e,t),e.prototype.addGameObject=function(t){this.gameObjects.push(t),t.transform&&(t.transform.inScene=!0)},e.prototype.removeGameObject=function(t){var e=this.gameObjects.indexOf(t);-1!==e&&(t.transform&&(t.transform.inScene=!1),this.gameObjects.splice(e,1))},e.prototype.destroy=function(){this.scene=null,t.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},e}(ge);t.LOAD_SCENE_MODE=void 0,(be=t.LOAD_SCENE_MODE||(t.LOAD_SCENE_MODE={})).SINGLE="SINGLE",be.MULTI_CANVAS="MULTI_CANVAS";var Te=function(t){if((t instanceof Oe||t instanceof h)&&!t.started){try{t.start&&t.start()}catch(e){t instanceof h?console.error(t.constructor.componentName+" start error",e):console.error(t.constructor.systemName+" start error",e)}t.started=!0}},Ae=function(e){function n(t){var r,n,o=void 0===t?{}:t,i=o.autoStart,a=void 0===i||i,c=o.frameRate,u=void 0===c?120:c,h=o.systems,l=o.needScene,p=void 0===l||l,f=e.call(this)||this;if(f.playing=!1,f.started=!1,f.multiScenes=[],f.systems=[],f.ticker=new xe({autoStart:!1,frameRate:u}),f.initTicker(),h&&h.length)try{for(var d=s(h),y=d.next();!y.done;y=d.next()){var m=y.value;f.addSystem(m)}}catch(t){r={error:t}}finally{try{y&&!y.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return p&&f.loadScene(new je("scene")),a&&f.start(),f}return r(n,e),Object.defineProperty(n.prototype,"scene",{get:function(){return this._scene},set:function(t){this._scene=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"gameObjects",{get:function(){return function(t){var e,r,n,o=(null===(n=null==t?void 0:t.scene)||void 0===n?void 0:n.gameObjects)||[],i=null==t?void 0:t.multiScenes.map((function(t){return t.gameObjects})),a=[];try{for(var u=s(i),h=u.next();!h.done;h=u.next())a=c(a,h.value)}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return c(o,a)}(this)},enumerable:!1,configurable:!0}),n.prototype.addSystem=function(t,e){var r;if(t instanceof Function)r=new t(e);else{if(!(t instanceof Oe))return void console.warn("can only add System");r=t}if(!this.systems.find((function(t){return t.constructor===r.constructor}))){r.game=this,r.init&&r.init(r.__systemDefaultParams),function(t,e){he[e.systemName]=e.observerInfo,ue[e.systemName]=t}(r,r.constructor),function(t){var e,r,n,o,i=[];t instanceof Array?i.push.apply(i,c(t)):i.push(t);try{for(var a=s(i),u=a.next();!u.done;u=a.next()){var h=u.value;for(var l in h.observerInfo){le[l]=le[l]||[];var p=le[l],f=function(t){-1===p.findIndex((function(e){return ae(e,t)}))&&le[l].push(t)};try{for(var d=(n=void 0,s(h.observerInfo[l])),y=d.next();!y.done;y=d.next())f(y.value)}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}(r.constructor);try{r.awake&&r.awake()}catch(t){console.error(r.constructor.systemName+" awake error",t)}return this.systems.push(r),r}console.warn(r.constructor.systemName+" System has been added")},n.prototype.removeSystem=function(t){if(t){var e=-1;"string"==typeof t?e=this.systems.findIndex((function(e){return e.name===t})):t instanceof Function?e=this.systems.findIndex((function(e){return e.constructor===t})):t instanceof Oe&&(e=this.systems.findIndex((function(e){return e===t}))),e>-1&&(this.systems[e].destroy&&this.systems[e].destroy(),this.systems.splice(e,1))}},n.prototype.getSystem=function(t){return this.systems.find((function(e){return"string"==typeof t?e.name===t:e instanceof t}))},n.prototype.pause=function(){!1!==this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},n.prototype.start=function(){!0!==this.playing&&(this.ticker.start(),this.playing=!0,this.started=!0)},n.prototype.resume=function(){!0!==this.playing&&(this.ticker.start(),this.triggerResume(),this.playing=!0)},n.prototype.initTicker=function(){var t=this;this.ticker.add((function(e){var r,n,o,i;t.scene&&function(t,e){var r,n,o,i,a,c,u,h;void 0===e&&(e=[]);try{for(var l=s(e),p=l.next();!p.done;p=l.next()){var f=p.value;try{for(var d=(o=void 0,s(f.components)),y=d.next();!y.done;y=d.next()){var m=y.value;try{Te(m),m.update&&m.update(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" update error",t)}}}catch(t){o={error:t}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}try{for(var v=s(e),_=v.next();!_.done;_=v.next()){f=_.value;try{for(var b=(u=void 0,s(f.components)),g=b.next();!g.done;g=b.next()){m=g.value;try{m.lateUpdate&&m.lateUpdate(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" lateUpdate error",t)}}}catch(t){u={error:t}}finally{try{g&&!g.done&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{_&&!_.done&&(c=v.return)&&c.call(v)}finally{if(a)throw a.error}}}(e,t.gameObjects);try{for(var a=s(t.systems),c=a.next();!c.done;c=a.next()){var u=c.value;try{Te(u),u.update&&u.update(e)}catch(e){console.error(u.constructor.systemName+" update error",e)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}try{for(var h=s(t.systems),l=h.next();!l.done;l=h.next()){u=l.value;try{u.lateUpdate&&u.lateUpdate(e)}catch(e){console.error(u.constructor.systemName+" lateUpdate error",e)}}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}}))},n.prototype.triggerResume=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),h=u.next();!h.done;h=u.next()){var l=h.value;try{l.onResume&&l.onResume()}catch(t){console.error("gameObject: "+c.name+", "+l.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onResume&&o.onResume()}catch(t){console.error(o.constructor.systemName+", onResume error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.triggerPause=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),h=u.next();!h.done;h=u.next()){var l=h.value;try{l.onPause&&l.onPause()}catch(t){console.error("gameObject: "+c.name+", "+l.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onPause&&o.onPause()}catch(t){console.error(o.constructor.systemName+", onPause error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.destroySystems=function(){var t,e;try{for(var r=s(c(this.systems)),n=r.next();!n.done;n=r.next()){var o=n.value;this.removeSystem(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.systems=[]},n.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},n.prototype.loadScene=function(e){var r=e.scene,n=e.mode,o=void 0===n?t.LOAD_SCENE_MODE.SINGLE:n,i=e.params,s=void 0===i?{}:i;if(r){switch(o){case t.LOAD_SCENE_MODE.SINGLE:this.scene=r;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(r)}this.emit("sceneChanged",{scene:r,mode:o,params:s})}},n}(u);function Se(t){return void 0===t&&(t={}),function(e){if(!e.observerInfo){for(var r in t)for(var n in t[r]){"string"==typeof t[r][n]&&(t[r][n]=[t[r][n]]);var o=void 0;Array.isArray(t[r][n])&&(o={prop:t[r][n],deep:!1},t[r][n]=o),"string"==typeof(o=t[r][n]).prop&&(o.prop=[o.prop])}e.observerInfo=t}}}var Ce=function(){function t(t,e,r){void 0===e&&(e=!1),this.next=null,this.prev=null,this.owner=null,this.fn=t,this.once=e,this.thisArg=r}return t.prototype.detach=function(){return null!==this.owner&&(this.owner.detach(this),!0)},t.prototype.dispose=function(){this.detach()},t}(),Pe=function(){function t(){this._head=null,this._tail=null,this._filter=null}return t.prototype.handlers=function(){for(var t=this._head,e=[];t;)e.push(t),t=t.next;return e},t.prototype.hasAny=function(){return!!this._head},t.prototype.has=function(t){return t.owner===this},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._head;if(!r)return!1;if(this._filter&&!this._filter.apply(this,t))return!1;for(;r;)r.once&&this.detach(r),r.fn.apply(r.thisArg,t),r=r.next;return!0},t.prototype.add=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new Ce(t,!1,e))},t.prototype.once=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new Ce(t,!0,e))},t.prototype.detach=function(t){var e=t;return e.owner!==this||(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this._head?(this._head=e.next,null===e.next&&(this._tail=null)):e===this._tail&&(this._tail=e.prev,this._tail&&(this._tail.next=null)),e.owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=null,this._tail=null;t;)t.owner=null,t=t.next;return this},t.prototype.filter=function(t){this._filter=t},t.prototype.proxy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.dispatch.apply(t,e)},o=0;o<e.length;++o)e[o].add(n);return this},t.prototype._addSignalBinding=function(t){var e=t;return this._head?(this._tail&&(this._tail.next=e),e.prev=this._tail,this._tail=e):(this._head=e,this._tail=e),e.owner=this,e},t}();var ke,Le,Re=function(t,e){if(t){e=e||{};for(var r={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},n=r.parser[e.strictMode?"strict":"loose"].exec(t),o={},i=14;i--;)o[r.key[i]]=n[i]||"";return o[r.q.name]={},o[r.key[12]].replace(r.q.parser,(function(t,e,n){e&&(o[r.q.name][e]=n)})),o}},De=function(t){this.config=t,this.onError=new Pe,this.onComplete=new Pe,this.onProgress=new Pe},Me=function(t,e){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Ne(t,e){function r(){this.constructor=t}Me(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Ie(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function Be(t){var e="";if(0===t.indexOf("data:")){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var n=t.indexOf("?"),o=t.indexOf("#"),i=Math.min(n>-1?n:t.length,o>-1?o:t.length);e=(t=t.substring(0,i)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()}function qe(t){throw new Error("Unexpected value. Should have been never.")}!function(t){t[t.Unknown=0]="Unknown",t[t.Buffer=1]="Buffer",t[t.Blob=2]="Blob",t[t.Json=3]="Json",t[t.Xml=4]="Xml",t[t.Image=5]="Image",t[t.Audio=6]="Audio",t[t.Video=7]="Video",t[t.Text=8]="Text"}(ke||(ke={})),function(t){t[t.NotStarted=0]="NotStarted",t[t.Loading=1]="Loading",t[t.Complete=2]="Complete"}(Le||(Le={}));var Ue,Ve=function(t){function e(e,r){var n=t.call(this,e)||this;return n.elementType=r,n._boundOnLoad=n._onLoad.bind(n),n._boundOnError=n._onError.bind(n),n._boundOnTimeout=n._onTimeout.bind(n),n._element=n._createElement(),n._elementTimer=0,n}return Ne(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin);var e=t.sourceSet||[t.url];if(navigator.isCocoonJS)this._element.src=e[0];else for(var r=0;r<e.length;++r){var n=e[r],o=t.mimeTypes?t.mimeTypes[r]:void 0;o||(o=this.elementType+"/"+Be(n));var i=document.createElement("source");i.src=n,i.type=o,this._element.appendChild(i)}this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("canplaythrough",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),this._element.load(),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){for(this._clearEvents();this._element.firstChild;)this._element.removeChild(this._element.firstChild);this._error(this.elementType+" load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement(this.elementType)},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("canplaythrough",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents();var t=ke.Unknown;switch(this.elementType){case"audio":t=ke.Audio;break;case"video":t=ke.Video;break;default:qe(this.elementType)}this.onComplete.dispatch(t,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error(this.elementType+" failed to load.")},e.prototype._onTimeout=function(){this._error(this.elementType+" load timed out.")},e}(De),ze=function(t){function e(e){return t.call(this,e,"audio")||this}return Ne(e,t),e}(Ve),Ge=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._element=e._createElement(),e._elementTimer=0,e}return Ne(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin),this._element.src=t.url,this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){this._clearEvents(),this._element.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",this._error("Image load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement("img")},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents(),this.onComplete.dispatch(ke.Image,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error("Image failed to load.")},e.prototype._onTimeout=function(){this._error("Image load timed out.")},e}(De),Fe=function(t){function e(e){return t.call(this,e,"video")||this}return Ne(e,t),e}(Ve),Xe=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest);function Je(t){return t.toString().replace("object ","")}!function(t){t.Default="text",t.Buffer="arraybuffer",t.Blob="blob",t.Document="document",t.Json="json",t.Text="text"}(Ue||(Ue={}));var Ye=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnAbort=e._onAbort.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._boundOnProgress=e._onProgress.bind(e),e._xhr=e._createRequest(),e._xhrType=Ue.Default,e}return Ne(e,t),e.prototype.load=function(){var t=this.config,e=Be(t.url);"string"!=typeof t.xhrType&&(t.xhrType=this._determineXhrType(e));var r=this._xhr;this._xhrType=t.xhrType||Ue.Default,Xe?(r.timeout=t.timeout||5e3,r.onload=this._boundOnLoad,r.onerror=this._boundOnError,r.ontimeout=this._boundOnTimeout,r.onprogress=this._boundOnProgress,r.open("GET",t.url,!0),setTimeout((function(){r.send()}),0)):(r.open("GET",t.url,!0),t.timeout&&(r.timeout=t.timeout),t.xhrType===Ue.Json||t.xhrType===Ue.Document?r.responseType=Ue.Text:r.responseType=t.xhrType,r.addEventListener("load",this._boundOnLoad,!1),r.addEventListener("abort",this._boundOnAbort,!1),r.addEventListener("error",this._boundOnError,!1),r.addEventListener("timeout",this._boundOnTimeout,!1),r.addEventListener("progress",this._boundOnProgress,!1),r.send())},e.prototype.abort=function(){Xe?(this._clearEvents(),this._xhr.abort(),this._onAbort()):this._xhr.abort()},e.prototype._createRequest=function(){return Xe?new window.XDomainRequest:new XMLHttpRequest},e.prototype._determineXhrType=function(t){return e._xhrTypeMap[t]||Ue.Default},e.prototype._clearEvents=function(){Xe?(this._xhr.onload=null,this._xhr.onerror=null,this._xhr.ontimeout=null,this._xhr.onprogress=null):(this._xhr.removeEventListener("load",this._boundOnLoad,!1),this._xhr.removeEventListener("abort",this._boundOnAbort,!1),this._xhr.removeEventListener("error",this._boundOnError,!1),this._xhr.removeEventListener("timeout",this._boundOnTimeout,!1),this._xhr.removeEventListener("progress",this._boundOnProgress,!1))},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(t,e){this._clearEvents(),this.onComplete.dispatch(t,e)},e.prototype._onLoad=function(){var t=this._xhr,e="",r=void 0===t.status?200:t.status;if(void 0!==t.responseType&&""!==t.responseType&&"text"!==t.responseType||(e=t.responseText),0===r&&(e.length>0||t.responseType===Ue.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case Ue.Buffer:this._complete(ke.Buffer,t.response);break;case Ue.Blob:this._complete(ke.Blob,t.response);break;case Ue.Document:this._parseDocument(e);break;case Ue.Json:this._parseJson(e);break;case Ue.Default:case Ue.Text:this._complete(ke.Text,e);break;default:qe(this._xhrType)}else this._error("["+t.status+"] "+t.statusText+": "+t.responseURL)},e.prototype._parseDocument=function(t){try{if(window.DOMParser){var e=(new DOMParser).parseFromString(t,"text/xml");this._complete(ke.Xml,e)}else{var r=document.createElement("div");r.innerHTML=t,this._complete(ke.Xml,r)}}catch(t){this._error("Error trying to parse loaded xml: "+t)}},e.prototype._parseJson=function(t){try{var e=JSON.parse(t);this._complete(ke.Json,e)}catch(t){this._error("Error trying to parse loaded json: "+t)}},e.prototype._onAbort=function(){var t=this._xhr;this._error(Je(t)+" Request was aborted by the user.")},e.prototype._onError=function(){var t=this._xhr;this._error(Je(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},e.prototype._onTimeout=function(){var t=this._xhr;this._error(Je(t)+" Request timed out.")},e.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(t.loaded/t.total)},e.setExtensionXhrType=function(t,r){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e._xhrTypeMap[t]=r)},e.ResponseType=Ue,e._xhrTypeMap={xhtml:Ue.Document,html:Ue.Document,htm:Ue.Document,xml:Ue.Document,tmx:Ue.Document,svg:Ue.Document,tsx:Ue.Document,gif:Ue.Blob,png:Ue.Blob,bmp:Ue.Blob,jpg:Ue.Blob,jpeg:Ue.Blob,tif:Ue.Blob,tiff:Ue.Blob,webp:Ue.Blob,tga:Ue.Blob,json:Ue.Json,text:Ue.Text,txt:Ue.Text,ttf:Ue.Buffer,otf:Ue.Buffer},e}(De);function $e(t){var e=t;return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(null===e)throw new Error("Callback was already called.");var n=e;return e=null,n.apply(this,t)}}var He=function(){function t(t,e){if(void 0===e&&(e=1),this.worker=t,this.concurrency=e,this.workers=0,this.buffer=0,this.paused=!1,this._started=!1,this._tasks=[],this.onSaturated=new Pe,this.onUnsaturated=new Pe,this.onEmpty=new Pe,this.onDrain=new Pe,this.onError=new Pe,0===e)throw new Error("Concurrency must not be zero");this.buffer=e/4}return Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.onDrain.detachAll(),this.workers=0,this._started=!1,this._tasks=[]},t.prototype.push=function(t,e){this._insert(t,!1,e)},t.prototype.unshift=function(t,e){this._insert(t,!0,e)},t.prototype.process=function(){for(;!this.paused&&this.workers<this.concurrency&&this._tasks.length;){var t=this._tasks.shift();0===this._tasks.length&&this.onEmpty.dispatch(),this.workers+=1,this.workers===this.concurrency&&this.onSaturated.dispatch(),this.worker(t.data,$e(this._next(t)))}},t.prototype.length=function(){return this._tasks.length},t.prototype.running=function(){return this.workers},t.prototype.idle=function(){return this._tasks.length+this.workers===0},t.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},t.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},t.prototype.getTask=function(t){return this._tasks[t]},t.prototype._insert=function(t,e,r){var n=this;if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(this._started=!0,null==t&&this.idle())setTimeout((function(){return n.onDrain.dispatch()}),1);else{var o={data:t,callback:r};e?this._tasks.unshift(o):this._tasks.push(o),setTimeout((function(){return n.process()}),1)}},t.prototype._next=function(t){var e=this;return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];e.workers-=1,t.callback&&t.callback.apply(t,Ie([r],n)),r&&e.onError.dispatch(r,t.data),e.workers<=e.concurrency-e.buffer&&e.onUnsaturated.dispatch(),e.idle()&&e.onDrain.dispatch(),e.process()}},t}(),We=function(){function t(e,r){if(this.children=[],this.onStart=new Pe,this.onProgress=new Pe,this.onComplete=new Pe,this.onAfterMiddleware=new Pe,this.data=null,this.type=ke.Unknown,this.error="",this.progressChunk=0,this._dequeue=function(){},this._onCompleteBinding=null,this._state=Le.NotStarted,this.name=e,this.metadata=r.metadata,"string"!=typeof r.crossOrigin&&(r.crossOrigin=this._determineCrossOrigin(r.url)),r.strategy&&"function"!=typeof r.strategy)this._strategy=r.strategy,this._strategy.config=r;else{var n=r.strategy;n||(n=t._loadStrategyMap[Be(r.url)]),n||(n=t._defaultLoadStrategy),this._strategy=new n(r)}this._strategy.onError.add(this._error,this),this._strategy.onComplete.add(this._complete,this),this._strategy.onProgress.add(this._progress,this)}return t.setDefaultLoadStrategy=function(e){t._defaultLoadStrategy=e},t.setLoadStrategy=function(e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t._loadStrategyMap[e]=r)},Object.defineProperty(t.prototype,"strategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this._strategy.config.url},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return this._state===Le.Loading},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._state===Le.Complete},enumerable:!0,configurable:!0}),t.prototype.abort=function(){this._strategy.abort()},t.prototype.load=function(){this._state=Le.Loading,this.onStart.dispatch(this),this._strategy.load()},t.prototype._error=function(t){this._state=Le.Complete,this.error=t,this.onComplete.dispatch(this)},t.prototype._complete=function(t,e){this._state=Le.Complete,this.type=t,this.data=e,this.onComplete.dispatch(this)},t.prototype._progress=function(t){this.onProgress.dispatch(this,t)},t.prototype._determineCrossOrigin=function(e,r){if(void 0===r&&(r=window.location),0===e.indexOf("data:")||0===e.indexOf("javascript:"))return"";if(window.origin!==window.location.origin)return"anonymous";t._tempAnchor||(t._tempAnchor=document.createElement("a")),t._tempAnchor.href=e;var n=Re(t._tempAnchor.href,{strictMode:!0}),o=!n.port&&""===r.port||n.port===r.port,i=n.protocol?n.protocol+":":"";return n.host===r.hostname&&o&&i===r.protocol?"":"anonymous"},t._tempAnchor=null,t._defaultLoadStrategy=Ye,t._loadStrategyMap={gif:Ge,png:Ge,bmp:Ge,jpg:Ge,jpeg:Ge,tif:Ge,tiff:Ge,webp:Ge,tga:Ge,svg:Ge,"svg+xml":Ge,mp3:ze,ogg:ze,wav:ze,mp4:Fe,webm:Fe,mov:Fe},t}();var Qe,Ke,Ze=/(#[\w-]+)?$/,tr=function(){function t(e,r){void 0===e&&(e=""),void 0===r&&(r=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this.resources={},this.onError=new Pe,this.onLoad=new Pe,this.onStart=new Pe,this.onComplete=new Pe,this.onProgress=new Pe,this._baseUrl="",this._urlResolvers=[],this._middleware=[],this._resourcesParsing=[],this._boundLoadResource=this._loadResource.bind(this),this.baseUrl=e,this._queue=new He(this._boundLoadResource,r),this._queue.pause(),this._middleware=t._defaultMiddleware.slice()}return Object.defineProperty(t.prototype,"baseUrl",{get:function(){return this._baseUrl},set:function(t){for(;t.length&&"/"===t.charAt(t.length-1);)t=t.slice(0,-1);this._baseUrl=t},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){if(Array.isArray(t)){for(var r=0;r<t.length;++r)this.add(t[r]);return this}var n="",o="",i=this._baseUrl,s={url:""};if("object"==typeof t?(n=t.url,o=t.name||t.url,i=t.baseUrl||i,s=t):(o=t,n="string"==typeof e?e:o),!n)throw new Error("You must specify the `url` property.");if(this.loading&&!s.parentResource)throw new Error("Cannot add root resources while the loader is running.");if(this.resources[o])throw new Error('Resource named "'+o+'" already exists.');n=this._prepareUrl(n,i),s.url=n;var a=new We(o,s);if(this.resources[o]=a,"function"==typeof s.onComplete&&a.onAfterMiddleware.once(s.onComplete),this.loading){var c=s.parentResource,u=[];for(r=0;r<c.children.length;++r)c.children[r].isComplete||u.push(c.children[r]);var h=c.progressChunk*(u.length+1)/(u.length+2);c.children.push(a),c.progressChunk=h;for(r=0;r<u.length;++r)u[r].progressChunk=h;a.progressChunk=h}return this._queue.push(a),this},t.prototype.use=function(e,r){return void 0===r&&(r=t.DefaultMiddlewarePriority),this._middleware.push({fn:e,priority:r}),this._middleware.sort((function(t,e){return t.priority-e.priority})),this},t.prototype.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.reset(),this._queue.pause(),this.resources){var e=this.resources[t];e&&(e._onCompleteBinding&&e._onCompleteBinding.detach(),e.isLoading&&e.abort())}return this.resources={},this},t.prototype.load=function(t){if("function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue.length(),r=0;r<this._queue.length();++r)this._queue.getTask(r).data.progressChunk=e;this._onStart(),this._queue.resume()}return this},Object.defineProperty(t.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!0,configurable:!0}),t.prototype.addUrlResolver=function(t){return this._urlResolvers.push(t),this},t.prototype._prepareUrl=function(t,e){var r=Re(t,{strictMode:!0});if(this._urlResolvers.forEach((function(e){t=e(t,r),r=Re(t,{strictMode:!0})})),r.protocol||0===t.indexOf("//")||(t=e.length&&"/"!==t.charAt(0)?e+"/"+t:e+t),this.defaultQueryString){var n=Ze.exec(t);if(n){var o=n[0];-1!==(t=t.substr(0,t.length-o.length)).indexOf("?")?t+="&"+this.defaultQueryString:t+="?"+this.defaultQueryString,t+=o}}return t},t.prototype._loadResource=function(t,e){t._dequeue=e,t._onCompleteBinding=t.onComplete.once(this._onLoad,this),t.load()},t.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t.prototype._onLoad=function(t){var e=this;t._onCompleteBinding=null,this._resourcesParsing.push(t),t._dequeue(),function(t,e,r,n){void 0===n&&(n=!1);var o=0,i=t.length;!function s(a){a||o===i?r&&r(a):n?setTimeout((function(){return e(t[o++],s)}),1):e(t[o++],s)}()}(this._middleware,(function(r,n){r.fn.call(e,t,n)}),(function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(100,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&0===e._resourcesParsing.length&&e._onComplete()}),!0)},t.use=function(e,r){return void 0===r&&(r=t.DefaultMiddlewarePriority),t._defaultMiddleware.push({fn:e,priority:r}),t._defaultMiddleware.sort((function(t,e){return t.priority-e.priority})),t},t.DefaultMiddlewarePriority=50,t._defaultMiddleware=[],t}(),er=function(e){function n(r){var n=r.resource,o=r.resourceTotal,i=e.call(this)||this;return i.progress=0,i.resourceTotal=0,i.resourceLoadedCount=0,i.resource=n,i.resourceTotal=o,0===o&&i.resource.emit(t.LOAD_EVENT.COMPLETE,i),i}return r(n,e),n.prototype.onStart=function(){this.resource.emit(t.LOAD_EVENT.START,this)},n.prototype.onProgress=function(e){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,e.success?this.resource.emit(t.LOAD_EVENT.LOADED,this,e):this.resource.emit(t.LOAD_EVENT.ERROR,this,e),this.resource.emit(t.LOAD_EVENT.PROGRESS,this,e),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(t.LOAD_EVENT.COMPLETE,this)},n}(u);t.LOAD_EVENT=void 0,(Qe=t.LOAD_EVENT||(t.LOAD_EVENT={})).START="start",Qe.PROGRESS="progress",Qe.LOADED="loaded",Qe.COMPLETE="complete",Qe.ERROR="error",t.RESOURCE_TYPE=void 0,(Ke=t.RESOURCE_TYPE||(t.RESOURCE_TYPE={})).IMAGE="IMAGE",Ke.SPRITE="SPRITE",Ke.SPRITE_ANIMATION="SPRITE_ANIMATION",Ke.DRAGONBONE="DRAGONBONE",Ke.SPINE="SPINE",Ke.AUDIO="AUDIO",Ke.VIDEO="VIDEO",Ye.setExtensionXhrType("json",Ue.Json),Ye.setExtensionXhrType("tex",Ue.Json),Ye.setExtensionXhrType("ske",Ue.Json),Ye.setExtensionXhrType("mp3",Ue.Buffer),Ye.setExtensionXhrType("wav",Ue.Buffer),Ye.setExtensionXhrType("aac",Ue.Buffer),Ye.setExtensionXhrType("ogg",Ue.Buffer);var rr={png:Ge,jpg:Ge,jpeg:Ge,webp:Ge,json:Ye,tex:Ye,ske:Ye,audio:Ye,video:Fe},nr=new(function(t){function e(e){var r=t.call(this)||this;return r.timeout=6e3,r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],e&&"number"==typeof e.timeout&&(r.timeout=e.timeout),r}return r(e,t),e.prototype.loadConfig=function(t){this.addResource(t),this.preload()},e.prototype.loadSingle=function(t){return this.addResource([t]),this.getResource(t.name)},e.prototype.addResource=function(t){var e,r;if(!t||t.length<1)console.warn("no resources");else try{for(var n=s(t),o=n.next();!o.done;o=n.next()){var i=o.value;this.resourcesMap[i.name]?console.warn(i.name+" was already added"):(this.resourcesMap[i.name]=i,this.resourcesMap[i.name].data={})}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},e.prototype.preload=function(){var t=Object.values(this.resourcesMap).filter((function(t){return t.preload})).map((function(t){return t.name}));this.progress=new er({resource:this,resourceTotal:t.length}),this.loadResource({names:t,preload:!0})},e.prototype.getResource=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this.loadResource({names:[t]}),[2,this.promiseMap[t]||Promise.resolve({})]}))}))},e.prototype.instance=function(t){return o(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=this.resourcesMap[t],(r=this.makeInstanceFunctions[e.type])?[4,this.makeInstanceFunctions[e.type](e)]:[3,2];case 1:r=n.sent(),n.label=2;case 2:return[2,r]}}))}))},e.prototype.destroy=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._destroy(t)];case 1:return e.sent(),[2]}}))}))},e.prototype._destroy=function(t,e){return void 0===e&&(e=!1),o(this,void 0,void 0,(function(){var r,n;return i(this,(function(o){switch(o.label){case 0:if(!(r=this.resourcesMap[t]))return[2];if(e)return[3,5];o.label=1;case 1:return o.trys.push([1,4,,5]),this.destroyInstanceFunctions[r.type]?[4,this.destroyInstanceFunctions[r.type](r)]:[3,3];case 2:o.sent(),o.label=3;case 3:return[3,5];case 4:return n=o.sent(),console.warn("destroy resource "+r.name+" error with '"+n.message+"'"),[3,5];case 5:return delete this.promiseMap[t],r.complete=!1,r.instance=void 0,[2]}}))}))},e.prototype.registerInstance=function(t,e){this.makeInstanceFunctions[t]=e},e.prototype.registerDestroy=function(t,e){this.destroyInstanceFunctions[t]=e},e.prototype.loadResource=function(t){var e=this,r=t.names,n=void 0===r?[]:r,o=t.preload,i=void 0!==o&&o,s=n.filter((function(t){return!e.promiseMap[t]&&e.resourcesMap[t]}));if(s.length){var a={},c=this.getLoader(i);s.forEach((function(t){e.promiseMap[t]=new Promise((function(e){return a[t]=e}));var r=e.resourcesMap[t];for(var n in r.src){var o=r.src[n].type;"data"===o?(r.data[n]=r.src[n].data,e.doComplete(t,a[t],i)):c.add({url:r.src[n].url,name:r.name+"_"+n,strategy:rr[o],metadata:{key:n,name:r.name,resolves:a}})}})),c.load()}},e.prototype.doComplete=function(t,e,r){return void 0===r&&(r=!1),o(this,void 0,void 0,(function(){var n,o,s,a;return i(this,(function(i){switch(i.label){case 0:if(n=this.resourcesMap[t],o={name:t,resource:this.resourcesMap[t],success:!0},!this.checkAllLoaded(t))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),s=n,[4,this.instance(t)];case 2:return s.instance=i.sent(),n.complete=!0,r&&this.progress.onProgress(o),e(n),[3,4];case 3:return a=i.sent(),n.complete=!1,r&&(o.errMsg=a.message,o.success=!1,this.progress.onProgress(o)),e({}),[3,4];case 4:return[2]}}))}))},e.prototype.checkAllLoaded=function(t){var e=this.resourcesMap[t];return Array.from(Object.keys(e.src)).every((function(t){return e.data[t]}))},e.prototype.getLoader=function(t){var e=this;void 0===t&&(t=!1);var r=this.loaders.find((function(t){return!t.loading}));return r||(r=new tr,this.loaders.push(r)),t&&r.onStart.once((function(){e.progress.onStart()})),r.onLoad.add((function(r,n){e.onLoad({preload:t,resource:n})})),r.onError.add((function(r,n,o){e.onError({errMsg:r,resource:o,preload:t})})),r.onComplete.once((function(){r.onLoad.detachAll(),r.onError.detachAll(),r.reset()})),r},e.prototype.onLoad=function(t){var e=t.preload,r=void 0!==e&&e,n=t.resource;return o(this,void 0,void 0,(function(){var t,e,o,s,a;return i(this,(function(i){return t=n.metadata,e=t.key,o=t.name,s=t.resolves,a=n.data,this.resourcesMap[o].data[e]=a,this.doComplete(o,s[o],r),[2]}))}))},e.prototype.onError=function(t){var e=t.errMsg,r=t.preload,n=void 0!==r&&r,s=t.resource;return o(this,void 0,void 0,(function(){var t,r,o,a;return i(this,(function(i){return t=s.metadata,r=t.name,o=t.resolves,this._destroy(r,!0),o[r]({}),n&&(a={name:r,resource:this.resourcesMap[r],success:!1,errMsg:e},this.progress.onProgress(a)),[2]}))}))},e}(u)),or={IDEProp:me,componentObserver:Se};t.Component=h,t.Game=Ae,t.GameObject=ge,t.IDEProp=me,t.Scene=je,t.System=Oe,t.Transform=ve,t.componentObserver=Se,t.decorators=or,t.resource=nr,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).EVA={})}(this,(function(t){"use strict";var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}var u=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,i||t,s),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o<i;o++)s[o]=n[o].fn;return s},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,o,i,s){var a=r?r+t:t;if(!this._events[a])return!1;var c,u,h=this._events[a],l=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,o),!0;case 5:return h.fn.call(h.context,e,n,o,i),!0;case 6:return h.fn.call(h.context,e,n,o,i,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var p,f=h.length;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,n);break;case 4:h[u].fn.call(h[u].context,e,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];h[u].fn.apply(h[u].context,c)}}return!0},a.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||n&&a.context!==n||s(this,i);else{for(var c=0,u=[],h=a.length;c<h;c++)(a[c].fn!==e||o&&!a[c].once||n&&a[c].context!==n)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}));var h=function(t){function e(e){var r=t.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=e,r}return r(e,t),e}(u);function l(t,e){return t===e||t!=t&&e!=e}function p(t,e){for(var r=t.length;r--;)if(l(t[r][0],e))return r;return-1}var f=Array.prototype.splice;function d(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}d.prototype.clear=function(){this.__data__=[],this.size=0},d.prototype.delete=function(t){var e=this.__data__,r=p(e,t);return!(r<0)&&(r==e.length-1?e.pop():f.call(e,r,1),--this.size,!0)},d.prototype.get=function(t){var e=this.__data__,r=p(e,t);return r<0?void 0:e[r][1]},d.prototype.has=function(t){return p(this.__data__,t)>-1},d.prototype.set=function(t,e){var r=this.__data__,n=p(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var y="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m="object"==typeof y&&y&&y.Object===Object&&y,v="object"==typeof self&&self&&self.Object===Object&&self,_=m||v||Function("return this")(),b=_.Symbol,g=Object.prototype,w=g.hasOwnProperty,O=g.toString,E=b?b.toStringTag:void 0;var x=Object.prototype.toString;var j=b?b.toStringTag:void 0;function T(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":j&&j in Object(t)?function(t){var e=w.call(t,E),r=t[E];try{t[E]=void 0;var n=!0}catch(t){}var o=O.call(t);return n&&(e?t[E]=r:delete t[E]),o}(t):function(t){return x.call(t)}(t)}function A(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function S(t){if(!A(t))return!1;var e=T(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var C,P=_["__core-js_shared__"],k=(C=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var L=Function.prototype.toString;function R(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var D=/^\[object .+?Constructor\]$/,M=Function.prototype,N=Object.prototype,I=M.toString,B=N.hasOwnProperty,q=RegExp("^"+I.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function U(t){return!(!A(t)||(e=t,k&&k in e))&&(S(t)?q:D).test(R(t));var e}function V(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return U(r)?r:void 0}var z=V(_,"Map"),G=V(Object,"create");var F=Object.prototype.hasOwnProperty;var X=Object.prototype.hasOwnProperty;function J(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Y(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function $(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}J.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(G){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return F.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return G?void 0!==e[t]:X.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=G&&void 0===e?"__lodash_hash_undefined__":e,this},$.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(z||d),string:new J}},$.prototype.delete=function(t){var e=Y(this,t).delete(t);return this.size-=e?1:0,e},$.prototype.get=function(t){return Y(this,t).get(t)},$.prototype.has=function(t){return Y(this,t).has(t)},$.prototype.set=function(t,e){var r=Y(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function H(t){var e=this.__data__=new d(t);this.size=e.size}H.prototype.clear=function(){this.__data__=new d,this.size=0},H.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},H.prototype.get=function(t){return this.__data__.get(t)},H.prototype.has=function(t){return this.__data__.has(t)},H.prototype.set=function(t,e){var r=this.__data__;if(r instanceof d){var n=r.__data__;if(!z||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new $(n)}return r.set(t,e),this.size=r.size,this};function W(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new $;++e<r;)this.add(t[e])}function Q(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}W.prototype.add=W.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},W.prototype.has=function(t){return this.__data__.has(t)};function K(t,e,r,n,o,i){var s=1&r,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(t),h=i.get(e);if(u&&h)return u==e&&h==t;var l=-1,p=!0,f=2&r?new W:void 0;for(i.set(t,e),i.set(e,t);++l<a;){var d=t[l],y=e[l];if(n)var m=s?n(y,d,l,e,t,i):n(d,y,l,t,e,i);if(void 0!==m){if(m)continue;p=!1;break}if(f){if(!Q(e,(function(t,e){if(s=e,!f.has(s)&&(d===t||o(d,t,r,n,i)))return f.push(e);var s}))){p=!1;break}}else if(d!==y&&!o(d,y,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p}var Z=_.Uint8Array;function tt(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function et(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var rt=b?b.prototype:void 0,nt=rt?rt.valueOf:void 0;var ot=Array.isArray;var it=Object.prototype.propertyIsEnumerable,st=Object.getOwnPropertySymbols,at=st?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}(st(t),(function(e){return it.call(t,e)})))}:function(){return[]};function ct(t){return null!=t&&"object"==typeof t}function ut(t){return ct(t)&&"[object Arguments]"==T(t)}var ht=Object.prototype,lt=ht.hasOwnProperty,pt=ht.propertyIsEnumerable,ft=ut(function(){return arguments}())?ut:function(t){return ct(t)&<.call(t,"callee")&&!pt.call(t,"callee")};var dt="object"==typeof t&&t&&!t.nodeType&&t,yt=dt&&"object"==typeof module&&module&&!module.nodeType&&module,mt=yt&&yt.exports===dt?_.Buffer:void 0,vt=(mt?mt.isBuffer:void 0)||function(){return!1},_t=/^(?:0|[1-9]\d*)$/;function bt(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&_t.test(t))&&t>-1&&t%1==0&&t<e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var wt={};wt["[object Float32Array]"]=wt["[object Float64Array]"]=wt["[object Int8Array]"]=wt["[object Int16Array]"]=wt["[object Int32Array]"]=wt["[object Uint8Array]"]=wt["[object Uint8ClampedArray]"]=wt["[object Uint16Array]"]=wt["[object Uint32Array]"]=!0,wt["[object Arguments]"]=wt["[object Array]"]=wt["[object ArrayBuffer]"]=wt["[object Boolean]"]=wt["[object DataView]"]=wt["[object Date]"]=wt["[object Error]"]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Number]"]=wt["[object Object]"]=wt["[object RegExp]"]=wt["[object Set]"]=wt["[object String]"]=wt["[object WeakMap]"]=!1;var Ot,Et="object"==typeof t&&t&&!t.nodeType&&t,xt=Et&&"object"==typeof module&&module&&!module.nodeType&&module,jt=xt&&xt.exports===Et&&m.process,Tt=function(){try{var t=xt&&xt.require&&xt.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),At=Tt&&Tt.isTypedArray,St=At?(Ot=At,function(t){return Ot(t)}):function(t){return ct(t)&>(t.length)&&!!wt[T(t)]},Ct=Object.prototype.hasOwnProperty;function Pt(t,e){var r=ot(t),n=!r&&ft(t),o=!r&&!n&&vt(t),i=!r&&!n&&!o&&St(t),s=r||n||o||i,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var u in t)!e&&!Ct.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bt(u,c))||a.push(u);return a}var kt=Object.prototype;var Lt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Rt=Object.prototype.hasOwnProperty;function Dt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||kt))return Lt(t);var e,r,n=[];for(var o in Object(t))Rt.call(t,o)&&"constructor"!=o&&n.push(o);return n}function Mt(t){return null!=(e=t)&>(e.length)&&!S(e)?Pt(t):Dt(t);var e}function Nt(t){return function(t,e,r){var n=e(t);return ot(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Mt,at)}var It=Object.prototype.hasOwnProperty;var Bt=V(_,"DataView"),qt=V(_,"Promise"),Ut=V(_,"Set"),Vt=V(_,"WeakMap"),zt="[object Map]",Gt="[object Promise]",Ft="[object Set]",Xt="[object WeakMap]",Jt="[object DataView]",Yt=R(Bt),$t=R(z),Ht=R(qt),Wt=R(Ut),Qt=R(Vt),Kt=T;(Bt&&Kt(new Bt(new ArrayBuffer(1)))!=Jt||z&&Kt(new z)!=zt||qt&&Kt(qt.resolve())!=Gt||Ut&&Kt(new Ut)!=Ft||Vt&&Kt(new Vt)!=Xt)&&(Kt=function(t){var e=T(t),r="[object Object]"==e?t.constructor:void 0,n=r?R(r):"";if(n)switch(n){case Yt:return Jt;case $t:return zt;case Ht:return Gt;case Wt:return Ft;case Qt:return Xt}return e});var Zt,te=Kt,ee="[object Arguments]",re="[object Array]",ne="[object Object]",oe=Object.prototype.hasOwnProperty;function ie(t,e,r,n,o,i){var s=ot(t),a=ot(e),c=s?re:te(t),u=a?re:te(e),h=(c=c==ee?ne:c)==ne,p=(u=u==ee?ne:u)==ne,f=c==u;if(f&&vt(t)){if(!vt(e))return!1;s=!0,h=!1}if(f&&!h)return i||(i=new H),s||St(t)?K(t,e,r,n,o,i):function(t,e,r,n,o,i,s){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Z(t),new Z(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return l(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=tt;case"[object Set]":var c=1&n;if(a||(a=et),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=2,s.set(t,e);var h=K(a(t),a(e),n,o,i,s);return s.delete(t),h;case"[object Symbol]":if(nt)return nt.call(t)==nt.call(e)}return!1}(t,e,c,r,n,o,i);if(!(1&r)){var d=h&&oe.call(t,"__wrapped__"),y=p&&oe.call(e,"__wrapped__");if(d||y){var m=d?t.value():t,v=y?e.value():e;return i||(i=new H),o(m,v,r,n,i)}}return!!f&&(i||(i=new H),function(t,e,r,n,o,i){var s=1&r,a=Nt(t),c=a.length;if(c!=Nt(e).length&&!s)return!1;for(var u=c;u--;){var h=a[u];if(!(s?h in e:It.call(e,h)))return!1}var l=i.get(t),p=i.get(e);if(l&&p)return l==e&&p==t;var f=!0;i.set(t,e),i.set(e,t);for(var d=s;++u<c;){var y=t[h=a[u]],m=e[h];if(n)var v=s?n(m,y,h,e,t,i):n(y,m,h,t,e,i);if(!(void 0===v?y===m||o(y,m,r,n,i):v)){f=!1;break}d||(d="constructor"==h)}if(f&&!d){var _=t.constructor,b=e.constructor;_==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,r,n,o,i))}function se(t,e,r,n,o){return t===e||(null==t||null==e||!ct(t)&&!ct(e)?t!=t&&e!=e:ie(t,e,r,n,se,o))}function ae(t,e){return se(t,e)}t.OBSERVER_TYPE=void 0,(Zt=t.OBSERVER_TYPE||(t.OBSERVER_TYPE={})).ADD="ADD",Zt.REMOVE="REMOVE",Zt.CHANGE="CHANGE";var ce={},ue={},he={},le={};function pe(t,e){ce[t.gameObject.id]||(ce[t.gameObject.id]={});var r=ce[t.gameObject.id],n=t.name+"_"+e.join(",");if(r[n])return r[n];for(var o=e.length-1,i=t,s=0;s<o;s++)i=i[e[s]];return r[n]={property:i,key:e[o]},r[n]}function fe(t){var e=t.systemName,r=t.componentName,n=t.component,o=t.prop,i=t.type;ue[e].componentObserver.add({component:n,prop:o,type:i,componentName:r})}function de(e){var r,n,o=e.obj,i=e.key,a=e.prop,c=e.component,u=e.componentName;if(void 0!==o)if(i in o){if(Object.defineProperty(o,"_"+i,{enumerable:!1,writable:!0,value:o[i]}),a.deep&&A(o[i]))try{for(var h=s(Object.keys(o[i])),l=h.next();!l.done;l=h.next()){var p=l.value;de({obj:o[i],key:p,prop:a,component:c,componentName:u})}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}Object.defineProperty(o,i,{enumerable:!0,set:function(e){o["_"+i]!==e&&(o["_"+i]=e,function(e){var r=e.prop,n=e.component,o=e.componentName;for(var i in he){var s=(he[i]||{})[o];s&&s.findIndex((function(t){return ae(t,r)}))>-1&&fe({systemName:i,componentName:o,component:n,prop:r,type:t.OBSERVER_TYPE.CHANGE})}}({prop:a,component:c,componentName:u}))},get:function(){return o["_"+i]}})}else console.error("prop "+i+" not in component: "+u+", Can not observer")}function ye(e,r){for(var n in void 0===r&&(r=e.name),he){(he[n]||{})[r]&&ue[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.REMOVE,componentName:r})}!function(t){t.gameObject&&delete ce[t.gameObject.id]}(e)}function me(t,e){t.constructor.IDEProps||(t.constructor.IDEProps=[]),t.constructor.IDEProps.push(e)}var ve=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Transform",e._parent=null,e.inScene=!1,e.children=[],e.position={x:0,y:0},e.size={width:0,height:0},e.origin={x:0,y:0},e.anchor={x:0,y:0},e.scale={x:1,y:1},e.skew={x:0,y:0},e.rotation=0,e}return r(e,t),e.prototype.init=function(t){var e,r;void 0===t&&(t={});try{for(var n=s(["position","size","origin","anchor","scale","skew"]),o=n.next();!o.done;o=n.next()){var i=o.value;Object.assign(this[i],t[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}this.rotation=t.rotation||this.rotation},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},set:function(t){t?t.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t.parent===this){var e=this.children.findIndex((function(e){return e===t}));this.children.splice(e,1)}else t.parent&&t.parent.removeChild(t);t._parent=this,this.children.push(t)},e.prototype.removeChild=function(t){var e=this.children.findIndex((function(e){return e===t}));e>-1&&(this.children.splice(e,1),t._parent=null)},e.prototype.clearChildren=function(){this.children.length=0},e.componentName="Transform",n([me],e.prototype,"position",void 0),n([me],e.prototype,"size",void 0),n([me],e.prototype,"origin",void 0),n([me],e.prototype,"anchor",void 0),n([me],e.prototype,"scale",void 0),n([me],e.prototype,"skew",void 0),n([me],e.prototype,"rotation",void 0),e}(h),_e=0;var be,ge=function(){function e(t,e){this._componentCache={},this.components=[],this._name=t,this.id=++_e,this.addComponent(ve,e)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(ve.componentName)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(t){var e,r;if(this._scene!==t){var n=this._scene;if(this._scene=t,this.transform&&this.transform.children)try{for(var o=s(this.transform.children),i=o.next();!i.done;i=o.next()){i.value.gameObject.scene=t}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?t.addGameObject(this):n&&n.removeGameObject(this)}},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t&&t.transform&&t!==this){if(!(t instanceof e))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error("gameObject '"+this.name+"' has been destroy");t.transform.parent=this.transform,t.scene=this.scene}},e.prototype.removeChild=function(t){return t instanceof e&&t.parent&&t.parent===this?(t.transform.parent=null,t.scene=null,t):t},e.prototype.addComponent=function(e,r){var n=function(t){return t instanceof h?t.name:t instanceof Function?t.componentName:void 0}(e);if(!this._componentCache[n]){var o;if(e instanceof Function)o=new e(r);else{if(!(e instanceof h))throw new Error("addComponent recieve Component and Component Constructor");o=e}if(o.gameObject)throw new Error("component has been added on gameObject "+o.gameObject.name);return o.gameObject=this,o.init&&o.init(o.__componentDefaultParams),function(e,r){for(var n in void 0===r&&(r=e.name),he)(he[n]||{})[r]&&ue[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.ADD,componentName:r})}(o,o.name),function(t,e){var r,n;if(void 0===e&&(e=t.name),e&&le[e]){if(!(t&&(o=t,o&&o.constructor&&"componentName"in o.constructor)))throw new Error("component param must be an instance of Component");var o;if(!t.gameObject||!t.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var i=s(le[e]),a=i.next();!a.done;a=i.next()){var c=a.value,u=pe(t,c.prop);de({obj:u.property,key:u.key,prop:c,component:t,componentName:e})}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}(o,o.name),this.components.push(o),this._componentCache[n]=o,o.awake&&o.awake(),o}},e.prototype.removeComponent=function(t){var e;if("string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),"Transform"===e)throw new Error("Transform can't be removed");return this._removeComponent(e)},e.prototype._removeComponent=function(t){var e=this.components.findIndex((function(e){return e.name===t}));if(-1!==e){var r=this.components.splice(e,1)[0];return delete this._componentCache[t],r.onDestroy&&r.onDestroy(),ye(r,t),r.gameObject=void 0,r}},e.prototype.getComponent=function(t){var e;return"string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),void 0!==this._componentCache[e]?this._componentCache[e]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){for(var t in Array.from(this.transform.children).forEach((function(t){t.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(t);this.components.length=0},e}(),we=function(){function e(){this.events=[]}return e.prototype.add=function(e){var r=e.component,n=e.prop,o=e.type,i=e.componentName;o===t.OBSERVER_TYPE.REMOVE&&(this.events=this.events.filter((function(t){return t.component!==r})));var s=this.events.findIndex((function(t){return t.component===r&&ae(t.prop,n)&&t.type===o}));s>-1&&this.events.splice(s,1),this.events.push({gameObject:r.gameObject,component:r,prop:n,type:o,componentName:i})},e.prototype.getChanged=function(){return this.events},Object.defineProperty(e.prototype,"changed",{get:function(){return this.events},enumerable:!1,configurable:!0}),e.prototype.clear=function(){var t=this.events;return this.events=[],t},e}(),Oe=function(){function t(t){this.started=!1,this.componentObserver=new we,this.__systemDefaultParams=t,this.name=this.constructor.systemName}return t.prototype.destroy=function(){var t;this.componentObserver=null,this.__systemDefaultParams=null,null===(t=this.onDestroy)||void 0===t||t.call(this)},t}(),Ee={autoStart:!0,frameRate:60},xe=function(){function t(t){var e=this;t=Object.assign({},Ee,t),this._frameDuration=1e3/t.frameRate,this.autoStart=t.autoStart,this.frameRate=t.frameRate,this._tickers=new Set,this._requestId=null,this._blockTime=0,this._lastTime=Date.now(),this._frameCount=0,this._activeWithPause=!1,this._ticker=function(){e._started&&(e._requestId=requestAnimationFrame(e._ticker),e.update())},this.autoStart&&this.start(),this.bindEvent()}return t.prototype.update=function(){var t,e,r=Date.now();if(r-this._lastTime>=this._frameDuration){var n=r-this._lastTime,o={deltaTime:n,frameCount:++this._frameCount,time:r-this._blockTime,fps:Math.round(1e3/n)};try{for(var i=s(this._tickers),a=i.next();!a.done;a=i.next()){var c=a.value;"function"==typeof c&&c(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this._lastTime=r}},t.prototype.add=function(t){this._tickers.add(t)},t.prototype.remove=function(t){this._tickers.delete(t)},t.prototype.start=function(){this._started||(this._lastStopTime>0&&(this._blockTime=this._blockTime+Date.now()-this._lastStopTime,this._lastStopTime=0),this._started=!0,this._lastTime=Date.now(),this._requestId=requestAnimationFrame(this._ticker))},t.prototype.pause=function(){this._started=!1,this._lastStopTime=Date.now()},t.prototype.active=function(){this._activeWithPause||this.start(),this._activeWithPause=!1},t.prototype.background=function(){this._started?this.pause():this._activeWithPause=!0},t.prototype.bindEvent=function(){},t}(),je=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.gameObjects=[],n.scene=n,n}return r(e,t),e.prototype.addGameObject=function(t){this.gameObjects.push(t),t.transform&&(t.transform.inScene=!0)},e.prototype.removeGameObject=function(t){var e=this.gameObjects.indexOf(t);-1!==e&&(t.transform&&(t.transform.inScene=!1),this.gameObjects.splice(e,1))},e.prototype.destroy=function(){this.scene=null,t.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},e}(ge);t.LOAD_SCENE_MODE=void 0,(be=t.LOAD_SCENE_MODE||(t.LOAD_SCENE_MODE={})).SINGLE="SINGLE",be.MULTI_CANVAS="MULTI_CANVAS";var Te=function(t){if((t instanceof Oe||t instanceof h)&&!t.started){try{t.start&&t.start()}catch(e){t instanceof h?console.error(t.constructor.componentName+" start error",e):console.error(t.constructor.systemName+" start error",e)}t.started=!0}},Ae=function(e){function n(t){var r,n,o=void 0===t?{}:t,i=o.autoStart,a=void 0===i||i,c=o.frameRate,u=void 0===c?120:c,h=o.systems,l=o.needScene,p=void 0===l||l,f=e.call(this)||this;if(f.playing=!1,f.started=!1,f.multiScenes=[],f.systems=[],f.ticker=new xe({autoStart:!1,frameRate:u}),f.initTicker(),h&&h.length)try{for(var d=s(h),y=d.next();!y.done;y=d.next()){var m=y.value;f.addSystem(m)}}catch(t){r={error:t}}finally{try{y&&!y.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return p&&f.loadScene(new je("scene")),a&&f.start(),f}return r(n,e),Object.defineProperty(n.prototype,"scene",{get:function(){return this._scene},set:function(t){this._scene=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"gameObjects",{get:function(){return function(t){var e,r,n,o=(null===(n=null==t?void 0:t.scene)||void 0===n?void 0:n.gameObjects)||[],i=null==t?void 0:t.multiScenes.map((function(t){return t.gameObjects})),a=[];try{for(var u=s(i),h=u.next();!h.done;h=u.next())a=c(a,h.value)}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return c(o,a)}(this)},enumerable:!1,configurable:!0}),n.prototype.addSystem=function(t,e){var r;if(t instanceof Function)r=new t(e);else{if(!(t instanceof Oe))return void console.warn("can only add System");r=t}if(!this.systems.find((function(t){return t.constructor===r.constructor}))){r.game=this,r.init&&r.init(r.__systemDefaultParams),function(t,e){he[e.systemName]=e.observerInfo,ue[e.systemName]=t}(r,r.constructor),function(t){var e,r,n,o,i=[];t instanceof Array?i.push.apply(i,c(t)):i.push(t);try{for(var a=s(i),u=a.next();!u.done;u=a.next()){var h=u.value;for(var l in h.observerInfo){le[l]=le[l]||[];var p=le[l],f=function(t){-1===p.findIndex((function(e){return ae(e,t)}))&&le[l].push(t)};try{for(var d=(n=void 0,s(h.observerInfo[l])),y=d.next();!y.done;y=d.next())f(y.value)}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}(r.constructor);try{r.awake&&r.awake()}catch(t){console.error(r.constructor.systemName+" awake error",t)}return this.systems.push(r),r}console.warn(r.constructor.systemName+" System has been added")},n.prototype.removeSystem=function(t){if(t){var e=-1;"string"==typeof t?e=this.systems.findIndex((function(e){return e.name===t})):t instanceof Function?e=this.systems.findIndex((function(e){return e.constructor===t})):t instanceof Oe&&(e=this.systems.findIndex((function(e){return e===t}))),e>-1&&(this.systems[e].destroy&&this.systems[e].destroy(),this.systems.splice(e,1))}},n.prototype.getSystem=function(t){return this.systems.find((function(e){return"string"==typeof t?e.name===t:e instanceof t}))},n.prototype.pause=function(){!1!==this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},n.prototype.start=function(){!0!==this.playing&&(this.ticker.start(),this.playing=!0,this.started=!0)},n.prototype.resume=function(){!0!==this.playing&&(this.ticker.start(),this.triggerResume(),this.playing=!0)},n.prototype.initTicker=function(){var t=this;this.ticker.add((function(e){var r,n,o,i;t.scene&&function(t,e){var r,n,o,i,a,c,u,h;void 0===e&&(e=[]);try{for(var l=s(e),p=l.next();!p.done;p=l.next()){var f=p.value;try{for(var d=(o=void 0,s(f.components)),y=d.next();!y.done;y=d.next()){var m=y.value;try{Te(m),m.update&&m.update(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" update error",t)}}}catch(t){o={error:t}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}try{for(var v=s(e),_=v.next();!_.done;_=v.next()){f=_.value;try{for(var b=(u=void 0,s(f.components)),g=b.next();!g.done;g=b.next()){m=g.value;try{m.lateUpdate&&m.lateUpdate(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" lateUpdate error",t)}}}catch(t){u={error:t}}finally{try{g&&!g.done&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{_&&!_.done&&(c=v.return)&&c.call(v)}finally{if(a)throw a.error}}}(e,t.gameObjects);try{for(var a=s(t.systems),c=a.next();!c.done;c=a.next()){var u=c.value;try{Te(u),u.update&&u.update(e)}catch(e){console.error(u.constructor.systemName+" update error",e)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}try{for(var h=s(t.systems),l=h.next();!l.done;l=h.next()){u=l.value;try{u.lateUpdate&&u.lateUpdate(e)}catch(e){console.error(u.constructor.systemName+" lateUpdate error",e)}}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}}))},n.prototype.triggerResume=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),h=u.next();!h.done;h=u.next()){var l=h.value;try{l.onResume&&l.onResume()}catch(t){console.error("gameObject: "+c.name+", "+l.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onResume&&o.onResume()}catch(t){console.error(o.constructor.systemName+", onResume error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.triggerPause=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),h=u.next();!h.done;h=u.next()){var l=h.value;try{l.onPause&&l.onPause()}catch(t){console.error("gameObject: "+c.name+", "+l.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onPause&&o.onPause()}catch(t){console.error(o.constructor.systemName+", onPause error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.destroySystems=function(){var t,e;try{for(var r=s(c(this.systems)),n=r.next();!n.done;n=r.next()){var o=n.value;this.removeSystem(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.systems=[]},n.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},n.prototype.loadScene=function(e){var r=e.scene,n=e.mode,o=void 0===n?t.LOAD_SCENE_MODE.SINGLE:n,i=e.params,s=void 0===i?{}:i;if(r){switch(o){case t.LOAD_SCENE_MODE.SINGLE:this.scene=r;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(r)}this.emit("sceneChanged",{scene:r,mode:o,params:s})}},n}(u);function Se(t){return void 0===t&&(t={}),function(e){if(!e.observerInfo){for(var r in t)for(var n in t[r]){"string"==typeof t[r][n]&&(t[r][n]=[t[r][n]]);var o=void 0;Array.isArray(t[r][n])&&(o={prop:t[r][n],deep:!1},t[r][n]=o),"string"==typeof(o=t[r][n]).prop&&(o.prop=[o.prop])}e.observerInfo=t}}}var Ce=function(){function t(t,e,r){void 0===e&&(e=!1),this.next=null,this.prev=null,this.owner=null,this.fn=t,this.once=e,this.thisArg=r}return t.prototype.detach=function(){return null!==this.owner&&(this.owner.detach(this),!0)},t.prototype.dispose=function(){this.detach()},t}(),Pe=function(){function t(){this._head=null,this._tail=null,this._filter=null}return t.prototype.handlers=function(){for(var t=this._head,e=[];t;)e.push(t),t=t.next;return e},t.prototype.hasAny=function(){return!!this._head},t.prototype.has=function(t){return t.owner===this},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._head;if(!r)return!1;if(this._filter&&!this._filter.apply(this,t))return!1;for(;r;)r.once&&this.detach(r),r.fn.apply(r.thisArg,t),r=r.next;return!0},t.prototype.add=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new Ce(t,!1,e))},t.prototype.once=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new Ce(t,!0,e))},t.prototype.detach=function(t){var e=t;return e.owner!==this||(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this._head?(this._head=e.next,null===e.next&&(this._tail=null)):e===this._tail&&(this._tail=e.prev,this._tail&&(this._tail.next=null)),e.owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=null,this._tail=null;t;)t.owner=null,t=t.next;return this},t.prototype.filter=function(t){this._filter=t},t.prototype.proxy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.dispatch.apply(t,e)},o=0;o<e.length;++o)e[o].add(n);return this},t.prototype._addSignalBinding=function(t){var e=t;return this._head?(this._tail&&(this._tail.next=e),e.prev=this._tail,this._tail=e):(this._head=e,this._tail=e),e.owner=this,e},t}();var ke,Le,Re=function(t,e){if(t){e=e||{};for(var r={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},n=r.parser[e.strictMode?"strict":"loose"].exec(t),o={},i=14;i--;)o[r.key[i]]=n[i]||"";return o[r.q.name]={},o[r.key[12]].replace(r.q.parser,(function(t,e,n){e&&(o[r.q.name][e]=n)})),o}},De=function(t){this.config=t,this.onError=new Pe,this.onComplete=new Pe,this.onProgress=new Pe},Me=function(t,e){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Ne(t,e){function r(){this.constructor=t}Me(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Ie(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function Be(t){var e="";if(0===t.indexOf("data:")){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var n=t.indexOf("?"),o=t.indexOf("#"),i=Math.min(n>-1?n:t.length,o>-1?o:t.length);e=(t=t.substring(0,i)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()}function qe(t){throw new Error("Unexpected value. Should have been never.")}!function(t){t[t.Unknown=0]="Unknown",t[t.Buffer=1]="Buffer",t[t.Blob=2]="Blob",t[t.Json=3]="Json",t[t.Xml=4]="Xml",t[t.Image=5]="Image",t[t.Audio=6]="Audio",t[t.Video=7]="Video",t[t.Text=8]="Text"}(ke||(ke={})),function(t){t[t.NotStarted=0]="NotStarted",t[t.Loading=1]="Loading",t[t.Complete=2]="Complete"}(Le||(Le={}));var Ue,Ve=function(t){function e(e,r){var n=t.call(this,e)||this;return n.elementType=r,n._boundOnLoad=n._onLoad.bind(n),n._boundOnError=n._onError.bind(n),n._boundOnTimeout=n._onTimeout.bind(n),n._element=n._createElement(),n._elementTimer=0,n}return Ne(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin);var e=t.sourceSet||[t.url];if(navigator.isCocoonJS)this._element.src=e[0];else for(var r=0;r<e.length;++r){var n=e[r],o=t.mimeTypes?t.mimeTypes[r]:void 0;o||(o=this.elementType+"/"+Be(n));var i=document.createElement("source");i.src=n,i.type=o,this._element.appendChild(i)}this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("canplaythrough",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),this._element.load(),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){for(this._clearEvents();this._element.firstChild;)this._element.removeChild(this._element.firstChild);this._error(this.elementType+" load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement(this.elementType)},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("canplaythrough",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents();var t=ke.Unknown;switch(this.elementType){case"audio":t=ke.Audio;break;case"video":t=ke.Video;break;default:qe(this.elementType)}this.onComplete.dispatch(t,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error(this.elementType+" failed to load.")},e.prototype._onTimeout=function(){this._error(this.elementType+" load timed out.")},e}(De),ze=function(t){function e(e){return t.call(this,e,"audio")||this}return Ne(e,t),e}(Ve),Ge=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._element=e._createElement(),e._elementTimer=0,e}return Ne(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin),this._element.src=t.url,this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){this._clearEvents(),this._element.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",this._error("Image load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement("img")},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents(),this.onComplete.dispatch(ke.Image,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error("Image failed to load.")},e.prototype._onTimeout=function(){this._error("Image load timed out.")},e}(De),Fe=function(t){function e(e){return t.call(this,e,"video")||this}return Ne(e,t),e}(Ve),Xe=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest);function Je(t){return t.toString().replace("object ","")}!function(t){t.Default="text",t.Buffer="arraybuffer",t.Blob="blob",t.Document="document",t.Json="json",t.Text="text"}(Ue||(Ue={}));var Ye=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnAbort=e._onAbort.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._boundOnProgress=e._onProgress.bind(e),e._xhr=e._createRequest(),e._xhrType=Ue.Default,e}return Ne(e,t),e.prototype.load=function(){var t=this.config,e=Be(t.url);"string"!=typeof t.xhrType&&(t.xhrType=this._determineXhrType(e));var r=this._xhr;this._xhrType=t.xhrType||Ue.Default,Xe?(r.timeout=t.timeout||5e3,r.onload=this._boundOnLoad,r.onerror=this._boundOnError,r.ontimeout=this._boundOnTimeout,r.onprogress=this._boundOnProgress,r.open("GET",t.url,!0),setTimeout((function(){r.send()}),0)):(r.open("GET",t.url,!0),t.timeout&&(r.timeout=t.timeout),t.xhrType===Ue.Json||t.xhrType===Ue.Document?r.responseType=Ue.Text:r.responseType=t.xhrType,r.addEventListener("load",this._boundOnLoad,!1),r.addEventListener("abort",this._boundOnAbort,!1),r.addEventListener("error",this._boundOnError,!1),r.addEventListener("timeout",this._boundOnTimeout,!1),r.addEventListener("progress",this._boundOnProgress,!1),r.send())},e.prototype.abort=function(){Xe?(this._clearEvents(),this._xhr.abort(),this._onAbort()):this._xhr.abort()},e.prototype._createRequest=function(){return Xe?new window.XDomainRequest:new XMLHttpRequest},e.prototype._determineXhrType=function(t){return e._xhrTypeMap[t]||Ue.Default},e.prototype._clearEvents=function(){Xe?(this._xhr.onload=null,this._xhr.onerror=null,this._xhr.ontimeout=null,this._xhr.onprogress=null):(this._xhr.removeEventListener("load",this._boundOnLoad,!1),this._xhr.removeEventListener("abort",this._boundOnAbort,!1),this._xhr.removeEventListener("error",this._boundOnError,!1),this._xhr.removeEventListener("timeout",this._boundOnTimeout,!1),this._xhr.removeEventListener("progress",this._boundOnProgress,!1))},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(t,e){this._clearEvents(),this.onComplete.dispatch(t,e)},e.prototype._onLoad=function(){var t=this._xhr,e="",r=void 0===t.status?200:t.status;if(void 0!==t.responseType&&""!==t.responseType&&"text"!==t.responseType||(e=t.responseText),0===r&&(e.length>0||t.responseType===Ue.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case Ue.Buffer:console.warn(ke.Buffer,t.response),this._complete(ke.Buffer,t.response);break;case Ue.Blob:this._complete(ke.Blob,t.response);break;case Ue.Document:this._parseDocument(e);break;case Ue.Json:this._parseJson(e);break;case Ue.Default:case Ue.Text:this._complete(ke.Text,e);break;default:qe(this._xhrType)}else this._error("["+t.status+"] "+t.statusText+": "+t.responseURL)},e.prototype._parseDocument=function(t){try{if(window.DOMParser){var e=(new DOMParser).parseFromString(t,"text/xml");this._complete(ke.Xml,e)}else{var r=document.createElement("div");r.innerHTML=t,this._complete(ke.Xml,r)}}catch(t){this._error("Error trying to parse loaded xml: "+t)}},e.prototype._parseJson=function(t){try{var e=JSON.parse(t);this._complete(ke.Json,e)}catch(t){this._error("Error trying to parse loaded json: "+t)}},e.prototype._onAbort=function(){var t=this._xhr;this._error(Je(t)+" Request was aborted by the user.")},e.prototype._onError=function(){var t=this._xhr;this._error(Je(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},e.prototype._onTimeout=function(){var t=this._xhr;this._error(Je(t)+" Request timed out.")},e.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(t.loaded/t.total)},e.setExtensionXhrType=function(t,r){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e._xhrTypeMap[t]=r)},e.ResponseType=Ue,e._xhrTypeMap={xhtml:Ue.Document,html:Ue.Document,htm:Ue.Document,xml:Ue.Document,tmx:Ue.Document,svg:Ue.Document,tsx:Ue.Document,gif:Ue.Blob,png:Ue.Blob,bmp:Ue.Blob,jpg:Ue.Blob,jpeg:Ue.Blob,tif:Ue.Blob,tiff:Ue.Blob,webp:Ue.Blob,tga:Ue.Blob,json:Ue.Json,text:Ue.Text,txt:Ue.Text,ttf:Ue.Buffer,otf:Ue.Buffer},e}(De);function $e(t){var e=t;return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(null===e)throw new Error("Callback was already called.");var n=e;return e=null,n.apply(this,t)}}var He=function(){function t(t,e){if(void 0===e&&(e=1),this.worker=t,this.concurrency=e,this.workers=0,this.buffer=0,this.paused=!1,this._started=!1,this._tasks=[],this.onSaturated=new Pe,this.onUnsaturated=new Pe,this.onEmpty=new Pe,this.onDrain=new Pe,this.onError=new Pe,0===e)throw new Error("Concurrency must not be zero");this.buffer=e/4}return Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.onDrain.detachAll(),this.workers=0,this._started=!1,this._tasks=[]},t.prototype.push=function(t,e){this._insert(t,!1,e)},t.prototype.unshift=function(t,e){this._insert(t,!0,e)},t.prototype.process=function(){for(;!this.paused&&this.workers<this.concurrency&&this._tasks.length;){var t=this._tasks.shift();0===this._tasks.length&&this.onEmpty.dispatch(),this.workers+=1,this.workers===this.concurrency&&this.onSaturated.dispatch(),this.worker(t.data,$e(this._next(t)))}},t.prototype.length=function(){return this._tasks.length},t.prototype.running=function(){return this.workers},t.prototype.idle=function(){return this._tasks.length+this.workers===0},t.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},t.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},t.prototype.getTask=function(t){return this._tasks[t]},t.prototype._insert=function(t,e,r){var n=this;if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(this._started=!0,null==t&&this.idle())setTimeout((function(){return n.onDrain.dispatch()}),1);else{var o={data:t,callback:r};e?this._tasks.unshift(o):this._tasks.push(o),setTimeout((function(){return n.process()}),1)}},t.prototype._next=function(t){var e=this;return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];e.workers-=1,t.callback&&t.callback.apply(t,Ie([r],n)),r&&e.onError.dispatch(r,t.data),e.workers<=e.concurrency-e.buffer&&e.onUnsaturated.dispatch(),e.idle()&&e.onDrain.dispatch(),e.process()}},t}(),We=function(){function t(e,r){if(this.children=[],this.onStart=new Pe,this.onProgress=new Pe,this.onComplete=new Pe,this.onAfterMiddleware=new Pe,this.data=null,this.type=ke.Unknown,this.error="",this.progressChunk=0,this._dequeue=function(){},this._onCompleteBinding=null,this._state=Le.NotStarted,this.name=e,this.metadata=r.metadata,"string"!=typeof r.crossOrigin&&(r.crossOrigin=this._determineCrossOrigin(r.url)),r.strategy&&"function"!=typeof r.strategy)this._strategy=r.strategy,this._strategy.config=r;else{var n=r.strategy;n||(n=t._loadStrategyMap[Be(r.url)]),n||(n=t._defaultLoadStrategy),this._strategy=new n(r)}this._strategy.onError.add(this._error,this),this._strategy.onComplete.add(this._complete,this),this._strategy.onProgress.add(this._progress,this)}return t.setDefaultLoadStrategy=function(e){t._defaultLoadStrategy=e},t.setLoadStrategy=function(e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t._loadStrategyMap[e]=r)},Object.defineProperty(t.prototype,"strategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this._strategy.config.url},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return this._state===Le.Loading},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._state===Le.Complete},enumerable:!0,configurable:!0}),t.prototype.abort=function(){this._strategy.abort()},t.prototype.load=function(){this._state=Le.Loading,this.onStart.dispatch(this),this._strategy.load()},t.prototype._error=function(t){this._state=Le.Complete,this.error=t,this.onComplete.dispatch(this)},t.prototype._complete=function(t,e){this._state=Le.Complete,this.type=t,this.data=e,this.onComplete.dispatch(this)},t.prototype._progress=function(t){this.onProgress.dispatch(this,t)},t.prototype._determineCrossOrigin=function(e,r){if(void 0===r&&(r=window.location),0===e.indexOf("data:")||0===e.indexOf("javascript:"))return"";if(window.origin!==window.location.origin)return"anonymous";t._tempAnchor||(t._tempAnchor=document.createElement("a")),t._tempAnchor.href=e;var n=Re(t._tempAnchor.href,{strictMode:!0}),o=!n.port&&""===r.port||n.port===r.port,i=n.protocol?n.protocol+":":"";return n.host===r.hostname&&o&&i===r.protocol?"":"anonymous"},t._tempAnchor=null,t._defaultLoadStrategy=Ye,t._loadStrategyMap={gif:Ge,png:Ge,bmp:Ge,jpg:Ge,jpeg:Ge,tif:Ge,tiff:Ge,webp:Ge,tga:Ge,svg:Ge,"svg+xml":Ge,mp3:ze,ogg:ze,wav:ze,mp4:Fe,webm:Fe,mov:Fe},t}();var Qe,Ke,Ze=/(#[\w-]+)?$/,tr=function(){function t(e,r){void 0===e&&(e=""),void 0===r&&(r=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this.resources={},this.onError=new Pe,this.onLoad=new Pe,this.onStart=new Pe,this.onComplete=new Pe,this.onProgress=new Pe,this._baseUrl="",this._urlResolvers=[],this._middleware=[],this._resourcesParsing=[],this._boundLoadResource=this._loadResource.bind(this),this.baseUrl=e,this._queue=new He(this._boundLoadResource,r),this._queue.pause(),this._middleware=t._defaultMiddleware.slice()}return Object.defineProperty(t.prototype,"baseUrl",{get:function(){return this._baseUrl},set:function(t){for(;t.length&&"/"===t.charAt(t.length-1);)t=t.slice(0,-1);this._baseUrl=t},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){if(Array.isArray(t)){for(var r=0;r<t.length;++r)this.add(t[r]);return this}var n="",o="",i=this._baseUrl,s={url:""};if("object"==typeof t?(n=t.url,o=t.name||t.url,i=t.baseUrl||i,s=t):(o=t,n="string"==typeof e?e:o),!n)throw new Error("You must specify the `url` property.");if(this.loading&&!s.parentResource)throw new Error("Cannot add root resources while the loader is running.");if(this.resources[o])throw new Error('Resource named "'+o+'" already exists.');n=this._prepareUrl(n,i),s.url=n;var a=new We(o,s);if(this.resources[o]=a,"function"==typeof s.onComplete&&a.onAfterMiddleware.once(s.onComplete),this.loading){var c=s.parentResource,u=[];for(r=0;r<c.children.length;++r)c.children[r].isComplete||u.push(c.children[r]);var h=c.progressChunk*(u.length+1)/(u.length+2);c.children.push(a),c.progressChunk=h;for(r=0;r<u.length;++r)u[r].progressChunk=h;a.progressChunk=h}return this._queue.push(a),this},t.prototype.use=function(e,r){return void 0===r&&(r=t.DefaultMiddlewarePriority),this._middleware.push({fn:e,priority:r}),this._middleware.sort((function(t,e){return t.priority-e.priority})),this},t.prototype.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.reset(),this._queue.pause(),this.resources){var e=this.resources[t];e&&(e._onCompleteBinding&&e._onCompleteBinding.detach(),e.isLoading&&e.abort())}return this.resources={},this},t.prototype.load=function(t){if("function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue.length(),r=0;r<this._queue.length();++r)this._queue.getTask(r).data.progressChunk=e;this._onStart(),this._queue.resume()}return this},Object.defineProperty(t.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!0,configurable:!0}),t.prototype.addUrlResolver=function(t){return this._urlResolvers.push(t),this},t.prototype._prepareUrl=function(t,e){var r=Re(t,{strictMode:!0});if(this._urlResolvers.forEach((function(e){t=e(t,r),r=Re(t,{strictMode:!0})})),r.protocol||0===t.indexOf("//")||(t=e.length&&"/"!==t.charAt(0)?e+"/"+t:e+t),this.defaultQueryString){var n=Ze.exec(t);if(n){var o=n[0];-1!==(t=t.substr(0,t.length-o.length)).indexOf("?")?t+="&"+this.defaultQueryString:t+="?"+this.defaultQueryString,t+=o}}return t},t.prototype._loadResource=function(t,e){t._dequeue=e,t._onCompleteBinding=t.onComplete.once(this._onLoad,this),t.load()},t.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t.prototype._onLoad=function(t){var e=this;t._onCompleteBinding=null,this._resourcesParsing.push(t),t._dequeue(),function(t,e,r,n){void 0===n&&(n=!1);var o=0,i=t.length;!function s(a){a||o===i?r&&r(a):n?setTimeout((function(){return e(t[o++],s)}),1):e(t[o++],s)}()}(this._middleware,(function(r,n){r.fn.call(e,t,n)}),(function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(100,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&0===e._resourcesParsing.length&&e._onComplete()}),!0)},t.use=function(e,r){return void 0===r&&(r=t.DefaultMiddlewarePriority),t._defaultMiddleware.push({fn:e,priority:r}),t._defaultMiddleware.sort((function(t,e){return t.priority-e.priority})),t},t.DefaultMiddlewarePriority=50,t._defaultMiddleware=[],t}(),er=function(e){function n(r){var n=r.resource,o=r.resourceTotal,i=e.call(this)||this;return i.progress=0,i.resourceTotal=0,i.resourceLoadedCount=0,i.resource=n,i.resourceTotal=o,0===o&&i.resource.emit(t.LOAD_EVENT.COMPLETE,i),i}return r(n,e),n.prototype.onStart=function(){this.resource.emit(t.LOAD_EVENT.START,this)},n.prototype.onProgress=function(e){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,e.success?this.resource.emit(t.LOAD_EVENT.LOADED,this,e):this.resource.emit(t.LOAD_EVENT.ERROR,this,e),this.resource.emit(t.LOAD_EVENT.PROGRESS,this,e),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(t.LOAD_EVENT.COMPLETE,this)},n}(u);t.LOAD_EVENT=void 0,(Qe=t.LOAD_EVENT||(t.LOAD_EVENT={})).START="start",Qe.PROGRESS="progress",Qe.LOADED="loaded",Qe.COMPLETE="complete",Qe.ERROR="error",t.RESOURCE_TYPE=void 0,(Ke=t.RESOURCE_TYPE||(t.RESOURCE_TYPE={})).IMAGE="IMAGE",Ke.SPRITE="SPRITE",Ke.SPRITE_ANIMATION="SPRITE_ANIMATION",Ke.DRAGONBONE="DRAGONBONE",Ke.SPINE="SPINE",Ke.AUDIO="AUDIO",Ke.VIDEO="VIDEO",Ye.setExtensionXhrType("json",Ue.Json),Ye.setExtensionXhrType("tex",Ue.Json),Ye.setExtensionXhrType("ske",Ue.Json),Ye.setExtensionXhrType("mp3",Ue.Buffer),Ye.setExtensionXhrType("wav",Ue.Buffer),Ye.setExtensionXhrType("aac",Ue.Buffer),Ye.setExtensionXhrType("ogg",Ue.Buffer);var rr={png:Ge,jpg:Ge,jpeg:Ge,webp:Ge,json:Ye,tex:Ye,ske:Ye,audio:Ye,video:Fe},nr=new(function(t){function e(e){var r=t.call(this)||this;return r.timeout=6e3,r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],e&&"number"==typeof e.timeout&&(r.timeout=e.timeout),r}return r(e,t),e.prototype.loadConfig=function(t){this.addResource(t),this.preload()},e.prototype.loadSingle=function(t){return this.addResource([t]),this.getResource(t.name)},e.prototype.addResource=function(t){var e,r;if(!t||t.length<1)console.warn("no resources");else try{for(var n=s(t),o=n.next();!o.done;o=n.next()){var i=o.value;this.resourcesMap[i.name]?console.warn(i.name+" was already added"):(this.resourcesMap[i.name]=i,this.resourcesMap[i.name].data={})}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},e.prototype.preload=function(){var t=Object.values(this.resourcesMap).filter((function(t){return t.preload})).map((function(t){return t.name}));this.progress=new er({resource:this,resourceTotal:t.length}),this.loadResource({names:t,preload:!0})},e.prototype.getResource=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this.loadResource({names:[t]}),[2,this.promiseMap[t]||Promise.resolve({})]}))}))},e.prototype.instance=function(t){return o(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=this.resourcesMap[t],(r=this.makeInstanceFunctions[e.type])?[4,this.makeInstanceFunctions[e.type](e)]:[3,2];case 1:r=n.sent(),n.label=2;case 2:return[2,r]}}))}))},e.prototype.destroy=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._destroy(t)];case 1:return e.sent(),[2]}}))}))},e.prototype._destroy=function(t,e){return void 0===e&&(e=!1),o(this,void 0,void 0,(function(){var r,n;return i(this,(function(o){switch(o.label){case 0:if(!(r=this.resourcesMap[t]))return[2];if(e)return[3,5];o.label=1;case 1:return o.trys.push([1,4,,5]),this.destroyInstanceFunctions[r.type]?[4,this.destroyInstanceFunctions[r.type](r)]:[3,3];case 2:o.sent(),o.label=3;case 3:return[3,5];case 4:return n=o.sent(),console.warn("destroy resource "+r.name+" error with '"+n.message+"'"),[3,5];case 5:return delete this.promiseMap[t],r.complete=!1,r.instance=void 0,[2]}}))}))},e.prototype.registerInstance=function(t,e){this.makeInstanceFunctions[t]=e},e.prototype.registerDestroy=function(t,e){this.destroyInstanceFunctions[t]=e},e.prototype.loadResource=function(t){var e=this,r=t.names,n=void 0===r?[]:r,o=t.preload,i=void 0!==o&&o,s=n.filter((function(t){return!e.promiseMap[t]&&e.resourcesMap[t]}));if(s.length){var a={},c=this.getLoader(i);s.forEach((function(t){e.promiseMap[t]=new Promise((function(e){return a[t]=e}));var r=e.resourcesMap[t];for(var n in r.src){var o=r.src[n].type;"data"===o?(r.data[n]=r.src[n].data,e.doComplete(t,a[t],i)):c.add({url:r.src[n].url,name:r.name+"_"+n,strategy:rr[o],metadata:{key:n,name:r.name,resolves:a}})}})),c.load()}},e.prototype.doComplete=function(t,e,r){return void 0===r&&(r=!1),o(this,void 0,void 0,(function(){var n,o,s,a;return i(this,(function(i){switch(i.label){case 0:if(n=this.resourcesMap[t],o={name:t,resource:this.resourcesMap[t],success:!0},!this.checkAllLoaded(t))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),s=n,[4,this.instance(t)];case 2:return s.instance=i.sent(),n.complete=!0,r&&this.progress.onProgress(o),e(n),[3,4];case 3:return a=i.sent(),n.complete=!1,r&&(o.errMsg=a.message,o.success=!1,this.progress.onProgress(o)),e({}),[3,4];case 4:return[2]}}))}))},e.prototype.checkAllLoaded=function(t){var e=this.resourcesMap[t];return Array.from(Object.keys(e.src)).every((function(t){return e.data[t]}))},e.prototype.getLoader=function(t){var e=this;void 0===t&&(t=!1);var r=this.loaders.find((function(t){return!t.loading}));return r||(r=new tr,this.loaders.push(r)),t&&r.onStart.once((function(){e.progress.onStart()})),r.onLoad.add((function(r,n){e.onLoad({preload:t,resource:n})})),r.onError.add((function(r,n,o){e.onError({errMsg:r,resource:o,preload:t})})),r.onComplete.once((function(){r.onLoad.detachAll(),r.onError.detachAll(),r.reset()})),r},e.prototype.onLoad=function(t){var e=t.preload,r=void 0!==e&&e,n=t.resource;return o(this,void 0,void 0,(function(){var t,e,o,s,a;return i(this,(function(i){return t=n.metadata,e=t.key,o=t.name,s=t.resolves,a=n.data,this.resourcesMap[o].data[e]=a,this.doComplete(o,s[o],r),[2]}))}))},e.prototype.onError=function(t){var e=t.errMsg,r=t.preload,n=void 0!==r&&r,s=t.resource;return o(this,void 0,void 0,(function(){var t,r,o,a;return i(this,(function(i){return t=s.metadata,r=t.name,o=t.resolves,this._destroy(r,!0),o[r]({}),n&&(a={name:r,resource:this.resourcesMap[r],success:!1,errMsg:e},this.progress.onProgress(a)),[2]}))}))},e}(u)),or={IDEProp:me,componentObserver:Se};t.Component=h,t.Game=Ae,t.GameObject=ge,t.IDEProp=me,t.Scene=je,t.System=Oe,t.Transform=ve,t.componentObserver=Se,t.decorators=or,t.resource=nr,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@eva/eva.js", | ||
"version": "1.0.6", | ||
"version": "1.0.7-alpha.0", | ||
"description": "@eva/eva.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
531600
10
12018
2