Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eva/eva.js

Package Overview
Dependencies
Maintainers
2
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eva/eva.js - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-alpha.1

2

dist/eva.js.cjs.prod.js

@@ -1,1 +0,1 @@

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

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc