@eva/react-eva-sprite-animation
Version:
React EVA是一个让开发同学能够在React技术体系下,利用EVA JS的游戏研发能力,开发动画、游戏类场景的框架。它可以让开发同学用熟悉的JSX和Hooks语法编写动画、游戏场景的代码。
1 lines • 655 kB
JavaScript
!function e(t,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")):t.dist=r(t.React)}(window,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="./dist/",r(r.s=111)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Component",(function(){return V})),r.d(t,"Game",(function(){return je})),r.d(t,"GameObject",(function(){return pe})),r.d(t,"IDEProp",(function(){return Ne})),r.d(t,"LOAD_EVENT",(function(){return He})),r.d(t,"LOAD_SCENE_MODE",(function(){return Re})),r.d(t,"OBSERVER_TYPE",(function(){return Y})),r.d(t,"RESOURCE_TYPE",(function(){return Xe})),r.d(t,"RESOURCE_TYPE_STRATEGY",(function(){return ze})),r.d(t,"Scene",(function(){return Ce})),r.d(t,"System",(function(){return ge})),r.d(t,"Transform",(function(){return ce})),r.d(t,"componentObserver",(function(){return Be})),r.d(t,"decorators",(function(){return Ye})),r.d(t,"resource",(function(){return Ve})),r.d(t,"resourceLoader",(function(){return Ge})),r.d(t,"version",(function(){return qe}));var n=r(17),i=r.n(n),o=r(110),a=r(34),s=r(4),u=function(){function e(e,t,r){void 0===t&&(t=!1),this.next=null,this.prev=null,this.owner=null,this.fn=e,this.once=t,this.thisArg=r}return e.prototype.detach=function(){return null!==this.owner&&(this.owner.detach(this),!0)},e.prototype.dispose=function(){this.detach()},e}(),l=function(){function e(){this._head=null,this._tail=null,this._filter=null}return e.prototype.handlers=function(){for(var e=this._head,t=[];e;)t.push(e),e=e.next;return t},e.prototype.hasAny=function(){return!!this._head},e.prototype.has=function(e){return e.owner===this},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this._head;if(!r)return!1;if(this._filter&&!this._filter.apply(this,e))return!1;for(;r;)r.once&&this.detach(r),r.fn.apply(r.thisArg,e),r=r.next;return!0},e.prototype.add=function(e,t){return void 0===t&&(t=null),this._addSignalBinding(new u(e,!1,t))},e.prototype.once=function(e,t){return void 0===t&&(t=null),this._addSignalBinding(new u(e,!0,t))},e.prototype.detach=function(e){var t=e;return t.owner!==this||(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._head?(this._head=t.next,null===t.next&&(this._tail=null)):t===this._tail&&(this._tail=t.prev,this._tail&&(this._tail.next=null)),t.owner=null),this},e.prototype.detachAll=function(){var e=this._head;if(!e)return this;for(this._head=null,this._tail=null;e;)e.owner=null,e=e.next;return this},e.prototype.filter=function(e){this._filter=e},e.prototype.proxy=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.dispatch.apply(e,t)},i=0;i<t.length;++i)t[i].add(n);return this},e.prototype._addSignalBinding=function(e){var t=e;return this._head?(this._tail&&(this._tail.next=t),t.prev=this._tail,this._tail=t):(this._head=t,this._tail=t),t.owner=this,t},e}(),c=r(20),h=r.n(c),f=function(){function e(e){this.config=e,this.onError=new l,this.onComplete=new l,this.onProgress=new l}return e}(),d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},p,v;function y(e,t){function r(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function m(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n}function g(e){var t,r="";if(0===e.indexOf("data:")){var n=e.indexOf("/");r=e.substring(n+1,e.indexOf(";",n))}else{var i=e.indexOf("?"),o=e.indexOf("#"),a=Math.min(i>-1?i:e.length,o>-1?o:e.length);r=(e=e.substring(0,a)).substring(e.lastIndexOf(".")+1)}return r.toLowerCase()}function _(e){throw new Error("Unexpected value. Should have been never.")}!function(e){e[e.Unknown=0]="Unknown",e[e.Buffer=1]="Buffer",e[e.Blob=2]="Blob",e[e.Json=3]="Json",e[e.Xml=4]="Xml",e[e.Image=5]="Image",e[e.Audio=6]="Audio",e[e.Video=7]="Video",e[e.Text=8]="Text"}(p||(p={})),function(e){e[e.NotStarted=0]="NotStarted",e[e.Loading=1]="Loading",e[e.Complete=2]="Complete"}(v||(v={}));var b=function(e){function t(t,r){var n=e.call(this,t)||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 y(t,e),t.prototype.load=function(){var e=this.config;e.crossOrigin&&(this._element.crossOrigin=e.crossOrigin);var t=e.sourceSet||[e.url];if(navigator.isCocoonJS)this._element.src=t[0];else for(var r=0;r<t.length;++r){var n=t[r],i=e.mimeTypes?e.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(),e.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,e.timeout))},t.prototype.abort=function(){for(this._clearEvents();this._element.firstChild;)this._element.removeChild(this._element.firstChild);this._error(this.elementType+" load aborted by the user.")},t.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement(this.elementType)},t.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)},t.prototype._error=function(e){this._clearEvents(),this.onError.dispatch(e)},t.prototype._complete=function(){this._clearEvents();var e=p.Unknown;switch(this.elementType){case"audio":e=p.Audio;break;case"video":e=p.Video;break;default:_(this.elementType)}this.onComplete.dispatch(e,this._element)},t.prototype._onLoad=function(){this._complete()},t.prototype._onError=function(){this._error(this.elementType+" failed to load.")},t.prototype._onTimeout=function(){this._error(this.elementType+" load timed out.")},t}(f),x=function(e){function t(t){return e.call(this,t,"audio")||this}return y(t,e),t}(b),E="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._boundOnLoad=t._onLoad.bind(t),t._boundOnError=t._onError.bind(t),t._boundOnTimeout=t._onTimeout.bind(t),t._element=t._createElement(),t._elementTimer=0,t}return y(t,e),t.prototype.load=function(){var e=this.config;e.crossOrigin&&(this._element.crossOrigin=e.crossOrigin),this._element.src=e.url,this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),e.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,e.timeout))},t.prototype.abort=function(){this._clearEvents(),this._element.src=E,this._error("Image load aborted by the user.")},t.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement("img")},t.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},t.prototype._error=function(e){this._clearEvents(),this.onError.dispatch(e)},t.prototype._complete=function(){this._clearEvents(),this.onComplete.dispatch(p.Image,this._element)},t.prototype._onLoad=function(){this._complete()},t.prototype._onError=function(){this._error("Image failed to load.")},t.prototype._onTimeout=function(){this._error("Image load timed out.")},t}(f),w=function(e){function t(t){return e.call(this,t,"video")||this}return y(t,e),t}(b),S=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest),O;function P(e){return e.toString().replace("object ","")}!function(e){e.Default="text",e.Buffer="arraybuffer",e.Blob="blob",e.Document="document",e.Json="json",e.Text="text"}(O||(O={}));var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._boundOnLoad=t._onLoad.bind(t),t._boundOnAbort=t._onAbort.bind(t),t._boundOnError=t._onError.bind(t),t._boundOnTimeout=t._onTimeout.bind(t),t._boundOnProgress=t._onProgress.bind(t),t._xhr=t._createRequest(),t._xhrType=O.Default,t}return y(t,e),t.prototype.load=function(){var e=this.config,t=g(e.url);"string"!=typeof e.xhrType&&(e.xhrType=this._determineXhrType(t));var r=this._xhr;this._xhrType=e.xhrType||O.Default,S?(r.timeout=e.timeout||5e3,r.onload=this._boundOnLoad,r.onerror=this._boundOnError,r.ontimeout=this._boundOnTimeout,r.onprogress=this._boundOnProgress,r.open("GET",e.url,!0),setTimeout((function(){r.send()}),0)):(r.open("GET",e.url,!0),e.timeout&&(r.timeout=e.timeout),e.xhrType===O.Json||e.xhrType===O.Document?r.responseType=O.Text:r.responseType=e.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())},t.prototype.abort=function(){S?(this._clearEvents(),this._xhr.abort(),this._onAbort()):this._xhr.abort()},t.prototype._createRequest=function(){return S?new window.XDomainRequest:new XMLHttpRequest},t.prototype._determineXhrType=function(e){return t._xhrTypeMap[e]||O.Default},t.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))},t.prototype._error=function(e){this._clearEvents(),this.onError.dispatch(e)},t.prototype._complete=function(e,t){this._clearEvents(),this.onComplete.dispatch(e,t)},t.prototype._onLoad=function(){var e=this._xhr,t="",r=void 0===e.status?200:e.status,n;if(void 0!==e.responseType&&""!==e.responseType&&"text"!==e.responseType||(t=e.responseText),0===r&&(t.length>0||e.responseType===O.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case O.Buffer:this._complete(p.Buffer,e.response);break;case O.Blob:this._complete(p.Blob,e.response);break;case O.Document:this._parseDocument(t);break;case O.Json:this._parseJson(t);break;case O.Default:case O.Text:this._complete(p.Text,t);break;default:_(this._xhrType)}else this._error("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._parseDocument=function(e){try{if(window.DOMParser){var t,r=(new DOMParser).parseFromString(e,"text/xml");this._complete(p.Xml,r)}else{var n=document.createElement("div");n.innerHTML=e,this._complete(p.Xml,n)}}catch(e){this._error("Error trying to parse loaded xml: "+e)}},t.prototype._parseJson=function(e){try{var t=JSON.parse(e);this._complete(p.Json,t)}catch(e){this._error("Error trying to parse loaded json: "+e)}},t.prototype._onAbort=function(){var e=this._xhr;this._error(P(e)+" Request was aborted by the user.")},t.prototype._onError=function(){var e=this._xhr;this._error(P(e)+" Request failed. Status: "+e.status+', text: "'+e.statusText+'"')},t.prototype._onTimeout=function(){var e=this._xhr;this._error(P(e)+" Request timed out.")},t.prototype._onProgress=function(e){e&&e.lengthComputable&&this.onProgress.dispatch(e.loaded/e.total)},t.setExtensionXhrType=function(e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t._xhrTypeMap[e]=r)},t.ResponseType=O,t._xhrTypeMap={xhtml:O.Document,html:O.Document,htm:O.Document,xml:O.Document,tmx:O.Document,svg:O.Document,tsx:O.Document,gif:O.Blob,png:O.Blob,bmp:O.Blob,jpg:O.Blob,jpeg:O.Blob,tif:O.Blob,tiff:O.Blob,webp:O.Blob,tga:O.Blob,json:O.Json,text:O.Text,txt:O.Text,ttf:O.Buffer,otf:O.Buffer},t}(f);function R(e){var t=e;return function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(null===t)throw new Error("Callback was already called.");var i=t;return t=null,i.apply(this,r)}}var M=function(){function e(e,t){if(void 0===t&&(t=1),this.worker=e,this.concurrency=t,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===t)throw new Error("Concurrency must not be zero");this.buffer=t/4}return Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.onDrain.detachAll(),this.workers=0,this._started=!1,this._tasks=[]},e.prototype.push=function(e,t){this._insert(e,!1,t)},e.prototype.unshift=function(e,t){this._insert(e,!0,t)},e.prototype.process=function(){for(;!this.paused&&this.workers<this.concurrency&&this._tasks.length;){var e=this._tasks.shift();0===this._tasks.length&&this.onEmpty.dispatch(),this.workers+=1,this.workers===this.concurrency&&this.onSaturated.dispatch(),this.worker(e.data,R(this._next(e)))}},e.prototype.length=function(){return this._tasks.length},e.prototype.running=function(){return this.workers},e.prototype.idle=function(){return this._tasks.length+this.workers===0},e.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},e.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var e=1;e<=this.concurrency;e++)this.process()}},e.prototype.getTask=function(e){return this._tasks[e]},e.prototype._insert=function(e,t,r){var n=this;if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(this._started=!0,null==e&&this.idle())setTimeout((function(){return n.onDrain.dispatch()}),1);else{var i={data:e,callback:r};t?this._tasks.unshift(i):this._tasks.push(i),setTimeout((function(){return n.process()}),1)}},e.prototype._next=function(e){var t=this;return function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];t.workers-=1,e.callback&&e.callback.apply(e,m([r],n)),r&&t.onError.dispatch(r,e.data),t.workers<=t.concurrency-t.buffer&&t.onUnsaturated.dispatch(),t.idle()&&t.onDrain.dispatch(),t.process()}},e}(),A=function(){function e(t,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=t,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=e._loadStrategyMap[g(r.url)]),n||(n=e._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 e.setDefaultLoadStrategy=function(t){e._defaultLoadStrategy=t},e.setLoadStrategy=function(t,r){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e._loadStrategyMap[t]=r)},Object.defineProperty(e.prototype,"strategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._strategy.config.url},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._state===v.Loading},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isComplete",{get:function(){return this._state===v.Complete},enumerable:!0,configurable:!0}),e.prototype.abort=function(){this._strategy.abort()},e.prototype.load=function(){this._state=v.Loading,this.onStart.dispatch(this),this._strategy.load()},e.prototype._error=function(e){this._state=v.Complete,this.error=e,this.onComplete.dispatch(this)},e.prototype._complete=function(e,t){this._state=v.Complete,this.type=e,this.data=t,this.onComplete.dispatch(this)},e.prototype._progress=function(e){this.onProgress.dispatch(this,e)},e.prototype._determineCrossOrigin=function(t,r){if(void 0===r&&(r=window.location),0===t.indexOf("data:")||0===t.indexOf("javascript:"))return"";if(window.origin!==window.location.origin)return"anonymous";e._tempAnchor||(e._tempAnchor=document.createElement("a")),e._tempAnchor.href=t;var n=h()(e._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"},e._tempAnchor=null,e._defaultLoadStrategy=C,e._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},e}();function D(e,t,r,n){void 0===n&&(n=!1);var i=0,o=e.length;!function a(s){s||i===o?r&&r(s):n?setTimeout((function(){return t(e[i++],a)}),1):t(e[i++],a)}()}var I=100,L=/(#[\w-]+)?$/,k=function(){function e(t,r){void 0===t&&(t=""),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=t,this._queue=new M(this._boundLoadResource,r),this._queue.pause(),this._middleware=e._defaultMiddleware.slice()}return Object.defineProperty(e.prototype,"baseUrl",{get:function(){return this._baseUrl},set:function(e){for(;e.length&&"/"===e.charAt(e.length-1);)e=e.slice(0,-1);this._baseUrl=e},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t){if(Array.isArray(e)){for(var r=0;r<e.length;++r)this.add(e[r]);return this}var n="",i="",o=this._baseUrl,a={url:""};if("object"==typeof e?(n=e.url,i=e.name||e.url,o=e.baseUrl||o,a=e):(i=e,n="string"==typeof t?t: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},e.prototype.use=function(t,r){return void 0===r&&(r=e.DefaultMiddlewarePriority),this._middleware.push({fn:t,priority:r}),this._middleware.sort((function(e,t){return e.priority-t.priority})),this},e.prototype.reset=function(){for(var e in this.progress=0,this.loading=!1,this._queue.reset(),this._queue.pause(),this.resources){var t=this.resources[e];t&&(t._onCompleteBinding&&t._onCompleteBinding.detach(),t.isLoading&&t.abort())}return this.resources={},this},e.prototype.load=function(e){if("function"==typeof e&&this.onComplete.once(e),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var t,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(e.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(e){this._queue.concurrency=e},enumerable:!0,configurable:!0}),e.prototype.addUrlResolver=function(e){return this._urlResolvers.push(e),this},e.prototype._prepareUrl=function(e,t){var r=h()(e,{strictMode:!0});if(this._urlResolvers.forEach((function(t){e=t(e,r),r=h()(e,{strictMode:!0})})),r.protocol||0===e.indexOf("//")||(e=t.length&&"/"!==e.charAt(0)?t+"/"+e:t+e),this.defaultQueryString){var n=L.exec(e);if(n){var i=n[0];-1!==(e=e.substr(0,e.length-i.length)).indexOf("?")?e+="&"+this.defaultQueryString:e+="?"+this.defaultQueryString,e+=i}}return e},e.prototype._loadResource=function(e,t){e._dequeue=t,e._onCompleteBinding=e.onComplete.once(this._onLoad,this),e.load()},e.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},e.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},e.prototype._onLoad=function(e){var t=this;e._onCompleteBinding=null,this._resourcesParsing.push(e),e._dequeue(),D(this._middleware,(function(r,n){r.fn.call(t,e,n)}),(function(){e.onAfterMiddleware.dispatch(e),t.progress=Math.min(100,t.progress+e.progressChunk),t.onProgress.dispatch(t,e),e.error?t.onError.dispatch(e.error,t,e):t.onLoad.dispatch(t,e),t._resourcesParsing.splice(t._resourcesParsing.indexOf(e),1),t._queue.idle()&&0===t._resourcesParsing.length&&t._onComplete()}),!0)},e.use=function(t,r){return void 0===r&&(r=e.DefaultMiddlewarePriority),e._defaultMiddleware.push({fn:t,priority:r}),e._defaultMiddleware.sort((function(e,t){return e.priority-t.priority})),e},e.DefaultMiddlewarePriority=50,e._defaultMiddleware=[],e}(),j=function(e,t){return(j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function N(e,t){function r(){this.constructor=e}j(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function B(e,t,r,n){var i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n,a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,r,o):a(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function F(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function U(e,t){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(e){return function(t){return u([e,t])}}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=t.call(e,r)}catch(e){a=[6,e],i=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function G(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function H(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(e){a={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function X(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(H(arguments[t]));return e}function z(e){return e instanceof W?e.name:e instanceof Function?e.componentName:void 0}var W=function(e){function t(t){var r=e.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=t,r}return N(t,e),t}(i.a),V=W,Y;!function(e){e.ADD="ADD",e.REMOVE="REMOVE",e.CHANGE="CHANGE"}(Y||(Y={}));var q={},K={},Q={},$={};function Z(e,t){q[e.gameObject.id]||(q[e.gameObject.id]={});var r=q[e.gameObject.id],n=e.name+"_"+t.join(",");if(r[n])return r[n];for(var i=t.length-1,o=e,a=0;a<i;a++)o=o[t[a]];return r[n]={property:o,key:t[i]},r[n]}function J(e){e.gameObject&&delete q[e.gameObject.id]}function ee(e){var t,r,n=e.systemName,i=e.componentName,o=e.component,a=e.prop,s=e.type;null===(r=null===(t=K[n])||void 0===t?void 0:t.componentObserver)||void 0===r||r.add({component:o,prop:a,type:s,componentName:i})}function te(e){var t=e.prop,r=e.component,n=e.componentName;for(var i in Q){var a,s=(Q[i]||{})[n],u;if(s)s.findIndex((function(e){return Object(o.a)(e,t)}))>-1&&ee({systemName:i,componentName:n,component:r,prop:t,type:Y.CHANGE})}}function re(e){var t,r,n=e.obj,i=e.key,o=e.prop,s=e.component,u=e.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=G(Object.keys(n[i])),c=l.next();!c.done;c=l.next()){var h=c.value;re({obj:n[i],key:h,prop:o,component:s,componentName:u})}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}Object.defineProperty(n,i,{enumerable:!0,set:function(e){n["_"+i]!==e&&(n["_"+i]=e,te({prop:o,component:s,componentName:u}))},get:function(){return n["_"+i]}})}else console.error("prop "+i+" not in component: "+u+", Can not observer")}function ne(e){return e&&e.constructor&&"componentName"in e.constructor}function ie(e){var t,r,n,i,a=[];e instanceof Array?a.push.apply(a,X(e)):a.push(e);try{for(var s=G(a),u=s.next();!u.done;u=s.next()){var l=u.value;for(var c in l.observerInfo){$[c]=$[c]||[];var h=$[c],f=function(e){var t;-1===h.findIndex((function(t){return Object(o.a)(t,e)}))&&$[c].push(e)};try{for(var d=(n=void 0,G(l.observerInfo[c])),p=d.next();!p.done;p=d.next()){var v;f(p.value)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}function oe(e,t){var r,n;if(void 0===t&&(t=e.name),t&&$[t]){if(!e||!ne(e))throw new Error("component param must be an instance of Component");if(!e.gameObject||!e.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var i=G($[t]),o=i.next();!o.done;o=i.next()){var a=o.value,s=Z(e,a.prop),u,l;re({obj:s.property,key:s.key,prop:a,component:e,componentName:t})}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}function ae(e,t){var r,n;for(var i in void 0===t&&(t=e.name),Q){var o,a;(Q[i]||{})[t]&&(null===(n=null===(r=K[i])||void 0===r?void 0:r.componentObserver)||void 0===n||n.add({component:e,type:Y.ADD,componentName:t}))}}function se(e,t){var r,n;for(var i in void 0===t&&(t=e.name),Q){var o,a;(Q[i]||{})[t]&&(null===(n=null===(r=K[i])||void 0===r?void 0:r.componentObserver)||void 0===n||n.add({component:e,type:Y.REMOVE,componentName:t}))}J(e)}function ue(e,t){Q[t.systemName]=t.observerInfo,K[t.systemName]=e}var le,ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Transform",t._parent=null,t.inScene=!1,t.children=[],t.position={x:0,y:0},t.size={width:0,height:0},t.origin={x:0,y:0},t.anchor={x:0,y:0},t.scale={x:1,y:1},t.skew={x:0,y:0},t.rotation=0,t}return N(t,e),t.prototype.init=function(e){var t,r;void 0===e&&(e={});var n=["position","size","origin","anchor","scale","skew"];try{for(var i=G(n),o=i.next();!o.done;o=i.next()){var a=o.value;Object.assign(this[a],e[a])}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.rotation=e.rotation||this.rotation},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){e?e.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),t.prototype.addChild=function(e){if(e.parent===this){var t=this.children.findIndex((function(t){return t===e}));this.children.splice(t,1)}else e.parent&&e.parent.removeChild(e);e._parent=this,this.children.push(e)},t.prototype.removeChild=function(e){var t=this.children.findIndex((function(t){return t===e}));t>-1&&(this.children.splice(t,1),e._parent=null)},t.prototype.clearChildren=function(){this.children.length=0},t.componentName="Transform",B([Object(s.b)("vector2"),Object(s.a)(1)],t.prototype,"position",void 0),B([Object(s.b)("size"),Object(s.a)(1)],t.prototype,"size",void 0),B([Object(s.b)("vector2"),Object(s.a)(.1)],t.prototype,"origin",void 0),B([Object(s.b)("vector2"),Object(s.a)(.1)],t.prototype,"anchor",void 0),B([Object(s.b)("vector2"),Object(s.a)(.1)],t.prototype,"scale",void 0),B([Object(s.b)("vector2"),Object(s.a)(.1)],t.prototype,"skew",void 0),B([Object(s.b)("number"),Object(s.a)(.1)],t.prototype,"rotation",void 0),t}(V),he=0;function fe(){return++he}var de,pe=function(){function e(e,t){this._componentCache={},this.components=[],this._name=e,this.id=fe(),this.addComponent(ce,t)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(ce)},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(e){var t,r;if(this._scene!==e){var n=this._scene;if(this._scene=e,this.transform&&this.transform.children)try{for(var i=G(this.transform.children),o=i.next();!o.done;o=i.next()){var a;o.value.gameObject.scene=e}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e?e.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,t){var r=z(e);if(!this._componentCache[r]){var n;if(e instanceof Function)n=new e(t);else{if(!(e instanceof V))throw new Error("addComponent recieve Component and Component Constructor");n=e}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),ae(n,n.name),oe(n,n.name),this.components.push(n),this._componentCache[r]=n,n.awake&&n.awake(),n}},e.prototype.removeComponent=function(e){var t;if("string"==typeof e?t=e:e instanceof V?t=e.name:e.componentName&&(t=e.componentName),"Transform"===t)throw new Error("Transform can't be removed");return this._removeComponent(t)},e.prototype._removeComponent=function(e){var t=this.components.findIndex((function(t){var r;return t.name===e}));if(-1!==t){var r=this.components.splice(t,1)[0];return delete this._componentCache[e],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),se(r,e),r.gameObject=void 0,r}},e.prototype.getComponent=function(e){var t;return"string"==typeof e?t=e:e instanceof V?t=e.name:e.componentName&&(t=e.componentName),void 0!==this._componentCache[t]?this._componentCache[t]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){if(this.transform){for(var e in Array.from(this.transform.children).forEach((function(e){var t;e.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(e);this.components.length=0}else console.error("Cannot destroy gameObject that have already been destroyed.")},e}(),ve,ye=function(){function e(){this.events=[]}return e.prototype.add=function(e){var t=e.component,r=e.prop,n=e.type,i=e.componentName;if(n===Y.REMOVE){if(this.events.find((function(e){return e.component===t&&e.type===Y.ADD})))return void(this.events=this.events.filter((function(e){return e.component!==t})));this.events=this.events.filter((function(e){return e.component!==t}))}var a=this.events.findIndex((function(e){return e.component===t&&Object(o.a)(e.prop,r)&&e.type===n}));a>-1&&this.events.splice(a,1),this.events.push({gameObject:t.gameObject,component:t,prop:r,type:n,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 e=this.events;return this.events=[],e},e}(),me,ge=function(){function e(e){this.started=!1,this.componentObserver=new ye,this.__systemDefaultParams=e,this.name=this.constructor.systemName}return e.prototype.destroy=function(){var e;this.componentObserver=null,this.__systemDefaultParams=null,null===(e=this.onDestroy)||void 0===e||e.call(this)},e}();function _e(){var e=null;return e=Date.now?Date.now:function(){return(new Date).getTime()}}var be=_e(),xe={originTime:0,playbackRate:1},Ee,Te=function(){function e(t,r){t instanceof e&&(r=t,t={}),t=Object.assign({},xe,t),r&&(this._parent=r),this._createTime=be(),this._timeMark=[{globalTime:this.globalTime,localTime:-t.originTime,entropy:-t.originTime,playbackRate:t.playbackRate,globalEntropy:0}],this._parent&&(this._timeMark[0].globalEntropy=this._parent.entropy),this._playbackRate=t.playbackRate}return Object.defineProperty(e.prototype,"globalTime",{get:function(){return this.parent?this.parent.currentTime:be()-this._createTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastTimeMark",{get:function(){return this._timeMark[this._timeMark.length-1]},enumerable:!1,configurable:!0}),e.prototype.markTime=function(e){var t=void 0===e?{}:e,r=t.time,n=void 0===r?this.currentTime:r,i=t.entropy,o=void 0===i?this.entropy:i,a=t.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(e.prototype,"currentTime",{get:function(){var e=this.lastTimeMark,t=e.localTime,r=e.globalTime;return t+(this.globalTime-r)*this.playbackRate},set:function(e){this.markTime({time:e})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalEntropy",{get:function(){return this._parent?this._parent.entropy:this.globalTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entropy",{get:function(){var e=this.lastTimeMark,t=e.entropy,r=e.globalEntropy;return t+Math.abs((this.globalEntropy-r)*this.playbackRate)},set:function(e){if(this.entropy>e){var t=this.seekTimeMark(e);this._timeMark.length=t+1}this.markTime({entropy:e})},enumerable:!1,configurable:!0}),e.prototype.fork=function(t){return new e(t,this)},e.prototype.seekGlobalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],n=r.entropy,i=r.playbackRate,o;return r.globalTime+(e-n)/Math.abs(i)},e.prototype.seekLocalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],n=r.localTime,i=r.entropy,o;return r.playbackRate>0?n+(e-i):n-(e-i)},e.prototype.seekTimeMark=function(e){var t=this._timeMark,r=0,n=t.length-1;if(e<=t[r].entropy)return r;if(e>=t[n].entropy)return n;for(var i=Math.floor((r+n)/2);i>r&&i<n;){if(e===t[i].entropy)return i;e<t[i].entropy?n=i:e>t[i].entropy&&(r=i),i=Math.floor((r+n)/2)}return r},Object.defineProperty(e.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){e!==this.playbackRate&&(this.markTime({playbackRate:e}),this._playbackRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){if(0===this.playbackRate)return!0;for(var e=this.parent;e;){if(0===e.playbackRate)return!0;e=e.parent}return!1},enumerable:!1,configurable:!0}),e}(),we={autoStart:!0,frameRate:60},Se,Oe=function(){function e(e){var t=this;e=Object.assign({},we,e),this._frameCount=0,this._frameDuration=1e3/e.frameRate,this.autoStart=e.autoStart,this.frameRate=e.frameRate,this.timeline=new Te({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=function(){t._started&&(t._requestId=requestAnimationFrame(t._ticker),t.update())},this.autoStart&&this.start()}return e.prototype.update=function(){var e,t,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=G(this._tickers),u=s.next();!u.done;u=s.next()){var l=u.value;"function"==typeof l&&l(a)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}}},e.prototype.add=function(e){this._tickers.add(e)},e.prototype.remove=function(e){this._tickers.delete(e)},e.prototype.start=function(){this._started||(this._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))},e.prototype.pause=function(){this._started=!1,this.timeline.playbackRate=0},e.prototype.setPlaybackRate=function(e){this.timeline.playbackRate=e},e}(),Pe,Ce=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.gameObjects=[],n.scene=n,n}return N(t,e),t.prototype.addGameObject=function(e){this.gameObjects.push(e),e.transform&&(e.transform.inScene=!0)},t.prototype.removeGameObject=function(e){var t=this.gameObjects.indexOf(e);-1!==t&&(e.transform&&(e.transform.inScene=!1),this.gameObjects.splice(t,1))},t.prototype.destroy=function(){this.scene=null,e.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},t}(pe),Re;!function(e){e.SINGLE="SINGLE",e.MULTI_CANVAS="MULTI_CANVAS"}(Re||(Re={}));var Me=function(e){if((e instanceof ge||e instanceof V)&&!e.started){e.started=!0;try{e.start&&e.start()}catch(t){e instanceof V?console.error(e.constructor.componentName+" start error",t):console.error(e.constructor.systemName+" start error",t)}}},Ae=function(e){var t,r,n,i=(null===(n=null==e?void 0:e.scene)||void 0===n?void 0:n.gameObjects)||[],o=null==e?void 0:e.multiScenes.map((function(e){var t;return e.gameObjects})),a=[];try{for(var s=G(o),u=s.next();!u.done;u=s.next()){var l;a=X(a,u.value)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return X(i,a)},De=function(e,t){var r,n,i,o,a,s,u,l;void 0===t&&(t=[]);try{for(var c=G(t),h=c.next();!h.done;h=c.next()){var f=h.value;try{for(var d=(i=void 0,G(f.components)),p=d.next();!p.done;p=d.next()){var v=p.value;try{Me(v),v.update&&v.update(e)}catch(e){console.error("gameObject: "+f.name+" "+v.name+" update error",e)}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}try{for(var y=G(t),m=y.next();!m.done;m=y.next()){var f=m.value;try{for(var g=(u=void 0,G(f.components)),_=g.next();!_.done;_=g.next()){var v=_.value;try{v.lateUpdate&&v.lateUpdate(e)}catch(e){console.error("gameObject: "+f.name+" "+v.name+" lateUpdate error",e)}}}catch(e){u={error:e}}finally{try{_&&!_.done&&(l=g.return)&&l.call(g)}finally{if(u)throw u.error}}}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}},Ie=function(e){var t,r,n,i;try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{for(var u=(n=void 0,G(s.components)),l=u.next();!l.done;l=u.next()){var c=l.value;try{c.onResume&&c.onResume()}catch(e){console.error("gameObject: "+s.name+", "+c.name+", onResume error",e)}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},Le=function(e){var t,r,n,i;try{for(var o=G(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{for(var u=(n=void 0,G(s.components)),l=u.next();!l.done;l=u.next()){var c=l.value;try{c.onPause&&c.onPause()}catch(e){console.error("gameObject: "+s.name+", "+c.name+", onResume error",e)}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},ke,je=function(e){function t(t){var r,n,i=void 0===t?{}:t,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=e.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 Oe({autoStart:!1,frameRate:s}),f.initTicker(),o&&o.length)try{for(var d=G(o),p=d.next();!p.done;p=d.next()){var v=p.value;f.addSystem(v)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return h&&f.loadScene(new Ce("scene")),l&&f.start(),f}return N(t,e),Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},set:function(e){this._scene=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gameObjects",{get:function(){return Ae(this)},enumerable:!1,configurable:!0}),t.prototype.addSystem=function(e,t){var r,n;if(e instanceof Function)r=new e(t);else{if(!(e instanceof ge))return void console.warn("can only add System");r=e}if(!this.systems.find((function(e){return e.constructor===r.constructor}))){r.game=this,r.init&&r.init(r.__systemDefaultParams),ue(r,r.constructor),ie(r.constructor);try{r.awake&&r.awake()}catch(e){console.error(r.constructor.systemName+" awake error",e)}return this.systems.push(r),r}console.warn(r.constructor.systemName+" System has been added")},t.prototype.removeSystem=function(e){if(e){var t=-1;"string"==typeof e?t=this.systems.findIndex((function(t){return t.name===e})):e instanceof Function?t=this.systems.findIndex((function(t){return t.constructor===e})):e instanceof ge&&(t=this.systems.findIndex((function(t){return t===e}))),t>-1&&(this.systems[t].destroy&&this.systems[t].destroy(),this.systems.splice(t,1))}},t.prototype.getSystem=function(e){return this.systems.find((function(t){return"string"==typeof e?t.name===e:t instanceof e}))},t.prototype.pause=function(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},t.prototype.start=function(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())},t.prototype.resume=function(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())},t.prototype.initTicker=function(){var e=this;this.ticker.add((function(t){var r,n,i,o;e.scene&&De(t,e.gameObjects);try{for(var a=G(e.systems),s=a.next();!s.done;s=a.next()){var u=s.value;try{Me(u),u.update&&u.update(t)}catch(t){console.error(u.constructor.systemName+" update error",t)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}try{for(var l=G(e.systems),c=l.next();!c.done;c=l.next()){var u=c.value;try{u.lateUpdate&&u.lateUpdate(t)}catch(t){console.error(u.constructor.systemName+" lateUpdate error",t)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}}))},t.prototype.triggerResume=function(){var e,t;Ie(this.gameObjects);try{for(var r=G(this.systems),n=r.next();!n.done;n=r.next()){var i=n.value;try{i.onResume&&i.onResume()}catch(e){console.error(i.constructor.systemName+", onResume error",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.triggerPause=function(){var e,t;Le(this.gameObjects);try{for(var r=G(this.systems),n=r.next();!n.done;n=r.next()){var i=n.value;try{i.onPause&&i.onPause()}catch(e){console.error(i.constructor.systemName+", onPause error",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype.destroySystems=function(){var e,t;try{for(var r=G(X(this.systems)),n=r.next();!n.done;n=r.next()){var i=n.value;this.removeSystem(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.systems.length=0},t.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},t.prototype.loadScene=function(e){var t=e.scene,r=e.mode,n=void 0===r?Re.SINGLE:r,i=e.params,o=void 0===i?{}:i;if(t){switch(n){case Re.SINGLE:this.scene=t;break;case Re.MULTI_CANVAS:this.multiScenes.push(t)}this.emit("sceneChanged",{scene:t,mode:n,params:o})}},t}(i.a);function Ne(e,t){e.constructor.IDEProps||(e.constructor.IDEProps=[]),e.constructor.IDEProps.push(t)}function Be(e){return void 0===e&&(e={}),function(t){if(!t.observerInfo){for(var r in e)for(var n in e[r]){"string"==typeof e[r][n]&&(e[r][n]=[e[r][n]]);var i=void 0;Array.isArray(e[r][n])&&(i={prop:e[r][n],deep:!1},e[r][n]=i),"string"==typeof(i=e[r][n]).prop&&(i.prop=[i.prop])}t.observerInfo=e}}}var Fe,Ue=function(e){function t(t){var r=t.resource,n=t.resourceTotal,i=e.call(this)||this;return i.progress=0,i.resourceTotal=0,i.resourceLoadedCount=0,i.resource=r,i.resourceTotal=n,0===n&&i.resource.emit(He.COMPLETE,i),i}return N(t,e),t.prototype.onStart=function(){this.resource.emit(He.START,this)},t.prototype.onProgress=function(e){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,e.success?this.resource.emit(He.LOADED,this,e):this.resource.emit(He.ERROR,this,e),this.resource.emit(He.PROGRESS,this,e),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(He.COMPLETE,this)},t}(i.a),Ge={AbstractLoadStrategy:f,AudioLoadStrategy:x,ImageLoadStrategy:T,XhrResponseType:O,MediaElementLoadStrategy:b,VideoLoadStrategy:w,XhrLoadStrategy:C,Loader:k,Resource:A,ResourceType:p,ResourceState:v},He,Xe;!function(e){e.START="start",e.PROGRESS="progress",e.LOADED="loaded",e.COMPLETE="complete",e.ERROR="error"}(He||(He={})),function(e){e.IMAGE="IMAGE",e.SPRITE="SPRITE",e.SPRITE_ANIMATION="SPRITE_ANIMATION",e.AUDIO="AUDIO",e.VIDEO="VIDEO"}(Xe||(Xe={})),C.setExtensionXhrType("json",O.Json),C.setExtensionXhrType("tex",O.Json),C.setExtensionXhrType("ske",O.Json),C.setExtensionXhrType("mp3",O.Buffer),C.setExtensionXhrType("wav",O.Buffer),C.setExtensionXhrType("aac",O.Buffer),C.setExtensionXhrType("ogg",O.Buffer);var ze={png:T,jpg:T,jpeg:T,webp:T,json:C,tex:C,ske:C,audio:C,video:w},We,Ve=new(function(e){function t(t){var r=e.call(this)||this;return r.timeout=6e3,r.preProcessResourceHandlers=[],r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],t&&"number"==typeof t.timeout&&(r.timeout=t.timeout),r}return N(t,e),t.prototype.loadConfig=function(e){this.addResource(e),this.preload()},t.prototype.loadSingle=function(e){return this.addResource([e]),this.getResource(e.name)},t.prototype.addResource=function(e){var t,r;if(!e||e.length<1)console.warn("no resources");else try{for(var n=G(e),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(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},t.prototype.addPreProcessResourceHandler=function(e){this.preProcessResourceHandlers.push(e)},t.prototype.removePreProcessResourceHandler=function(e){this.preProcessResourceHandlers.splice(this.preProcessResourceHandlers.indexOf(e),1)},t.prototype.preload=function(){var e=[];for(var t in this.resourcesMap){var r=this.resourcesMap[t];!r.preload||r.complete||this.promiseMap[t]||e.push(r.name)}this.progress=new Ue({resource:this,resourceTotal:e.length}),this.loadResource({names:e,preload:!0})},t.prototype.getResource=function(e){return F(this,void 0,void 0,(function(){return U(this,(function(t){return this.loadResource({names:[e]}),[2,this.promiseMap[e]||Promise.resolve({})]}))}))},t.prototype.instance=function(e){return F(this,void 0,void 0,(function(){var t,r;return U(this,(function(n){switch(n.label){case 0:return t=this.resourcesMap[e],(r=this.makeInstanceFunctions[t.type])?[4,this.makeInstanceFunctions[t.type](t)]:[3,2];case 1:r=n.sent(),n.label=2;case 2:return[2,r]}}))}))},t.prototype.destroy=function(e){return F(this,void 0,void 0,(function(){return U(this,(function(t){switch(t.label){case 0:return[4,this._destroy(e)];case 1:return t.sent(),[2]}}))}))},t.prototype._destroy=function(e,t){return void 0===t&&(t=!1),F(this,void 0,void 0,(function(){var r,n;return U(this,(function(i){switch(i.label){case 0:if(!(r=this.resourcesMap[e]))return[2];if(