UNPKG

@eva/react-eva-spine

Version:

React EVA是一个让开发同学能够在React技术体系下,利用EVA JS的游戏研发能力,开发动画、游戏类场景的框架。它可以让开发同学用熟悉的JSX和Hooks语法编写动画、游戏场景的代码。

1 lines 792 kB
!function t(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):"object"==typeof exports?exports.dist=r(require("react")):e.dist=r(e.React)}(window,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="./dist/",r(r.s=111)}([function(t,e,r){"use strict";(function(t){e.__esModule=!0,e.loader=e.prepare=e.particles=e.mesh=e.loaders=e.interaction=e.filters=e.extras=e.extract=e.accessibility=void 0;var n=r(123);Object.keys(n).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function e(){return n[t]}})}));var i=r(3);Object.keys(i).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function e(){return i[t]}})}));var o,a=M(r(183)),s,u=S(r(184)),l,c=S(r(186)),h,f=S(r(91)),d,p=S(r(196)),v,m=S(r(203)),y,g=S(r(205)),_,b=S(r(209)),x,E=S(r(214)),T,w=S(r(219));function S(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function M(t){return t&&t.__esModule?t:{default:t}}i.utils.mixins.performMixins();var R=g.shared||null;e.accessibility=u,e.extract=c,e.extras=f,e.filters=p,e.interaction=m,e.loaders=g,e.mesh=b,e.particles=E,e.prepare=w,e.loader=R,"function"==typeof a.default&&(0,a.default)(e),t.PIXI=e}).call(this,r(28))},function(t,e,r){"use strict";r.r(e),r.d(e,"Component",(function(){return Y})),r.d(e,"Game",(function(){return Nt})),r.d(e,"GameObject",(function(){return pt})),r.d(e,"IDEProp",(function(){return Bt})),r.d(e,"LOAD_EVENT",(function(){return Vt})),r.d(e,"LOAD_SCENE_MODE",(function(){return Ct})),r.d(e,"OBSERVER_TYPE",(function(){return z})),r.d(e,"RESOURCE_TYPE",(function(){return Gt})),r.d(e,"RESOURCE_TYPE_STRATEGY",(function(){return Ht})),r.d(e,"Scene",(function(){return Pt})),r.d(e,"System",(function(){return gt})),r.d(e,"Transform",(function(){return ct})),r.d(e,"componentObserver",(function(){return jt})),r.d(e,"decorators",(function(){return zt})),r.d(e,"resource",(function(){return Yt})),r.d(e,"resourceLoader",(function(){return Xt})),r.d(e,"version",(function(){return qt}));var n=r(16),i=r.n(n),o=r(110),a=r(34),s=r(5),u=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}(),l=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 u(t,!1,e))},t.prototype.once=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new u(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)},i=0;i<e.length;++i)e[i].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}(),c=r(19),h=r.n(c),f=function(){function t(t){this.config=t,this.onError=new l,this.onComplete=new l,this.onProgress=new l}return t}(),d=function(t,e){return(d=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)},p,v;function m(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function y(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n}function g(t){var e,r="";if(0===t.indexOf("data:")){var n=t.indexOf("/");r=t.substring(n+1,t.indexOf(";",n))}else{var i=t.indexOf("?"),o=t.indexOf("#"),a=Math.min(i>-1?i:t.length,o>-1?o:t.length);r=(t=t.substring(0,a)).substring(t.lastIndexOf(".")+1)}return r.toLowerCase()}function _(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"}(p||(p={})),function(t){t[t.NotStarted=0]="NotStarted",t[t.Loading=1]="Loading",t[t.Complete=2]="Complete"}(v||(v={}));var b=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 m(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],i=t.mimeTypes?t.mimeTypes[r]:void 0;i||(i=this.elementType+"/"+g(n));var o=document.createElement("source");o.src=n,o.type=i,this._element.appendChild(o)}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=p.Unknown;switch(this.elementType){case"audio":t=p.Audio;break;case"video":t=p.Video;break;default:_(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}(f),x=function(t){function e(e){return t.call(this,e,"audio")||this}return m(e,t),e}(b),E="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",T=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 m(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=E,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(p.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}(f),w=function(t){function e(e){return t.call(this,e,"video")||this}return m(e,t),e}(b),S=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest),M;function R(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"}(M||(M={}));var P=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=M.Default,e}return m(e,t),e.prototype.load=function(){var t=this.config,e=g(t.url);"string"!=typeof t.xhrType&&(t.xhrType=this._determineXhrType(e));var r=this._xhr;this._xhrType=t.xhrType||M.Default,S?(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===M.Json||t.xhrType===M.Document?r.responseType=M.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(){S?(this._clearEvents(),this._xhr.abort(),this._onAbort()):this._xhr.abort()},e.prototype._createRequest=function(){return S?new window.XDomainRequest:new XMLHttpRequest},e.prototype._determineXhrType=function(t){return e._xhrTypeMap[t]||M.Default},e.prototype._clearEvents=function(){S?(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,n;if(void 0!==t.responseType&&""!==t.responseType&&"text"!==t.responseType||(e=t.responseText),0===r&&(e.length>0||t.responseType===M.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case M.Buffer:this._complete(p.Buffer,t.response);break;case M.Blob:this._complete(p.Blob,t.response);break;case M.Document:this._parseDocument(e);break;case M.Json:this._parseJson(e);break;case M.Default:case M.Text:this._complete(p.Text,e);break;default:_(this._xhrType)}else this._error("["+t.status+"] "+t.statusText+": "+t.responseURL)},e.prototype._parseDocument=function(t){try{if(window.DOMParser){var e,r=(new DOMParser).parseFromString(t,"text/xml");this._complete(p.Xml,r)}else{var n=document.createElement("div");n.innerHTML=t,this._complete(p.Xml,n)}}catch(t){this._error("Error trying to parse loaded xml: "+t)}},e.prototype._parseJson=function(t){try{var e=JSON.parse(t);this._complete(p.Json,e)}catch(t){this._error("Error trying to parse loaded json: "+t)}},e.prototype._onAbort=function(){var t=this._xhr;this._error(R(t)+" Request was aborted by the user.")},e.prototype._onError=function(){var t=this._xhr;this._error(R(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},e.prototype._onTimeout=function(){var t=this._xhr;this._error(R(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=M,e._xhrTypeMap={xhtml:M.Document,html:M.Document,htm:M.Document,xml:M.Document,tmx:M.Document,svg:M.Document,tsx:M.Document,gif:M.Blob,png:M.Blob,bmp:M.Blob,jpg:M.Blob,jpeg:M.Blob,tif:M.Blob,tiff:M.Blob,webp:M.Blob,tga:M.Blob,json:M.Json,text:M.Text,txt:M.Text,ttf:M.Buffer,otf:M.Buffer},e}(f);function C(t){var e=t;return function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(null===e)throw new Error("Callback was already called.");var i=e;return e=null,i.apply(this,r)}}var O=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 l,this.onUnsaturated=new l,this.onEmpty=new l,this.onDrain=new l,this.onError=new l,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,C(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 i={data:t,callback:r};e?this._tasks.unshift(i):this._tasks.push(i),setTimeout((function(){return n.process()}),1)}},t.prototype._next=function(t){var e=this;return function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];e.workers-=1,t.callback&&t.callback.apply(t,y([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}(),A=function(){function t(e,r){if(this.children=[],this.onStart=new l,this.onProgress=new l,this.onComplete=new l,this.onAfterMiddleware=new l,this.data=null,this.type=p.Unknown,this.error="",this.progressChunk=0,this._dequeue=function(){},this._onCompleteBinding=null,this._state=v.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[g(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===v.Loading},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._state===v.Complete},enumerable:!0,configurable:!0}),t.prototype.abort=function(){this._strategy.abort()},t.prototype.load=function(){this._state=v.Loading,this.onStart.dispatch(this),this._strategy.load()},t.prototype._error=function(t){this._state=v.Complete,this.error=t,this.onComplete.dispatch(this)},t.prototype._complete=function(t,e){this._state=v.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=h()(t._tempAnchor.href,{strictMode:!0}),i=!n.port&&""===r.port||n.port===r.port,o=n.protocol?n.protocol+":":"";return n.host===r.hostname&&i&&o===r.protocol?"":"anonymous"},t._tempAnchor=null,t._defaultLoadStrategy=P,t._loadStrategyMap={gif:T,png:T,bmp:T,jpg:T,jpeg:T,tif:T,tiff:T,webp:T,tga:T,svg:T,"svg+xml":T,mp3:x,ogg:x,wav:x,mp4:w,webm:w,mov:w},t}();function I(t,e,r,n){void 0===n&&(n=!1);var i=0,o=t.length;!function a(s){s||i===o?r&&r(s):n?setTimeout((function(){return e(t[i++],a)}),1):e(t[i++],a)}()}var D=100,k=/(#[\w-]+)?$/,L=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 l,this.onLoad=new l,this.onStart=new l,this.onComplete=new l,this.onProgress=new l,this._baseUrl="",this._urlResolvers=[],this._middleware=[],this._resourcesParsing=[],this._boundLoadResource=this._loadResource.bind(this),this.baseUrl=e,this._queue=new O(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="",i="",o=this._baseUrl,a={url:""};if("object"==typeof t?(n=t.url,i=t.name||t.url,o=t.baseUrl||o,a=t):(i=t,n="string"==typeof e?e:i),!n)throw new Error("You must specify the `url` property.");if(this.loading&&!a.parentResource)throw new Error("Cannot add root resources while the loader is running.");if(this.resources[i])throw new Error('Resource named "'+i+'" already exists.');n=this._prepareUrl(n,o),a.url=n;var s=new A(i,a);if(this.resources[i]=s,"function"==typeof a.onComplete&&s.onAfterMiddleware.once(a.onComplete),this.loading){for(var u=a.parentResource,l=[],r=0;r<u.children.length;++r)u.children[r].isComplete||l.push(u.children[r]);var c,h=u.progressChunk*(l.length+1)/(l.length+2);u.children.push(s),u.progressChunk=h;for(var r=0;r<l.length;++r)l[r].progressChunk=h;s.progressChunk=h}return this._queue.push(s),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,r=100/this._queue.length(),n=0;n<this._queue.length();++n)this._queue.getTask(n).data.progressChunk=r;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=h()(t,{strictMode:!0});if(this._urlResolvers.forEach((function(e){t=e(t,r),r=h()(t,{strictMode:!0})})),r.protocol||0===t.indexOf("//")||(t=e.length&&"/"!==t.charAt(0)?e+"/"+t:e+t),this.defaultQueryString){var n=k.exec(t);if(n){var i=n[0];-1!==(t=t.substr(0,t.length-i.length)).indexOf("?")?t+="&"+this.defaultQueryString:t+="?"+this.defaultQueryString,t+=i}}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(),I(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}(),N=function(t,e){return(N=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 B(t,e){function r(){this.constructor=t}N(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function j(t,e,r,n){var i=arguments.length,o=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n,a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(o=(i<3?a(o):i>3?a(e,r,o):a(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function U(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function F(t,e){var r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=2&a[0]?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=e.call(t,r)}catch(t){a=[6,t],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function X(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function V(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(t){a={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function G(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(V(arguments[e]));return t}function H(t){return t instanceof W?t.name:t instanceof Function?t.componentName:void 0}var W=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 B(e,t),e}(i.a),Y=W,z;!function(t){t.ADD="ADD",t.REMOVE="REMOVE",t.CHANGE="CHANGE"}(z||(z={}));var q={},K={},Q={},Z={};function $(t,e){q[t.gameObject.id]||(q[t.gameObject.id]={});var r=q[t.gameObject.id],n=t.name+"_"+e.join(",");if(r[n])return r[n];for(var i=e.length-1,o=t,a=0;a<i;a++)o=o[e[a]];return r[n]={property:o,key:e[i]},r[n]}function J(t){t.gameObject&&delete q[t.gameObject.id]}function tt(t){var e,r,n=t.systemName,i=t.componentName,o=t.component,a=t.prop,s=t.type;null===(r=null===(e=K[n])||void 0===e?void 0:e.componentObserver)||void 0===r||r.add({component:o,prop:a,type:s,componentName:i})}function et(t){var e=t.prop,r=t.component,n=t.componentName;for(var i in Q){var a,s=(Q[i]||{})[n],u;if(s)s.findIndex((function(t){return Object(o.a)(t,e)}))>-1&&tt({systemName:i,componentName:n,component:r,prop:e,type:z.CHANGE})}}function rt(t){var e,r,n=t.obj,i=t.key,o=t.prop,s=t.component,u=t.componentName;if(void 0!==n)if(i in n){if(Object.defineProperty(n,"_"+i,{enumerable:!1,writable:!0,value:n[i]}),o.deep&&Object(a.a)(n[i]))try{for(var l=X(Object.keys(n[i])),c=l.next();!c.done;c=l.next()){var h=c.value;rt({obj:n[i],key:h,prop:o,component:s,componentName:u})}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}Object.defineProperty(n,i,{enumerable:!0,set:function(t){n["_"+i]!==t&&(n["_"+i]=t,et({prop:o,component:s,componentName:u}))},get:function(){return n["_"+i]}})}else console.error("prop "+i+" not in component: "+u+", Can not observer")}function nt(t){return t&&t.constructor&&"componentName"in t.constructor}function it(t){var e,r,n,i,a=[];t instanceof Array?a.push.apply(a,G(t)):a.push(t);try{for(var s=X(a),u=s.next();!u.done;u=s.next()){var l=u.value;for(var c in l.observerInfo){Z[c]=Z[c]||[];var h=Z[c],f=function(t){var e;-1===h.findIndex((function(e){return Object(o.a)(e,t)}))&&Z[c].push(t)};try{for(var d=(n=void 0,X(l.observerInfo[c])),p=d.next();!p.done;p=d.next()){var v;f(p.value)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}function ot(t,e){var r,n;if(void 0===e&&(e=t.name),e&&Z[e]){if(!t||!nt(t))throw new Error("component param must be an instance of Component");if(!t.gameObject||!t.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var i=X(Z[e]),o=i.next();!o.done;o=i.next()){var a=o.value,s=$(t,a.prop),u,l;rt({obj:s.property,key:s.key,prop:a,component:t,componentName:e})}}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}function at(t,e){var r,n;for(var i in void 0===e&&(e=t.name),Q){var o,a;(Q[i]||{})[e]&&(null===(n=null===(r=K[i])||void 0===r?void 0:r.componentObserver)||void 0===n||n.add({component:t,type:z.ADD,componentName:e}))}}function st(t,e){var r,n;for(var i in void 0===e&&(e=t.name),Q){var o,a;(Q[i]||{})[e]&&(null===(n=null===(r=K[i])||void 0===r?void 0:r.componentObserver)||void 0===n||n.add({component:t,type:z.REMOVE,componentName:e}))}J(t)}function ut(t,e){Q[e.systemName]=e.observerInfo,K[e.systemName]=t}var lt,ct=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 B(e,t),e.prototype.init=function(t){var e,r;void 0===t&&(t={});var n=["position","size","origin","anchor","scale","skew"];try{for(var i=X(n),o=i.next();!o.done;o=i.next()){var a=o.value;Object.assign(this[a],t[a])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}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",j([Object(s.b)("vector2"),Object(s.a)(1)],e.prototype,"position",void 0),j([Object(s.b)("size"),Object(s.a)(1)],e.prototype,"size",void 0),j([Object(s.b)("vector2"),Object(s.a)(.1)],e.prototype,"origin",void 0),j([Object(s.b)("vector2"),Object(s.a)(.1)],e.prototype,"anchor",void 0),j([Object(s.b)("vector2"),Object(s.a)(.1)],e.prototype,"scale",void 0),j([Object(s.b)("vector2"),Object(s.a)(.1)],e.prototype,"skew",void 0),j([Object(s.b)("number"),Object(s.a)(.1)],e.prototype,"rotation",void 0),e}(Y),ht=0;function ft(){return++ht}var dt,pt=function(){function t(t,e){this._componentCache={},this.components=[],this._name=t,this.id=ft(),this.addComponent(ct,e)}return Object.defineProperty(t.prototype,"transform",{get:function(){return this.getComponent(ct)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.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 i=X(this.transform.children),o=i.next();!o.done;o=i.next()){var a;o.value.gameObject.scene=t}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}t?t.addGameObject(this):n&&n.removeGameObject(this)}},enumerable:!1,configurable:!0}),t.prototype.addChild=function(e){if(e&&e.transform&&e!==this){if(!(e instanceof t))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error("gameObject '"+this.name+"' has been destroy");e.transform.parent=this.transform,e.scene=this.scene}},t.prototype.removeChild=function(e){return e instanceof t&&e.parent&&e.parent===this?(e.transform.parent=null,e.scene=null,e):e},t.prototype.addComponent=function(t,e){var r=H(t);if(!this._componentCache[r]){var n;if(t instanceof Function)n=new t(e);else{if(!(t instanceof Y))throw new Error("addComponent recieve Component and Component Constructor");n=t}if(n.gameObject)throw new Error("component has been added on gameObject "+n.gameObject.name);return n.gameObject=this,n.init&&n.init(n.__componentDefaultParams),at(n,n.name),ot(n,n.name),this.components.push(n),this._componentCache[r]=n,n.awake&&n.awake(),n}},t.prototype.removeComponent=function(t){var e;if("string"==typeof t?e=t:t instanceof Y?e=t.name:t.componentName&&(e=t.componentName),"Transform"===e)throw new Error("Transform can't be removed");return this._removeComponent(e)},t.prototype._removeComponent=function(t){var e=this.components.findIndex((function(e){var r;return e.name===t}));if(-1!==e){var r=this.components.splice(e,1)[0];return delete this._componentCache[t],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),st(r,t),r.gameObject=void 0,r}},t.prototype.getComponent=function(t){var e;return"string"==typeof t?e=t:t instanceof Y?e=t.name:t.componentName&&(e=t.componentName),void 0!==this._componentCache[e]?this._componentCache[e]:void 0},t.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},t.prototype.destroy=function(){if(this.transform){for(var t in Array.from(this.transform.children).forEach((function(t){var e;t.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(t);this.components.length=0}else console.error("Cannot destroy gameObject that have already been destroyed.")},t}(),vt,mt=function(){function t(){this.events=[]}return t.prototype.add=function(t){var e=t.component,r=t.prop,n=t.type,i=t.componentName;if(n===z.REMOVE){if(this.events.find((function(t){return t.component===e&&t.type===z.ADD})))return void(this.events=this.events.filter((function(t){return t.component!==e})));this.events=this.events.filter((function(t){return t.component!==e}))}var a=this.events.findIndex((function(t){return t.component===e&&Object(o.a)(t.prop,r)&&t.type===n}));a>-1&&this.events.splice(a,1),this.events.push({gameObject:e.gameObject,component:e,prop:r,type:n,componentName:i})},t.prototype.getChanged=function(){return this.events},Object.defineProperty(t.prototype,"changed",{get:function(){return this.events},enumerable:!1,configurable:!0}),t.prototype.clear=function(){var t=this.events;return this.events=[],t},t}(),yt,gt=function(){function t(t){this.started=!1,this.componentObserver=new mt,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}();function _t(){var t=null;return t=Date.now?Date.now:function(){return(new Date).getTime()}}var bt=_t(),xt={originTime:0,playbackRate:1},Et,Tt=function(){function t(e,r){e instanceof t&&(r=e,e={}),e=Object.assign({},xt,e),r&&(this._parent=r),this._createTime=bt(),this._timeMark=[{globalTime:this.globalTime,localTime:-e.originTime,entropy:-e.originTime,playbackRate:e.playbackRate,globalEntropy:0}],this._parent&&(this._timeMark[0].globalEntropy=this._parent.entropy),this._playbackRate=e.playbackRate}return Object.defineProperty(t.prototype,"globalTime",{get:function(){return this.parent?this.parent.currentTime:bt()-this._createTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastTimeMark",{get:function(){return this._timeMark[this._timeMark.length-1]},enumerable:!1,configurable:!0}),t.prototype.markTime=function(t){var e=void 0===t?{}:t,r=e.time,n=void 0===r?this.currentTime:r,i=e.entropy,o=void 0===i?this.entropy:i,a=e.playbackRate,s=void 0===a?this.playbackRate:a,u={globalTime:this.globalTime,localTime:n,entropy:o,playbackRate:s,globalEntropy:this.globalEntropy};this._timeMark.push(u)},Object.defineProperty(t.prototype,"currentTime",{get:function(){var t=this.lastTimeMark,e=t.localTime,r=t.globalTime;return e+(this.globalTime-r)*this.playbackRate},set:function(t){this.markTime({time:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"globalEntropy",{get:function(){return this._parent?this._parent.entropy:this.globalTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"entropy",{get:function(){var t=this.lastTimeMark,e=t.entropy,r=t.globalEntropy;return e+Math.abs((this.globalEntropy-r)*this.playbackRate)},set:function(t){if(this.entropy>t){var e=this.seekTimeMark(t);this._timeMark.length=e+1}this.markTime({entropy:t})},enumerable:!1,configurable:!0}),t.prototype.fork=function(e){return new t(e,this)},t.prototype.seekGlobalTime=function(t){var e=this.seekTimeMark(t),r=this._timeMark[e],n=r.entropy,i=r.playbackRate,o;return r.globalTime+(t-n)/Math.abs(i)},t.prototype.seekLocalTime=function(t){var e=this.seekTimeMark(t),r=this._timeMark[e],n=r.localTime,i=r.entropy,o;return r.playbackRate>0?n+(t-i):n-(t-i)},t.prototype.seekTimeMark=function(t){var e=this._timeMark,r=0,n=e.length-1;if(t<=e[r].entropy)return r;if(t>=e[n].entropy)return n;for(var i=Math.floor((r+n)/2);i>r&&i<n;){if(t===e[i].entropy)return i;t<e[i].entropy?n=i:t>e[i].entropy&&(r=i),i=Math.floor((r+n)/2)}return r},Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){t!==this.playbackRate&&(this.markTime({playbackRate:t}),this._playbackRate=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paused",{get:function(){if(0===this.playbackRate)return!0;for(var t=this.parent;t;){if(0===t.playbackRate)return!0;t=t.parent}return!1},enumerable:!1,configurable:!0}),t}(),wt={autoStart:!0,frameRate:60},St,Mt=function(){function t(t){var e=this;t=Object.assign({},wt,t),this._frameCount=0,this._frameDuration=1e3/t.frameRate,this.autoStart=t.autoStart,this.frameRate=t.frameRate,this.timeline=new Tt({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=function(){e._started&&(e._requestId=requestAnimationFrame(e._ticker),e.update())},this.autoStart&&this.start()}return t.prototype.update=function(){var t,e,r=this.timeline.currentTime,n=r-this._lastFrameTime;if(n>=this._frameDuration){var i=r-n%this._frameDuration,o=i-this._lastFrameTime;this._lastFrameTime=i;var a={deltaTime:o,time:i,currentTime:i,frameCount:++this._frameCount,fps:Math.round(1e3/o)};try{for(var s=X(this._tickers),u=s.next();!u.done;u=s.next()){var l=u.value;"function"==typeof l&&l(a)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}},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._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))},t.prototype.pause=function(){this._started=!1,this.timeline.playbackRate=0},t.prototype.setPlaybackRate=function(t){this.timeline.playbackRate=t},t}(),Rt,Pt=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.gameObjects=[],n.scene=n,n}return B(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}(pt),Ct;!function(t){t.SINGLE="SINGLE",t.MULTI_CANVAS="MULTI_CANVAS"}(Ct||(Ct={}));var Ot=function(t){if((t instanceof gt||t instanceof Y)&&!t.started){t.started=!0;try{t.start&&t.start()}catch(e){t instanceof Y?console.error(t.constructor.componentName+" start error",e):console.error(t.constructor.systemName+" start error",e)}}},At=function(t){var e,r,n,i=(null===(n=null==t?void 0:t.scene)||void 0===n?void 0:n.gameObjects)||[],o=null==t?void 0:t.multiScenes.map((function(t){var e;return t.gameObjects})),a=[];try{for(var s=X(o),u=s.next();!u.done;u=s.next()){var l;a=G(a,u.value)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return G(i,a)},It=function(t,e){var r,n,i,o,a,s,u,l;void 0===e&&(e=[]);try{for(var c=X(e),h=c.next();!h.done;h=c.next()){var f=h.value;try{for(var d=(i=void 0,X(f.components)),p=d.next();!p.done;p=d.next()){var v=p.value;try{Ot(v),v.update&&v.update(t)}catch(t){console.error("gameObject: "+f.name+" "+v.name+" update error",t)}}}catch(t){i={error:t}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}try{for(var m=X(e),y=m.next();!y.done;y=m.next()){var f=y.value;try{for(var g=(u=void 0,X(f.components)),_=g.next();!_.done;_=g.next()){var v=_.value;try{v.lateUpdate&&v.lateUpdate(t)}catch(t){console.error("gameObject: "+f.name+" "+v.name+" lateUpdate error",t)}}}catch(t){u={error:t}}finally{try{_&&!_.done&&(l=g.return)&&l.call(g)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}},Dt=function(t){var e,r,n,i;try{for(var o=X(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{for(var u=(n=void 0,X(s.components)),l=u.next();!l.done;l=u.next()){var c=l.value;try{c.onResume&&c.onResume()}catch(t){console.error("gameObject: "+s.name+", "+c.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},kt=function(t){var e,r,n,i;try{for(var o=X(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{for(var u=(n=void 0,X(s.components)),l=u.next();!l.done;l=u.next()){var c=l.value;try{c.onPause&&c.onPause()}catch(t){console.error("gameObject: "+s.name+", "+c.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},Lt,Nt=function(t){function e(e){var r,n,i=void 0===e?{}:e,o=i.systems,a=i.frameRate,s=void 0===a?60:a,u=i.autoStart,l=void 0===u||u,c=i.needScene,h=void 0===c||c,f=t.call(this)||this;if(f.playing=!1,f.started=!1,f.multiScenes=[],f.systems=[],window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=f),f.ticker=new Mt({autoStart:!1,frameRate:s}),f.initTicker(),o&&o.length)try{for(var d=X(o),p=d.next();!p.done;p=d.next()){var v=p.value;f.addSystem(v)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return h&&f.loadScene(new Pt("scene")),l&&f.start(),f}return B(e,t),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(t){this._scene=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gameObjects",{get:function(){return At(this)},enumerable:!1,configurable:!0}),e.prototype.addSystem=function(t,e){var r,n;if(t instanceof Function)r=new t(e);else{if(!(t instanceof gt))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),ut(r,r.constructor),it(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")},e.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 gt&&(e=this.systems.findIndex((function(e){return e===t}))),e>-1&&(this.systems[e].destroy&&this.systems[e].destroy(),this.systems.splice(e,1))}},e.prototype.getSystem=function(t){return this.systems.find((function(e){return"string"==typeof t?e.name===t:e instanceof t}))},e.prototype.pause=function(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},e.prototype.start=function(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())},e.prototype.resume=function(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())},e.prototype.initTicker=function(){var t=this;this.ticker.add((function(e){var r,n,i,o;t.scene&&It(e,t.gameObjects);try{for(var a=X(t.systems),s=a.next();!s.done;s=a.next()){var u=s.value;try{Ot(u),u.update&&u.update(e)}catch(e){console.error(u.constructor.systemName+" update error",e)}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}try{for(var l=X(t.systems),c=l.next();!c.done;c=l.next()){var u=c.value;try{u.lateUpdate&&u.lateUpdate(e)}catch(e){console.error(u.constructor.systemName+" lateUpdate error",e)}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}}))},e.prototype.triggerResume=function(){var t,e;Dt(this.gameObjects);try{for(var r=X(this.systems),n=r.next();!n.done;n=r.next()){var i=n.value;try{i.onResume&&i.onResume()}catch(t){console.error(i.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}}},e.prototype.triggerPause=function(){var t,e;kt(this.gameObjects);try{for(var r=X(this.systems),n=r.next();!n.done;n=r.next()){var i=n.value;try{i.onPause&&i.onPause()}catch(t){console.error(i.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}}},e.prototype.destroySystems=function(){var t,e;try{for(var r=X(G(this.systems)),n=r.next();!n.done;n=r.next()){var i=n.value;this.removeSystem(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.systems.length=0},e.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},e.prototype.loadScene=function(t){var e=t.scene,r=t.mode,n=void 0===r?Ct.SINGLE:r,i=t.params,o=void 0===i?{}:i;if(e){switch(n){case Ct.SINGLE:this.scene=e;break;case Ct.MULTI_CANVAS:this.multiScenes.push(e)}this.emit("sceneChanged",{scene:e,mode:n,params:o})}},e}(i.a);function Bt(t,e){t.constructor.IDEProps||(t.constructor.IDEProps=[]),t.constructor.IDEProps.push(e)}function jt(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 i=void 0;Array.isArray(t[r][n])&&(i={prop:t[r][n],deep:!1},t[r][n]=i),"string"==typeof(i=t[r][n]).prop&&(i.prop=[i.prop])}e.observerInfo=t}}}var Ut,Ft=function(t){function e(e){var r=e.resource,n=e.resourceTotal,i=t.call(this)||this;return i.progress=0,i.resourceTotal=0,i.resourceLoadedCount=0,i.resource=r,i.resourceTotal=n,0===n&&i.resource.emit(Vt.COMPLETE,i),i}return B(e,t),e.prototype.onStart=function(){this.resource.emit(Vt.START,this)},e.prototype.onProgress=function(t){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,t.success?this.resource.emit(Vt.LOADED,this,t):this.resource.emit(Vt.ERROR,this,t),this.resource.emit(Vt.PROGRESS,this,t),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(Vt.COMPLETE,this)},e}(i.a),Xt={AbstractLoadStrategy:f,AudioLoadStrategy:x,ImageLoadStrategy:T,XhrResponseType:M,MediaElementLoadStrategy:b,VideoLoadStrategy:w,XhrLoadStrategy:P,Loader:L,Resource:A,ResourceType:p,ResourceState:v},Vt,Gt;!function(t){t.START="start",t.PROGRESS="progress",t.LOADED="loaded",t.COMPLETE="complete",t.ERROR="error"}(Vt||(Vt={})),function(t){t.IMAGE="IMAGE",t.SPRITE="SPRITE",t.SPRITE_ANIMATION="SPRITE_ANIMATION",t.AUDIO="AUDIO",t.VIDEO="VIDEO"}(Gt||(Gt={})),P.setExtensionXhrType("json",M.Json),P.setExtensionXhrType("tex",M.Json),P.setExtensionXhrType("ske",M.Json),P.setExtensionXhrType("mp3",M.Buffer),P.setExtensionXhrType("wav",M.Buffer),P.setExtensionXhrType("aac",M.Buffer),P.setExtensionXhrType("ogg",M.Buffer);var Ht={png:T,jpg:T,jpeg:T,webp:T,json:P,tex:P,ske:P,audio:P,video:w},Wt,Yt=new(function(t){function e(e){var r=t.call(this)||this;return r.timeout=6e3,r.preProcessResourceHandlers=[],r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],e&&"number"==typeof e.timeout&&(r.timeout=e.timeout),r}return B(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=X(t),i=n.next();!i.done;i=n.next()){var o=i.value;this.resourcesMap[o.name]?console.warn(o.name+" was already added"):(this.resourcesMap[o.name]=o,this.resourcesMap[o.name].data={})}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},e.prototype.addPreProcessResourceHandler=function(t){this.preProcessResourceHandlers.push(t)},e.prototype.removePreProcessResourceHandler=function(t){this.preProcessResourceHandlers.splice(this.preProcessResourceHandlers.indexOf(t),1)},e.prototype.preload=function(){var t=[];for(v