var t="2.0.66",e=Math.PI,r=e>>1,i=e+r;function n(t){switch(t){case r:case-i:case i:case-r:return 0;case e:case-e:return-1;default:return Math.cos(t)}}function o(t){switch(t){case r:case-i:return 1;case e:case-e:return 0;case i:case-r:return-1;default:return Math.sin(t)}}var a,s,h,u,l,c,p,d,f,v,m,y,g,x,_,b=2*e,T=180/e,w=e/180;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(a||(a={})),function(t){t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC"}(s||(s={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(h||(h={})),function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(u||(u={})),function(t){t.CENTER="center",t.LEFT="left",t.RIGHT="right"}(l||(l={})),function(t){t.MIDDLE="middle",t.UP="up",t.DOWN="down",t.TOP="top",t.BOTTOM="bottom"}(c||(c={})),function(t){t.SINGLE="single",t.MULTI="multi"}(p||(p={})),function(t){t[t.middle=.5]="middle",t[t.outter=1]="outter",t[t.inner=0]="inner"}(d||(d={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(f||(f={})),function(t){t.MITER="miter",t.ROUND="round",t.BEVEL="bevel"}(v||(v={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=21]="SRC_OVER",t[t.SRC_IN=22]="SRC_IN",t[t.SRC_OUT=23]="SRC_OUT",t[t.SRC_ATOP=24]="SRC_ATOP",t[t.DST_OVER=25]="DST_OVER",t[t.DST_IN=26]="DST_IN",t[t.DST_OUT=27]="DST_OUT",t[t.DST_ATOP=28]="DST_ATOP",t[t.ERASE=29]="ERASE",t[t.SUBTRACT=30]="SUBTRACT"}(m||(m={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(y||(y={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.NEAREST=1]="NEAREST"}(g||(g={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(x||(x={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(_||(_={}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var M=function(t,e){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},M(t,e)};function S(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}M(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var E=function(){return E=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},E.apply(this,arguments)};function C(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))}function A(t,e){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function P(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,n++)i[n]=o[a];return i}var O,R=function(){function t(){this._instanceId=0,this._instanceType="HashObject",this._instanceId=t._object_id++}return Object.defineProperty(t.prototype,"instanceId",{get:function(){return this._instanceId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instanceType",{get:function(){return this._instanceType},enumerable:!1,configurable:!0}),t._object_id=0,t}(),I=function(t){function e(e){var r=t.call(this)||this;return r.type="",r.target=null,r.data=null,r._pd=!1,r._instanceType="Event",r.type=e,r}return S(e,t),e.prototype.stopPropagation=function(){this._pd=!0},e.prototype.destroy=function(){this.target=null,this.data=null},e.prototype.reset=function(t,e){var r=this;r.target=e,r._pd=!1,r.type=t,r.data=null},e.RESIZE="onResize",e.SCROLL_TO_HEAD="onScrollToHead",e.SCROLL_STOP="onScrollStop",e.SCROLL_START="onScrollStart",e.SCROLL_TO_END="onScrollToEnd",e.SCROLLING="onScrolling",e.INIT_STAGE="onInitStage",e.ADDED_TO_STAGE="onAddedToStage",e.REMOVED_FROM_STAGE="onRemovedFromStage",e.ENTER_FRAME="onEnterFrame",e.END_FRAME="onEndFrame",e.COMPLETE="onComplete",e.PROGRESS="onProgress",e.ERROR="onError",e.BLUR="onBlur",e.FOCUS="onFocus",e.INPUT="onInput",e}(R),D=function(t){function e(){var e=t.call(this)||this;return e.eventTypes={},e.eventTypes1={},e._instanceType="EventDispatcher",e}return S(e,t),e.getMouseEventCount=function(t){void 0===t&&(t="");var r=0;if(""==t)for(var i in e._MECO)0==i.indexOf("onMouse")&&(r+=e._MECO[i]);else e._MECO[t]&&(r=e._MECO[t]);return r},e.prototype.addEventListener=function(t,e,r,i){if(void 0===i&&(i=!0),!t)throw new Error("type should not be empty");if(!e)throw new Error("listener should not be empty");var n=this,o=n.eventTypes;i||(o=n.eventTypes1),o[t]||(o[t]=[]);for(var a=0,s=o[t].length;a<s;a++){var h=o[t][a];if(h.fn===e&&h.context===r)return console.warn("Same listener and context has been added before"),n}return o[t].unshift(new F(e,r||n)),0==t.indexOf("onMouse")&&n._changeMouseCount(t,!0),n},e.prototype.once=function(t,e,r,i){if(void 0===i&&(i=!0),!t)throw new Error("type should not be empty");if(!e)throw new Error("listener should not be empty");var n=this,o=n.eventTypes;return i||(o=n.eventTypes1),o[t]||(o[t]=[]),o[t].unshift(new F(e,r||n,!0)),0==t.indexOf("onMouse")&&n._changeMouseCount(t,!0),n},e.prototype._changeMouseCount=function(t,r){var i=r?1:-1;e._MECO[t]||(e._MECO[t]=0),e._MECO[t]+=i,e._MECO[t]<0&&(e._MECO[t]=0),e._totalMEC+=i},e.prototype.dispatchEvent=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=!0);var i=this;"string"==typeof t&&(i._defaultEvent?i._defaultEvent.reset(t,i):i._defaultEvent=new I(t),t=i._defaultEvent);var n=i.eventTypes[t.type];if(r||(n=i.eventTypes1[t.type]),n){var o=n.length;null==t.target&&(t.target=i),null!=e&&(t.data=e);for(var a=o-1;a>=0;a--)if(!t._pd)if(n[a]){var s=n[a],h=t.type;s.fn.call(s.context,t),s.once&&i.removeEventListener(h,s.fn,s.context,r)}else n.splice(a,1);return!0}return!1},e.prototype.hasEventListener=function(t,e){void 0===e&&(e=!0);var r=this;if(e){if(r.eventTypes[t]&&r.eventTypes[t].length>0)return!0}else if(r.eventTypes1[t]&&r.eventTypes1[t].length>0)return!0;return!1},e.prototype.removeAllEventListenerByType=function(t,e){void 0===e&&(e=!0);var r=this;if(e){if(r.eventTypes[t]&&r.eventTypes[t].length>0){if(0==t.indexOf("onMouse"))for(var i=0;i<r.eventTypes[t].length;i++)r._changeMouseCount(t,!1);r.eventTypes[t]=[]}}else if(r.eventTypes1[t]&&r.eventTypes1[t].length>0){if(0==t.indexOf("onMouse"))for(i=0;i<r.eventTypes1[t].length;i++)r._changeMouseCount(t,!1);r.eventTypes1[t]=[]}return r},e.prototype.removeEventListener=function(t,e,r,i){void 0===i&&(i=!0);var n=this,o=n.eventTypes[t];if(i||(o=n.eventTypes1[t]),o)for(var a=r||n,s=o.length-1;s>=0;s--)o[s].fn===e&&o[s].context===a&&(o.splice(s,1),0==t.indexOf("onMouse")&&n._changeMouseCount(t,!1));return n},e.prototype.removeAllEventListener=function(){var t=this;for(var e in t.eventTypes)if(0==e.indexOf("onMouse"))for(var r=0;r<t.eventTypes[e].length;r++)t._changeMouseCount(e,!1);for(var e in t.eventTypes1)if(0==e.indexOf("onMouse"))for(r=0;r<t.eventTypes1[e].length;r++)t._changeMouseCount(e,!1);t.eventTypes1={},t.eventTypes={}},e.prototype.destroy=function(){var t=this;t.removeAllEventListener(),t.eventTypes=null,t.eventTypes1=null},e._MECO={},e._totalMEC=0,e}(R),F=function(t,e,r){void 0===r&&(r=!1),this.fn=t,this.context=e,this.once=r},N=function(t){function e(e,r){void 0===e&&(e=0),void 0===r&&(r=0);var i=t.call(this)||this;i.x=0,i.y=0;var n=i;return n._instanceType="Point",n.x=e,n.y=r,i}return S(e,t),e.prototype.destroy=function(){},e.distance=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.length;return 4==r?Math.sqrt((t[0]-t[2])*(t[0]-t[2])+(t[1]-t[3])*(t[1]-t[3])):2==r?Math.sqrt((t[0].x-t[1].x)*(t[0].x-t[1].x)+(t[0].y-t[1].y)*(t[0].y-t[1].y)):void 0},e.prototype.set=function(t,e){this.x=t,this.y=e},e.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},e}(R),k=function(t){function e(e,r,i,n,o,a){void 0===e&&(e=1),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0);var s=t.call(this)||this;s.a=1,s.b=0,s.c=0,s.d=1,s.tx=0,s.ty=0,s.array=null,s.prepend=function(t){var e=this,r=t.a,i=t.b,n=t.c,o=t.d,a=t.tx,s=t.ty,h=e.a,u=e.c,l=e.tx;return e.a=r*h+n*e.b,e.b=i*h+o*e.b,e.c=r*u+n*e.d,e.d=i*u+o*e.d,e.tx=r*l+n*e.ty+a,e.ty=i*l+o*e.ty+s,this};var h=s;return h._instanceType="Matrix",h.a=e,h.b=r,h.c=i,h.d=n,h.tx=o,h.ty=a,s}return S(e,t),e.prototype.clone=function(){var t=this;return new e(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.prototype.copy=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},e.prototype.transformPoint=function(t,e,r){void 0===r&&(r=null);var i=this;return r||(r=new N),r.x=t*i.a+e*i.c+i.tx,r.y=t*i.b+e*i.d+i.ty,r},e.prototype.transformPointInverse=function(t,e,r){void 0===r&&(r=null),r||(r=new N);var i=1/(this.a*this.d+this.c*-this.b);return r.x=this.d*i*t+-this.c*i*e+(this.ty*this.c-this.tx*this.d)*i,r.y=this.a*i*e+-this.b*i*t+(-this.ty*this.a+this.tx*this.b)*i,r},e.prototype.setFrom=function(t){var e=this;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.tx=t.tx,e.ty=t.ty},e.prototype.identity=function(){var t=this;t.a=t.d=1,t.b=t.c=t.tx=t.ty=0},e.prototype.invert=function(){var t=this,e=t.a,r=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty;if(0==r&&0==i)return 0==e||0==n?t.a=t.d=t.tx=t.ty=0:(e=t.a=1/e,n=t.d=1/n,t.tx=-e*o,t.ty=-n*a),t;var s=e*n-r*i;if(0==s)return t.identity(),t;s=1/s;var h=t.a=n*s;return r=t.b=-r*s,i=t.c=-i*s,n=t.d=e*s,t.tx=-(h*o+i*a),t.ty=-(r*o+n*a),t},e.prototype.createBox=function(t,e,r,i,a,s,h,u,l){var c=this;if(0!=a?s=h=a%360:(s%=360,h%=360),0==s&&0==h)c.a=r,c.b=c.c=0,c.d=i;else{h*=w;var p=n(s*=w),d=o(s);s==h?(c.a=p*r,c.b=d*r):(c.a=n(h)*r,c.b=o(h)*r),c.c=-d*i,c.d=p*i}c.tx=t+u-(u*c.a+l*c.c),c.ty=e+l-(u*c.b+l*c.d)},e.prototype.append=function(t){var e=this.a,r=this.b,i=this.c,n=this.d;this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty},e.isEqual=function(t,e){return t.tx==e.tx&&t.ty==e.ty&&t.a==e.a&&t.b==e.b&&t.c==e.c&&t.d==e.d},e.prototype.concat=function(t){var e=this,r=e.a,i=e.b,n=e.c,o=e.d,a=e.tx,s=e.ty,h=t.a,u=t.b,l=t.c,c=t.d,p=t.tx,d=t.ty;e.a=r*h+i*l,e.b=r*u+i*c,e.c=n*h+o*l,e.d=n*u+o*c,e.tx=a*h+s*l+p,e.ty=a*u+s*c+d},e.prototype.rotate=function(t){var e=this,r=Math.sin(t),i=Math.cos(t),n=e.a,o=e.b,a=e.c,s=e.d,h=e.tx,u=e.ty;e.a=n*i-o*r,e.b=n*r+o*i,e.c=a*i-s*r,e.d=a*r+s*i,e.tx=h*i-u*r,e.ty=h*r+u*i},e.prototype.scale=function(t,e){var r=this;r.a*=t,r.d*=e,r.c*=t,r.b*=e,r.tx*=t,r.ty*=e},e.prototype.translate=function(t,e){this.tx+=t,this.ty+=e},e.prototype.set=function(t,e,r,i,n,o){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o,this},e.prototype.getRotation=function(){return Math.round(Math.atan2(this.b,this.a)*T)},e.prototype.toArray=function(t,e){void 0===t&&(t=!1),this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r},e.prototype.decompose=function(t){var e=this.a,r=this.b,i=this.c,n=this.d,o=-Math.atan2(-i,n),a=Math.atan2(r,e),s=Math.abs(o+a);return s<1e-5||Math.abs(b-s)<1e-5?(t.rotation=a,e<0&&n>=0&&(t.rotation+=t.rotation<=0?Math.PI:-Math.PI),t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx,t.position.y=this.ty,t},Object.defineProperty(e,"IDENTITY",{get:function(){return new e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"TEMP_MATRIX",{get:function(){return new e},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){},e}(R),L=function(t){function e(e,r,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var o=t.call(this)||this;return o._instanceType="ObservablePoint",o._x=i,o._y=n,o.cb=e,o.scope=r,o}return S(e,t),e.prototype.set=function(t,e){var r=t||0,i=e||0;this._x===r&&this._y===i||(this._x=r,this._y=i,this.cb.call(this.scope))},e.prototype.copy=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){},e}(R),B=function(t){function e(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0);var o=t.call(this)||this;o.x=0,o.y=0,o.width=0,o.height=0;var a=o;return a._instanceType="Rectangle",a.x=e,a.y=r,a.height=n,a.width=i,o.type=s.RECT,o}return S(e,t),e.prototype.clear=function(){this.x=0,this.y=0,this.width=0,this.height=0},e.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},Object.defineProperty(e.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),e.prototype.isPointIn=function(t){var e=this;return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height},e.prototype.fit=function(t){var e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(n-i,0)},e.prototype.pad=function(t,e){t=t||0,e=e||(0!==e?t:0),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e},e.createFromRects=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0==t.length)return null;if(1==t.length)return t[0];for(var r=t[0],i=r.x,n=r.y,o=r.width,a=r.height,s=void 0,h=void 0,u=void 0,l=void 0,c=1;c<t.length;c++)(t[c].width||t[c].height)&&(s=i+o,u=n+a,h=t[c].x+t[c].width,l=t[c].y+t[c].height,(i>t[c].x||0==i&&0==o)&&(i=t[c].x),(n>t[c].y||0==n&&0==a)&&(n=t[c].y),s<h&&(s=h),u<l&&(u=l),r.x=i,r.y=n,r.width=s-i,r.height=u-n);return r},e.createFromPoints=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var i=e[0].x,n=e[0].y,o=e[0].x,a=e[0].y,s=1;s<e.length;s++)null!=e[s]&&(i>e[s].x&&(i=e[s].x),n>e[s].y&&(n=e[s].y),o<e[s].x&&(o=e[s].x),a<e[s].y&&(a=e[s].y));return t.x=i,t.y=n,t.width=o-i,t.height=a-n,t},e.createFromVertexData=function(t,e,r){var i=new N,n=e[0],o=e[1],a=e[0],s=e[1];r&&(r.transformPoint(n,o,i),n=a=i.x,o=s=i.y);for(var h=2;h<e.length;h+=2)null!=e[h]&&(i.set(e[h],e[h+1]),r&&r.transformPoint(i.x,i.y,i),n>i.x&&(n=i.x),o>i.y&&(o=i.y),a<i.x&&(a=i.x),s<i.y&&(s=i.y));return t.x=n,t.y=o,t.width=a-n,t.height=s-o,t},e.createRectfrom2Point=function(t,e,r){var i=e.x,n=e.y,o=e.x,a=e.y;return i>r.x&&(i=r.x),n>r.y&&(n=r.y),o<r.x&&(o=r.x),a<r.y&&(a=r.y),t.x=i,t.y=n,t.width=o-i,t.height=a-n,t},e.testRectCross=function(t,e){var r,i,n,o;return r=t.x+t.width/2,i=t.y+t.height/2,n=e.x+e.width/2,o=e.y+e.height/2,Math.abs(r-n)<=t.width/2+e.width/2&&Math.abs(i-o)<=t.height/2+e.height/2},e.prototype.destroy=function(){},e}(R),z=function(t){function e(){var e=t.call(this)||this;return e._instanceType="Transform",e.worldMatrix=new k,e.localMatrix=new k,e._worldID=0,e._parentID=0,e.position=new L(e.onChange,e,0,0),e.scale=new L(e.onChange,e,1,1),e.anchor=new L(e.onChange,e,0,0),e.skew=new L(e.updateSkew,e,0,0),e._rotation=0,e._cx=1,e._sx=0,e._cy=0,e._sy=1,e._localID=0,e._currentLocalID=0,e}return S(e,t),e.prototype.onChange=function(){this._localID++},e.prototype.updateSkew=function(){this._cx=n(this._rotation+this.skew._y),this._sx=o(this._rotation+this.skew._y),this._cy=-o(this._rotation-this.skew._x),this._sy=n(this._rotation-this.skew._x),this._localID++},e.prototype.updateLocalMatrix=function(){var t=this.localMatrix;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale._x,t.b=this._sx*this.scale._x,t.c=this._cy*this.scale._y,t.d=this._sy*this.scale._y,t.tx=this.position._x+this.anchor._x-(this.anchor._x*t.a+this.anchor._y*t.c),t.ty=this.position._y+this.anchor._y-(this.anchor._x*t.b+this.anchor._y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},e.prototype.updateWorldMatrix=function(t){var e=this.localMatrix;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale._x,e.b=this._sx*this.scale._x,e.c=this._cy*this.scale._y,e.d=this._sy*this.scale._y,e.tx=this.position._x+this.anchor._x-(this.anchor._x*e.a+this.anchor._y*e.c),e.ty=this.position._y+this.anchor._y-(this.anchor._x*e.b+this.anchor._y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var r=t.worldMatrix,i=this.worldMatrix;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._worldID++}},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(t){t!==this._rotation&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){this.worldMatrix=null,this.localMatrix=null,this.position=null,this.skew=null,this.scale=null,this.anchor=null},e}(R);!function(t){t.tb="tb",t.web="web",t.tt="tt",t.wx="wx"}(O||(O={}));var U,j,V,X,W=O.web;function H(){return W}function Y(t){W=t}function G(){return"tb"==H()?function(){var t=my;if(!t)return null;if(t.createOffscreenCanvas)return t.createOffscreenCanvas()||t.createOffscreenCanvas(3,3);return t._createOffscreenCanvas()||t._createOffscreenCanvas(3,3)}():document.createElement("canvas")}function q(t){U=t,Y(O.tb)}function Z(t){console.warn("Function initedByCanvas will be abandoned soon,use function initedByTbCanvas instead"),q(t)}function K(){U=null}function Q(){console.warn("Function destroyCanvasContent will be abandoned soon,use function destroyTbCanvas instead"),K()}function J(){return"tb"!=H()?new Image:U?U.createImage():void console.warn("TbMini inited canvas does not exist")}function $(t){return"tb"!=H()?$(t):U?U.requestAnimationFrame(t):void console.warn("TbMini inited canvas does not exist")}function tt(t){if("tb"==H()){if(U)return void U.cancelAnimationFrame(t);console.warn("TbMini inited canvas does not exist")}else tt(t)}function et(){if("tb"==H()||"tt"==H()||"wx"==H())return!0;if(void 0!==j)return j;var t={stencil:!0,failIfMajorPerformanceCaveat:!0};try{if(!window.WebGLRenderingContext)return!1;var e=G(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!(!r||!r.getContextAttributes().stencil);if(r){var n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,j=i}catch(t){return j=!1}}function rt(){return V||(("tb"==H()||!(V=navigator&&navigator.userAgent&&(t=navigator.userAgent.toLocaleLowerCase(),/android/.test(t)?"android":/iphone|ipod|ipad/.test(t)?"ios":"pc")||null)&&my)&&(V=my.getSystemInfoSync().platform.toLowerCase()),V);var t}function it(){return X||(("tb"==H()||!(X=window&&(window.devicePixelRatio||1))&&my)&&(X=my.getSystemInfoSync().pixelRatio),X)}window&&(window.my=null);var nt=32,ot=2147483647,at=-1<<31;function st(t){var e=t>>31;return(t^e)-e}function ht(t,e){return e^(t^e)&-(t<e)}function ut(t,e){return t^(t^e)&-(t<e)}function lt(t){return!(t&t-1||!t)}function ct(t){var e,r;return t>>>=e=Number(t>65535)<<4,t>>>=r=Number(t>255)<<3,e|=r,t>>>=r=Number(t>15)<<2,e|=r,(e|=r=Number(t>3)<<1)|(t>>>=r)>>1}function pt(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0}function dt(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function ft(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function vt(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function mt(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)}function yt(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1}var gt=new Array(256);function xt(t){return gt[255&t]<<24|gt[t>>>8&255]<<16|gt[t>>>16&255]<<8|gt[t>>>24&255]}function _t(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bt(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16}function Tt(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2}function wt(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22}function Mt(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>ft(t)+1}!function(t){for(var e=0;e<256;++e){var r=e,i=e,n=7;for(r>>>=1;r;r>>>=1)i<<=1,i|=1&r,--n;t[e]=i<<n&255}}(gt);var St,Et=0;function Ct(){return++Et}function At(){if(!St){var t=G();t.width=1,t.height=1,St=t.getContext("2d")}return St}function Pt(t,e){var r,i=At();r=4==t.length?i.createLinearGradient(t[0],t[1],t[2],t[3]):i.createRadialGradient(t[0],t[1],t[2],t[3],t[4],t[5]);for(var n=0,o=e.length;n<o;n++)r.addColorStop(e[n][0],Nt(e[n][1],e[n][2]));return r}function Ot(t){return At().createPattern(t,"repeat")}function Rt(t,e){return(e=e||[])[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function It(t){return t=t.toString(16),"#"+(t="000000".substr(0,6-t.length)+t)}function Dt(t){return 0==t.indexOf("#")&&(t=t.replace("#","0x")),parseInt(t)}function Ft(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}function Nt(t,e){if(0==t.indexOf("0x")&&(t=t.replace("0x","#")),t.length<7&&(t="#000000"),1!=e){var r=parseInt("0x"+t.substr(1,2)),i=parseInt("0x"+t.substr(3,2)),n=parseInt("0x"+t.substr(5,2));t="rgba("+r+","+i+","+n+","+e+")"}return t}function kt(t){return 0===t?0:t<0?-1:1}function Lt(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var r=t>>16&255,i=t>>8&255,n=255&t;return(255*e<<24)+((r=r*e+.5|0)<<16)+((i=i*e+.5|0)<<8)+(n=n*e+.5|0)}var Bt=Object.create(null),zt=Object.create(null);function Ut(){var t;for(t in Bt)Bt[t].destroy();for(t in zt)zt[t].destroy()}function jt(){var t;for(t in Bt)delete Bt[t];for(t in zt)delete zt[t]}function Vt(t,e,r){var i,n=t.length;if(!(e>=n||0===r)){var o=n-(r=e+r>n?n-e:r);for(i=e;i<o;++i)t[i]=t[i+r];t.length=o}}function Xt(t,e,r){return Math.max(e,Math.min(r,t))}function Wt(t){for(var e,r,i,n="",o=new Uint8Array(t),a=8*t.byteLength,s=0;s<a;s+=6)r=s%8,i=(o[e=s/8|0]||0)<<r>>2,r>2&&(i|=(o[e+1]||0)>>10-r),n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(63&i);return n+=4==r?"=":6==r?"==":""}function Ht(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",r=0,i=t.length;r<i;r++)e+=String.fromCharCode(t[r]);return decodeURIComponent(escape(e))}var Yt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Gt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],qt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Kt=[],Qt=[];!function(){for(var t=0;t<16;t++){var e=[];Qt.push(e);for(var r=0;r<16;r++)for(var i=kt(Yt[t]*Yt[r]+qt[t]*Gt[r]),n=kt(Gt[t]*Yt[r]+Zt[t]*Gt[r]),o=kt(Yt[t]*qt[r]+qt[t]*Zt[r]),a=kt(Gt[t]*qt[r]+Zt[t]*Zt[r]),s=0;s<16;s++)if(Yt[s]===i&&Gt[s]===n&&qt[s]===o&&Zt[s]===a){e.push(s);break}}for(t=0;t<16;t++){var h=new k;h.set(Yt[t],Gt[t],qt[t],Zt[t],0,0),Kt.push(h)}}();var Jt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MIRROR_HORIZONTAL:12,uX:function(t){return Yt[t]},uY:function(t){return Gt[t]},vX:function(t){return qt[t]},vY:function(t){return Zt[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return Qt[t][e]},sub:function(t,e){return Qt[t][Jt.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Jt.S:Jt.N:2*Math.abs(e)<=Math.abs(t)?t>0?Jt.E:Jt.W:e>0?t>0?Jt.SE:Jt.SW:t>0?Jt.NE:Jt.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=Kt[Jt.inv(e)];n.tx=r,n.ty=i,t.append(n)}},$t=function(t){function e(){var e=t.call(this)||this;return e.mouseEnable=!0,e._instanceType="DisplayObject",e.tempDisplayObjectParent=null,e.transform=new z,e._alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e._worldAlpha=1,e.filterArea=null,e._filters=null,e._enabledFilters=null,e._localBoundsSelf=new B,e._bounds=new B,e._boundsID=0,e._lastBoundsID=-1,e._mask=null,e.destroyed=!1,e}return S(e,t),Object.defineProperty(e.prototype,"filters",{get:function(){return this._filters&&this._filters.slice()},set:function(t){this._filters=t&&t.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new e),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.updateTransform=function(){this.transform.updateWorldMatrix(this.parent.transform),this._worldAlpha=this.alpha*this.parent._worldAlpha},e.prototype.hitTestPoint=function(t,r){void 0===r&&(r=!1);var i=this;if(!i.visible)return null;if(r&&!i.mouseEnable)return null;if(r){if(i._localBoundsSelf.isPointIn(i.globalToLocal(t,e._bp)))return i}else if(i._localBoundsSelf.isPointIn(t))return i;return null},e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateWorldMatrix(this.parent.transform)):this.transform.updateWorldMatrix(this._tempDisplayObjectParent.transform)},e.prototype.getBounds=function(t,r){return void 0===t&&(t=!1),void 0===r&&(r=e.temBounds),t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this.calculateBounds(),r.copy(this._bounds)},e.prototype.getLocalBounds=function(t){void 0===t&&(t=e.temBounds);var r=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var n=this.getBounds(!1,t);return this.parent=i,this.transform=r,this.parent&&this.updateTransform(),n},e.prototype.calculateBounds=function(){this._lastBoundsID!=this._boundsID&&(this._lastBoundsID=this._boundsID)},e.prototype.needUpdateBounds=function(){this._lastBoundsID=-1},e.prototype.globalToLocal=function(t,r){return void 0===r&&(r=null),this.worldMatrix.transformPointInverse(t.x,t.y,r||e._bp)},e.prototype.localToGlobal=function(t,r){void 0===r&&(r=null);var i=this.worldMatrix.transformPoint(t.x,t.y,r||e._bp);return this.stage?this.stage.globalToLocal(i,r||e._bp):i},e.prototype._onDispatchBubbledEvent=function(t){var e=this;(t!=I.REMOVED_FROM_STAGE||e.stage)&&(t==I.REMOVED_FROM_STAGE?(e.dispatchEvent(t),e.stage=null):t==I.ADDED_TO_STAGE&&(e.stage=e.parent.stage,e.dispatchEvent(t)))},e.prototype.renderWebGL=function(t){},e.prototype.renderCanvas=function(t){},e.prototype.setTransform=function(t,e,r,i,n,o,a,s,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=1),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===h&&(h=0),this.position.x=t,this.position.y=e,this.scale.x=r||1,this.scale.y=i||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.anchor.x=s,this.anchor.y=h,this},e.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.removeAllEventListener(),this.transform.destroy(),this.transform=null,this._localBoundsSelf=null,this._bounds=null,this.tempDisplayObjectParent=null,this._mask=null,this.filterArea=null,this._filters=null,this._enabledFilters=null,this.mouseEnable=!1,this.destroyed=!0},Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!=t&&(this._alpha=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldMatrix",{get:function(){return this.transform.worldMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localMatrix",{get:function(){return this.transform.localMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleX",{get:function(){return this.transform.scale.x},set:function(t){this.transform.scale.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleY",{get:function(){return this.transform.scale.y},set:function(t){this.transform.scale.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this.transform.anchor},set:function(t){this.transform.anchor.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchorX",{get:function(){return this.transform.anchor.x},set:function(t){this.transform.anchor.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchorY",{get:function(){return this.transform.anchor.y},set:function(t){this.transform.anchor.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skewX",{get:function(){return this.transform.skew.x*T},set:function(t){this.transform.skew.x=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skewY",{get:function(){return this.transform.skew.y*T},set:function(t){this.transform.skew.y=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation*T},set:function(t){this.transform.rotation=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask!=t&&(this._mask&&(this._mask.renderable=!0,this._mask._isUsedToMask=!1),this._mask=t,this._mask&&(this._mask.renderable=!1,this._mask._isUsedToMask=!0,this._boundsID++))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),e.prototype.update=function(){this.hasEventListener(I.ENTER_FRAME)&&this.dispatchEvent(I.ENTER_FRAME)},e._bp=new N,e._p1=new N,e._p2=new N,e._p3=new N,e._p4=new N,e.temBounds=new B,e}(D);$t.prototype.displayObjectUpdateTransform=$t.prototype.updateTransform,$t.prototype.displayObjectHitTestPoint=$t.prototype.hitTestPoint;var te=function(t){function e(){var e=t.call(this)||this;return e.mouseChildren=!0,e._instanceType="Container",e.children=[],e}return S(e,t),e.prototype.addChild=function(t){return this.addChildAt(t,this.children.length),t},e.prototype.addChildren=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.forEach((function(e){t.addChild(e)})),e},e.prototype.addChildAt=function(t,e){if(t){var r,i=this,n=i==t.parent;if(t.parent)if(n){r=i.children.length;for(var o=0;o<r;o++)if(i.children[o]==t){i.children.splice(o,1);break}}else t.parent.removeChild(t);return t.parent=i,t.transform._parentID=-1,this._boundsID++,e>=(r=i.children.length)?(i.children[i.children.length]=t,e=r):0==e||e<0?(i.children.unshift(t),e=0):i.children.splice(e,0,t),i.stage&&!n&&t._onDispatchBubbledEvent(I.ADDED_TO_STAGE),t}},e.prototype.swapChildren=function(t,e){if(t!==e){var r=this,i=-1,n=-1,o=r.children.length;if((i="number"==typeof t?t:r.getChildIndex(t))==(n="number"==typeof e?e:r.getChildIndex(e))||i<0||i>=o||n<0||n>=o)return!1;var a=r.children[i];return r.children[i]=r.children[n],r.children[n]=a,!0}},e.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);return-1===e?null:e},e.prototype.setChildIndex=function(t,e){this.addChildAt(t,e)},e.prototype.getChildAt=function(t){return t<0||t>=this.children.length?null:this.children[t]},e.prototype.getChildByName=function(t,r){if(void 0===r&&(r=!1),!t)return null;var i;i="string"==typeof t?new RegExp("^"+t+"$"):t;var n=[];return e._getElementsByName(i,this,!0,r,n),n[0]||null},e.prototype.getChildrenByName=function(t,r){if(void 0===r&&(r=!1),!t)return null;var i;i="string"==typeof t?new RegExp("^"+t+"$"):t;var n=[];return e._getElementsByName(i,this,!1,r,n),n},e.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1===e?null:(this.removeChildAt(e),t)},e.prototype.removeChildAt=function(t){var e,r=this,i=r.children.length-1;if(!(i<0))return(e=t==i?r.children.pop():0==t?r.children.shift():r.children.splice(t,1)[0])._onDispatchBubbledEvent(I.REMOVED_FROM_STAGE),e.parent=null,e.transform._parentID=-1,this._boundsID++,e},e.prototype.removeChildren=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.length?(e.forEach((function(e){t.removeChild(e)})),e):this.spliceChildren(0,this.children.length)},e.prototype.removeAllChildren=function(){return this.removeChildren()},e.prototype.removeChildrenAt=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var r=t,i="number"==typeof e?e:this.children.length,n=i-r;if(n>0&&n<=i)return this.spliceChildren(r,n);if(0===n&&0===this.children.length)return[];throw new RangeError("removeChildren: 移除范围有误")},e.prototype.spliceChildren=function(t,e){var r=this.children.splice(t,e);if(!r.length)return[];for(var i=0;i<r.length;++i)r[i].parent=null,r[i].transform&&(r[i].transform._parentID=-1);this._boundsID++;for(i=0;i<r.length;++i)r[i]._onDispatchBubbledEvent(I.REMOVED_FROM_STAGE);return r},e.prototype.updateTransform=function(){t.prototype.updateTransform.call(this);for(var e=0,r=this.children.length;e<r;++e){var i=this.children[e];i.visible&&i.updateTransform()}},e.prototype.calculateBounds=function(){if(this._lastBoundsID!=this._boundsID){this._lastBoundsID=this._boundsID,this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var e=this.children[t];e.visible&&e.renderable&&(e.calculateBounds(),e.mask?(e.mask.calculateBounds(),e._bounds.x<e.mask._bounds.x&&(e._bounds.x=e.mask._bounds.x),e._bounds.y<e.mask._bounds.y&&(e._bounds.y=e.mask._bounds.y),e._bounds.width>e.mask._bounds.width&&(e._bounds.width=e.mask._bounds.width),e._bounds.height>e.mask._bounds.height&&(e._bounds.height=e.mask._bounds.height),B.createFromRects(this._bounds,e._bounds)):e.filterArea||B.createFromRects(this._bounds,e._bounds))}}},e.prototype._calculateBounds=function(){},e.prototype.hitTestPoint=function(t,e){if(void 0===e&&(e=!1),!this.visible)return null;if(e&&!this.mouseChildren)return null;for(var r,i,n=this.children,o=n.length-1;o>=0;o--)if(!(r=n[o])._isUsedToMask&&(!r.mask||r.mask.hitTestPoint(t,e))&&(i=r.hitTestPoint(t,e)))return i;return null},e.prototype.renderWebGL=function(t){if(this.visible&&!(this._worldAlpha<=0)&&this.renderable&&(!this.mask||ee(this.mask)))if(this.mask||this.filters&&this.filters.length)this.renderAdvancedWebGL(t);else{this._renderWebGL(t);for(var e=0,r=this.children.length;e<r;++e)this.children[e].renderWebGL(t)}},e.prototype.renderAdvancedWebGL=function(t){t.batchManager.flush();var e=this.filters;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var r=0;r<e.length;r++)e[r].enabled&&this._enabledFilters.push(e[r]);this._enabledFilters.length&&t.filterManager.pushFilter(this,this._enabledFilters)}var i=this.mask;i&&t.maskManager.pushMask(this,this.mask),this._renderWebGL(t);r=0;for(var n=this.children.length;r<n;r++)this.children[r].renderWebGL(t);t.batchManager.flush(),i&&t.maskManager.popMask(this,this.mask),e&&this._enabledFilters&&this._enabledFilters.length&&t.filterManager.popFilter()},e.prototype._renderWebGL=function(t){},e.prototype.renderCanvas=function(t){if(this.visible&&!(this._worldAlpha<=0)&&this.renderable){if(this.mask){if(!ee(this.mask))return;t.maskManager.pushMask(this.mask)}this._renderCanvas(t);for(var e=0,r=this.children.length;e<r;++e)this.children[e].renderCanvas(t);this.mask&&t.maskManager.popMask(t)}},e.prototype._renderCanvas=function(t){},e.prototype.update=function(){t.prototype.update.call(this);for(var e=this.children.length-1;e>=0;e--){var r=this.children[e];r.visible&&r.update()}},e.prototype._onDispatchBubbledEvent=function(e){var r=this,i=r.children.length;if(e!=I.REMOVED_FROM_STAGE||r.stage){t.prototype._onDispatchBubbledEvent.call(this,e);for(var n=0;n<i;n++)r.children[n]._onDispatchBubbledEvent(e)}},e.prototype.destroy=function(){for(var e=this.children.length-1;e>=0;e--)this.children[e].destroy();t.prototype.destroy.call(this),this.mouseChildren=!1},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t},enumerable:!1,configurable:!0}),e._getElementsByName=function(t,r,i,n,o){var a=r.children.length;if(a>0)for(var s=void 0,h=void 0,u=0;u<a;u++){if((s=(h=r.children[u]).name)&&""!=s&&t.test(s)&&(o[o.length]=h,i))return;n&&null!=h.children&&e._getElementsByName(t,h,i,n,o)}},e._childrenOperationMethods=["addChild","addChildAt","addChildren","removeChild","removeChildAt","removeChildren","removeAllChildren","removeChildrenAt","spliceChildren","getChildAt","getChildByName","getChildrenByName","getChildIndex","setChildIndex","swapChildren"],e}($t);function ee(t){if(!t)return!1;if(t.texture){if(t.updateShape&&t.updateShape(),!t.texture.valid)return!1}else if(!t.graphicsData||!t.graphicsData.length)return!1;return!0}te.prototype.containerUpdateTransform=te.prototype.updateTransform;var re,ie=function(t){function e(){var e=t.call(this)||this;e.htmlElement=null,e._isAdded=!1;var r=e;return r._instanceType="FloatDisplay",r.addEventListener(I.REMOVED_FROM_STAGE,(function(t){r.htmlElement&&(r.htmlElement.style.display="none"),r.stage.removeEventListener(I.ENTER_FRAME,r.updateStyle,r)})),r.addEventListener(I.ADDED_TO_STAGE,(function(t){if(r.htmlElement){var e=r.htmlElement.style;r._isAdded?r.htmlElement&&r.visible&&(e.display="block"):(r._isAdded=!0,r.addHtmlElement())}r.stage.addEventListener(I.ENTER_FRAME,r.updateStyle,r)})),e._transformID=-1,e}return S(e,t),e.prototype.init=function(t){var e,r=this;e="string"==typeof t?document.getElementById(t):"Video"==t._instanceType?t.media:t,r.htmlElement&&r.removeHtmlElement();var i=e.style;i.position="absolute",i.display="none",i.transformOrigin=i.WebkitTransformOrigin="0 0 0";var n=r.getStyle(e,"width"),o=r.getStyle(e,"height"),a=0,s=0;n.indexOf("px")&&(a=parseInt(n)),o.indexOf("px")&&(s=parseInt(o)),r._localBoundsSelf.width=a,r._localBoundsSelf.height=s,r.htmlElement=e,r.stage&&(r._isAdded=!0,r.addHtmlElement())},e.prototype.getStyle=function(t,e){if(t.style[e])return t.style[e];if(document.defaultView&&document.defaultView.getComputedStyle){e=(e=e.replace(/([A-Z])/g,"-$1")).toLowerCase();var r=document.defaultView.getComputedStyle(t,"");return r&&r.getPropertyValue(e)}return null},e.prototype.updateStyle=function(){var t=this,e=t.htmlElement;if(e){var r=e.style,i=t.visible;if(t.stage||(i=!1),i)for(var n=t.parent;n;){if(!n.visible){i=!1;break}n=n.parent}var o=i?"block":"none";if(o!=r.display&&(r.display=o),i){if(this._transformID!=this.transform._worldID){this._transformID=this.transform._worldID;var a=t.transform.worldMatrix,s=t.stage._dpi||t.stage.dpi;r.transform=r.webkitTransform="matrix("+(a.a/s).toFixed(4)+","+(a.b/s).toFixed(4)+","+(a.c/s).toFixed(4)+","+(a.d/s).toFixed(4)+","+(a.tx/s).toFixed(4)+","+(a.ty/s).toFixed(4)+")"}r.opacity=t._worldAlpha}}},e.prototype.removeHtmlElement=function(){var t=this,e=t.htmlElement;e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e),t._isAdded=!1,t.htmlElement=null)},e.prototype.addHtmlElement=function(){var t=this.stage,e=this.htmlElement;if(t&&e){var r=this.stage.canvas.parentNode;r?r.insertBefore(e,r.childNodes[0]):document.body.appendChild(e)}},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.removeHtmlElement()},e}($t),ne=function(t){function e(){var e=t.call(this)||this;return e.caches={},e._instanceType="Loader",console.warn("Instance GlobalLoader with class Loader will be abandoned soon, use each load methods instead(such as loadImage) and change parameters"),e}return S(e,t),e.prototype.loadSheet=function(t,e){var r=this,i=e.substring(0,e.lastIndexOf("."))+".png";this.loadImage((function(n,o){n?(r.cache(i,o),r.caches[e]&&(t(!0,{json:r.caches[e],img:o}),r.caches[e]=null,r.caches[i]=null)):t(!1)}),i),this.loadJson((function(n,o){n?(r.cache(e,o),r.caches[i]&&(t(!0,{json:o,img:r.caches[i]}),r.caches[e]=null,r.caches[i]=null)):t(!1)}),e)},e.prototype.loadJson=function(t,e){"tb"!=H()?this.loadRawWeb(t,e,"json"):this.tbLoad((function(e,r){t(e,e?JSON.parse(r):r)}),e,"utf8")},e.prototype.loadAB=function(t,e){"tb"==H()?this.tbLoad(t,e,"ArrayBuffer"):this.loadRawWeb(t,e,"arraybuffer")},e.prototype.loadText=function(t,e){"tb"==H()?this.tbLoad(t,e,"utf8"):this.loadRawWeb(t,e,"text")},e.prototype.loadRawWeb=function(t,e,r){var i;if(void 0===r&&(r="json"),window.XMLHttpRequest)i=new XMLHttpRequest;else{if(!window.ActiveXObject)return void t(!1,"your browser doesnt support XMLHttpRequest!");i=new window.ActiveXObject}null!=i&&(i.open("GET",e,!0),i.responseType=r,i.send(),i.onreadystatechange=function(){if(4==i.readyState){var e=i.status;e>=200&&e<300||304==e?t(!0,i.response):t(!1,"request.status:"+e)}})},e.prototype.loadImage=function(t,e){var r=J();r.onload=function(){t(!0,r)},r.onerror=function(){t(!1)},0!==(e=encodeURI(decodeURI(e))).indexOf("data:")&&(r.crossOrigin="anonymous"),r.src=e},e.prototype.tbLoad=function(t,e,r){var i=this;void 0===r&&(r="ArrayBuffer"),0==e.indexOf("cloud://")?this.getTbTempUrl((function(e){i.downloadReadFile(t,e,r)}),e):this.downloadReadFile(t,e,r)},e.prototype.getTbTempUrl=function(t,e){getApp().cloud.file.getTempFileURL({fileId:[e]}).then((function(e){t(e[0].url.replace("-internal",""))})).catch((function(t){console.error(t)}))},e.prototype.downloadReadFile=function(t,e,r){void 0===r&&(r="ArrayBuffer");var i=my;i.downloadFile({url:e,success:function(e){var n=e.apFilePath;i.getFileSystemManager().readFile({filePath:n,encoding:"ArrayBuffer"===r?"":r,success:function(e){t(!0,e.data)},fail:function(e){t(!1,e)}})},fail:function(e){t(!1,e)}})},e.prototype.cache=function(t,e){this.caches[t]&&console.log("rewrite orign data:"+t),this.caches[t]=e},e}(D),oe=new ne;function ae(t,e,r,i){void 0===i&&(i="anonymous");var n=J();n.onload=function(){e(n)},n.onerror=function(){r&&r()},0!==(t=encodeURI(decodeURI(t))).indexOf("data:")&&(n.crossOrigin=i),n.src=t}function se(t,e,r){le(t,e,r,re.json)}function he(t,e,r){le(t,e,r,re.arraybuffer)}function ue(t,e,r){le(t,e,r,re.text)}function le(t,e,r,i){void 0===i&&(i=re.text),("tb"==H()?de:ce)(t,e,r,i)}function ce(t,e,r,i){var n;if(void 0===i&&(i=re.text),window.XMLHttpRequest)n=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(r&&r("your browser doesnt support XMLHttpRequest!"));n=new window.ActiveXObject}null!=n&&(n.open("GET",t,!0),n.responseType=i,n.send(),n.onreadystatechange=function(){if(4==n.readyState){var t=n.status;t>=200&&t<300||304==t?e(n.response):r&&r("request.status:"+t)}})}function pe(t,e,r,i){void 0===i&&(i=re.text);var n=my;n.downloadFile({url:t,success:function(t){var o=t.apFilePath;n.getFileSystemManager().readFile({filePath:o,encoding:i===re.arraybuffer?"":"utf8",success:function(t){e(i==re.json?JSON.parse(t.data):t.data)},fail:function(t){r&&r(t)}})},fail:function(t){r&&r(t)}})}function de(t,e,r,i){void 0===i&&(i=re.text),0==t.indexOf("cloud://")?function(t,e,r){getApp().cloud.file.getTempFileURL({fileId:[t]}).then((function(t){e(t[0].url.replace("-internal",""))})).catch((function(t){r&&r(t)}))}(t,(function(t){pe(t,e,r,i)}),r):pe(t,e,r,i)}!function(t){t.text="text",t.json="json",t.arraybuffer="arraybuffer"}(re||(re={}));var fe=function(t){function e(e,r){void 0===e&&(e=null),void 0===r&&(r=g.LINEAR);var i=t.call(this)||this;if(i._touchedId=0,i.width=100,i.height=100,i.scaleMode=r,i.hasLoaded=!1,i._isLoading=!1,i.source=null,i.imageType=null,i.premultipliedAlpha=!0,i.imageUrl=null,i.isPowerOfTwo=!1,i.mipmap=!0,i.wrapMode=x.CLAMP,i._glTextures={},i._enabledId=0,i.textureCacheIds=[],e)if(e._data)i._sourceLoaded(e);else if(e.getContext)i._sourceLoaded(e);else if(e.complete)i._sourceLoaded(e);else{var n=i;e.onload=function(){n._sourceLoaded(e)},e.onerror=function(){n.dispatchEvent("loaded")}}return i}return S(e,t),e.prototype.update=function(){this.width=this.source.width,this.height=this.source.height,this.hasLoaded=!(!this.width||!this.height),this.isPowerOfTwo=lt(this.width)&&lt(this.height),this.dispatchEvent("update")},e.prototype._sourceLoaded=function(t){this.source=t,this.imageUrl=t.src||t.path||null,this.imageType=this.source.type||null,this.hasLoaded=!0,this.update(),this.dispatchEvent("loaded")},e.prototype.destroy=function(){this.imageUrl&&(delete Bt[this.imageUrl],this.imageUrl=null),this.source=null,this.dispose(),e.removeFromCache(this),this.textureCacheIds=null},e.prototype.dispose=function(){this.dispatchEvent("dispose")},e.fromUrl=function(t){if(zt[t])return zt[t];var r=new e;return oe.loadImage((function(i,n){i?(r._sourceLoaded(n),0!==t.indexOf("data:")&&e.addToCache(r,t)):r.dispatchEvent("loaded")}),t),r},e.fromData=function(t){return new e(t)},e.fromCanvas=function(t,r){void 0===r&&(r="canvas"),t._canvasId||(t._canvasId=r+"_"+Ct());var i=zt[t._canvasId];return i||(i=new e(t),e.addToCache(i,t._canvasId)),i},e.fromImage=function(t){var r=t.src,i=zt[r];return i||(i=new e(t),r&&0!==r.indexOf("data:")&&e.addToCache(i,r)),i},e.from=function(t){return"string"==typeof t?e.fromUrl(t):t._data?e.fromData(t):t.getContext?e.fromCanvas(t):e.fromImage(t)},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),zt[e]&&console.warn("rewrite cached baseTexture: "+e),zt[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=zt[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete zt[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i<t.textureCacheIds.length;++i)delete zt[t.textureCacheIds[i]];return t.textureCacheIds.length=0,t}return null},e}(D),ve=function(){function t(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsUint32=new Uint32Array(4),this.uvsFloat32=new Float32Array(8)}return t.prototype.set=function(t,e,r){var i=e.width,n=e.height;if(r){var o=t.width/2/i,a=t.height/2/n,s=t.x/i+o,h=t.y/n+a;r=Jt.add(r,Jt.NW),this.x0=s+o*Jt.uX(r),this.y0=h+a*Jt.uY(r),r=Jt.add(r,2),this.x1=s+o*Jt.uX(r),this.y1=h+a*Jt.uY(r),r=Jt.add(r,2),this.x2=s+o*Jt.uX(r),this.y2=h+a*Jt.uY(r),r=Jt.add(r,2),this.x3=s+o*Jt.uX(r),this.y3=h+a*Jt.uY(r)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n;this.uvsUint32[0]=(65535*this.y0&65535)<<16|65535*this.x0&65535,this.uvsUint32[1]=(65535*this.y1&65535)<<16|65535*this.x1&65535,this.uvsUint32[2]=(65535*this.y2&65535)<<16|65535*this.x2&65535,this.uvsUint32[3]=(65535*this.y3&65535)<<16|65535*this.x3&65535,this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},t}(),me=function(t){function e(r,i,n,o,a,s){var h=t.call(this)||this;return h._instanceType="Texture",h.noFrame=!1,i||(h.noFrame=!0,i=new B(0,0,1,1)),r instanceof e&&(r=r.baseTexture),h.baseTexture=r,h._frame=i,h.trim=o||null,h.valid=!1,h._uvs=null,h.orig=n||i,h._rotate=Number(a||0),r.hasLoaded||r.source&&r.source.getContext?(h.noFrame&&(i=new B(0,0,r.width,r.height),r.addEventListener("update",h.onBaseTextureUpdated,h)),h.frame=i):r.once("loaded",h.onBaseTextureLoaded,h),h.defaultAnchor=s?new N(s.x,s.y):new N(0,0),h._updateID=0,h.transform=null,h.textureCacheIds=[],h}return S(e,t),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=G();t.width=16,t.height=16;var r=t.getContext("2d");r.clearRect(0,0,16,16),r.fillStyle="white",r.fillRect(0,0,16,16);var i=new e(new fe(t));ye(i),ye(i.baseTexture),e._WHITE=i}return e._WHITE},enumerable:!1,configurable:!0}),e.prototype.update=function(){this.baseTexture.update()},e.prototype.onBaseTextureLoaded=function(t){var e=t.target;this._updateID++,this.noFrame?e.source&&(this.frame=new B(0,0,e.width,e.height),this.baseTexture.addEventListener("update",this.onBaseTextureUpdated,this)):this.frame=this._frame,this.dispatchEvent("update"),this.dispatchEvent("loaded")},e.prototype.onBaseTextureUpdated=function(t){var e=t.target;this._updateID++,this._frame.width=e.width,this._frame.height=e.height,this.orig.width=this._frame.width,this.orig.height=this._frame.height,this.valid=e.hasLoaded,this.dispatchEvent("update")},e.prototype.destroy=function(){this.baseTexture&&(this.baseTexture.removeEventListener("update",this.onBaseTextureUpdated,this),this.baseTexture.removeEventListener("loaded",this.onBaseTextureLoaded,this),this.baseTexture=null),this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){return new e(this.baseTexture,this.frame,this.orig,this.trim,this.rotate,this.defaultAnchor)},e.prototype.updateUvs=function(){this._uvs||(this._uvs=new ve),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var e=t.x,r=t.y,i=t.width,n=t.height,o=e+i>this.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+s+" "+u)}this.valid=i&&n&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.fromUrl=function(t){var r=Bt[t];return r||(r=new e(fe.fromUrl(t)),e.addToCache(r,t)),r},e.fromCanvas=function(t,r){return void 0===r&&(r="canvas"),new e(fe.fromCanvas(t,r))},e.fromData=function(t){return new e(fe.fromData(t))},e.fromImage=function(t){var r=t.src,i=Bt[r];return i||(i=new e(fe.fromImage(t)),r&&0!==r.indexOf("data:")&&e.addToCache(i,r)),i},e.from=function(t){return"string"==typeof t?e.fromUrl(t):t.data?e.fromData(t):t.getContext?e.fromCanvas(t):e.fromImage(t)},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Bt[e]&&console.warn("rewrite cached texture: "+e),Bt[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=Bt[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Bt[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i<t.textureCacheIds.length;++i)Bt[t.textureCacheIds[i]]===t&&delete Bt[t.textureCacheIds[i]];return t.textureCacheIds.length=0,t}return null},e}(D);function ye(t){t.destroy=function(){},t.addEventListener=function(){},t.once=function(){},t.dispatchEvent=function(){},t.removeEventListener=function(){}}me.EMPTY=new me(new fe),ye(me.EMPTY),ye(me.EMPTY.baseTexture);var ge,xe=new Uint16Array([0,1,2,0,2,3]),_e=function(t){function e(e){var r=t.call(this)||this;return r._blendMode=m.NORMAL,r.hitTestByPixel=!1,r._instanceType="Sprite",r._anchorTexture=new L(r._onAnchorUpdate,r,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),r._texture=null,r._width=0,r._height=0,r._tint=null,r._tintRGB=null,r.tint=16777215,r._cachedTint=16777215,r._uvs=null,r.texture=e||me.EMPTY,r._vertexData=new Float32Array(8),r._vertexTrimmedData=null,r._transformID=-1,r._textureID=-1,r._transformTrimmedID=-1,r._textureTrimmedID=-1,r._indices=xe,r.pluginName="sprite",r}return S(e,t),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){},enumerable:!1,configurable:!0}),e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._texture.valid&&(this._uvs=this._texture._uvs.uvsFloat32),this._width&&(this.scale.x=kt(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=kt(this.scale.y)*this._height/this._texture.orig.height),this.updateLocalBoundsSelf(),this._boundsID++},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1,this.updateLocalBoundsSelf()},e.prototype.updateLocalBoundsSelf=function(){var t=this._texture.orig.width,e=this._texture.orig.height;this._localBoundsSelf.x=-t*this.anchorTexture.x,this._localBoundsSelf.y=-e*this.anchorTexture.y,this._localBoundsSelf.width=t,this._localBoundsSelf.height=e},e.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID||this._textureID!==this._texture._updateID){this._transformID=this.transform._worldID,this._textureID=this._texture._updateID;var t=this._texture,e=this.transform.worldMatrix,r=e.a,i=e.b,n=e.c,o=e.d,a=e.tx,s=e.ty,h=this._vertexData,u=t.trim,l=t.orig,c=this._anchorTexture,p=0,d=0,f=0,v=0;u?(p=(d=u.x-c._x*l.width)+u.width,f=(v=u.y-c._y*l.height)+u.height):(p=(d=-c._x*l.width)+l.width,f=(v=-c._y*l.height)+l.height),h[0]=r*d+n*v+a,h[1]=o*v+i*d+s,h[2]=r*p+n*v+a,h[3]=o*v+i*p+s,h[4]=r*p+n*f+a,h[5]=o*f+i*p+s,h[6]=r*d+n*f+a,h[7]=o*f+i*d+s}},e.prototype.calculateTrimmedVertices=function(){if(this._vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this._vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this._vertexTrimmedData,r=t.orig,i=this._anchorTexture,n=this.transform.worldMatrix,o=n.a,a=n.b,s=n.c,h=n.d,u=n.tx,l=n.ty,c=-i._x*r.width,p=c+r.width,d=-i._y*r.height,f=d+r.height;e[0]=o*c+s*d+u,e[1]=h*d+a*c+l,e[2]=o*p+s*d+u,e[3]=h*d+a*p+l,e[4]=o*p+s*f+u,e[5]=h*f+a*p+l,e[6]=o*c+s*f+u,e[7]=h*f+a*c+l},e.prototype._renderWebGL=function(t){this.calculateVertices(),t.batchManager.setObjectRenderer(t.plugins.batch),t.plugins.batch.render(this)},e.prototype._renderCanvas=function(t){t.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),B.createFromVertexData(this._bounds,this._vertexData)):(this.calculateTrimmedVertices(),B.createFromVertexData(this._bounds,this._vertexTrimmedData))},e.prototype.getLocalBounds=function(e){return 0===this.children.length?(e||(e=$t.temBounds),e.copy(this._localBoundsSelf),e):t.prototype.getLocalBounds.call(this,e)},e.prototype.hitTestPoint=function(e,r){if(void 0===r&&(r=!1),!this.visible)return null;var i;if(i=t.prototype.hitTestPoint.call(this,e,r))return i;if(!(i=this.displayObjectHitTestPoint(e,r)))return null;if(!this.hitTestByPixel)return i;var n=this.texture,o=this._anchorTexture,a=n.orig,s=n.frame,h=n.trim,u=n.rotate,l=n.baseTexture,c=$t._bp.copy(e);if(r&&(c=this.globalToLocal(c)),c.x+=o.x*a.width,c.y+=o.y*a.height,h){if(!h.isPointIn(c))return null;c.x-=h.x,c.y-=h.y}if(u&&(ge||(ge=new k),2==u?ge.set(0,1,-1,0,s.width,0):6==u&&ge.set(0,-1,1,0,0,s.height),ge.transformPoint(c.x,c.y,c)),c.x+=s.x,c.y+=s.y,l.source._data)return l.source._data[4*(Math.round(c.y-1)*l.source.width+Math.round(c.x))-1]>0?i:null;var p=At();p.setTransform(1,0,0,1,0,0),p.clearRect(0,0,1,1),p.setTransform(1,0,0,1,-c.x,-c.y),p.drawImage(l.source,0,0);var d=p.getImageData(0,0,1,1);return d&&d.data?d.data[3]>0?i:null:i},e.prototype.destroy=function(){t.prototype.destroy.call(this),this._texture.removeEventListener("update",this._onTextureUpdate,this),this._anchorTexture=null,this._texture=null,this._indices=null,this._uvs=null,this._vertexData=null,this._vertexTrimmedData=null,this.tintedTexture&&(this.tintedTexture=null)},Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var e=kt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var e=kt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchorTexture",{get:function(){return this._anchorTexture},set:function(t){this._anchorTexture.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture===me.EMPTY?null:this._texture},set:function(t){this._texture===t||this.destroyed||(this._texture&&this._texture.removeEventListener("update",this._onTextureUpdate,this),this._texture=t||me.EMPTY,this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,t?(t.baseTexture.hasLoaded&&this._onTextureUpdate(),t.addEventListener("update",this._onTextureUpdate,this)):this._onTextureUpdate())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16))},enumerable:!1,configurable:!0}),e.fromUrl=function(t){return new e(me.fromUrl(t))},e.fromFrame=function(t){var r=Bt[t];return r||console.warn("TextureCache hasn‘t texture "+t),new e(r)},e}(te),be=function(t){function e(e){var r=t.call(this,e)||this;return r.clientX=0,r.clientY=0,r.stageX=0,r.stageY=0,r.localX=0,r.localY=0,r.currentTarget=null,r.identifier=0,r._instanceType="MouseEvent",r}return S(e,t),e.prototype.destroy=function(){this.currentTarget=null,t.prototype.destroy.call(this)},e.MOUSE_DOWN="onMouseDown",e.MOUSE_UP="onMouseUp",e.CLICK="onMouseClick",e.MOUSE_MOVE="onMouseMove",e.MOUSE_OVER="onMouseOver",e.MOUSE_OUT="onMouseOut",e}(I),Te=function(){this.textures=[],this.blend=0,this.textureCount=0,this.start=0,this.size=0,this.type=y.TRIANGLES},we=function(){function t(t){this.renderer=t,this.renderer.addEventListener("onContextChange",this.onContextChange,this)}return t.prototype.onContextChange=function(){},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.flush=function(){},t.prototype.render=function(t){},t.prototype.destroy=function(){this.renderer.removeEventListener("onContextChange",this.onContextChange,this),this.renderer=null},t}();var Me=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Se(t,e){var r=!e;if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");if(r){var i=G();i.width=1,i.height=1,e=function(t,e){var r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);if(!r)throw new Error("This browser does not support webGL. Try using the canvas renderer");return r}(i)}for(var n=e.createShader(e.FRAGMENT_SHADER);;){var o=Me.replace(/%forloop%/gi,Ee(t));if(e.shaderSource(n,o),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))break;t=t/2|0}return r&&e.getExtension("WEBGL_lose_context")&&e.getExtension("WEBGL_lose_context").loseContext(),t}function Ee(t){for(var e="",r=0;r<t;++r)r>0&&(e+="\nelse "),r<t-1&&(e+="if(test == "+r+".0){}");return e}var Ce=function(){function t(t){this.vertices=new ArrayBuffer(t),this.float32View=new Float32Array(this.vertices),this.uint32View=new Uint32Array(this.vertices)}return t.prototype.destroy=function(){this.vertices=null,this.float32View=null,this.uint32View=null,this.positions=null,this.uvs=null,this.colors=null},t}(),Ae=function(){function t(t,e,r,i,n){this.uploadData=function(t,e,r){this.bind();var i=this.gl;if(t instanceof Float32Array){if(!Pe){if(!i.getExtension("OES_texture_float"))throw new Error("floating point textures not available");Pe=!0}this.type=i.FLOAT}else this.type=this.type||i.UNSIGNED_BYTE;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),e!==this.width||r!==this.height?i.texImage2D(i.TEXTURE_2D,0,this.format,e,r,0,this.format,this.type,t||null):i.texSubImage2D(i.TEXTURE_2D,0,0,0,e,r,this.format,this.type,t||null),this.width=e,this.height=r},this.gl=t,this.texture=t.createTexture(),this.mipmap=!1,this.premultiplyAlpha=!1,this.width=e||-1,this.height=r||-1,this.format=i||t.RGBA,this.type=n||t.UNSIGNED_BYTE}return t.prototype.upload=function(t){this.bind();var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var r=t.videoWidth||t.width,i=t.videoHeight||t.height;i!==this.height||r!==this.width?e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,this.type,t):e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.format,this.type,t),this.width=r,this.height=i},t.prototype.bind=function(t){var e=this.gl;void 0!==t&&e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.texture)},t.prototype.unbind=function(){var t=this.gl;t.bindTexture(t.TEXTURE_2D,null)},t.prototype.minFilter=function(t){var e=this.gl;this.bind(),this.mipmap?e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t?e.LINEAR_MIPMAP_LINEAR:e.NEAREST_MIPMAP_NEAREST):e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t?e.LINEAR:e.NEAREST)},t.prototype.magFilter=function(t){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t?e.LINEAR:e.NEAREST)},t.prototype.enableMipmap=function(){var t=this.gl;this.bind(),this.mipmap=!0,t.generateMipmap(t.TEXTURE_2D)},t.prototype.enableLinearScaling=function(){this.minFilter(!0),this.magFilter(!0)},t.prototype.enableNearestScaling=function(){this.minFilter(!1),this.magFilter(!1)},t.prototype.enableWrapClamp=function(){var t=this.gl;this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)},t.prototype.enableWrapRepeat=function(){var t=this.gl;this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT)},t.prototype.enableWrapMirrorRepeat=function(){var t=this.gl;this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.MIRRORED_REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.MIRRORED_REPEAT)},t.prototype.destroy=function(){this.gl.deleteTexture(this.texture)},t.fromSource=function(e,r,i){var n=new t(e);return n.premultiplyAlpha=i||!1,n.upload(r),n},t.fromData=function(e,r,i,n){var o=new t(e);return o.uploadData(r,i,n),o},t}(),Pe=!1,Oe=new ArrayBuffer(0),Re=function(){function t(t,e,r,i){this.destroy=function(){this.gl.deleteBuffer(this.buffer)},this.gl=t,this.buffer=t.createBuffer(),this.type=e||t.ARRAY_BUFFER,this.drawType=i||t.STATIC_DRAW,this.data=Oe,r&&this.upload(r),this._updateID=0}return t.prototype.upload=function(t,e,r){r||this.bind();var i=this.gl;t=t||this.data,e=e||0,this.data.byteLength>=t.byteLength?i.bufferSubData(this.type,e,t):i.bufferData(this.type,t,this.drawType),this.data=t},t.prototype.bind=function(){this.gl.bindBuffer(this.type,this.buffer)},t.createVertexBuffer=function(e,r,i){return new t(e,e.ARRAY_BUFFER,r,i)},t.createIndexBuffer=function(e,r,i){return new t(e,e.ELEMENT_ARRAY_BUFFER,r,i)},t.create=function(e,r,i,n){return new t(e,r,i,n)},t}();var Ie=function(){function t(e,r){if(this.nativeVaoExtension=null,t.FORCE_NATIVE||(this.nativeVaoExtension=e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object")),this.nativeState=r,this.nativeVaoExtension){this.nativeVao=this.nativeVaoExtension.createVertexArrayOES();var i=e.getParameter(e.MAX_VERTEX_ATTRIBS);this.nativeState={tempAttribState:new Array(i),attribState:new Array(i)}}this.gl=e,this.attributes=[],this.indexBuffer=null,this.dirty=!1}return t.prototype.bind=function(){if(this.nativeVao){if(this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao),this.dirty)return this.dirty=!1,this.activate(),this;this.indexBuffer&&this.indexBuffer.bind()}else this.activate();return this},t.prototype.unbind=function(){return this.nativeVao&&this.nativeVaoExtension.bindVertexArrayOES(null),this},t.prototype.activate=function(){for(var t=this.gl,e=null,r=0;r<this.attributes.length;r++){var i=this.attributes[r];e!==i.buffer&&(i.buffer.bind(),e=i.buffer),i.attribute.pointer(i.type||t.FLOAT,i.normalized||!1,i.stride||0,i.start||0)}return function(t,e,r){var i;if(r){var n=r.tempAttribState,o=r.attribState;for(i=0;i<n.length;i++)n[i]=!1;for(i=0;i<e.length;i++)n[e[i].attribute.location]=!0;for(i=0;i<o.length;i++)o[i]!==n[i]&&(o[i]=n[i],r.attribState[i]?t.enableVertexAttribArray(i):t.disableVertexAttribArray(i))}else for(i=0;i<e.length;i++){var a=e[i];t.enableVertexAttribArray(a.attribute.location)}}(t,this.attributes,this.nativeState),this.indexBuffer&&this.indexBuffer.bind(),this},t.prototype.addAttribute=function(t,e,r,i,n,o,a){return this.attributes.push({buffer:t,attribute:e,location:e.location,type:r||this.gl.FLOAT,normalized:i||!1,stride:n||0,start:o||0,name:a}),this.dirty=!0,this},t.prototype.removeAttribute=function(t,e){void 0===e&&(e=!0);for(var r=this.attributes.length-1;r>=0;r--){if(this.attributes[r].name===t&&(this.attributes.splice(r,1),this.dirty=!0,e))break}return this},t.prototype.addIndex=function(t){return this.indexBuffer=t,this.dirty=!0,this},t.prototype.clear=function(){return this.nativeVao&&this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao),this.attributes.length=0,this.indexBuffer=null,this},t.prototype.draw=function(t,e,r){var i=this.gl;return this.indexBuffer?i.drawElements(t,e||this.indexBuffer.data.length,i.UNSIGNED_SHORT,2*(r||0)):i.drawArrays(t,r||0,e||this.getSize()),this},t.prototype.destroy=function(){this.gl=null,this.indexBuffer=null,this.attributes=null,this.nativeState=null,this.nativeVao&&this.nativeVaoExtension.deleteVertexArrayOES(this.nativeVao),this.nativeVaoExtension=null,this.nativeVao=null},t.prototype.getSize=function(){var t=this.attributes[0];return(t.buffer.data.length||t.buffer.data.byteLength/4)/(t.stride/4||t.attribute.size)},t.FORCE_NATIVE=!1,t}(),De=function(){function t(t,e,r){this.gl=t,this.framebuffer=t.createFramebuffer(),this.stencil=null,this.texture=null,this.width=e||100,this.height=r||100}return t.prototype.enableTexture=function(t){var e=this.gl;this.texture=t||new Ae(e),this.texture.bind(),this.bind(),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture.texture,0)},t.prototype.enableStencil=function(){if(!this.stencil){var t=this.gl;this.stencil=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this.stencil),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,this.stencil),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,this.width,this.height)}},t.prototype.clear=function(t,e,r,i){this.bind();var n=this.gl;n.clearColor(t,e,r,i),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT)},t.prototype.bind=function(){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer)},t.prototype.unbind=function(){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null)},t.prototype.resize=function(t,e){var r=this.gl;this.width=t,this.height=e,this.texture&&this.texture.uploadData(null,t,e),this.stencil&&(r.bindRenderbuffer(r.RENDERBUFFER,this.stencil),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e))},t.prototype.destroy=function(){var t=this.gl;this.texture&&this.texture.destroy(),t.deleteFramebuffer(this.framebuffer),this.gl=null,this.stencil=null,this.texture=null},t.createRGBA=function(e,r,i,n){var o=Ae.fromData(e,n||null,r,i);o.enableNearestScaling(),o.enableWrapClamp();var a=new t(e,r,i);return a.enableTexture(o),a.enableStencil(),a.unbind(),a},t.createFloat32=function(e,r,i,n){var o=Ae.fromData(e,n,r,i);o.enableNearestScaling(),o.enableWrapClamp();var a=new t(e,r,i);return a.enableTexture(o),a.unbind(),a},t}();var Fe=function(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)?i:(console.log(t.getShaderInfoLog(i)),null)};function Ne(t,e){if(!ke){var r=Object.keys(Le);ke={};for(var i=0;i<r.length;++i){var n=r[i];ke[t[n]]=Le[n]}}return ke[e]}var ke=null,Le={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D"};function Be(t){return ze[t]}var ze={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Ue(t,e){switch(t){case"float":case"int":case"sampler2D":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"bool":return!1;case"bvec2":return je(2*e);case"bvec3":return je(3*e);case"bvec4":return je(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}}var je=function(t){for(var e=new Array(t),r=0;r<e.length;r++)e[r]=!1;return e};function Ve(t,e){return"precision"!==t.substring(0,9)?"precision "+e+" float;\n"+t:t}function Xe(t,e){var r={data:{}};r.gl=t;for(var i=Object.keys(e),n=0;n<i.length;n++){var o=i[n],a=o.split("."),s=a[a.length-1],h=qe(a,r),u=e[o];h.data[s]=u,h.gl=t,Object.defineProperty(h,s,{get:We(s),set:Ge(s,u)})}return r}var We=function(t){return function(){return this.data[t].value}},He={float:function(t,e,r){t.uniform1f(e,r)},vec2:function(t,e,r){t.uniform2f(e,r[0],r[1])},vec3:function(t,e,r){t.uniform3f(e,r[0],r[1],r[2])},vec4:function(t,e,r){t.uniform4f(e,r[0],r[1],r[2],r[3])},int:function(t,e,r){t.uniform1i(e,r)},ivec2:function(t,e,r){t.uniform2i(e,r[0],r[1])},ivec3:function(t,e,r){t.uniform3i(e,r[0],r[1],r[2])},ivec4:function(t,e,r){t.uniform4i(e,r[0],r[1],r[2],r[3])},bool:function(t,e,r){t.uniform1i(e,r)},bvec2:function(t,e,r){t.uniform2i(e,r[0],r[1])},bvec3:function(t,e,r){t.uniform3i(e,r[0],r[1],r[2])},bvec4:function(t,e,r){t.uniform4i(e,r[0],r[1],r[2],r[3])},mat2:function(t,e,r){t.uniformMatrix2fv(e,!1,r)},mat3:function(t,e,r){t.uniformMatrix3fv(e,!1,r)},mat4:function(t,e,r){t.uniformMatrix4fv(e,!1,r)},sampler2D:function(t,e,r){t.uniform1i(e,r)}},Ye={float:function(t,e,r){t.uniform1fv(e,r)},vec2:function(t,e,r){t.uniform2fv(e,r)},vec3:function(t,e,r){t.uniform3fv(e,r)},vec4:function(t,e,r){t.uniform4fv(e,r)},int:function(t,e,r){t.uniform1iv(e,r)},ivec2:function(t,e,r){t.uniform2iv(e,r)},ivec3:function(t,e,r){t.uniform3iv(e,r)},ivec4:function(t,e,r){t.uniform4iv(e,r)},bool:function(t,e,r){t.uniform1iv(e,r)},bvec2:function(t,e,r){t.uniform2iv(e,r)},bvec3:function(t,e,r){t.uniform3iv(e,r)},bvec4:function(t,e,r){t.uniform4iv(e,r)},sampler2D:function(t,e,r){t.uniform1iv(e,r)},mat4:function(t,e,r){t.uniformMatrix4fv(e,!1,r)}};function Ge(t,e){return function(r){this.data[t].value=r;var i=this.data[t].location;1===e.size?He[e.type](this.gl,i,r):Ye[e.type](this.gl,i,r)}}function qe(t,e){for(var r=e,i=0;i<t.length-1;i++){var n=r[t[i]]||{data:{}};r[t[i]]=n,r=n}return r}var Ze=function(){function t(t,e,r,i,n){this.gl=t,i&&(e=Ve(e,i),r=Ve(r,i)),this.program=function(t,e,r,i){var n=Fe(t,t.VERTEX_SHADER,e),o=Fe(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,n),t.attachShader(a,o),i)for(var s in i)t.bindAttribLocation(a,i[s],s);return t.linkProgram(a),t.getProgramParameter(a,t.LINK_STATUS)||(console.error("Error: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(a,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(a)&&console.warn("Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(a)),t.deleteProgram(a),a=null),t.deleteShader(n),t.deleteShader(o),a}(t,e,r,n),this.attributes=function(t,e){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=t.getActiveAttrib(e,n),a=Ne(t,o.type);r[o.name]={type:a,size:Be(a),location:t.getAttribLocation(e,o.name),pointer:function(e,r,i,n){void 0===e&&(e=t.FLOAT),void 0===r&&(r=!1),void 0===i&&(i=0),void 0===n&&(n=0),t.vertexAttribPointer(this.location,this.size,e,r,i,n)}}}return r}(t,this.program),this.uniformData=function(t,e){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),n=0;n<i;n++){var o=t.getActiveUniform(e,n),a=o.name.replace(/\[.*?\]/,""),s=Ne(t,o.type);r[a]={type:s,size:o.size,location:t.getUniformLocation(e,a),value:Ue(s,o.size)}}return r}(t,this.program),this.uniforms=Xe(t,this.uniformData)}return t.prototype.bind=function(){return this.gl.useProgram(this.program),this},t.prototype.destroy=function(){this.attributes=null,this.uniformData=null,this.uniforms=null,this.gl.deleteProgram(this.program)},t}(),Ke=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","varying float vTextureId;","uniform sampler2D uSamplers[%count%];","void main(void){","vec4 color;","float textureId = floor(vTextureId+0.5);","%forloop%","gl_FragColor = color * vColor;","}"].join("\n");var Qe=function(){for(var t=[],e=[],r=0;r<32;r++)t[r]=r,e[r]=r;t[m.NORMAL_NPM]=m.NORMAL,t[m.ADD_NPM]=m.ADD,t[m.SCREEN_NPM]=m.SCREEN,e[m.NORMAL]=m.NORMAL_NPM,e[m.ADD]=m.ADD_NPM,e[m.SCREEN]=m.SCREEN_NPM;var i=[];return i.push(e),i.push(t),i}(),Je=0,$e=function(t){function e(e){var r=t.call(this,e)||this;r.vertSize=6,r.vertByteSize=4*r.vertSize,r.size=8e3,r.currentSize=0,r.currentIndexSize=0,r.aBuffers={},r.iBuffers={},r.shader=null,r.currentIndex=0,r.groups=[];for(var i=0;i<r.size/4;i++)r.groups[i]=new Te;return r.elements=[],r.vertexBuffers=[],r.indexBuffers=[],r.vaos=[],r.vaoMax=2,r.vertexCount=0,r.renderer.addEventListener("onPreRender",r.onPreRender,r),r}return S(e,t),e.prototype.onContextChange=function(){var t=this.renderer.gl;this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),16),this.MAX_TEXTURES=Se(this.MAX_TEXTURES,t),this.shader=function(t,e){var r=Ke;r=(r=r.replace(/%count%/gi,e)).replace(/%forloop%/gi,function(t){var e="";e+="\n",e+="\n";for(var r=0;r<t;r++)r>0&&(e+="\nelse "),r<t-1&&(e+="if(textureId == "+r+".0)"),e+="\n{",e+="\n\tcolor = texture2D(uSamplers["+r+"], vTextureCoord);",e+="\n}";return(e+="\n")+"\n"}(e));for(var i=new Ze(t,"precision highp float;attribute vec2 aVertexPosition;attribute vec2 aTextureCoord;attribute vec4 aColor;attribute float aTextureId;uniform mat3 projectionMatrix;varying vec2 vTextureCoord;varying vec4 vColor;varying float vTextureId;void main(void){gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);vTextureCoord = aTextureCoord;vTextureId = aTextureId;vColor = aColor;}",r),n=[],o=0;o<e;o++)n[o]=o;return i.bind(),i.uniforms.uSamplers=n,i}(t,this.MAX_TEXTURES),this.renderer.bindVao(null);for(var e=this.shader.attributes,r=0;r<this.vaoMax;r++){var i=this.vertexBuffers[r]=Re.createVertexBuffer(t,null,t.STREAM_DRAW),n=this.indexBuffers[r]=Re.createIndexBuffer(t,null,t.STREAM_DRAW),o=this.renderer.createVao().addIndex(n).addAttribute(i,e.aVertexPosition,t.FLOAT,!1,this.vertByteSize,0).addAttribute(i,e.aTextureCoord,t.FLOAT,!0,this.vertByteSize,8).addAttribute(i,e.aColor,t.UNSIGNED_BYTE,!0,this.vertByteSize,16);e.aTextureId&&o.addAttribute(i,e.aTextureId,t.FLOAT,!1,this.vertByteSize,20),this.vaos[r]=o}},e.prototype.onPreRender=function(){this.vertexCount=0},e.prototype.render=function(t){t._texture&&t._texture.valid&&(this.currentSize+t._vertexData.length/2>this.size&&this.flush(),this.elements[this.currentIndex++]=t,this.currentSize+=t._vertexData.length/2,this.currentIndexSize+=t._indices.length)},e.prototype.getIndexBuffer=function(t){var e=vt(Math.ceil(t/12)),r=ct(e),i=12*e,n=this.iBuffers[r];return n||(this.iBuffers[r]=n=new Uint16Array(i)),n},e.prototype.getAttributeBuffer=function(t){var e=vt(Math.ceil(t/8));ct(e);var r=8*e,i=this.aBuffers[r];return i||(this.aBuffers[r]=i=new Ce(r*this.vertByteSize)),i},e.prototype.flush=function(){if(0!==this.currentSize){var t,e,r,i=this.renderer.gl,n=this.MAX_TEXTURES,o=this.getAttributeBuffer(this.currentSize),a=this.getIndexBuffer(this.currentIndexSize),s=this.elements,h=this.groups,u=o.float32View,l=o.uint32View,c=this.renderer.textureGC.count,p=0,d=0,f=1,v=0,m=h[0],y=Qe[s[0]._texture.baseTexture.premultipliedAlpha?1:0][s[0]._blendMode];for(m.textureCount=0,m.start=0,m.blend=y,Je++,r=0;r<this.currentIndex;++r){var g=s[r];s[r]=null,t=g._texture.baseTexture;var x=Qe[t.premultipliedAlpha?1:0][g._blendMode];y!==x&&(y=x,e=null,v=n,Je++),e!==t&&(e=t,t._enabledId!==Je&&(v===n&&(Je++,v=0,m.size=d-m.start,(m=h[f++]).textureCount=0,m.blend=y,m.start=d),t._touchedId=c,t._enabledId=Je,t._id=v,m.textures[m.textureCount++]=t,v++)),this.packGeometry(g,u,l,a,p,d),p+=g._vertexData.length/2*this.vertSize,d+=g._indices.length}m.size=d-m.start,rt(),this.vertexBuffers[this.vertexCount].upload(o.vertices,0,!0),this.indexBuffers[this.vertexCount].upload(a,0,!0);var _=this.renderer.textureManager;for(r=0;r<f;r++){for(var b=h[r],T=b.textureCount,w=0;w<T;w++)b.textures[w]!=_.boundTextures[w]&&_.bindTexture(b.textures[w],w,!0),b.textures[w]=null;this.renderer.setBlendMode(b.blend),i.drawElements(b.type,b.size,i.UNSIGNED_SHORT,2*b.start)}this.currentIndex=0,this.currentSize=0,this.currentIndexSize=0}},e.prototype.packGeometry=function(t,e,r,i,n,o){for(var a=n/this.vertSize,s=t._uvs,h=t._indices,u=t._vertexData,l=t._texture.baseTexture._id,c=null==t._tintRGB?16777215:t._tintRGB,p=Math.min(t._worldAlpha,1),d=p<1&&t._texture.baseTexture.premultipliedAlpha?Lt(c,p):c+(255*p<<24),f=0;f<u.length;f+=2)e[n++]=u[f],e[n++]=u[f+1],e[n++]=s[f],e[n++]=s[f+1],r[n++]=d,e[n++]=l;for(f=0;f<h.length;f++)i[o++]=a+h[f]},e.prototype.start=function(){this.renderer.bindShader(this.shader),this.renderer.bindVao(this.vaos[this.vertexCount]),this.vertexBuffers[this.vertexCount].bind(),this.indexBuffers[this.vertexCount].bind()},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var e=0;e<this.vaoMax;e++)this.vaos[e]&&this.vaos[e].destroy();this.renderer.removeEventListener("onPreRender",this.onPreRender,this),this.shader&&(this.shader.destroy(),this.shader=null),this.vaos=null,t.prototype.destroy.call(this)},e}(we),tr=function(t){function e(){var e=t.call(this)||this;return e.transparent=!0,e._backgroundColor=0,e._backgroundColorRgba=[0,0,0,0],e._backgroundColorString="#000000",e.backgroundColor=e._backgroundColor,e._tempDisplayObjectParent=new te,e._lastObjectRendered=e._tempDisplayObjectParent,e}return S(e,t),e.prototype.resize=function(t,e){this.width=t,this.height=e},e.prototype.render=function(t,e,r){},e.prototype.destroy=function(){this.type=a.UNKNOWN,this.transparent=!1,this._backgroundColor=0,this._backgroundColorRgba=null,this._backgroundColorString=null,this._tempDisplayObjectParent=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor!==t&&(this._backgroundColor=t,this._backgroundColorString=It(t),Rt(t,this._backgroundColorRgba))},enumerable:!1,configurable:!0}),e}(D),er=function(){function t(t,e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=g.LINEAR),void 0===n&&(n=!1),this.gl=t,this.frameBuffer=null,this.texture=null,this.clearColor=[0,0,0,0],this.size=new B(0,0,1,1),this.projectionMatrix=new k,this.transform=null,this.frame=null,this.defaultFrame=new B,this.destinationFrame=null,this.sourceFrame=null,this.stencilBuffer=null,this.stencilMaskStack=[],this.filterData=null,this.filterPoolKey="",this.scaleMode=i,this.root=n,this.root?(this.frameBuffer=new De(t,100,100),this.frameBuffer.framebuffer=null):(this.frameBuffer=De.createRGBA(t,100,100),this.scaleMode===g.NEAREST?this.frameBuffer.texture.enableNearestScaling():this.frameBuffer.texture.enableLinearScaling(),this.texture=this.frameBuffer.texture),this.setFrame(),this.resize(e,r)}return t.prototype.clear=function(t){var e=t||this.clearColor;this.frameBuffer.clear(e[0],e[1],e[2],e[3])},t.prototype.attachStencilBuffer=function(){this.root||this.frameBuffer.enableStencil()},t.prototype.setFrame=function(t,e){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||this.destinationFrame},t.prototype.activate=function(){var t=this.gl;this.frameBuffer.bind(),this.calculateProjection(this.destinationFrame,this.sourceFrame),this.transform&&this.projectionMatrix.append(this.transform),this.destinationFrame!==this.sourceFrame?(t.enable(t.SCISSOR_TEST),t.scissor(0|this.destinationFrame.x,0|this.destinationFrame.y,0|this.destinationFrame.width,0|this.destinationFrame.height)):t.disable(t.SCISSOR_TEST),t.viewport(0|this.destinationFrame.x,0|this.destinationFrame.y,0|this.destinationFrame.width,0|this.destinationFrame.height)},t.prototype.calculateProjection=function(t,e){var r=this.projectionMatrix;e=e||t,r.identity(),this.root?(r.a=1/t.width*2,r.d=-1/t.height*2,r.tx=-1-e.x*r.a,r.ty=1-e.y*r.d):(r.a=1/t.width*2,r.d=1/t.height*2,r.tx=-1-e.x*r.a,r.ty=-1-e.y*r.d)},t.prototype.resize=function(t,e){if(t|=0,e|=0,this.size.width!==t||this.size.height!==e){this.size.width=t,this.size.height=e,this.defaultFrame.width=t,this.defaultFrame.height=e,this.frameBuffer.resize(t,e);var r=this.frame||this.size;this.calculateProjection(r)}},t.prototype.destroy=function(){this.frameBuffer.destroy(),this.frameBuffer=null,this.texture=null},t}(),rr=function(){function t(t){this._nextTextureLocation=0,this.renderer=t,this.gl=t.gl,this._managedTextures=[],this.renderer.addEventListener("onContextChange",this.onContextChange,this)}return t.prototype.onContextChange=function(){var t=this.gl,e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures=new Array(e),this.emptyTextures=new Array(e);var r=Ae.fromData(t,null,1,1),i={_glTextures:{}};i._glTextures[this.renderer.CONTEXT_UID]={};for(var n=0;n<e;n++){var o=new fe;o._glTextures[this.renderer.CONTEXT_UID]=r,this.boundTextures[n]=i,this.emptyTextures[n]=o,this.bindTexture(null,n)}},t.prototype.bindTexture=function(t,e,r){if((t=(t=t||this.emptyTextures[e]).baseTexture||t)._touchedId=this.renderer.textureGC.count,r)e=e||0;else{for(var i=0;i<this.boundTextures.length;i++)if(this.boundTextures[i]===t)return i;void 0===e&&(this._nextTextureLocation++,this._nextTextureLocation%=this.boundTextures.length,e=this.boundTextures.length-this._nextTextureLocation-1)}var n=this.gl,o=t._glTextures[this.renderer.CONTEXT_UID];return o?(this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),this.boundTextures[e]!==t&&n.bindTexture(n.TEXTURE_2D,o.texture),this.boundTextures[e]=t):this.updateTexture(t,e),e},t.prototype.getTexture=function(){},t.prototype.updateTexture=function(t,e){t="Event"===t.instanceType?t.target.baseTexture||t.target:t.baseTexture||t;var r=this.gl,i=!!t._glRenderTargets;if(!t.hasLoaded)return null;var n=this.boundTextures;if(void 0===e){e=0;for(var o=0;o<n.length;++o)if(n[o]===t){e=o;break}}n[e]=t,this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e));var a=t._glTextures[this.renderer.CONTEXT_UID];if(a)i?t._glRenderTargets[this.renderer.CONTEXT_UID].resize(t.width,t.height):t.source._data?a.uploadData(t.source._data,t.width,t.height):a.upload(t.source);else{if(i){var s=new er(this.gl,t.width,t.height,t.scaleMode,!1);s.resize(t.width,t.height),t._glRenderTargets[this.renderer.CONTEXT_UID]=s,a=s.texture}else(a=new Ae(this.gl,null,null,null,null)).premultiplyAlpha=!0,t.source._data?a.uploadData(t.source._data,t.width,t.height):a.upload(t.source);t._glTextures[this.renderer.CONTEXT_UID]=a,t.addEventListener("update",this.updateTexture,this),t.addEventListener("dispose",this.destroyTexture,this),this._managedTextures.push(t),t.isPowerOfTwo?(t.mipmap&&a.enableMipmap(),t.wrapMode===x.CLAMP?a.enableWrapClamp():t.wrapMode===x.REPEAT?a.enableWrapRepeat():a.enableWrapMirrorRepeat()):a.enableWrapClamp(),t.scaleMode===g.NEAREST?a.enableNearestScaling():a.enableLinearScaling()}return a},t.prototype.unbindTexture=function(t){var e=this.gl;t=t.baseTexture||t;for(var r=0;r<this.boundTextures.length;r++)this.boundTextures[r]===t&&(this.boundTextures[r]=this.emptyTextures[r],this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(e.TEXTURE_2D,this.emptyTextures[r]._glTextures[this.renderer.CONTEXT_UID].texture))},t.prototype.destroyTexture=function(t,e){if("Event"===t.instanceType&&(t=t.target),(t=t.baseTexture||t).hasLoaded){var r=this.renderer.CONTEXT_UID,i=t._glTextures,n=t._glRenderTargets;if(i[r]&&(this.unbindTexture(t),i[r].destroy(),t.removeEventListener("update",this.updateTexture,this),t.removeEventListener("dispose",this.destroyTexture,this),delete i[r],!e)){var o=this._managedTextures.indexOf(t);-1!==o&&Vt(this._managedTextures,o,1)}n&&n[r]&&(n[r].destroy(),delete n[r])}},t.prototype.removeAll=function(){for(var t=0;t<this._managedTextures.length;++t){var e=this._managedTextures[t];e._glTextures[this.renderer.CONTEXT_UID]&&delete e._glTextures[this.renderer.CONTEXT_UID]}},t.prototype.destroy=function(){for(var t=0;t<this._managedTextures.length;++t){var e=this._managedTextures[t];this.destroyTexture(e,!0)}this.renderer.removeEventListener("onContextChange",this.onContextChange,this),this.renderer=null,this._managedTextures=null},t}(),ir=function(){function t(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=3600,this.checkCountMax=600,this.mode=_.AUTO}return t.prototype.update=function(){this.count++,this.mode!==_.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run()))},t.prototype.run=function(){for(var t=this.renderer.textureManager,e=t._managedTextures,r=!1,i=0;i<e.length;i++){var n=e[i];!n._glRenderTargets&&this.count-n._touchedId>this.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){var o=0;for(i=0;i<e.length;i++)null!==e[i]&&(e[o++]=e[i]);e.length=o}},t.prototype.unload=function(t){var e=this.renderer.textureManager;t._texture&&t._texture._glRenderTargets&&e.destroyTexture(t._texture,!0);for(var r=t.children.length-1;r>=0;r--)this.unload(t.children[r])},t}();var nr=function(){function t(t){this.activeState=new Uint8Array(16),this.defaultState=new Uint8Array(16),this.defaultState[0]=1,this.gl=t,this.maxAttribs=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.attribState={tempAttribState:new Array(this.maxAttribs),attribState:new Array(this.maxAttribs)},this.blendModes=function(t,e){return void 0===e&&(e=[]),e[m.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.ADD]=[t.ONE,t.DST_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.NONE]=[0,0],e[m.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.ADD_NPM]=[t.SRC_ALPHA,t.DST_ALPHA,t.ONE,t.DST_ALPHA],e[m.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_COLOR],e[m.SRC_OVER]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[m.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[m.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[m.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[m.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[m.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[m.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[m.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[m.ERASE]=[t.ZERO,t.ONE,t.SRC_ALPHA,0],e[m.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.nativeVaoExtension=t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object")}return t.prototype.setState=function(t){this.setBlend(t[0]),this.setDepthTest(t[1]),this.setFrontFace(t[2]),this.setCullFace(t[3]),this.setBlendMode(t[4])},t.prototype.setBlend=function(t){t=t?1:0,this.activeState[0]!==t&&(this.activeState[0]=t,this.gl[t?"enable":"disable"](this.gl.BLEND))},t.prototype.setBlendMode=function(t){if(t!==this.activeState[4]){this.activeState[4]=t;var e=this.blendModes[t];2===e.length?this.gl.blendFunc(e[0],e[1]):this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3])}},t.prototype.setDepthTest=function(t){t=t?1:0,this.activeState[1]!==t&&(this.activeState[1]=t,this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST))},t.prototype.setCullFace=function(t){t=t?1:0,this.activeState[3]!==t&&(this.activeState[3]=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE))},t.prototype.setFrontFace=function(t){t=t?1:0,this.activeState[2]!==t&&(this.activeState[2]=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))},t.prototype.resetAttributes=function(){for(var t=0;t<this.attribState.tempAttribState.length;t++)this.attribState.tempAttribState[t]=0;for(t=0;t<this.attribState.attribState.length;t++)this.attribState.attribState[t]=0;for(t=1;t<this.maxAttribs;t++)this.gl.disableVertexAttribArray(t)},t.prototype.resetToDefault=function(){this.nativeVaoExtension&&this.nativeVaoExtension.bindVertexArrayOES(null),this.resetAttributes();for(var t=0;t<this.activeState.length;++t)this.activeState[t]=32;this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.setState(this.defaultState)},t.prototype.resetTo3D=function(){this.setDepthTest(1),this.setFrontFace(0),this.setCullFace(1)},t}(),or=function(){function t(t){this.renderer=t,this.emptyRenderer=new we(t),this.currentRenderer=this.emptyRenderer}return t.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t}();function ar(t){for(var e,r=new RegExp("^(projectionMatrix|uSampler|filterArea|filterClamp)$"),i={},n=t.replace(/\s+/g," ").split(/\s*;\s*/),o=0;o<n.length;o++){var a=n[o].trim();if(a.indexOf("uniform")>-1){var s=a.split(" "),h=s[1],u=s[2],l=1;u.indexOf("[")>-1&&(e=u.split(/\[|]/),u=e[0],l*=Number(e[1])),u.match(r)||(i[u]={value:Ue(h,l),name:u,type:h})}}return i}var sr={},hr=function(){function t(e,r,i){for(var n in this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=r||t.defaultFragmentSrc,this._blendMode=m.NORMAL,this.uniformData=i||function(t,e){var r=ar(t),i=ar(e);return E(E({},r),i)}(this.vertexSrc,this.fragmentSrc),this.uniforms={},this.uniformData)this.uniforms[n]=this.uniformData[n].value,this.uniformData[n].type&&(this.uniformData[n].type=this.uniformData[n].type.toLowerCase());this.glShaders={},sr[this.vertexSrc+this.fragmentSrc]||(sr[this.vertexSrc+this.fragmentSrc]=Ct()),this.glShaderKey=sr[this.vertexSrc+this.fragmentSrc],this.padding=4,this.resolution=1,this.enabled=!0,this.autoFit=!0}return Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),t.prototype.apply=function(t,e,r,i){t.applyFilter(this,e,r,i)},Object.defineProperty(t,"defaultVertexSrc",{get:function(){return["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 projectionMatrix;","uniform mat3 filterMatrix;","varying vec2 vTextureCoord;","varying vec2 vFilterCoord;","void main(void){","   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);","   vFilterCoord = ( filterMatrix * vec3( aTextureCoord, 1.0)  ).xy;","   vTextureCoord = aTextureCoord ;","}"].join("\n")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return["varying vec2 vTextureCoord;","varying vec2 vFilterCoord;","uniform sampler2D uSampler;","uniform sampler2D filterSampler;","void main(void){","   vec4 masky = texture2D(filterSampler, vFilterCoord);","   vec4 sample = texture2D(uSampler, vTextureCoord);","   vec4 color;","   if(mod(vFilterCoord.x, 1.0) > 0.5)","   {","     color = vec4(1.0, 0.0, 0.0, 1.0);","   }","   else","   {","     color = vec4(0.0, 1.0, 0.0, 1.0);","   }","   gl_FragColor = mix(sample, masky, 0.5);","   gl_FragColor *= sample.a;","}"].join("\n")},enumerable:!1,configurable:!0}),t}(),ur=["precision highp float;","varying vec2 v_rgbNW;","varying vec2 v_rgbNE;","varying vec2 v_rgbSW;","varying vec2 v_rgbSE;","varying vec2 v_rgbM;","varying vec2 vTextureCoord;","uniform sampler2D uSampler;","uniform vec4 filterArea;","#ifndef FXAA_REDUCE_MIN","#define FXAA_REDUCE_MIN   (1.0/ 128.0)","#endif","#ifndef FXAA_REDUCE_MUL","#define FXAA_REDUCE_MUL   (1.0 / 8.0)","#endif","#ifndef FXAA_SPAN_MAX","#define FXAA_SPAN_MAX     8.0","#endif","vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 resolution,","vec2 v_rgbNW, vec2 v_rgbNE,","vec2 v_rgbSW, vec2 v_rgbSE,","vec2 v_rgbM) {","vec4 color;","mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);","vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;","vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;","vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;","vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;","vec4 texColor = texture2D(tex, v_rgbM);","vec3 rgbM  = texColor.xyz;","vec3 luma = vec3(0.299, 0.587, 0.114);","float lumaNW = dot(rgbNW, luma);","float lumaNE = dot(rgbNE, luma);","float lumaSW = dot(rgbSW, luma);","float lumaSE = dot(rgbSE, luma);","float lumaM  = dot(rgbM,  luma);","float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));","float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));","mediump vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *","(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);","float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);","dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),","max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * inverseVP;","vec3 rgbA = 0.5 * (","texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +","texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);","vec3 rgbB = rgbA * 0.5 + 0.25 * (","texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +","texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);","float lumaB = dot(rgbB, luma);","if ((lumaB < lumaMin) || (lumaB > lumaMax))","color = vec4(rgbA, texColor.a);","else","color = vec4(rgbB, texColor.a);","return color;","}","void main() {","vec2 fragCoord = vTextureCoord * filterArea.xy;","vec4 color;","color = fxaa(uSampler, fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);","gl_FragColor = color;","}"].join("\n"),lr=function(t){function e(){return t.call(this,"precision highp float;attribute vec2 aVertexPosition;attribute vec2 aTextureCoord;uniform mat3 projectionMatrix;varying vec2 v_rgbNW;varying vec2 v_rgbNE;varying vec2 v_rgbSW;varying vec2 v_rgbSE;varying vec2 v_rgbM;uniform vec4 filterArea;varying vec2 vTextureCoord;vec2 mapCoord( vec2 coord ){coord *= filterArea.xy;coord += filterArea.zw;return coord;}vec2 unmapCoord( vec2 coord ){coord -= filterArea.zw;coord /= filterArea.xy;return coord;}void texcoords(vec2 fragCoord, vec2 resolution,out vec2 v_rgbNW, out vec2 v_rgbNE,out vec2 v_rgbSW, out vec2 v_rgbSE,out vec2 v_rgbM) {vec2 inverseVP = 1.0 / resolution.xy;v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;v_rgbM = vec2(fragCoord * inverseVP);}void main(void) {gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);vTextureCoord = aTextureCoord;vec2 fragCoord = vTextureCoord * filterArea.xy;texcoords(fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);}",ur)||this}return S(e,t),e}(hr),cr="precision highp float;attribute vec2 aVertexPosition;attribute vec2 aTextureCoord;uniform mat3 projectionMatrix;varying vec2 vTextureCoord;void main(void){gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);vTextureCoord = aTextureCoord;}",pr=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random());var i=t.call(this,cr,"precision mediump float;varying vec2 vTextureCoord;varying vec4 vColor;uniform float uNoise;uniform float uSeed;uniform sampler2D uSampler;float rand(vec2 co){return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);}void main(){vec4 color = texture2D(uSampler, vTextureCoord);float randomValue = rand(gl_FragCoord.xy * uSeed);float diff = (randomValue - 0.5) * uNoise;if (color.a > 0.0) {color.rgb /= color.a;}color.r += diff;color.g += diff;color.b += diff;color.rgb *= color.a;gl_FragColor = color;}")||this;return i.noise=e,i.seed=r,i}return S(e,t),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e}(hr),dr=function(t){function e(e,r){var i=this,n=new k;return e.renderable=!1,(i=t.call(this,"precision highp float;attribute vec2 aVertexPosition;attribute vec2 aTextureCoord;uniform mat3 projectionMatrix;uniform mat3 filterMatrix;varying vec2 vTextureCoord;varying vec2 vFilterCoord;void main(void){gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);vFilterCoord = ( filterMatrix * vec3( aTextureCoord, 1.0)  ).xy;vTextureCoord = aTextureCoord;}","precision mediump float;varying vec2 vFilterCoord;varying vec2 vTextureCoord;uniform vec2 scale;uniform sampler2D uSampler;uniform sampler2D mapSampler;uniform vec4 filterArea;uniform vec4 filterClamp;void main(void){vec4 map = texture2D(mapSampler, vFilterCoord);map -= 0.5;map.xy *= scale / filterArea.xy;gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), filterClamp.xy, filterClamp.zw));}")||this).maskSprite=e,i.maskMatrix=n,i.uniforms.mapSampler=e._texture,i.uniforms.filterMatrix=n,i.uniforms.scale={x:1,y:1},null==r&&(r=20),i.scale=new N(r,r),i}return S(e,t),e.prototype.apply=function(t,e,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y,t.applyFilter(this,e,r)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e}(hr),fr=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform float strength;","uniform mat3 projectionMatrix;","varying vec2 vBlurTexCoords[%size%];","void main(void)","{","gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);","%blur%","}"].join("\n");function vr(t,e){var r,i=Math.ceil(t/2),n=fr,o="";r=e?"vBlurTexCoords[%index%] = aTextureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = aTextureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a<t;a++){var s=r.replace("%index%",a);o+=s=s.replace("%sampleIndex%",a-(i-1)+".0"),o+="\n"}return n=(n=n.replace("%blur%",o)).replace("%size%",t)}var mr={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},yr=["precision mediump float;","varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{","    gl_FragColor = vec4(0.0);","    %blur%","}"].join("\n");function gr(t){for(var e,r=mr[t],i=r.length,n=yr,o="",a=0;a<t;a++){var s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",a+"");e=a,a>=i&&(e=t-a-1),o+=s=s.replace("%value%",r[e]),o+="\n"}return n=(n=n.replace("%blur%",o)).replace("%size%",t)}function xr(t){for(var e=t.getParameter(t.MAX_VARYING_VECTORS),r=15;r>e;)r-=2;return r}var _r=function(t){function e(e,r,i,n){var o=this,a=vr(n=n||5,!0),s=gr(n);return(o=t.call(this,a,s)||this).resolution=i||1,o._quality=0,o.quality=r||4,o.strength=e||8,o.firstRun=!0,o}return S(e,t),Object.defineProperty(e.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=2*Math.abs(t),this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,e,r,i){if(this.firstRun){var n=xr(t.renderer.gl);this.vertexSrc=vr(n,!0),this.fragmentSrc=gr(n),this.firstRun=!1}if(this.uniforms.strength=1/r.size.width*(r.size.width/e.size.width),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{for(var o=t.getRenderTarget(!0),a=e,s=o,h=0;h<this.passes-1;h++){t.applyFilter(this,a,s,!0);var u=s;s=a,a=u}t.applyFilter(this,a,r,i),t.returnRenderTarget(o)}},e}(hr),br=function(t){function e(e,r,i,n){var o=this,a=vr(n=n||5,!1),s=gr(n);return(o=t.call(this,a,s)||this).resolution=i||1,o._quality=0,o.quality=r||4,o.strength=e||8,o.firstRun=!0,o}return S(e,t),Object.defineProperty(e.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=2*Math.abs(t),this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,e,r,i){if(this.firstRun){var n=xr(t.renderer.gl);this.vertexSrc=vr(n,!1),this.fragmentSrc=gr(n),this.firstRun=!1}if(this.uniforms.strength=1/r.size.height*(r.size.height/e.size.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{for(var o=t.getRenderTarget(!0),a=e,s=o,h=0;h<this.passes-1;h++){t.applyFilter(this,a,s,!0);var u=s;s=a,a=u}t.applyFilter(this,a,r,i),t.returnRenderTarget(o)}},e}(hr),Tr=function(t){function e(e,r,i,n){var o=t.call(this)||this;return o.blurXFilter=new _r(e,r,i,n),o.blurYFilter=new br(e,r,i,n),o.padding=0,o.resolution=i||1,o.quality=r||4,o.blur=e||8,o}return S(e,t),e.prototype.apply=function(t,e,r){var i=t.getRenderTarget(!0);this.blurXFilter.apply(t,e,i,!0),this.blurYFilter.apply(t,i,r,!1),t.returnRenderTarget(i)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(t){this.blurXFilter.quality=this.blurYFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t,this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t,this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(t){this.blurYFilter.blendMode=t},enumerable:!1,configurable:!0}),e}(hr),wr=function(t){function e(e){var r=t.call(this,cr,"precision mediump float;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform float m[20];uniform float uAlpha;void main(void){vec4 c = texture2D(uSampler, vTextureCoord);if (uAlpha == 0.0) {gl_FragColor = c;return;}if (c.a > 0.0) {c.rgb /= c.a;}vec4 result;result.r = (m[0] * c.r);result.r += (m[1] * c.g);result.r += (m[2] * c.b);result.r += (m[3] * c.a);result.r += m[4];result.g = (m[5] * c.r);result.g += (m[6] * c.g);result.g += (m[7] * c.b);result.g += (m[8] * c.a);result.g += m[9];result.b = (m[10] * c.r);result.b += (m[11] * c.g);result.b += (m[12] * c.b);result.b += (m[13] * c.a);result.b += m[14];result.a = (m[15] * c.r);result.a += (m[16] * c.g);result.a += (m[17] * c.b);result.a += (m[18] * c.a);result.a += m[19];vec3 rgb = mix(c.rgb, result.rgb, uAlpha);rgb *= result.a;gl_FragColor = vec4(rgb, result.a);}")||this;return r.uniforms.m=e||[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],r.alpha=1,r}return S(e,t),e.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t},e.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},e.prototype.brightness=function(t,e){var r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.greyscale=function(t,e){var r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},e.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var r=Math.cos(t),i=Math.sin(t),n=1/3,o=(0,Math.sqrt)(n),a=[r+(1-r)*n,n*(1-r)-o*i,n*(1-r)+o*i,0,0,n*(1-r)+o*i,r+n*(1-r),n*(1-r)-o*i,0,0,n*(1-r)-o*i,n*(1-r)+o*i,r+n*(1-r),0,0,0,0,0,1,0];this._loadMatrix(a,e)},e.prototype.contrast=function(t,e){var r=(t||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.saturate=function(t,e){void 0===t&&(t=0);var r=2*t/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},e.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},e.prototype.technicolor=function(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)},e.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},e.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},e.prototype.kodachrome=function(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)},e.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},e.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},e.prototype.colorTone=function(t,e,r,i,n){var o=((r=r||16770432)>>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,h=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,l=(255&i)/255,c=[.3,.59,.11,0,0,o,a,s,t=t||.2,0,h,u,l,e=e||.15,0,o-h,a-u,s-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(hr);wr.prototype.grayscale=wr.prototype.greyscale;var Mr=function(t){function e(e){void 0===e&&(e=1);var r=t.call(this,cr,"precision mediump float;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform float uAlpha;void main(void){gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;}")||this;return r.alpha=e,r.glShaderKey="alpha",r}return S(e,t),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(hr),Sr=new k,Er=function(){function t(t,e){void 0===e&&(e=.5),this._texture=t,this.mapCoord=new k,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._lastTextureID=-1,this.clampOffset=0,this.clampMargin=e}return Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._lastTextureID=-1},enumerable:!1,configurable:!0}),t.prototype.multiplyUvs=function(t,e){void 0===e&&(e=t);for(var r=this.mapCoord,i=0;i<t.length;i+=2){var n=t[i],o=t[i+1];e[i]=n*r.a+o*r.c+r.tx,e[i+1]=n*r.b+o*r.d+r.ty}return e},t.prototype.update=function(t){var e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._lastTextureID===e._updateID)return!1;this._lastTextureID=e._updateID;var r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);var i=e.orig,n=e.trim;n&&(Sr.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Sr));var o=e.baseTexture,a=this.uClampFrame,s=this.clampMargin,h=this.clampOffset;return a[0]=(e._frame.x+s+h)/o.width,a[1]=(e._frame.y+s+h)/o.height,a[2]=(e._frame.x+e._frame.width-s+h)/o.width,a[3]=(e._frame.y+e._frame.height-s+h)/o.height,this.uClampOffset[0]=h/o.width,this.uClampOffset[1]=h/o.height,!0},t}(),Cr=function(t){function e(e){var r=this,i=new k;return r=t.call(this,"attribute vec2 aVertexPosition;attribute vec2 aTextureCoord;uniform mat3 projectionMatrix;uniform mat3 otherMatrix;varying vec2 vMaskCoord;varying vec2 vTextureCoord;void main(void){gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);vTextureCoord = aTextureCoord;vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0)  ).xy;}","precision mediump float;varying vec2 vMaskCoord;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform sampler2D mask;uniform float alpha;uniform vec4 maskClamp;void main(void){float clip = step(3.5,step(maskClamp.x, vMaskCoord.x) +step(maskClamp.y, vMaskCoord.y) +step(vMaskCoord.x, maskClamp.z) +step(vMaskCoord.y, maskClamp.w));vec4 original = texture2D(uSampler, vTextureCoord);vec4 masky = texture2D(mask, vMaskCoord);original *= (masky.a * alpha * clip);gl_FragColor = original;}")||this,e.renderable=!1,r.maskSprite=e,r.maskMatrix=i,r}return S(e,t),e.prototype.apply=function(t,e,r){var i=this.maskSprite,n=this.maskSprite.texture;n&&n.valid&&(n.transform||(n.transform=new Er(n,0)),n.transform.update(),this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,i).prepend(n.transform.mapCoord),this.uniforms.alpha=i._worldAlpha,this.uniforms.maskClamp=n.transform.uClampFrame,t.applyFilter(this,e,r))},e}(hr),Ar=["precision mediump float;","varying vec2 vTextureCoord;","uniform sampler2D uSampler;","const float resolution=1024.0;","uniform float radius;","uniform vec2 dir;","void main() {","vec4 sum = vec4(0.0);","vec2 tc = vTextureCoord;","float blur = radius/resolution;","float hstep = dir.x;","float vstep = dir.y;","sum += texture2D(uSampler, vec2(tc.x - 4.0*blur*hstep, tc.y - 4.0*blur*vstep)) * 0.0162162162;","sum += texture2D(uSampler, vec2(tc.x - 3.0*blur*hstep, tc.y - 3.0*blur*vstep)) * 0.0540540541;","sum += texture2D(uSampler, vec2(tc.x - 2.0*blur*hstep, tc.y - 2.0*blur*vstep)) * 0.1216216216;","sum += texture2D(uSampler, vec2(tc.x - 1.0*blur*hstep, tc.y - 1.0*blur*vstep)) * 0.1945945946;","sum += texture2D(uSampler, vec2(tc.x, tc.y)) * 0.2270270270;","sum += texture2D(uSampler, vec2(tc.x + 1.0*blur*hstep, tc.y + 1.0*blur*vstep)) * 0.1945945946;","sum += texture2D(uSampler, vec2(tc.x + 2.0*blur*hstep, tc.y + 2.0*blur*vstep)) * 0.1216216216;","sum += texture2D(uSampler, vec2(tc.x + 3.0*blur*hstep, tc.y + 3.0*blur*vstep)) * 0.0540540541;","sum += texture2D(uSampler, vec2(tc.x + 4.0*blur*hstep, tc.y + 4.0*blur*vstep)) * 0.0162162162;","vec4 cc= texture2D(uSampler,vTextureCoord );","gl_FragColor =vec4(sum.rgb, cc.a);","}"].join("\n"),Pr=function(t){function e(e){void 0===e&&(e=.5);var r=t.call(this,cr,Ar)||this;return r.blur=e,r.uniforms.dir=[1,1],r}return S(e,t),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur!==t&&(t>1&&(t=1),t<0&&(t=0),this._blur=t,this.uniforms.radius=10*t)},enumerable:!1,configurable:!0}),e}(hr),Or=["precision mediump float;","uniform sampler2D uSampler;","varying vec2 vTextureCoord;","uniform float threshold;","void main() {","vec4 color = texture2D(uSampler, vTextureCoord);","float _max = max(max(color.r, color.g), color.b);","float _min = min(min(color.r, color.g), color.b);","float brightness = (_max + _min) * 0.5;","if(brightness > threshold) {","gl_FragColor = color;","} else {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join("\n"),Rr=function(t){function e(e){void 0===e&&(e=.5);var r=t.call(this,cr,Or)||this;return r.threshold=e,r}return S(e,t),Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(hr),Ir=["precision mediump float;","varying vec2 vTextureCoord;","uniform sampler2D uSampler;","uniform vec2 uOffset;","uniform vec4 filterClamp;","void main(void)","{","vec4 color = vec4(0.0);","color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));","color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));","color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));","color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));","color *= 0.25;","gl_FragColor = color;","}"].join("\n"),Dr=["precision mediump float;","varying vec2 vTextureCoord;","uniform sampler2D uSampler;","uniform vec2 uOffset;","void main(void)","{","vec4 color = vec4(0.0);","color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));","color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));","color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));","color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));","color *= 0.25;","gl_FragColor = color;","}"].join("\n"),Fr=function(t){function e(e,r,i){void 0===e&&(e=4),void 0===r&&(r=3),void 0===i&&(i=!1);var n=t.call(this,cr,i?Ir:Dr)||this;return n.uniforms.uOffset=new Float32Array(2),n._pixelSize=new N,n.pixelSize=1,n._clamp=i,n._kernels=null,Array.isArray(e)?n.kernels=e:(n._blur=e,n.quality=r),n}return S(e,t),e.prototype.apply=function(t,e,r,i){var n,o=this.pixelSize.x/e.size.width,a=this.pixelSize.y/e.size.height;if(1===this._quality||0===this._blur)n=this._kernels[0]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,t.applyFilter(this,e,r,i);else{for(var s=t.getRenderTarget(),h=e,u=s,l=void 0,c=this._quality-1,p=0;p<c;p++)n=this._kernels[p]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,t.applyFilter(this,h,u,!0),l=h,h=u,u=l;n=this._kernels[c]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,t.applyFilter(this,h,r,i),t.returnRenderTarget(s)}},e.prototype._generateKernels=function(){var t=this._blur,e=this._quality,r=[t];if(t>0)for(var i=t,n=t/e,o=1;o<e;o++)i-=n,r.push(i);this._kernels=r},Object.defineProperty(e.prototype,"kernels",{get:function(){return this._kernels},set:function(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){"number"==typeof t?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof N?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(hr),Nr=["precision mediump float;","uniform sampler2D uSampler;","varying vec2 vTextureCoord;","uniform sampler2D bloomTexture;","uniform float bloomScale;","uniform float brightness;","void main() {","vec4 color = texture2D(uSampler, vTextureCoord);","color.rgb *= brightness;","vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);","bloomColor.rgb *= bloomScale;","gl_FragColor = color + bloomColor;","}"].join("\n"),kr=function(t){function e(e){var r=t.call(this,cr,Nr)||this;"number"==typeof e&&(e={threshold:e}),e=E({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:1},e),r.bloomScale=e.bloomScale,r.brightness=e.brightness;var i=e.kernels,n=e.blur,o=e.quality,a=e.pixelSize,s=e.resolution;return r._extractFilter=new Rr(e.threshold),r._extractFilter.resolution=s,r._blurFilter=i?new Fr(i):new Fr(n,o),r.pixelSize=a,r.resolution=s,r}return S(e,t),e.prototype.apply=function(t,e,r,i){var n=t.getRenderTarget();this._extractFilter.apply(t,e,n,!0);var o=t.getRenderTarget();this._blurFilter.apply(t,n,o,!0),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=o,t.applyFilter(this,e,r,i),t.returnRenderTarget(o),t.returnRenderTarget(n)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e}(hr),Lr=["precision mediump float;","varying vec2 vTextureCoord;","uniform sampler2D uSampler;","uniform float gamma;","uniform float contrast;","uniform float saturation;","uniform float brightness;","uniform float red;","uniform float green;","uniform float blue;","uniform float alpha;","void main(void)","{","vec4 c = texture2D(uSampler, vTextureCoord);","if (c.a > 0.0) {","c.rgb /= c.a;","vec3 rgb = pow(c.rgb, vec3(1. / gamma));","rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);","rgb.r *= red;","rgb.g *= green;","rgb.b *= blue;","c.rgb = rgb * brightness;","c.rgb *= c.a;","}","gl_FragColor = c * alpha;","}"].join("\n"),Br=function(t){function e(e){var r=t.call(this,cr,Lr)||this;return r.gamma=1,r.saturation=1,r.contrast=1,r.brightness=1,r.red=1,r.green=1,r.blue=1,r.alpha=1,"object"==typeof e&&Object.keys(e).forEach((function(t){r[t]=e[t]})),r}return S(e,t),e.prototype.apply=function(t,e,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,r,i)},e}(hr),zr=function(){function t(t){this.renderer=t,this.scissor=!1,this.scissorData=null,this.scissorRenderTarget=null,this.enableScissor=!0,this.alphaMaskPool=[],this.alphaMaskIndex=0}return t.prototype.pushMask=function(t,e){e.texture?this.pushSpriteMask(t,e):this.pushStencilMask(e)},t.prototype.popMask=function(t,e){e.texture?this.popSpriteMask():this.popStencilMask()},t.prototype.pushSpriteMask=function(t,e){var r=this.alphaMaskPool[this.alphaMaskIndex];r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new Cr(e)]),r[0].resolution=1,r[0].maskSprite=e;var i=t.filterArea;t.filterArea=e.getBounds(!0),this.renderer.filterManager.pushFilter(t,r),t.filterArea=i,this.alphaMaskIndex++},t.prototype.popSpriteMask=function(){this.renderer.filterManager.popFilter(),this.alphaMaskIndex--},t.prototype.pushStencilMask=function(t){this.renderer.batchManager.flush(),this.renderer.stencilManager.pushStencil(t)},t.prototype.popStencilMask=function(){this.renderer.stencilManager.popStencil()},t.prototype.pushScissorMask=function(t,e){e.renderable=!0;var r=this.renderer._activeRenderTarget,i=e.getBounds();i.fit(r.size),e.renderable=!1,this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(i.x,r.root?r.size.height-i.y-i.height:i.y,i.width,i.height),this.scissorRenderTarget=r,this.scissorData=e,this.scissor=!0},t.prototype.popScissorMask=function(){this.scissorRenderTarget=null,this.scissorData=null,this.scissor=!1;var t=this.renderer.gl;t.disable(t.SCISSOR_TEST)},t.prototype.destroy=function(){this.renderer=null},t}(),Ur=function(){function t(t){this.renderer=t,this.stencilMaskStack=null}return t.prototype.setMaskStack=function(t){this.stencilMaskStack=t;var e=this.renderer.gl;0===t.length?e.disable(e.STENCIL_TEST):e.enable(e.STENCIL_TEST)},t.prototype.pushStencil=function(t){this.renderer._activeRenderTarget.attachStencilBuffer();var e=this.renderer.gl,r=this.stencilMaskStack.length;0===r&&e.enable(e.STENCIL_TEST),this.stencilMaskStack.push(t),e.colorMask(!1,!1,!1,!1),e.stencilFunc(e.EQUAL,r,this._getBitwiseMask()),e.stencilOp(e.KEEP,e.KEEP,e.INCR),t.renderable=!0;var i=t._worldAlpha;t._worldAlpha=1,t.renderWebGL(this.renderer),this.renderer.batchManager.flush(),t.renderable=!1,t._worldAlpha=i,this._useCurrent()},t.prototype.popStencil=function(){var t=this.renderer.gl,e=this.stencilMaskStack.pop();if(0===this.stencilMaskStack.length)t.disable(t.STENCIL_TEST),t.clear(t.STENCIL_BUFFER_BIT),t.clearStencil(0);else{t.colorMask(!1,!1,!1,!1),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0;var r=e._worldAlpha;e._worldAlpha=1,e.renderWebGL(this.renderer),this.renderer.batchManager.flush(),e.renderable=!1,e._worldAlpha=r,this._useCurrent()}},t.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.stencilMaskStack.length,this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},t.prototype._getBitwiseMask=function(){return(1<<this.stencilMaskStack.length)-1},t.prototype.destroy=function(){this.renderer=null,this.stencilMaskStack=null},t}();var jr=function(){function t(t,e){this.gl=t,this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.interleaved=new Float32Array(16);for(var r=0;r<4;r++)this.interleaved[4*r]=this.vertices[2*r],this.interleaved[4*r+1]=this.vertices[2*r+1],this.interleaved[4*r+2]=this.uvs[2*r],this.interleaved[4*r+3]=this.uvs[2*r+1];this.indices=function(t){for(var e=6*t,r=new Uint16Array(e),i=0,n=0;i<e;i+=6,n+=4)r[i+0]=n+0,r[i+1]=n+1,r[i+2]=n+2,r[i+3]=n+0,r[i+4]=n+2,r[i+5]=n+3;return r}(1),this.vertexBuffer=Re.createVertexBuffer(t,this.interleaved,t.STATIC_DRAW),this.indexBuffer=Re.createIndexBuffer(t,this.indices,t.STATIC_DRAW),this.vao=new Ie(t,e)}return t.prototype.initVao=function(t){this.vao.clear().addIndex(this.indexBuffer).addAttribute(this.vertexBuffer,t.attributes.aVertexPosition,this.gl.FLOAT,!1,16,0).addAttribute(this.vertexBuffer,t.attributes.aTextureCoord,this.gl.FLOAT,!1,16,8)},t.prototype.map=function(t,e){var r=0,i=0;return this.uvs[0]=r,this.uvs[1]=i,this.uvs[2]=r+e.width/t.width,this.uvs[3]=i,this.uvs[4]=r+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=r,this.uvs[7]=i+e.height/t.height,r=e.x,i=e.y,this.vertices[0]=r,this.vertices[1]=i,this.vertices[2]=r+e.width,this.vertices[3]=i,this.vertices[4]=r+e.width,this.vertices[5]=i+e.height,this.vertices[6]=r,this.vertices[7]=i+e.height,this},t.prototype.upload=function(){for(var t=0;t<4;t++)this.interleaved[4*t]=this.vertices[2*t],this.interleaved[4*t+1]=this.vertices[2*t+1],this.interleaved[4*t+2]=this.uvs[2*t],this.interleaved[4*t+3]=this.uvs[2*t+1];return this.vertexBuffer.upload(this.interleaved),this},t.prototype.destroy=function(){var t=this.gl;t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.indexBuffer),this.gl=null,this.vertices=null,this.uvs=null,this.interleaved=null,this.indices=null,this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.vao.destroy()},t}();var Vr=function(){function t(){this.renderTarget=null,this.target=null,this.resolution=1,this.sourceFrame=new B,this.destinationFrame=new B,this.filters=[]}return t.prototype.clear=function(){this.filters=null,this.target=null,this.renderTarget=null},t}(),Xr=function(){function t(t){this.renderer=t,this.gl=this.renderer.gl,this.quad=new jr(this.gl,t.state.attribState),this.shaderCache={},this.pool={},this.filterData=null,this.managedFilters=[],this.renderer.addEventListener("onPreRender",this.onPreRender,this),this._screenWidth=t.width,this._screenHeight=t.height}return t.prototype.pushFilter=function(t,e){var r=this.renderer,i=this.filterData;if(!i){var n=new Vr;n.sourceFrame=n.destinationFrame=this.renderer._activeRenderTarget.size,n.renderTarget=r._activeRenderTarget,this.renderer._activeRenderTarget.filterData=i={index:0,stack:[n]},this.filterData=i}var o=i.stack[++i.index],a=i.stack[0].destinationFrame;o||(o=i.stack[i.index]=new Vr);var s=e[0].resolution,h=0|e[0].padding,u=t.filterArea||t.getBounds(!0),l=o.sourceFrame,c=o.destinationFrame;l.x=(u.x*s|0)/s,l.y=(u.y*s|0)/s,l.width=(u.width*s|0)/s,l.height=(u.height*s|0)/s,i.stack[0].renderTarget.transform||e[0].autoFit&&l.fit(a),l.pad(h),c.width=l.width,c.height=l.height;var p=this.getPotRenderTarget(r.gl,l.width,l.height,s);o.target=t,o.filters=e,o.resolution=s,o.renderTarget=p,p.setFrame(c,l),r.bindRenderTarget(p),p.clear()},t.prototype.popFilter=function(){var t=this.filterData,e=t.stack[t.index-1],r=t.stack[t.index];this.quad.map(r.renderTarget.size,r.sourceFrame).upload();var i=r.filters;if(1===i.length)i[0].apply(this,r.renderTarget,e.renderTarget,!1,r),this.freePotRenderTarget(r.renderTarget);else{var n=r.renderTarget,o=this.getPotRenderTarget(this.renderer.gl,r.sourceFrame.width,r.sourceFrame.height,r.resolution);o.setFrame(r.destinationFrame,r.sourceFrame),o.clear();var a=0;for(a=0;a<i.length-1;++a){i[a].apply(this,n,o,!0,r);var s=n;n=o,o=s}i[a].apply(this,n,e.renderTarget,!1,r),this.freePotRenderTarget(n),this.freePotRenderTarget(o)}r.clear(),t.index--,0===t.index&&(this.filterData=null)},t.prototype.applyFilter=function(t,e,r,i){var n=this.renderer,o=n.gl,a=t.glShaders[n.CONTEXT_UID];a||(t.glShaderKey?(a=this.shaderCache[t.glShaderKey])||(a=new Ze(this.gl,t.vertexSrc,t.fragmentSrc),t.glShaders[n.CONTEXT_UID]=this.shaderCache[t.glShaderKey]=a,this.managedFilters.push(t)):(a=t.glShaders[n.CONTEXT_UID]=new Ze(this.gl,t.vertexSrc,t.fragmentSrc),this.managedFilters.push(t)),n.bindVao(null),this.quad.initVao(a)),n.bindVao(this.quad.vao),n.bindRenderTarget(r),i&&(o.disable(o.SCISSOR_TEST),n.clear(),o.enable(o.SCISSOR_TEST)),r===n.maskManager.scissorRenderTarget&&n.maskManager.pushScissorMask(null,n.maskManager.scissorData),n.bindShader(a);var s=this.renderer.textureManager.emptyTextures[0];this.renderer.textureManager.boundTextures[0]=s,this.syncUniforms(a,t),n.state.setBlendMode(t.blendMode),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e.texture.texture),this.quad.vao.draw(this.renderer.gl.TRIANGLES,6,0),o.bindTexture(o.TEXTURE_2D,s._glTextures[this.renderer.CONTEXT_UID].texture),this.renderer.textureManager.currentLocation=-1},t.prototype.syncUniforms=function(t,e){var r,i=e.uniformData,n=e.uniforms,o=1;if(t.uniforms.filterArea){r=this.filterData.stack[this.filterData.index];var a=t.uniforms.filterArea;a[0]=r.renderTarget.size.width,a[1]=r.renderTarget.size.height,a[2]=r.sourceFrame.x,a[3]=r.sourceFrame.y,t.uniforms.filterArea=a}if(t.uniforms.filterClamp){r=r||this.filterData.stack[this.filterData.index];var s=t.uniforms.filterClamp;s[0]=0,s[1]=0,s[2]=(r.sourceFrame.width-1)/r.renderTarget.size.width,s[3]=(r.sourceFrame.height-1)/r.renderTarget.size.height,t.uniforms.filterClamp=s}for(var h in i){var u=i[h].type;if("sampler2d"===u&&0!==n[h]){if(n[h].baseTexture)t.uniforms[h]=this.renderer.textureManager.bindTexture(n[h].baseTexture,o);else{t.uniforms[h]=o;var l=this.renderer.gl;this.renderer.textureManager.boundTextures[o]=this.renderer.textureManager.emptyTextures[o],l.activeTexture(l.TEXTURE0+o),n[h].texture.bind()}o++}else if("mat3"===u)void 0!==n[h].a?t.uniforms[h]=n[h].toArray(!0):t.uniforms[h]=n[h];else if("vec2"===u)if(void 0!==n[h].x){var c=t.uniforms[h]||new Float32Array(2);c[0]=n[h].x,c[1]=n[h].y,t.uniforms[h]=c}else t.uniforms[h]=n[h];else"float"===u?t.uniforms.data[h].value!==i[h]&&(t.uniforms[h]=n[h]):t.uniforms[h]=n[h]}},t.prototype.getRenderTarget=function(t,e){var r=this.filterData.stack[this.filterData.index],i=this.getPotRenderTarget(this.renderer.gl,r.sourceFrame.width,r.sourceFrame.height,e||r.resolution);return i.setFrame(r.destinationFrame,r.sourceFrame),i},t.prototype.returnRenderTarget=function(t){this.freePotRenderTarget(t)},t.prototype.calculateScreenSpaceMatrix=function(t){var e=this.filterData.stack[this.filterData.index];return function(t,e,r){var i=t.identity();return i.translate(e.x/r.width,e.y/r.height),i.scale(r.width,r.height),i}(t,e.sourceFrame,e.renderTarget.size)},t.prototype.calculateNormalizedScreenSpaceMatrix=function(t){var e=this.filterData.stack[this.filterData.index];return function(t,e,r){var i=t.identity();i.translate(e.x/r.width,e.y/r.height);var n=r.width/e.width,o=r.height/e.height;return i.scale(n,o),i}(t,e.sourceFrame,e.renderTarget.size)},t.prototype.calculateSpriteMatrix=function(t,e){var r=this.filterData.stack[this.filterData.index];return function(t,e,r,i){var n=i._texture.orig,o=t.set(r.width,0,0,r.height,e.x,e.y),a=k.TEMP_MATRIX.copy(i.worldMatrix);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(i.anchorTexture.x,i.anchorTexture.y),o}(t,r.sourceFrame,r.renderTarget.size,e)},t.prototype.destroy=function(t){void 0===t&&(t=!1);var e=this.renderer,r=this.managedFilters;e.removeEventListener("onPreRender",this.onPreRender,this),this.renderer=null;for(var i=0;i<r.length;i++)t||r[i].glShaders[e.CONTEXT_UID].destroy(),delete r[i].glShaders[e.CONTEXT_UID];this.shaderCache={},t?this.pool={}:this.emptyPool()},t.prototype.getPotRenderTarget=function(t,e,r,i){var n="screen";r*=i,(e*=i)===this._screenWidth&&r===this._screenHeight||(n=(65535&(e=vt(e)))<<16|65535&(r=vt(r))),this.pool[n]||(this.pool[n]=[]);var o=this.pool[n].pop();if(!o){var a=this.renderer.textureManager.boundTextures[0];t.activeTexture(t.TEXTURE0),o=new er(t,e,r,void 0),t.bindTexture(t.TEXTURE_2D,a._glTextures[this.renderer.CONTEXT_UID].texture),this.renderer.textureManager.currentLocation=-1}return o.resolution=i,o.defaultFrame.width=o.size.width=e/i,o.defaultFrame.height=o.size.height=r/i,o.filterPoolKey=n,o},t.prototype.emptyPool=function(){for(var t in this.pool){var e=this.pool[t];if(e)for(var r=0;r<e.length;r++)e[r].destroy(!0)}this.pool={}},t.prototype.freePotRenderTarget=function(t){this.pool[t.filterPoolKey].push(t)},t.prototype.onPreRender=function(){if(this._screenWidth!==this.renderer.width||this._screenHeight!==this.renderer.height){this._screenWidth=this.renderer.width,this._screenHeight=this.renderer.height;var t=this.pool.screen;if(t)for(var e=0;e<t.length;e++)t[e].destroy(!0);this.pool.screen=[]}},t}(),Wr=0,Hr=function(t){function e(r,i,n){var o=t.call(this)||this;return o.plugins={},o._instanceType="WebglRenderer",o.type=a.WEBGL,o.handleContextLost=o.handleContextLost.bind(o),o.handleContextRestored=o.handleContextRestored.bind(o),o._backgroundColorRgba[3]=o.transparent?0:1,o.gl=r,o.CONTEXT_UID=Wr++,o.maskManager=new zr(o),o.stencilManager=new Ur(o),o.batchManager=new or(o),o.textureManager=null,o.initPlugins(e.__plugins),o.state=new nr(o.gl),o.renderingToScreen=!0,o._activeShader=null,o._activeVao=null,o._activeRenderTarget=null,o._initContext(),o.resize(i,n),o}return S(e,t),e.prototype._initContext=function(){var t=this.gl;t.isContextLost()&&t.getExtension("WEBGL_lose_context")&&t.getExtension("WEBGL_lose_context").restoreContext(),this._activeShader=null,this._activeVao=null,this.textureManager=new rr(this),this.filterManager=new Xr(this),this.textureGC=new ir(this),this.state.resetToDefault(),this.rootRenderTarget=new er(t,1,1,g.LINEAR,!0),this.rootRenderTarget.clearColor=this._backgroundColorRgba,this.bindRenderTarget(this.rootRenderTarget),this.dispatchEvent("onContextChange")},e.prototype.render=function(t,e,r){if(this.dispatchEvent("onPreRender"),this.renderingToScreen=!e,this.gl&&!this.gl.isContextLost()){e||(this._lastObjectRendered=t),t.update();var i=t.parent;t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=i,this.bindRenderTexture(e,r),this.batchManager.currentRenderer.start(),this._activeRenderTarget.clear(),t.renderWebGL(this),this.batchManager.currentRenderer.flush(),this.textureGC.update(),this.dispatchEvent("onPostRender")}},e.prototype.clear=function(t){this._activeRenderTarget.clear(t)},e.prototype.setTransform=function(t){this._activeRenderTarget.transform=t},e.prototype.clearRenderTexture=function(t,e){var r=t.baseTexture._glRenderTargets[this.CONTEXT_UID];return r&&r.clear(e),this},e.prototype.bindShader=function(t,e){return void 0===e&&(e=!0),this._activeShader!==t&&(this._activeShader=t,t.bind(),!1!==e&&(t.uniforms.projectionMatrix=this._activeRenderTarget.projectionMatrix.toArray(!0))),this},e.prototype.createVao=function(){return new Ie(this.gl,this.state.attribState)},e.prototype.bindVao=function(t,e){return void 0===e&&(e=!1),this._activeVao===t?(e&&t.bind(),this):(t?t.bind():this._activeVao&&this._activeVao.unbind(),this._activeVao=t,this)},e.prototype.reset=function(){this.batchManager.reset(),this.bindVao(null),this._activeShader=null,this._activeRenderTarget=this.rootRenderTarget;for(var t=0;t<this.textureManager.boundTextures.length;t++)this.textureManager.boundTextures[t]=this.textureManager.emptyTextures[t];return this.rootRenderTarget.activate(),this.state.resetToDefault(),this},e.prototype.bindRenderTexture=function(t,e){var r;if(t){var i=t.baseTexture;i._glRenderTargets[this.CONTEXT_UID]||this.textureManager.updateTexture(i,0),this.textureManager.unbindTexture(i),(r=i._glRenderTargets[this.CONTEXT_UID]).setFrame(t.frame)}else r=this.rootRenderTarget;return r.transform=e,this.bindRenderTarget(r),this},e.prototype.bindRenderTarget=function(t){return t!==this._activeRenderTarget&&(this._activeRenderTarget=t,t.activate(),this._activeShader&&(this._activeShader.uniforms.projectionMatrix=t.projectionMatrix.toArray(!0)),this.stencilManager.setMaskStack(t.stencilMaskStack)),this},e.prototype.setBlendMode=function(t){this.state.setBlendMode(t)},e.prototype.resize=function(e,r){t.prototype.resize.call(this,e,r),this.rootRenderTarget.resize(e,r),this._activeRenderTarget===this.rootRenderTarget&&(this.rootRenderTarget.activate(),this._activeShader&&(this._activeShader.uniforms.projectionMatrix=this.rootRenderTarget.projectionMatrix.toArray(!0)))},e.prototype.destroy=function(){this.destroyPlugins(),this.textureManager.destroy(),t.prototype.destroy.call(this),this.maskManager.destroy(),this.stencilManager.destroy(),this.filterManager.destroy(),this.maskManager=null,this.filterManager=null,this.textureManager=null,this.handleContextLost=null,this.handleContextRestored=null},e.prototype.handleContextRestored=function(){this.textureManager.removeAll(),this.filterManager.destroy(!0),this._initContext(),this.resize(this.width,this.height)},e.prototype.handleContextLost=function(t){t.preventDefault()},e.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},e.prototype.destroyPlugins=function(){for(var t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null;this.plugins=null},e.registerPlugin=function(t,r){e.__plugins=e.__plugins||{},e.__plugins[t]=r},e}(tr);Hr.registerPlugin("batch",$e);var Yr=function(){function t(t){this.renderer=t}return t.prototype.render=function(t){var e=this.renderer,r=e.context,i=t._worldAlpha,n=t.transform.worldMatrix;r.setTransform(n.a,n.b,n.c,n.d,n.tx,n.ty),e.setBlendMode(t.blendMode);for(var o=0;o<t.graphicsData.length;o++){var a=t.graphicsData[o],h=a.shape,u=a.fillStyle,l=a.lineStyle,c=u.color,p=l.color;r.lineWidth=l.width,r.lineCap=l.cap,r.lineJoin=l.join,r.miterLimit=l.miterLimit;var d=!0;if(a.type===s.POLY){r.beginPath();var f=h.points;r.moveTo(f[0],f[1]);for(var v=1;v<f.length/2;++v)r.lineTo(f[2*v],f[2*v+1]);d=!qr(f)}else if(a.type===s.RECT){if(!a.holes.length){u.visible&&(r.globalAlpha=u.alpha*i,r.fillStyle="#"+("00000"+(0|c).toString(16)).substr(-6),r.fillRect(h.x,h.y,h.width,h.height)),l.visible&&(r.globalAlpha=l.alpha*i,r.strokeStyle="#"+("00000"+(0|p).toString(16)).substr(-6),r.strokeRect(h.x,h.y,h.width,h.height));continue}r.beginPath(),r.moveTo(h.x,h.y),r.lineTo(h.x+h.width,h.y),r.lineTo(h.x+h.width,h.y+h.height),r.lineTo(h.x,h.y+h.height),r.lineTo(h.x,h.y)}else if(a.type===s.CIRC)r.beginPath(),r.arc(h.x,h.y,h.radius,0,2*Math.PI,!1);else if(a.type===s.ELIP){var m=2*h.width,y=2*h.height,g=h.x-m/2,x=h.y-y/2;r.beginPath();var _=.5522848,b=m/2*_,T=y/2*_,w=g+m,M=x+y,S=g+m/2,E=x+y/2;r.moveTo(g,E),r.bezierCurveTo(g,E-T,S-b,x,S,x),r.bezierCurveTo(S+b,x,w,E-T,w,E),r.bezierCurveTo(w,E+T,S+b,M,S,M),r.bezierCurveTo(S-b,M,g,E+T,g,E)}else if(a.type===s.RREC){var C=h.x,A=h.y,P=h.width,O=h.height,R=h.radius,I=Math.min(P,O)/2;R=R>I?I:R,r.beginPath(),r.moveTo(C,A+R),r.quadraticCurveTo(C,A,C+R,A),r.lineTo(C+P-R,A),r.quadraticCurveTo(C+P,A,C+P,A+R),r.lineTo(C+P,A+O-R),r.quadraticCurveTo(C+P,A+O,C+P-R,A+O),r.lineTo(C+R,A+O),r.quadraticCurveTo(C,A+O,C,A+O-R),r.lineTo(C,A+R)}for(var D=0;D<a.holes.length;D++)Gr(a.holes[D],r,d);u.visible&&(r.globalAlpha=u.alpha*i,r.fillStyle="#"+("00000"+(0|c).toString(16)).substr(-6),r.fill()),l.visible&&(h.closed&&r.closePath(),r.globalAlpha=l.alpha*i,r.strokeStyle="#"+("00000"+(0|p).toString(16)).substr(-6),r.stroke())}},t.prototype.destroy=function(){this.renderer=null},t}();function Gr(t,e,r){void 0===r&&(r=!0);var i=t.type,n=t.shape;switch(i){case s.POLY:var o=n.points;if(r==qr(o)){e.moveTo(o[0],o[1]);for(var a=1;a<o.length/2;++a)e.lineTo(o[2*a],o[2*a+1])}else{e.moveTo(o[o.length-2],o[o.length-1]);for(a=o.length/2-2;a>=0;--a)e.lineTo(o[2*a],o[2*a+1])}o[0]===o[o.length-2]&&o[1]===o[o.length-1]||e.closePath();break;case s.RECT:e.moveTo(n.x,n.y),r?(e.lineTo(n.x,n.y+n.height),e.lineTo(n.x+n.width,n.y+n.height),e.lineTo(n.x+n.width,n.y),e.lineTo(n.x,n.y)):(e.lineTo(n.x+n.width,n.y),e.lineTo(n.x+n.width,n.y+n.height),e.lineTo(n.x,n.y+n.height),e.lineTo(n.x,n.y));break;case s.CIRC:e.moveTo(n.x+n.radius,n.y),e.arc(n.x,n.y,n.radius,0,2*Math.PI,r);break;case s.ELIP:var h=2*n.width,u=2*n.height,l=n.x-h/2,c=n.y-u/2,p=.5522848,d=h/2*p,f=u/2*p,v=l+h,m=c+u,y=l+h/2,g=c+u/2;e.moveTo(l,g),r?(e.bezierCurveTo(y-d,m,l,g+f,y,m),e.bezierCurveTo(v,g+f,y+d,m,v,g),e.bezierCurveTo(y+d,c,v,g-f,y,c),e.bezierCurveTo(l,g-f,y-d,c,l,g)):(e.bezierCurveTo(l,g-f,y-d,c,y,c),e.bezierCurveTo(y+d,c,v,g-f,v,g),e.bezierCurveTo(v,g+f,y+d,m,y,m),e.bezierCurveTo(y-d,m,l,g+f,l,g));break;case s.RREC:var x=n.x,_=n.y,b=n.width,T=n.height,w=n.radius,M=Math.min(b,T)/2|0;w=w>M?M:w,e.moveTo(x,_+w),r?(e.lineTo(x,_+T-w),e.quadraticCurveTo(x,_+T,x+w,_+T),e.lineTo(x+b-w,_+T),e.quadraticCurveTo(x+b,_+T,x+b,_+T-w),e.lineTo(x+b,_+w),e.quadraticCurveTo(x+b,_,x+b-w,_),e.lineTo(x+w,_),e.quadraticCurveTo(x,_,x,_+w)):(e.quadraticCurveTo(x,_,x+w,_),e.lineTo(x+b-w,_),e.quadraticCurveTo(x+b,_,x+b,_+w),e.lineTo(x+b,_+T-w),e.quadraticCurveTo(x+b,_+T,x+b-w,_+T),e.lineTo(x+w,_+T),e.quadraticCurveTo(x,_+T,x,_+T-w),e.lineTo(x,_+w))}}function qr(t){var e=[];t[0]===t[t.length-2]&&(t[1],t[t.length-1]);for(var r=0;r<t.length-2;r+=2)e.push(t[r+2]-t[r],t[r+3]-t[r+1]);t[0]===t[t.length-2]&&t[1]===t[t.length-1]||e.push(t[0]-t[t.length-2],t[1]-t[t.length-1]);var i=0;for(r=0;r<e.length-2;r+=2)i=i+e[r]*e[r+3]-e[r+1]*e[r+2];return!((i=i+e[e.length-2]*e[1]-e[e.length-1]*e[0])>0)}var Zr=function(t){function e(e){var r=t.call(this)||this;return r._instanceType="CanvasMaskManager",r.renderer=e,r}return S(e,t),e.prototype.pushMask=function(t){var e=this.renderer;e.context.save(),e.context.globalAlpha=0;var r=t.transform.worldMatrix;e.context.setTransform(r.a||1e-10,r.b,r.c,r.d||1e-10,r.tx,r.ty),"Shape"==t.instanceType?t._drawShape(e.context):"Graphics"==t.instanceType&&(t.finishPoly(),this.renderGraphicsShape(t)),e.context.clip()},e.prototype.renderGraphicsShape=function(t){var e=this.renderer.context,r=t.graphicsData.length;if(0!==r){e.beginPath();for(var i=0;i<r;i++){var n=t.graphicsData[i],o=n.shape,a=!0;if(n.type===s.POLY){var h=o.points;e.moveTo(h[0],h[1]);for(var u=1;u<h.length/2;u++)e.lineTo(h[2*u],h[2*u+1]);a=!qr(h),h[0]===h[h.length-2]&&h[1]===h[h.length-1]||e.closePath()}else if(n.type===s.RECT)e.rect(o.x,o.y,o.width,o.height);else if(n.type===s.CIRC)e.arc(o.x,o.y,o.radius,0,2*Math.PI);else if(n.type===s.ELIP){var l=2*o.width,c=2*o.height,p=o.x-l/2,d=o.y-c/2,f=.5522848,v=l/2*f,m=c/2*f,y=p+l,g=d+c,x=p+l/2,_=d+c/2;e.moveTo(p,_),e.bezierCurveTo(p,_-m,x-v,d,x,d),e.bezierCurveTo(x+v,d,y,_-m,y,_),e.bezierCurveTo(y,_+m,x+v,g,x,g),e.bezierCurveTo(x-v,g,p,_+m,p,_)}else if(n.type===s.RREC){var b=o.x,T=o.y,w=o.width,M=o.height,S=o.radius,E=Math.min(w,M)/2|0;S=S>E?E:S,e.moveTo(b,T+S),e.quadraticCurveTo(b,T,b+S,T),e.lineTo(b+w-S,T),e.quadraticCurveTo(b+w,T,b+w,T+S),e.lineTo(b+w,T+M-S),e.quadraticCurveTo(b+w,T+M,b+w-S,T+M),e.lineTo(b+S,T+M),e.quadraticCurveTo(b,T+M,b,T+M-S),e.lineTo(b,T+S)}for(u=0;u<n.holes.length;u++)Gr(n.holes[i],e,a)}}},e.prototype.popMask=function(t){t.context.restore()},e.prototype.destroy=function(){},e}(R),Kr=null;function Qr(t){var e=G();e.width=6,e.height=1;var r=e.getContext("2d");return r.fillStyle=t,r.fillRect(0,0,6,1),e}function Jr(){if(null!=Kr)return Kr;if("undefined"==typeof document)return Kr=!1;var t=Qr("#ff00ff"),e=Qr("#ffff00"),r=G();r.width=6,r.height=1;var i=r.getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(t,0,0),i.drawImage(e,2,0);var n=i.getImageData(2,0,1,1);if(!n)return Kr=!1;var o=n.data;return Kr=255===o[0]&&0===o[1]&&0===o[2]}var $r,ti;function ei(t,e){var r="#"+("00000"+(0|(e=function(t){var e=8,r=ni(t);return r[0]=Math.min(255,r[0]/e*e),r[1]=Math.min(255,r[1]/e*e),r[2]=Math.min(255,r[2]/e*e),function(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}(r)}(e))).toString(16)).substr(-6);t.tintCache=t.tintCache||{};var i,n=t.tintCache[r];if(n){if(n.tintId===t._updateID)return t.tintCache[r];i=t.tintCache[r]}else i=$r||G();return ti||(ti=Jr()?ri:ii),ti(t,e,i),i.tintId=t._updateID,t.tintCache[r]=i,$r=null,i}function ri(t,e,r){var i=r.getContext("2d"),n=t._frame.clone();r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.fillStyle="#"+("00000"+(0|e).toString(16)).substr(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply",i.drawImage(t.baseTexture.source,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(t.baseTexture.source,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()}function ii(t,e,r){var i=r.getContext("2d"),n=t._frame.clone();r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.source,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var o=ni(e),a=o[0],s=o[1],h=o[2],u=i.getImageData(0,0,n.width,n.height),l=u.data,c=0;c<l.length;c+=4)l[c+0]*=a,l[c+1]*=s,l[c+2]*=h;i.putImageData(u,0,0)}function ni(t,e){return(e=e||[])[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}var oi=new k,ai=function(){function t(t){this.renderer=t}return t.prototype.render=function(t){var e=t._texture,r=this.renderer,i=e._frame.width,n=e._frame.height,o=t.transform.worldMatrix,a=0,s=0;if(!(e.orig.width<=0||e.orig.height<=0)&&e.baseTexture.source&&e.valid){if(r.setBlendMode(t.blendMode),r.context.globalAlpha=t._worldAlpha,t._anchorTexture)e.trim?(a=e.trim.width/2+e.trim.x-t._anchorTexture.x*e.orig.width,s=e.trim.height/2+e.trim.y-t._anchorTexture.y*e.orig.height):(a=(.5-t._anchorTexture.x)*e.orig.width,s=(.5-t._anchorTexture.y)*e.orig.height),e.rotate&&(oi.copy(o),o=oi,Jt.matrixAppendRotationInv(o,e.rotate,a,s),a=0,s=0),a-=i/2,s-=n/2;else if("Graphics"==t.instanceType){var h=t._localBoundsSelf;a=h.x,s=h.y}r.context.setTransform(o.a,o.b,o.c,o.d,o.tx,o.ty);var u=r._outerBlend;u&&(r.context.save(),r.context.beginPath(),r.context.rect(a,s,i,n),r.context.clip()),16777215!==t.tint?(t.cachedTint===t.tint&&t.tintedTexture.tintId===t._texture._updateID||(t.cachedTint=t.tint,t.tintedTexture=ei(t._texture,t.tint)),r.context.drawImage(t.tintedTexture,0,0,i,n,a,s,i,n)):r.context.drawImage(e.baseTexture.source,e._frame.x,e._frame.y,i,n,a,s,i,n),u&&r.context.restore(),r.setBlendMode(m.NORMAL)}},t.prototype.destroy=function(){this.renderer=null},t}(),si=function(){function t(t,e){this.canvas=G(),this.resize(t,e),this.context=this.canvas.getContext("2d"),this.resize(t,e),this.clear()}return t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(t,e){this.canvas.width=t,this.canvas.height=e},t.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=t},enumerable:!1,configurable:!0}),t}(),hi=function(){function t(t){this.renderer=t}return t.prototype.render=function(t){var e=this.renderer,r=e.context,i=t.worldMatrix;r.setTransform(i.a,i.b,i.c,i.d,i.tx,i.ty),e.context.globalAlpha=t._worldAlpha,e.setBlendMode(t.blendMode),this._renderTriangles(t)},t.prototype._renderTriangles=function(t){for(var e=t._indices,r=e.length,i=0;i<r;i+=3){var n=2*e[i],o=2*e[i+1],a=2*e[i+2];this._renderDrawTriangle(t,n,o,a)}},t.prototype._renderDrawTriangle=function(t,e,r,i){var n=this.renderer.context,o=t._uvs,a=t._vertices,s=t.texture;if(s.valid){var h=s.baseTexture,u=h.source,l=h.width,c=h.height,p=o[e]*h.width,d=o[r]*h.width,f=o[i]*h.width,v=o[e+1]*h.height,m=o[r+1]*h.height,y=o[i+1]*h.height,g=a[e],x=a[r],_=a[i],b=a[e+1],T=a[r+1],w=a[i+1],M=t.canvasPadding;if(M>0){var S=M/Math.abs(t.worldMatrix.a),E=M/Math.abs(t.worldMatrix.d),C=(g+x+_)/3,A=(b+T+w)/3,P=g-C,O=b-A,R=Math.sqrt(P*P+O*O);g=C+P/R*(R+S),b=A+O/R*(R+E),O=T-A,x=C+(P=x-C)/(R=Math.sqrt(P*P+O*O))*(R+S),T=A+O/R*(R+E),O=w-A,_=C+(P=_-C)/(R=Math.sqrt(P*P+O*O))*(R+S),w=A+O/R*(R+E)}n.save(),n.beginPath(),n.moveTo(g,b),n.lineTo(x,T),n.lineTo(_,w),n.closePath(),n.clip();var I=p*m+v*f+d*y-m*f-v*d-p*y,D=g*m+v*_+x*y-m*_-v*x-g*y,F=p*x+g*f+d*_-x*f-g*d-p*_,N=p*m*_+v*x*f+g*d*y-g*m*f-v*d*_-p*x*y,k=b*m+v*w+T*y-m*w-v*T-b*y,L=p*T+b*f+d*w-T*f-b*d-p*w,B=p*m*w+v*T*f+b*d*y-b*m*f-v*d*w-p*T*y;n.transform(D/I,k/I,F/I,L/I,N/I,B/I),n.drawImage(u,0,0,l,c,0,0,l,c),n.restore()}},t.prototype.destroy=function(){this.renderer=null},t}();var ui=function(t){function e(e,r,i){var n,o=t.call(this)||this;return o.type=a.CANVAS,o._instanceType="CanvasRenderer",o.rootContext=e,o.maskManager=new Zr(o),o.plugins={sprite:new ai(o),graphics:new Yr(o),mesh:new hi(o)},o.blendModes=(void 0===n&&(n=[]),Jr()?(n[m.NORMAL]="source-over",n[m.ADD]="lighter",n[m.MULTIPLY]="multiply",n[m.SCREEN]="screen",n[m.OVERLAY]="overlay",n[m.DARKEN]="darken",n[m.LIGHTEN]="lighten",n[m.COLOR_DODGE]="color-dodge",n[m.COLOR_BURN]="color-burn",n[m.HARD_LIGHT]="hard-light",n[m.SOFT_LIGHT]="soft-light",n[m.DIFFERENCE]="difference",n[m.EXCLUSION]="exclusion",n[m.HUE]="hue",n[m.SATURATION]="saturate",n[m.COLOR]="color",n[m.LUMINOSITY]="luminosity"):(n[m.NORMAL]="source-over",n[m.ADD]="lighter",n[m.MULTIPLY]="source-over",n[m.SCREEN]="source-over",n[m.OVERLAY]="source-over",n[m.DARKEN]="source-over",n[m.LIGHTEN]="source-over",n[m.COLOR_DODGE]="source-over",n[m.COLOR_BURN]="source-over",n[m.HARD_LIGHT]="source-over",n[m.SOFT_LIGHT]="source-over",n[m.DIFFERENCE]="source-over",n[m.EXCLUSION]="source-over",n[m.HUE]="source-over",n[m.SATURATION]="source-over",n[m.COLOR]="source-over",n[m.LUMINOSITY]="source-over"),n[m.NORMAL_NPM]=n[m.NORMAL],n[m.ADD_NPM]=n[m.ADD],n[m.SCREEN_NPM]=n[m.SCREEN],n[m.SRC_OVER]="source-over",n[m.SRC_IN]="source-in",n[m.SRC_OUT]="source-out",n[m.SRC_ATOP]="source-atop",n[m.DST_OVER]="destination-over",n[m.DST_IN]="destination-in",n[m.DST_OUT]="destination-out",n[m.DST_ATOP]="destination-atop",n[m.SUBTRACT]="source-over",n),o._activeBlendMode=null,o._outerBlend=!1,o.resize(r,i),o}return S(e,t),e.prototype.render=function(t,e,r){this.dispatchEvent("onPreRender");var i=!e;e?((e=e.baseTexture||e)._canvasRenderTarget?(e._canvasRenderTarget.clear(),e._canvasRenderTarget.resize(e.width,e.height)):(e._canvasRenderTarget=new si(e.width,e.height),e.source=e._canvasRenderTarget.canvas,e.valid=!0),this.context=e._canvasRenderTarget.context):this.context=this.rootContext;var n=this.context;e||(this._lastObjectRendered=t),t.update();var o=t.parent,a=this._tempDisplayObjectParent.transform.worldMatrix;r?(a.copy(r),this._tempDisplayObjectParent.transform._worldID++):a.identity(),t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=o,n.save(),n.setTransform(1,0,0,1,0,0),n.globalAlpha=1,this._activeBlendMode=m.NORMAL,this._outerBlend=!1,n.globalCompositeOperation=this.blendModes[m.NORMAL],i&&(this.transparent?n.clearRect(0,0,this.width,this.height):(n.fillStyle=this._backgroundColorString,n.fillRect(0,0,this.width,this.height))),t.renderCanvas(this),n.restore(),this.dispatchEvent("onPostRender")},e.prototype.setBlendMode=function(t,e){void 0===e&&(e=!1);var r=t===m.SRC_IN||t===m.SRC_OUT||t===m.DST_IN||t===m.DST_ATOP;!e&&r&&(t=m.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=r,this.context.globalCompositeOperation=this.blendModes[t])},e.prototype.destroy=function(){this.destroyPlugins(),t.prototype.destroy.call(this),this.context=null,this.maskManager.destroy(),this.maskManager=null},e.prototype.destroyPlugins=function(){this.plugins.sprite.destroy(),this.plugins.graphics.destroy(),this.plugins.mesh.destroy()},e}(tr),li=function(t){function e(e,r,i,n,o,s,h,u,l,c){void 0===r&&(r=750),void 0===i&&(i=1624),void 0===s&&(s=a.CANVAS),void 0===h&&(h=!1),void 0===u&&(u=!1);var p=t.call(this)||this;p.renderObj=null,p.viewRect=new B,p.desWidth=0,p.desHeight=0,p.divHeight=0,p.divWidth=0,p._bgColor=0,p._lastDpList={},p.canvasOffsetTb={x:0,y:0},p._autoSteering=!1,p._ml=[],p._mp=[],p._mouseDownPoint={},p._mouseEventTypes={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",touchStart:"onMouseDown",touchMove:"onMouseMove",touchEnd:"onMouseUp"},p.canvas=e;var d=p;if(p._instanceType="Stage",d.stage=p,d.name="stageInstance_"+d.instanceId,d.desWidth=r,d.desHeight=i,d.divWidth=n,d.divHeight=o,l){d._dpi=l;var f=n*l,v=o*l;"tb"==H()&&(f+=l,v+=l),e.width=f,e.height=v}else console.warn("try to send param resolution, canvas‘s width and height will be setted up based on resolution"),d._dpi=e.width/n;if(console.log("%cfyge version:2.0.66","text-shadow: 0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);font-size:3em"),s!=a.WEBGL||et()||(s=a.CANVAS,console.warn("your device doesn‘t support webgl,will use canvas2d instead")),s==a.CANVAS){var m=e.getContext("2d");d.renderObj=new ui(m,e.width,e.height)}else{var y=E({alpha:!0,antialias:!1,premultipliedAlpha:!0,stencil:!0},c);m=e.getContext("webgl",y)||e.getContext("experimental-webgl",y);d.renderObj=new Hr(m,e.width,e.height),"web"==H()&&(e.addEventListener("webglcontextlost",d.renderObj.handleContextLost,!1),e.addEventListener("webglcontextrestored",d.renderObj.handleContextRestored,!1))}return d._stageCenter=h,d._scaleMode=u?"fixedHeight":"fixedWidth",d._setAlign(),setTimeout((function(){d.dispatchEvent(I.INIT_STAGE)}),100),p}return S(e,t),Object.defineProperty(e.prototype,"bgColor",{get:function(){return this._bgColor},set:function(t){this._bgColor!==t&&(this._bgColor=t,this.renderObj.backgroundColor=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stageWidth",{get:function(){return this.viewRect.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stageHeight",{get:function(){return this.viewRect.height},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoSteering",{get:function(){return this._autoSteering},set:function(t){this._autoSteering!=t&&(this._autoSteering=t,this._setAlign())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!=t&&(this._scaleMode=t,this._setAlign())},enumerable:!1,configurable:!0}),e.prototype._setAlign=function(){var t=this,e=t.canvas,r=e.width,i=e.height,n=t.desWidth,o=t.desHeight;t._stageCenter&&(t.anchorX=n>>1,t.anchorY=o>>1,t.x=r-n>>1,t.y=i-o>>1);var a=i>=r,s=o>=n;if(t._autoSteering&&s!=a){var h=i;i=r,r=h}var u="fixedHeight"==t._scaleMode?i/o:r/n;t.scaleX=u,t.scaleY=u,t._autoSteering&&s!=a?o>n?(t.rotation=-90,t._stageCenter||(t.y=r)):(t.rotation=90,t._stageCenter||(t.x=i)):(t.rotation=0,t._stageCenter||(t.x=t.y=0)),t.viewRect=t.viewRect||new B,t.viewRect.x=n-r/u>>1,t.viewRect.y=o-i/u>>1,t.viewRect.width=n-2*t.viewRect.x,t.viewRect.height=o-2*t.viewRect.y,t._stageCenter||(t.viewRect.x=t.viewRect.y=0)},e.prototype.resize=function(t,e){if("web"==H()&&(t=t||document.body.clientWidth,e=e||document.body.clientHeight),t&&t){var r=this,i=r._dpi,n=r.canvas;t==r.divWidth&&e==r.divHeight||(t!=r.divWidth&&(n.width=t*i),e!=r.divHeight&&(n.height=e*i),r.divWidth=t,r.divHeight=e,r._setAlign(),r.renderObj.resize(n.width,n.height),r.dispatchEvent(I.RESIZE))}else console.error("parm divWidth or divHeight cannot be empty")},e.prototype._initMouseEvent=function(t,e,r,i){t._pd=!1,t.clientX=e.x,t.clientY=e.y,t.stageX=r.x,t.stageY=r.y,t.identifier=i},e.prototype.flush=function(){this.renderObj.render(this)},e.prototype.onMouseEvent=function(t){"web"==H()&&(this.webMouseEventPreventDefault&&t.preventDefault(),this.webMouseEventStopPropagation&&t.stopPropagation());var e=this;if(D._totalMEC>0){var r=void 0,i=e._mouseEventTypes[t.type],n=void 0,o=void 0,a=void 0,s=void 0,h=void 0,u=void 0,l=void 0;"pc"==rt()?(t.identifier=0,r=[t]):r=[t.changedTouches[0]];var c=e.canvasOffsetTb,p=c.x,d=c.y;if("web"==H()){var f=document.documentElement,v=e.canvas.getBoundingClientRect();p=v.left+window.pageXOffset-f.clientLeft,d=v.top+window.pageYOffset-f.clientTop}for(var m=0;m<r.length;m++)if(r[m]&&(u=0,n=[],l="m"+r[m].identifier,(h=e._mp.length>0?e._mp.shift():new N).x=((r[m].pageX||r[m].x||r[m].b||0)-p)*e._dpi,h.y=((r[m].pageY||r[m].y||r[m].c||0)-d)*e._dpi,a=e.globalToLocal(h,$t._bp),D.getMouseEventCount()>0&&(e._ml[u]?(o=e._ml[u]).type=i:(o=new be(i),e._ml[u]=o),n[n.length]=o,e._initMouseEvent(o,h,a,l),u++),"onMouseDown"==i?e._mouseDownPoint[l]=h:"onMouseUp"==i&&e._mouseDownPoint[l]&&N.distance(e._mouseDownPoint[l],h)<20&&D.getMouseEventCount("onMouseClick")>0&&(e._ml[u]?(o=e._ml[u]).type="onMouseClick":(o=new be("onMouseClick"),e._ml[u]=o),n[n.length]=o,e._initMouseEvent(o,h,a,l),u++),u>0)){var y=e.hitTestPoint(h,!0),g=[];if(y)for(;y;)!1===y.mouseChildren&&(g.length=0),g[g.length]=y,y=y.parent;else g[g.length]=e;for(var x=g.length,_=x-1;_>=0;_--){y=g[_];for(var b=0;b<u;b++)n[b]._pd||y.hasEventListener(n[b].type)&&y.mouseEnable&&(n[b].target=y,n[b].currentTarget=g[0],s=y.globalToLocal(h,$t._bp),n[b].localX=s.x,n[b].localY=s.y,y.dispatchEvent(n[b]))}g.reverse();for(_=x-1;_>=0;_--){y=g[_];for(b=0;b<u;b++)n[b]._pd||y.hasEventListener(n[b].type,!1)&&y.mouseEnable&&(n[b].target=y,n[b].currentTarget=g[u-1],s=y.globalToLocal(h,$t._bp),n[b].localX=s.x,n[b].localY=s.y,y.dispatchEvent(n[b],null,!1))}if("onMouseDown"!=i){if((D.getMouseEventCount("onMouseOver")>0||D.getMouseEventCount("onMouseOut")>0)&&e._lastDpList[l]){var T=e._lastDpList[l].length,w=g.length;x=T>w?T:w;var M=!1,S=void 0,E=void 0;for(_=1;_<x;_++)M||e._lastDpList[l][_]!=g[_]&&(M=!0,e._ml[u]?(S=e._ml[u]).type="onMouseOver":(S=new be("onMouseOver"),e._ml[u]=S),e._initMouseEvent(S,h,a,l),u++,e._ml[u]?(E=e._ml[u]).type="onMouseOut":(E=new be("onMouseOut"),e._ml[u]=E),e._initMouseEvent(E,h,a,l)),M&&(e._lastDpList[l][_]&&(E._pd||(y=e._lastDpList[l][_]).hasEventListener("onMouseOut")&&(E.currentTarget=e._lastDpList[l][T-1],E.target=y,s=y.globalToLocal(h,$t._bp),E.localX=s.x,E.localY=s.y,y.dispatchEvent(E))),g[_]&&(S._pd||(y=g[_]).hasEventListener("onMouseOver")&&(S.currentTarget=g[w-1],S.target=y,s=y.globalToLocal(h,$t._bp),S.localX=s.x,S.localY=s.y,y.dispatchEvent(S))))}e._mp[e._mp.length]=h}"onMouseUp"==i?(delete e._mouseDownPoint[l],delete e._lastDpList[l]):e._lastDpList[l]=g}}},e.prototype.addWebMouseEvent=function(){var t=this.canvas;if(t&&t.addEventListener){var e=this.onMouseEvent.bind(this);"pc"==rt()?(t.addEventListener("mousedown",e,!1),t.addEventListener("mousemove",e,!1),t.addEventListener("mouseup",e,!1)):(t.addEventListener("touchstart",e,!1),t.addEventListener("touchmove",e,!1),t.addEventListener("touchend",e,!1))}},e.prototype.destroy=function(){var e=this;"web"==H()&&e.renderObj.type==a.WEBGL&&(e.canvas.removeEventListener("webglcontextlost",e.renderObj.handleContextLost,!1),e.canvas.removeEventListener("webglcontextrestored",e.renderObj.handleContextRestored,!1)),e.renderObj.destroy(),e.renderObj=null,e.viewRect=null,e._lastDpList=null,e._ml=null,t.prototype.destroy.call(this)},e}(te),ci=function(t){function e(e,r,i,n){void 0===r&&(r=null),void 0===i&&(i=null),void 0===n&&(n=null);var o=t.call(this)||this;return o._instanceType="GraphicsData",o.shape=e,o.lineStyle=i,o.fillStyle=r,o.matrix=n,o.holes=[],o.type=e.type,o.points=[],o}return S(e,t),e.prototype.clone=function(){return new e(this.shape,this.fillStyle,this.lineStyle,this.matrix)},e.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},e}(R),pi=function(t){function e(e,r,i){void 0===e&&(e=100),void 0===r&&(r=100),void 0===i&&(i=g.LINEAR);var n=t.call(this,null,i)||this;return n.width=Math.ceil(e),n.height=Math.ceil(r),n.scaleMode=i,n.hasLoaded=!0,n._glRenderTargets={},n._canvasRenderTarget=null,n.valid=!1,n}return S(e,t),e.prototype.resize=function(t,e){t=Math.ceil(t),e=Math.ceil(e),t===this.width&&e===this.height||(this.valid=t>0&&e>0,this.width=t,this.height=e,this.valid&&this.dispatchEvent("update"))},e.prototype.destroy=function(){t.prototype.destroy.call(this)},e}(fe),di=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.valid=!0,i.updateUvs(),i}return S(e,t),e.prototype.resize=function(t,e,r){void 0===r&&(r=!1),t=Math.ceil(t),e=Math.ceil(e),this.valid=t>0&&e>0,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r||this.baseTexture.resize(t,e),this.updateUvs()},e.create=function(t,r,i){return void 0===i&&(i=g.LINEAR),new e(new pi(t,r,i))},e}(me),fi=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.radius=r,this.type=s.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.isPointIn=function(t){if(this.radius<=0)return!1;var e=this.radius*this.radius,r=this.x-t.x,i=this.y-t.y;return(r*=r)+(i*=i)<=e},t.prototype.getBounds=function(){return new B(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t}(),vi=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.width=r,this.height=i,this.type=s.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.isPointIn=function(t){if(this.width<=0||this.height<=0)return!1;var e=(t.x-this.x)/this.width,r=(t.y-this.y)/this.height;return(e*=e)+(r*=r)<=1},t.prototype.getBounds=function(){return new B(this.x-this.width,this.y-this.height,this.width,this.height)},t}(),mi=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(Array.isArray(t[0])&&(t=t[0]),t[0]instanceof N){for(var r=[],i=0,n=t.length;i<n;i++)r.push(t[i].x,t[i].y);t=r}this.closed=!0,this.points=t,this.type=s.POLY}return t.prototype.clone=function(){return new t(this.points.slice())},t.prototype.isPointIn=function(t){for(var e=t.x,r=t.y,i=!1,n=this.points.length/2,o=0,a=n-1;o<n;a=o++){var s=this.points[2*o],h=this.points[2*o+1],u=this.points[2*a],l=this.points[2*a+1];h>r!=l>r&&e<(r-h)/(l-h)*(u-s)+s&&(i=!i)}return i},t}(),yi=function(){function t(t,e,r,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=20),this.x=t,this.y=e,this.width=r,this.height=i;var o=(r<i?r:i)/2;n=(n=n<0?-n:n)>o?o:n,this.radius=n,this.type=s.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.isPointIn=function(t){var e=t.x,r=t.y;if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){if(r>=this.y+this.radius&&r<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var i=e-(this.x+this.radius),n=r-(this.y+this.radius),o=this.radius*this.radius;if(i*i+n*n<=o)return!0;if((i=e-(this.x+this.width-this.radius))*i+n*n<=o)return!0;if(i*i+(n=r-(this.y+this.height-this.radius))*n<=o)return!0;if((i=e-(this.x+this.radius))*i+n*n<=o)return!0}return!1},t}();function gi(t,e,r){r=r||2;var i,n,o,a,s,h,u,l=e&&e.length,c=l?e[0]*r:t.length,p=xi(t,0,c,r,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=xi(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(Pi(a));for(s.sort(Ei),n=0;n<s.length;n++)Ci(s[n],r),r=_i(r,r.next);return r}(t,e,p,r)),t.length>80*r){i=o=t[0],n=a=t[1];for(var f=r;f<c;f+=r)(s=t[f])<i&&(i=s),(h=t[f+1])<n&&(n=h),s>o&&(o=s),h>a&&(a=h);u=0!==(u=Math.max(o-i,a-n))?1/u:0}return bi(p,d,r,i,n,u),d}function xi(t,e,r,i,n){var o,a;if(n===Ui(t,e,r,i)>0)for(o=e;o<r;o+=i)a=Li(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=Li(o,t[o],t[o+1],a);return a&&Di(a,a.next)&&(Bi(a),a=a.next),a}function _i(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!Di(i,i.next)&&0!==Ii(i.prev,i,i.next))i=i.next;else{if(Bi(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function bi(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=Ai(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,a,s,h,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<u&&(s++,i=i.nextZ);e++);for(h=u;s>0||h>0&&i;)0!==s&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(a>1)}(n)}(t,i,n,o);for(var s,h,u=t;t.prev!==t.next;)if(s=t.prev,h=t.next,o?wi(t,i,n,o):Ti(t))e.push(s.i/r),e.push(t.i/r),e.push(h.i/r),Bi(t),t=h.next,u=h.next;else if((t=h)===u){a?1===a?bi(t=Mi(t,e,r),e,r,i,n,o,2):2===a&&Si(t,e,r,i,n,o):bi(_i(t),e,r,i,n,o,1);break}}}function Ti(t){var e=t.prev,r=t,i=t.next;if(Ii(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Oi(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&Ii(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function wi(t,e,r,i){var n=t.prev,o=t,a=t.next;if(Ii(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,h=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,u=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,c=Ai(s,h,e,r,i),p=Ai(u,l,e,r,i),d=t.prevZ,f=t.nextZ;d&&d.z>=c&&f&&f.z<=p;){if(d!==t.prev&&d!==t.next&&Oi(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ii(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&Oi(n.x,n.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ii(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Oi(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ii(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&Oi(n.x,n.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ii(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Mi(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!Di(n,o)&&Fi(n,i,i.next,o)&&Ni(n,o)&&Ni(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),Bi(i),Bi(i.next),i=t=o),i=i.next}while(i!==t);return i}function Si(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Ri(a,s)){var h=ki(a,s);return a=_i(a,a.next),h=_i(h,h.next),bi(a,e,r,i,n,o),void bi(h,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}function Ei(t,e){return t.x-e.x}function Ci(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r.prev;var h,u=r,l=r.x,c=r.y,p=1/0;i=r.next;for(;i!==u;)n>=i.x&&i.x>=l&&n!==i.x&&Oi(o<c?n:a,o,l,c,o<c?a:n,o,i.x,i.y)&&((h=Math.abs(o-i.y)/(n-i.x))<p||h===p&&i.x>r.x)&&Ni(i,t)&&(r=i,p=h),i=i.next;return r}(t,e),e){var r=ki(e,t);_i(r,r.next)}}function Ai(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Pi(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Oi(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function Ri(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Fi(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&Ni(t,e)&&Ni(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)}function Ii(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Di(t,e){return t.x===e.x&&t.y===e.y}function Fi(t,e,r,i){return!!(Di(t,e)&&Di(r,i)||Di(t,i)&&Di(r,e))||Ii(t,e,r)>0!=Ii(t,e,i)>0&&Ii(r,i,t)>0!=Ii(r,i,e)>0}function Ni(t,e){return Ii(t.prev,t,t.next)<0?Ii(t,e,t.next)>=0&&Ii(t,t.prev,e)>=0:Ii(t,e,t.prev)<0||Ii(t,t.next,e)<0}function ki(t,e){var r=new zi(t.i,t.x,t.y),i=new zi(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function Li(t,e,r,i){var n=new zi(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Bi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function zi(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ui(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}gi.deviation=function(t,e,r,i){var n=e&&e.length,o=n?e[0]*r:t.length,a=Math.abs(Ui(t,0,o,r));if(n)for(var s=0,h=e.length;s<h;s++){var u=e[s]*r,l=s<h-1?e[s+1]*r:t.length;a-=Math.abs(Ui(t,u,l,r))}var c=0;for(s=0;s<i.length;s+=3){var p=i[s]*r,d=i[s+1]*r,f=i[s+2]*r;c+=Math.abs((t[p]-t[f])*(t[d+1]-t[p+1])-(t[p]-t[d])*(t[f+1]-t[p+1]))}return 0===a&&0===c?0:Math.abs((c-a)/a)},gi.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[n][o][a]);n>0&&(i+=t[n-1].length,r.holes.push(i))}return r};var ji={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,i=t.holes,n=e.verts,o=e.indices;if(r.length>=6){for(var a=[],s=0;s<i.length;s++){var h=i[s];a.push(r.length/2),r=r.concat(h.points)}var u=gi(r,a,2);if(!u)return;var l=n.length/2;for(s=0;s<u.length;s+=3)o.push(u[s]+l),o.push(u[s+1]+l),o.push(u[s+2]+l);for(s=0;s<r.length;s++)n.push(r[s])}}},Vi={build:function(t){var e,r,i=t.shape,n=t.points,o=i.x,a=i.y;if(n.length=0,t.type===s.CIRC?(e=i.radius,r=i.radius):(e=i.width,r=i.height),0!==e&&0!==r){var h=Math.floor(30*Math.sqrt(i.radius))||Math.floor(15*Math.sqrt(e+r));h/=2.3;for(var u=2*Math.PI/h,l=0;l<h-.5;l++)n.push(o+Math.cos(u*l)*e,a+Math.sin(u*l)*r);n.push(n[0],n[1])}},triangulate:function(t,e){var r=t.points,i=e.verts,n=e.indices,o=i.length/2,a=o;i.push(t.shape.x,t.shape.y);for(var s=0;s<r.length;s+=2)i.push(r[s],r[s+1]),n.push(o++,a,o)}},Xi={build:function(t){var e=t.shape,r=t.points,i=e.x,n=e.y,o=e.width,a=e.height,s=e.radius;r.length=0,s?(Hi(i,n+s,i,n,i+s,n,r),Hi(i+o-s,n,i+o,n,i+o,n+s,r),Hi(i+o,n+a-s,i+o,n+a,i+o-s,n+a,r),Hi(i+s,n+a,i,n+a,i,n+a-s,r)):r.push(i,n,i+o,n,i+o,n+a,i,n+a)},triangulate:function(t,e){for(var r=t.points,i=e.verts,n=e.indices,o=i.length/2,a=gi(r,null,2),s=0,h=a.length;s<h;s+=3)n.push(a[s]+o),n.push(a[s+1]+o),n.push(a[s+2]+o);for(s=0,h=r.length;s<h;s++)i.push(r[s],r[++s])}};function Wi(t,e,r){return t+(e-t)*r}function Hi(t,e,r,i,n,o,a){void 0===a&&(a=[]);for(var s=a,h=0,u=0,l=0,c=0,p=0,d=0,f=0,v=0;f<=20;++f)h=Wi(t,r,v=f/20),u=Wi(e,i,v),l=Wi(r,n,v),c=Wi(i,o,v),p=Wi(h,l,v),d=Wi(u,c,v),0===f&&s[s.length-2]===p&&s[s.length-1]===d||s.push(p,d);return s}function Yi(t,e,r,i,n,o,a,s){var h,u;a?(h=i,u=-r):(h=-i,u=r);var l=t-r*n+h,c=e-i*n+u,p=t+r*o+h,d=e+i*o+u;return s.push(l,c),s.push(p,d),2}function Gi(t,e,r,i,n,o,a,s){var h=r-t,u=i-e,l=Math.atan2(h,u),c=Math.atan2(n-t,o-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var p=l,d=c-l,f=Math.abs(d),v=Math.sqrt(h*h+u*u),m=1+(15*f*Math.sqrt(v)/Math.PI>>0),y=d/m;if(p+=y,s){a.push(t,e),a.push(r,i);for(var g=1,x=p;g<m;g++,x+=y)a.push(t,e),a.push(t+Math.sin(x)*v,e+Math.cos(x)*v);a.push(t,e),a.push(n,o)}else{a.push(r,i),a.push(t,e);for(g=1,x=p;g<m;g++,x+=y)a.push(t+Math.sin(x)*v,e+Math.cos(x)*v),a.push(t,e);a.push(n,o),a.push(t,e)}return 2*m}function qi(t,e){!function(t,e){var r=t.shape,i=t.points||r.points.slice(),n=e.closePointEps;if(0!==i.length){var o=t.lineStyle,a=new N(i[0],i[1]),h=new N(i[i.length-2],i[i.length-1]),u=r.type!==s.POLY||r.closed,l=Math.abs(a.x-h.x)<n&&Math.abs(a.y-h.y)<n;if(u){i=i.slice(),l&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));var c=.5*(a.x+h.x),p=.5*(h.y+a.y);i.unshift(c,p),i.push(c,p)}var d=e.verts,m=i.length/2,y=i.length,g=d.length/2,x=o.width/2,_=x*x,b=o.miterLimit*o.miterLimit,T=i[0],w=i[1],M=i[2],S=i[3],E=0,C=0,A=-(w-S),P=T-M,O=0,R=0,I=Math.sqrt(A*A+P*P);A/=I,P/=I,A*=x,P*=x;var D=o.alignment,F=2*(1-D),k=2*D;u||(o.cap===f.ROUND?y+=Gi(T-A*(F-k)*.5,w-P*(F-k)*.5,T-A*F,w-P*F,T+A*k,w+P*k,d,!0)+2:o.cap===f.SQUARE&&(y+=Yi(T,w,A,P,F,k,!0,d))),d.push(T-A*F,w-P*F),d.push(T+A*k,w+P*k);for(var L=1;L<m-1;++L){T=i[2*(L-1)],w=i[2*(L-1)+1],M=i[2*L],S=i[2*L+1],E=i[2*(L+1)],C=i[2*(L+1)+1],A=-(w-S),P=T-M,A/=I=Math.sqrt(A*A+P*P),P/=I,A*=x,P*=x,O=-(S-C),R=M-E,O/=I=Math.sqrt(O*O+R*R),R/=I,O*=x,R*=x;var B=M-T,z=w-S,U=M-E,j=C-S,V=z*U-j*B,X=V<0;if(Math.abs(V)<.1)d.push(M-A*F,S-P*F),d.push(M+A*k,S+P*k);else{var W=(-A+T)*(-P+S)-(-A+M)*(-P+w),H=(-O+E)*(-R+S)-(-O+M)*(-R+C),Y=(B*H-U*W)/V,G=(j*W-z*H)/V,q=(Y-M)*(Y-M)+(G-S)*(G-S),Z=M+(Y-M)*F,K=S+(G-S)*F,Q=M-(Y-M)*k,J=S-(G-S)*k,$=X?F:k;q<=Math.min(B*B+z*z,U*U+j*j)+$*$*_?o.join===v.BEVEL||q/_>b?(X?(d.push(Z,K),d.push(M+A*k,S+P*k),d.push(Z,K),d.push(M+O*k,S+R*k)):(d.push(M-A*F,S-P*F),d.push(Q,J),d.push(M-O*F,S-R*F),d.push(Q,J)),y+=2):o.join===v.ROUND?X?(d.push(Z,K),d.push(M+A*k,S+P*k),y+=Gi(M,S,M+A*k,S+P*k,M+O*k,S+R*k,d,!0)+4,d.push(Z,K),d.push(M+O*k,S+R*k)):(d.push(M-A*F,S-P*F),d.push(Q,J),y+=Gi(M,S,M-A*F,S-P*F,M-O*F,S-R*F,d,!1)+4,d.push(M-O*F,S-R*F),d.push(Q,J)):(d.push(Z,K),d.push(Q,J)):(d.push(M-A*F,S-P*F),d.push(M+A*k,S+P*k),o.join===v.BEVEL||q/_>b||(o.join===v.ROUND?y+=X?Gi(M,S,M+A*k,S+P*k,M+O*k,S+R*k,d,!0)+2:Gi(M,S,M-A*F,S-P*F,M-O*F,S-R*F,d,!1)+2:(X?(d.push(Q,J),d.push(Q,J)):(d.push(Z,K),d.push(Z,K)),y+=2)),d.push(M-O*F,S-R*F),d.push(M+O*k,S+R*k),y+=2)}}T=i[2*(m-2)],w=i[2*(m-2)+1],M=i[2*(m-1)],A=-(w-(S=i[2*(m-1)+1])),P=T-M,A/=I=Math.sqrt(A*A+P*P),P/=I,A*=x,P*=x,d.push(M-A*F,S-P*F),d.push(M+A*k,S+P*k),u||(o.cap===f.ROUND?y+=Gi(M-A*(F-k)*.5,S-P*(F-k)*.5,M-A*F,S-P*F,M+A*k,S+P*k,d,!1)+2:o.cap===f.SQUARE&&(y+=Yi(M,S,A,P,F,k,!1,d)));var tt=e.indices,et=n*n;for(L=g;L<y+g-2;++L)T=d[2*L],w=d[2*L+1],M=d[2*(L+1)],S=d[2*(L+1)+1],E=d[2*(L+2)],C=d[2*(L+2)+1],Math.abs(T*(S-C)+M*(C-w)+E*(w-S))<et||tt.push(L,L+1,L+2)}}(t,e)}var Zi=function(){function t(){this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.alphaBlock=this.alphaBlock,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=me.WHITE,this.matrix=null,this.visible=!1,this.alphaBlock=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),Ki=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.cap=f.BUTT,e.join=v.MITER,e.miterLimit=10,e}return S(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.width=0,this.alignment=.5,this.native=!1,this.cap=f.BUTT,this.join=v.MITER,this.miterLimit=10},e}(Zi);var Qi,Ji={adaptive:!1,maxLength:10,minSegments:8,maxSegments:2048,segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive)return e;var r=Math.ceil(t/this.maxLength);return r<this.minSegments?r=this.minSegments:r>this.maxSegments&&(r=this.maxSegments),r}};var $i=new k,tn=new N,en=new Float32Array(3),rn=[],nn={};nn[s.POLY]=ji,nn[s.CIRC]=Vi,nn[s.ELIP]=Vi,nn[s.RECT]={build:function(t){var e=t.shape,r=e.x,i=e.y,n=e.width,o=e.height,a=t.points;a.length=0,a.push(r,i,r+n,i,r+n,i+o,r,i+o)},triangulate:function(t,e){var r=t.points,i=e.verts,n=i.length/2;i.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},nn[s.RREC]=Xi;var on=function(t){function e(){var e=t.call(this)||this;return e._blendMode=m.NORMAL,e.batchTint=-1,e.hitTestByPixel=!0,e.cacheAsBitmap=!0,e.closePointEps=1e-4,e._instanceType="Graphics",e._fillStyle=new Zi,e._lineStyle=new Ki,e.tint=16777215,e.batchTint=-1,e._matrix=null,e._holeMode=!1,e._currentPath=null,e.graphicsData=[],e._isUsedToMask=!1,e.boundsPadding=0,e.dirty=0,e.boundsDirty=-1,e.cacheDirty=-1,e.verts=[],e.indices=[],e.batches=[],e.geoBatches=[],e.uvs=[],e.batchDirty=-1,e.shapeIndex=0,e.vertexData=null,e._transformID=-1,e}return S(e,t),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"matrix",{get:function(){return this._matrix},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.clone=function(){var t=new e;t.renderable=this.renderable,t._fillStyle=this._fillStyle,t._lineStyle=this._lineStyle,t._isUsedToMask=this._isUsedToMask,t.boundsPadding=this.boundsPadding,t.dirty=0;for(var r=0;r<this.graphicsData.length;++r)t.graphicsData.push(this.graphicsData[r].clone());return t._currentPath=null,t.updateLocalBoundsSelf(),t},e.prototype.beginStroke=function(t,e,r,i,n,o,a,s){return void 0===t&&(t=0),void 0===e&&(e=1),void 0===r&&(r=f.BUTT),void 0===i&&(i=v.MITER),void 0===n&&(n=10),void 0===o&&(o=1),void 0===a&&(a=.5),void 0===s&&(s=!1),"string"==typeof t&&(t=Dt(t)),this.lineTextureStyle(e,me.WHITE,t,o,null,a,s),this._lineStyle.cap=r,this._lineStyle.join=i,this._lineStyle.miterLimit=n,this},e.prototype.lineStyle=function(t,e,r,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=1),void 0===i&&(i=.5),void 0===n&&(n=!1),this.lineTextureStyle(t,me.WHITE,e,r,null,i,n),this},e.prototype.lineTextureStyle=function(t,e,r,i,n,o,a){void 0===t&&(t=0),void 0===e&&(e=me.WHITE),void 0===r&&(r=16777215),void 0===i&&(i=1),void 0===n&&(n=null),void 0===o&&(o=.5),void 0===a&&(a=!1),this._currentPath&&this.startPoly();var s=t>0&&i>0;return s?(n&&(n=n.clone()).invert(),this._lineStyle.color=r,this._lineStyle.width=t,this._lineStyle.alpha=i,this._lineStyle.matrix=n,this._lineStyle.texture=e,this._lineStyle.alignment=o,this._lineStyle.native=a,this._lineStyle.visible=s):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this._currentPath){var t=this._currentPath.points,e=this._currentPath.points.length;e>2&&(this.drawShape(this._currentPath),this._currentPath=new mi,this._currentPath.closed=!1,this._currentPath.points.push(t[e-2],t[e-1]))}else this._currentPath=new mi,this._currentPath.closed=!1},e.prototype.finishPoly=function(){this._currentPath&&(this._currentPath.points.length>2?(this.drawShape(this._currentPath),this._currentPath=null):this._currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this._currentPath.points[0]=t,this._currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this._currentPath||this.moveTo(0,0);var r=this._currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this},e.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._currentPath?0===this._currentPath.points.length&&(this._currentPath.points=[t,e]):this.moveTo(t,e)},e.prototype.quadraticCurveTo=function(t,e,r,i){this._initCurve();var n=this._currentPath.points;0===n.length&&this.moveTo(0,0);for(var o=0,a=0,s=n[n.length-2],h=n[n.length-1],u=Ji.segmentsCount(function(t,e,r,i,n,o){var a=t-(2*r+n),s=e-(2*i+o),h=(r-2)*t*2,u=(i-2)*e*2,l=4*(a*a+s*s),c=4*(a*h+s*u),p=h*h+u*u,d=2*Math.sqrt(l+c+p),f=Math.sqrt(l),v=2*l*f,m=2*Math.sqrt(p),y=c/f;return(v*d+f*c*(d-m)+(4*p*l-c*c)*Math.log((2*f+y+d)/(y+m)))/(4*v)}(s,h,t,e,r,i)),l=1;l<=u;++l){var c=l/u;o=s+(t-s)*c,a=h+(e-h)*c,n.push(o+(t+(r-t)*c-o)*c,a+(e+(i-e)*c-a)*c)}return this},e.prototype.bezierCurveTo=function(t,e,r,i,n,o){this._initCurve();var a=this._currentPath.points,s=a[a.length-2],h=a[a.length-1];a.length-=2;var u=Ji.segmentsCount(function(t,e,r,i,n,o,a,s){for(var h=0,u=0,l=0,c=0,p=0,d=0,f=0,v=0,m=0,y=0,g=0,x=t,_=e,b=1;b<=10;++b)y=x-(v=(f=(d=(p=1-(u=b/10))*p)*p)*t+3*d*u*r+3*p*(l=u*u)*n+(c=l*u)*a),g=_-(m=f*e+3*d*u*i+3*p*l*o+c*s),x=v,_=m,h+=Math.sqrt(y*y+g*g);return h}(s,h,t,e,r,i,n,o));return function(t,e,r,i,n,o,a,s,h,u){void 0===u&&(u=[]);var l=0,c=0,p=0,d=0,f=0;u.push(t,e);for(var v=1,m=0;v<=h;++v)p=(c=(l=1-(m=v/h))*l)*l,f=(d=m*m)*m,u.push(p*t+3*c*m*r+3*l*d*n+f*a,p*e+3*c*m*i+3*l*d*o+f*s)}(s,h,t,e,r,i,n,o,u,a),this},e.prototype.arcTo=function(t,e,r,i,n){this._initCurve(t,e);var o=this._currentPath.points,a=o[o.length-2],s=o[o.length-1]-e,h=a-t,u=i-e,l=r-t,c=Math.abs(s*l-h*u);if(c<1e-8||0===n)o[o.length-2]===t&&o[o.length-1]===e||o.push(t,e);else{var p=s*s+h*h,d=u*u+l*l,f=s*u+h*l,v=n*Math.sqrt(p)/c,m=n*Math.sqrt(d)/c,y=v*f/p,g=m*f/d,x=v*l+m*h,_=v*u+m*s,b=h*(m+y),T=s*(m+y),w=l*(v+g),M=u*(v+g),S=Math.atan2(T-_,b-x),E=Math.atan2(M-_,w-x);this.arc(x+t,_+e,n,S,E,h*u>l*s)}return this},e.prototype.arc=function(t,e,r,i,n,o){if(void 0===o&&(o=!1),i===n)return this;!o&&n<=i?n+=b:o&&i<=n&&(i+=b);var a=n-i;if(0===a)return this;var s=t+Math.cos(i)*r,h=e+Math.sin(i)*r,u=this.closePointEps,l=this._currentPath?this._currentPath.points:null;if(l){var c=Math.abs(l[l.length-2]-s),p=Math.abs(l[l.length-1]-h);c<u&&p<u||l.push(s,h)}else this.moveTo(s,h),l=this._currentPath.points;for(var d=Ji.segmentsCount(Math.abs(a)*r,40*Math.ceil(Math.abs(a)/b)),f=a/(2*d),v=2*f,m=Math.cos(f),y=Math.sin(f),g=d-1,x=g%1/g,_=0;_<=g;++_){var T=f+i+v*(_+x*_),w=Math.cos(T),M=-Math.sin(T);l.push((m*w+y*M)*r+t,(m*-M+y*w)*r+e)}return this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),"string"==typeof t&&(t=Dt(t)),this.beginTextureFill(me.WHITE,t,e)},e.prototype.beginTextureFill=function(t,e,r,i){void 0===t&&(t=me.WHITE),void 0===e&&(e=16777215),void 0===r&&(r=1),void 0===i&&(i=null),this._currentPath&&this.startPoly();var n=r>0;return n?(this._fillStyle.color=e,this._fillStyle.alpha=r,this._fillStyle.texture=t,this._fillStyle.matrix=i,this._fillStyle.visible=n):(this._fillStyle.reset(),this._fillStyle.alphaBlock=!0),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.endStroke=function(){return this.finishPoly(),this._lineStyle.reset(),this},e.prototype.closePath=function(){var t=this._currentPath;return this._currentPath&&(t.closed=!0),this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.drawRect=function(t,e,r,i){return this.drawShape(new B(t,e,r,i))},e.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new yi(t,e,r,i,n))},e.prototype.drawCircle=function(t,e,r){return this.drawShape(new fi(t,e,r))},e.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new vi(t,e,r,i))},e.prototype.drawPolygon=function(t){var e=t,r=!0;if(e instanceof mi&&(r=e.closed,e=e.points),!Array.isArray(e)){e=new Array(arguments.length);for(var i=0;i<e.length;++i)e[i]=arguments[i]}var n=new mi(e);return n.closed=r,this.drawShape(n),this},e.prototype.drawStar=function(t,e,r,i,n,o){void 0===o&&(o=0),n=n||i/2;for(var a=-1*Math.PI/2+o,s=2*r,h=b/s,u=[],l=0;l<s;l++){var c=l%2?n:i,p=l*h+a;u.push(t+c*Math.cos(p),e+c*Math.sin(p))}return this.drawPolygon(u)},e.prototype.drawShape=function(t){if(this._holeMode){if(!this.graphicsData.length)return this;e=new ci(t,null,null,this._matrix);this.graphicsData[this.graphicsData.length-1].holes.push(e),this.dirty++}else{var e=new ci(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix);this.graphicsData.push(e),this.dirty++}return this},e.prototype.clear=function(){if(this.graphicsData.length>0){this.boundsDirty=-1,this.dirty++,this.graphicsData.length=0,this.verts.length=0,this.uvs.length=0,this.indices.length=0,this.shapeIndex=0;for(var t=0;t<this.geoBatches.length;t++){var e=this.geoBatches[t];e.start=0,e.attribStart=0,e.style=null,rn.push(e)}this.geoBatches.length=0,this.batches.length=0}return this._currentPath=null,this._matrix=null,this._holeMode=!1,this._currentPath=null,this},e.prototype.isFastRect=function(){return!1},e.prototype._renderWebGL=function(t){if(this.finishPoly(),this.updateBatch(),t.batchManager.setObjectRenderer(t.plugins.batch),this.batches.length){this.calculateVertices(),this.calculateTints();for(var e=0;e<this.batches.length;e++){var r=this.batches[e];r._worldAlpha=this._worldAlpha*r.graAlpha,t.plugins.batch.render(r)}}},e.prototype.updateBatch=function(){if(this.batchDirty!==this.dirty&&0!==this.graphicsData.length){this.batchDirty=this.dirty;var t,e=this.uvs;(t=this.geoBatches.pop())||((t=rn.pop()||new an).style=t.style||this.graphicsData[0].fillStyle||this.graphicsData[0].lineStyle);var r=t.style.texture.baseTexture,i=t.style.color+t.style.alpha;this.geoBatches.push(t);for(var n=this.shapeIndex;n<this.graphicsData.length;n++){this.shapeIndex++;var o=this.graphicsData[n],a=nn[o.type],s=o.fillStyle,h=o.lineStyle;a.build(o),o.matrix&&this.transformPoints(o.points,o.matrix);for(var u=0;u<2;u++){var l=0===u?s:h;if(l.visible){var c=l.texture.baseTexture;if(r!==c||l.color+l.alpha!==i){c.wrapMode=x.REPEAT,r=c,i=l.color+l.alpha;var p=this.indices.length,d=this.verts.length/2;t.size=p-t.start,t.attribSize=d-t.attribStart,t.size>0&&(t=rn.pop()||new an,this.geoBatches.push(t)),t.style=l,t.start=p,t.attribStart=d}var f=this.verts.length/2;0===u?o.holes.length?(this.proccessHoles(o.holes),ji.triangulate(o,this)):a.triangulate(o,this):qi(o,this);var v=this.verts.length/2-f;this.addUvs(this.verts,e,l.texture,f,v,l.matrix)}}}var m=this.indices.length,y=this.verts.length/2;t.size=m-t.start,t.attribSize=y-t.attribStart;for(var g=new Uint16Array(this.indices),_=new Float32Array(this.uvs),b=0;b<this.geoBatches.length;b++){var T=this.geoBatches[b];for(u=0;u<T.size;u++){var w=T.start+u;g[w]=g[w]-T.attribStart}}this._transformID=-1,this.batchTint=-1,this.batches=[],this.vertexData=new Float32Array(this.verts);for(var M=this.blendMode,S=0;S<this.geoBatches.length;S++){var E=this.geoBatches[S],C=E.style.color,A=new Float32Array(this.vertexData.buffer,4*E.attribStart*2,2*E.attribSize),P=new Float32Array(_.buffer,4*E.attribStart*2,2*E.attribSize);T={_vertexData:A,_indices:new Uint16Array(g.buffer,2*E.start,E.size),_uvs:P,_tintRGB:C,_texture:E.style.texture,_worldAlpha:1,_blendMode:M,graAlpha:E.style.alpha,_batchRGB:Rt(C)};this.batches[S]=T}}},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=Rt(this.tint,en),e=0;e<this.batches.length;e++){var r=this.batches[e],i=r._batchRGB,n=(t[0]*i[0]*255<<16)+(t[1]*i[1]*255<<8)+(0|t[2]*i[2]*255);r._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var t=this.transform.worldMatrix,e=t.a,r=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty,s=this.verts,h=this.vertexData,u=0,l=0;l<s.length;l+=2){var c=s[l],p=s[l+1];h[u++]=e*c+i*p+o,h[u++]=n*p+r*c+a}}},e.prototype.transformPoints=function(t,e){for(var r=0;r<t.length/2;r++){var i=t[2*r],n=t[2*r+1];t[2*r]=e.a*i+e.c*n+e.tx,t[2*r+1]=e.b*i+e.d*n+e.ty}},e.prototype._renderCanvas=function(t){if(this.finishPoly(),this.cacheAsBitmap){if(this.cacheDirty!=this.dirty){this.cacheDirty=this.dirty;var e=this.mask;this.mask=null,this.cacheAsBitmap=!1;var r=this.alpha;this.alpha=1;var i=this.children;this.children=[],this.generateCanvasTexture(),this.mask=e,this.alpha=r,this.cacheAsBitmap=!0,this.children=i,this.transform._parentID=-1,this.parent&&this.updateTransform()}t.plugins.sprite.render(this)}else t.plugins.graphics.render(this)},e.prototype._calculateBounds=function(){this.updateLocalBoundsSelf();var t=this._localBoundsSelf,e=this.transform.worldMatrix;e.transformPoint(t.x,t.y,$t._p1),e.transformPoint(t.x+t.width,t.y,$t._p2),e.transformPoint(t.x+t.width,t.y+t.height,$t._p3),e.transformPoint(t.x,t.y+t.height,$t._p4),B.createFromPoints(this._bounds,$t._p1,$t._p2,$t._p3,$t._p4)},e.prototype.hitTestPoint=function(e,r){return void 0===r&&(r=!1),this.visible?(i=t.prototype.hitTestPoint.call(this,e,r))?i:r&&!this.mouseEnable?null:(this.updateLocalBoundsSelf(),(i=this.displayObjectHitTestPoint(e,r))?this.hitTestByPixel?this.hitTestPointAccuratly(e,r):i:null):null;var i},e.prototype.hitTestPointAccuratly=function(t,e){e?this.worldMatrix.transformPointInverse(t.x,t.y,tn):tn.set(t.x,t.y);for(var r=this.graphicsData,i=0;i<r.length;++i){var n=r[i];if((n.fillStyle.visible||n.fillStyle.alphaBlock)&&(n.shape&&n.shape.isPointIn(tn))){if(!n.holes||!n.holes.length)return this;for(var o=!1,a=0;a<n.holes.length;a++){if(n.holes[a].shape.isPointIn(tn)){o=!0;break}}if(!o)return this}}return null},e.prototype.updateLocalBoundsSelf=function(){if(this.boundsDirty!=this.dirty){this.boundsDirty=this.dirty,this.finishPoly();var t=1/0,e=-1/0,r=1/0,i=-1/0;if(this.graphicsData.length)for(var n=void 0,o=0,a=0,h=0,u=0,l=0;l<this.graphicsData.length;l++){var c=this.graphicsData[l],p=c.type,f=c.lineStyle;c.matrix||k.IDENTITY;var v=0;if(f&&f.visible){var m=f.alignment;v=f.width,p===s.POLY||(v*=Math.max(0,m))}if(n=c.shape,p===s.RECT||p===s.RREC)o=n.x-v,a=n.y-v,t=o<t?o:t,e=o+(h=n.width+2*v)>e?o+h:e,r=a<r?a:r,i=a+(u=n.height+2*v)>i?a+u:i;else if(p===s.CIRC)o=n.x,a=n.y,t=o-(h=n.radius+v)<t?o-h:t,e=o+h>e?o+h:e,r=a-(u=n.radius+v)<r?a-u:r,i=a+u>i?a+u:i;else if(p===s.ELIP)o=n.x,a=n.y,t=o-(h=n.width+v)<t?o-h:t,e=o+h>e?o+h:e,r=a-(u=n.height+v)<r?a-u:r,i=a+u>i?a+u:i;else for(var y=n,g=y.points,x=0,_=0,b=0,T=0,w=0,M=0,S=0,E=0,C=0;C+2<g.length;C+=2)if(o=g[C],a=g[C+1],x=g[C+2],_=g[C+3],b=Math.abs(x-o),T=Math.abs(_-a),u=v,!((h=Math.sqrt(b*b+T*T))<1e-9)){if(w=(u/h*T+b)/2,M=(u/h*b+T)/2,S=(x+o)/2,E=(_+a)/2,v&&f.alignment!=d.middle){var A=v/2,P=-(a-_),O=o-x;P/=h,O/=h,P*=A,O*=A;var R=f.alignment,I=1-R,D=R;R==d.inner?(S-=P*I,E-=O*I):(S+=P*D,E+=O*D)}t=S-w<t?S-w:t,e=S+w>e?S+w:e,r=E-M<r?E-M:r,i=E+M>i?E+M:i,v&&!y.closed&&(0==C&&(t=Math.min(t,o-v),e=Math.max(e,o+v),r=Math.min(r,a-v),i=Math.max(i,a+v)),C+4==g.length&&(t=Math.min(t,x-v),e=Math.max(e,x+v),r=Math.min(r,_-v),i=Math.max(i,_+v))),v&&g.length}}else t=0,e=0,r=0,i=0;var F=this.boundsPadding;this._localBoundsSelf.x=t-F,this._localBoundsSelf.y=r-F,this._localBoundsSelf.width=e-t+2*F,this._localBoundsSelf.height=i-r+2*F}},e.prototype.generateCanvasTexture=function(t){void 0===t&&(t=g.LINEAR),this.updateLocalBoundsSelf();var e=this._localBoundsSelf;return this._canvasBuffer?this._canvasBuffer.resize(e.width,e.height):this._canvasBuffer=di.create(e.width,e.height,t),Qi||(Qi=new ui(null,0,0)),this.transform.updateLocalMatrix(),$i.copy(this.transform.localMatrix),$i.invert(),$i.tx-=e.x,$i.ty-=e.y,Qi.render(this,this._canvasBuffer,$i),this._texture||(this._texture=me.fromCanvas(this._canvasBuffer.baseTexture._canvasRenderTarget.canvas,"graphics")),this._texture.baseTexture.update(),this._texture},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this._matrix=null,this._currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this.vertexData=null,this.geoBatches.length=0,this.geoBatches=null,this.batches.length=0,this.batches=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateLocalBoundsSelf(),Math.abs(this.scale.x)*this._localBoundsSelf.width},set:function(t){this.updateLocalBoundsSelf();var e=this._localBoundsSelf.width;if(0!==e){var r=kt(this.scale.x)||1;this.scale.x=r*t/e}else this.scale.x=1;this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateLocalBoundsSelf(),Math.abs(this.scale.y)*this._localBoundsSelf.height},set:function(t){this.updateLocalBoundsSelf();var e=this._localBoundsSelf.height;if(0!==e){var r=kt(this.scale.y)||1;this.scale.y=r*t/e}else this.scale.y=1;this._height=t},enumerable:!1,configurable:!0}),e.prototype.proccessHoles=function(t){for(var e=0;e<t.length;e++){var r=t[e];nn[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.matrix)}},e.prototype.addUvs=function(t,e,r,i,n,o){for(var a=0,s=e.length,h=r.frame;a<n;){var u=t[2*(i+a)],l=t[2*(i+a)+1];if(o){var c=o.a*u+o.c*l+o.tx;l=o.b*u+o.d*l+o.ty,u=c}a++;var p=r.frame;e.push(u/p.width,l/p.height)}var d=r.baseTexture;(h.width<d.width||h.height<d.height)&&this.adjustUvs(e,r,s,n)},e.prototype.adjustUvs=function(t,e,r,i){for(var n=e.baseTexture,o=1e-6,a=r+2*i,s=e.frame,h=s.width/n.width,u=s.height/n.height,l=s.x/s.width,c=s.y/s.height,p=Math.floor(t[r]+o),d=Math.floor(t[r+1]+o),f=r+2;f<a;f+=2)p=Math.min(p,Math.floor(t[f]+o)),d=Math.min(d,Math.floor(t[f+1]+o));l-=p,c-=d;for(f=r;f<a;f+=2)t[f]=(t[f]+l)*h,t[f+1]=(t[f+1]+c)*u},e}(te),an=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},sn=function(t){function e(){var e=t.call(this)||this;e._command=[],e.hitTestByPixel=!0,e._isUsedToMask=!1,e._instanceType="Shape";var r=G();return r.width=3,r.height=3,e.texture=me.fromCanvas(r,"shapeCanvas"),me.addToCache(e.texture,e.texture.baseTexture.textureCacheIds[0]),e.canvas=r,e.context=r.getContext("2d"),e.dirty=!0,e}return S(e,t),e.prototype.drawRoundedRect=function(t,e,r,i,n,o,a,s){void 0===n&&(n=0);var h=(r<i?r:i)/2,u=0,l=0,c=0,p=0;null==o&&(o=n),null==a&&(a=n),null==s&&(s=n),n<0&&(n*=u=-1),n>h&&(n=h),o<0&&(o*=l=-1),o>h&&(o=h),s<0&&(s*=c=-1),s>h&&(s=h),a<0&&(a*=p=-1),a>h&&(a=h);var d=this._command;return d[d.length]=[1,"moveTo",[t+r-o,e]],d[d.length]=[1,"arcTo",[t+r+o*l,e-o*l,t+r,e+o,o]],d[d.length]=[1,"lineTo",[t+r,e+i-s]],d[d.length]=[1,"arcTo",[t+r+s*c,e+i+s*c,t+r-s,e+i,s]],d[d.length]=[1,"lineTo",[t+a,e+i]],d[d.length]=[1,"arcTo",[t-a*p,e+i+a*p,t,e+i-a,a]],d[d.length]=[1,"lineTo",[t,e+n]],d[d.length]=[1,"arcTo",[t-n*u,e-n*u,t+n,e,n]],d[d.length]=[1,"closePath",[]],this},e.prototype.moveTo=function(t,e){return this._command[this._command.length]=[1,"moveTo",[t,e]],this},e.prototype.lineTo=function(t,e){return this._command[this._command.length]=[1,"lineTo",[t,e]],this},e.prototype.arcTo=function(t,e,r,i,n){return this._command[this._command.length]=[1,"arcTo",[t,e,r,i,n]],this},e.prototype.quadraticCurveTo=function(t,e,r,i){return this._command[this._command.length]=[1,"quadraticCurveTo",[t,e,r,i]],this},e.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._command[this._command.length]=[1,"bezierCurveTo",[t,e,r,i,n,o]],this},e.prototype.closePath=function(){return this._command[this._command.length]=[1,"closePath",[]],this},e.prototype.drawRect=function(t,e,r,i){var n=this._command;return n[n.length]=[1,"moveTo",[t,e]],n[n.length]=[1,"lineTo",[t+r,e]],n[n.length]=[1,"lineTo",[t+r,e+i]],n[n.length]=[1,"lineTo",[t,e+i]],n[n.length]=[1,"closePath",[]],this},e.prototype.arc=function(t,e,r,i,n,o){return void 0===o&&(o=!1),this._command[this._command.length]=[1,"arc",[t,e,r,i,n,o]],this},e.prototype.drawCircle=function(t,e,r,i){return void 0===i&&(i=!1),this._command[this._command.length]=[1,"arc",[t,e,r,0,2*Math.PI,i]],this},e.prototype.drawEllipse=function(t,e,r,i){var n=.5522848,o=r*n,a=i*n,s=this._command;return s[s.length]=[1,"moveTo",[t-r,e]],s[s.length]=[1,"bezierCurveTo",[t-r,e-a,t-o,e-i,t,e-i]],s[s.length]=[1,"bezierCurveTo",[t+o,e-i,t+r,e-a,t+r,e]],s[s.length]=[1,"bezierCurveTo",[t+r,e+a,t+o,e+i,t,e+i]],s[s.length]=[1,"bezierCurveTo",[t-o,e+i,t-r,e+a,t-r,e]],this},e.prototype.clear=function(){var t=this;return t._command=[],t.dirty=!0,t},e.prototype.beginFill=function(t,e){void 0===t&&(t=0),void 0===e&&(e=1),"number"==typeof t&&(t=It(t));var r=Nt(t,e);return this._fill(r),this},e.prototype.beginGradientFill=function(t,e){return this._fill(Pt(t,e)),this},e.prototype.beginBitmapFill=function(t,e){var r=this;return e&&(r._isBitmapFill=e),r._fill(Ot(t)),r},e.prototype._fill=function(t){var e=this._command;e[e.length]=[0,"fillStyle",t],e[e.length]=[1,"beginPath",[]],this.dirty=!0},e.prototype.beginStroke=function(t,e,r,i,n,o){void 0===t&&(t=0),void 0===e&&(e=1),void 0===r&&(r=f.BUTT),void 0===i&&(i=v.MITER),void 0===n&&(n=10),void 0===o&&(o=1),"number"==typeof t&&(t=It(t));var a=Nt(t,o);return this._stroke(a,e,r,i,n),this},e.prototype.beginGradientStroke=function(t,e,r,i,n,o){return void 0===r&&(r=1),void 0===i&&(i=f.BUTT),void 0===n&&(n=v.MITER),void 0===o&&(o=10),this._stroke(Pt(t,e),r,i,n,o),this},e.prototype.beginBitmapStroke=function(t,e,r,i,n,o){void 0===r&&(r=1),void 0===i&&(i=f.BUTT),void 0===n&&(n=v.MITER),void 0===o&&(o=10);var a=this;return e&&(a._isBitmapStroke=e),a._stroke(Ot(t),r,i,n,o),a},e.prototype._stroke=function(t,e,r,i,n){var o=this._command;o[o.length]=[0,"lineWidth",e],o[o.length]=[0,"lineCap",r],o[o.length]=[0,"lineJoin",i],o[o.length]=[0,"miterLimit",n],o[o.length]=[0,"strokeStyle",t],o[o.length]=[1,"beginPath",[]],this.dirty=!0},e.prototype.endFill=function(){var t=this,e=t._command,r=t._isBitmapFill;return r&&(e[e.length]=[2,"setTransform",r]),e[e.length]=[1,"fill",[]],r&&(t._isBitmapFill=null),t},e.prototype.endStroke=function(){var t=this,e=t._command,r=t._isBitmapStroke;return r&&(e[e.length]=[2,"setTransform",r]),e[e.length]=[1,"stroke",[]],r&&(t._isBitmapStroke=null),t},e.prototype.updateShape=function(){var t=this;if(t.dirty){t.dirty=!1;var e,r,i,n,o,a,s=t._command.length,h=0,u=0,l=0;for(o=0;o<s;o++)if(1==(a=t._command[o])[0]){if("moveTo"==a[1]||"lineTo"==a[1]||"arcTo"==a[1]||"bezierCurveTo"==a[1])null==e&&(e=a[2][0]),null==r&&(r=a[2][1]),null==i&&(i=a[2][0]),null==n&&(n=a[2][1]),"bezierCurveTo"==a[1]?(e=Math.min(e,a[2][0],a[2][2],a[2][4]),r=Math.min(r,a[2][1],a[2][3],a[2][5]),i=Math.max(i,a[2][0],a[2][2],a[2][4]),n=Math.max(n,a[2][1],a[2][3],a[2][5]),h=a[2][4],u=a[2][5]):(e=Math.min(e,a[2][0]),r=Math.min(r,a[2][1]),i=Math.max(i,a[2][0]),n=Math.max(n,a[2][1]),h=a[2][0],u=a[2][1]);else if("quadraticCurveTo"==a[1]){var c=.5*(h+a[2][0]),p=.5*(u+a[2][1]),d=.5*(a[2][0]+a[2][2]),f=.5*(a[2][1]+a[2][3]);null==e&&(e=c),null==r&&(r=p),null==i&&(i=c),null==n&&(n=p),e=Math.min(e,c,d,a[2][2]),r=Math.min(r,p,f,a[2][3]),i=Math.max(i,c,d,a[2][2]),n=Math.max(n,p,f,a[2][3]),h=a[2][2],u=a[2][3]}else if("arc"==a[1]){var v=a[2][0],m=a[2][1],y=a[2][2],g=v-y,x=m-y,_=v+y,b=m+y;null==e&&(e=g),null==r&&(r=x),null==i&&(i=_),null==n&&(n=b),e=Math.min(e,g),r=Math.min(r,x),i=Math.max(i,_),n=Math.max(n,b)}}else"lineWidth"==a[1]&&l<a[2]&&(l=a[2]);if(null!=e||l>0){null==e&&(e=0,r=0);var T=(i+=20+l>>1)-(e-=20+l>>1),w=(n+=20+l>>1)-(r-=20+l>>1),M=t.canvas,S=t.context;M.width=T,M.height=w,S.clearRect(0,0,T,w),S.setTransform(1,0,0,1,-e,-r),t._drawShape(S),t.anchorTexture.set(-e/T,-r/w)}else t.canvas.width=0,t.canvas.height=0,t.anchorTexture.set(0,0);t.texture.update()}},e.prototype._drawShape=function(t){for(var e,r=this,i=r._command,n=i.length,o=0;o<n;o++)if((e=i[o])[0]>0){var a=e[2].length;if(0==a)t[e[1]]();else if(2==a)t[e[1]](e[2][0],e[2][1]);else if(4==a)t[e[1]](e[2][0],e[2][1],e[2][2],e[2][3]);else if(5==a)t[e[1]](e[2][0],e[2][1],e[2][2],e[2][3],e[2][4]);else if(6==a){var s=e[2][4],h=e[2][5];2==e[0]&&(s+=r.anchorTexture.x*r.canvas.width,s+=r.anchorTexture.y*r.canvas.height),t[e[1]](e[2][0],e[2][1],e[2][2],e[2][3],s,h)}}else t[e[1]]=e[2]},e.prototype.hitTestPoint=function(e,r){return void 0===r&&(r=!1),this.updateShape(),t.prototype.hitTestPoint.call(this,e,r)},e.prototype.changeColor=function(t){for(var e=this,r=e._command.length,i=e._command,n=0;n<r;n++)0==i[n][0]&&("fillStyle"==i[n][1]&&t.fillColor&&i[n][2]!=t.fillColor&&(i[n][2]=t.fillColor,e.dirty=!0),"strokeStyle"==i[n][1]&&t.strokeColor&&i[n][2]!=t.strokeColor&&(i[n][2]=t.strokeColor,e.dirty=!0),"lineWidth"==i[n][1]&&t.lineWidth&&i[n][2]!=t.lineWidth&&(i[n][2]=t.lineWidth,e.dirty=!0))},e.prototype.calculateBounds=function(){this.updateShape(),this.stage&&this.stage.renderObj.type==a.WEBGL&&this._isUsedToMask&&this._boundsID++,t.prototype.calculateBounds.call(this)},e.prototype._renderCanvas=function(e){this.updateShape(),t.prototype._renderCanvas.call(this,e)},e.prototype._renderWebGL=function(e){this.updateShape(),t.prototype._renderWebGL.call(this,e)},e.prototype.destroy=function(){var e=this;e._command=null,e._isBitmapStroke=null,e._isBitmapFill=null,t.prototype.destroy.call(this)},e}(_e),hn=new N,un=new mi,ln=function(t){function e(e,r,i,n){var o=t.call(this)||this;return o._blendMode=m.NORMAL,o._instanceType="Mesh",o._texture=e||me.EMPTY,o._uvs=i||new Float32Array([0,0,1,0,1,1,0,1]),o._vertices=r||new Float32Array([0,0,100,0,100,100,0,100]),o._indices=n||new Uint16Array([0,1,3,2,3,1]),o._vertexDirty=0,o._vertexId=-1,o._localBoundsSelfId=-1,o.blendMode=m.NORMAL,o.canvasPadding=0,o._tint=null,o._tintRGB=null,o.tint=16777215,o._uvTransform=new Er(o._texture),o._needRefresh=!0,o}return S(e,t),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){},enumerable:!1,configurable:!0}),e.prototype._renderWebGL=function(t){this.refresh(),this.calculateVertices(),t.batchManager.setObjectRenderer(t.plugins.batch),t.plugins.batch.render(this)},e.prototype._renderCanvas=function(t){this.refresh(),t.plugins.mesh.render(this)},e.prototype._onTextureUpdate=function(){this._uvTransform.texture=this._texture,this._needRefresh=!0},e.prototype.multiplyUvs=function(){this._uvTransform.multiplyUvs(this._uvs)},e.prototype.refresh=function(t){void 0===t&&(t=!1),this._texture&&this._texture.valid&&(this._uvTransform.update(t)||this._needRefresh||t)&&this._refresh()},e.prototype._refresh=function(){},e.prototype.calculateVertices=function(){if(!(this._vertexId===this._vertexDirty&&this._transformID===this.transform._worldID||(this._vertexId=this._vertexDirty,this._transformID=this.transform._worldID,this._vertices.length<=2))){this._vertexData||(this._vertexData=new Float32Array(this._vertices.length));for(var t=this.transform.worldMatrix,e=t.a,r=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty,s=this._vertexData,h=0;h<s.length/2;h++){var u=this._vertices[2*h],l=this._vertices[2*h+1];s[2*h]=e*u+i*l+o,s[2*h+1]=r*u+n*l+a}}},e.prototype._calculateBounds=function(){this.updateLocalBoundsSelf();var t=this._localBoundsSelf,e=this.transform.worldMatrix;e.transformPoint(t.x,t.y,$t._p1),e.transformPoint(t.x+t.width,t.y,$t._p2),e.transformPoint(t.x+t.width,t.y+t.height,$t._p3),e.transformPoint(t.x,t.y+t.height,$t._p4),B.createFromPoints(this._bounds,$t._p1,$t._p2,$t._p3,$t._p4)},e.prototype.updateLocalBoundsSelf=function(){this._localBoundsSelfId!=this._vertexDirty&&(this._localBoundsSelfId=this._vertexDirty,this._vertices.length<=2&&this._localBoundsSelf.clear(),B.createFromVertexData(this._localBoundsSelf,this._vertices))},e.prototype.hitTestPoint=function(e,r){return void 0===r&&(r=!1),this.visible?(i=t.prototype.hitTestPoint.call(this,e,r))?i:r&&!this.mouseEnable?null:(this.updateLocalBoundsSelf(),(i=this.displayObjectHitTestPoint(e,r))?this.hitTestPointAccuratly(e,r):null):null;var i},e.prototype.hitTestPointAccuratly=function(t,e){e?this.globalToLocal(t,hn):hn.set(t.x,t.y);for(var r=this._vertices,i=un.points,n=this._indices,o=this._indices.length,a=0;a+2<o;a+=3){var s=2*n[a],h=2*n[a+1],u=2*n[a+2];if(i[0]=r[s],i[1]=r[s+1],i[2]=r[h],i[3]=r[h+1],i[4]=r[u],i[5]=r[u+1],un.isPointIn(hn))return this}return null},Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t,t&&(t.baseTexture.hasLoaded?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16))},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){t.prototype.destroy.call(this),this._texture.removeEventListener("update",this._onTextureUpdate,this),this._uvs=null,this._vertices=null,this._indices=null,this._vertexData=null},e}(te),cn=function(t){function e(e,r,i){void 0===r&&(r=10),void 0===i&&(i=10);var n=t.call(this,e)||this;return n.verticesX=r,n.verticesY=i,n.verticesX=r||10,n.verticesY=i||10,n.refresh(),n}return S(e,t),e.prototype._refresh=function(){for(var t=this.texture,e=this.verticesX*this.verticesY,r=[],i=[],n=this.verticesX-1,o=this.verticesY-1,a=t.width/n,s=t.height/o,h=0;h<e;h++){var u=h%this.verticesX,l=h/this.verticesX|0;r.push(u*a,l*s),i.push(u/n,l/o)}this._vertices=new Float32Array(r),this._uvs=new Float32Array(i),this._indices=pn(this.verticesX,this.verticesY),this._vertexDirty++,this.multiplyUvs()},e}(ln);function pn(t,e){for(var r=t-1,i=r*(e-1),n=[],o=0;o<i;o++){var a=o%r,s=o/r|0,h=s*t+a,u=s*t+a+1,l=(s+1)*t+a,c=(s+1)*t+a+1;n.push(h,u,l),n.push(u,c,l)}return new Uint16Array(n)}var dn,fn=pn(4,4),vn=function(t){function e(e,r,i,n,o){void 0===r&&(r=10),void 0===i&&(i=10),void 0===n&&(n=10),void 0===o&&(o=10);var a=t.call(this,e)||this;return a._origWidth=e.orig.width,a._origHeight=e.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=r,a._rightWidth=n,a._topHeight=i,a._bottomHeight=o,a._indices=fn,a._vertices=new Float32Array(32),a._uvs=new Float32Array(32),a.refresh(!0),a}return S(e,t),e.prototype.updateHorizontalVertices=function(){var t=this._vertices,e=this._topHeight+this._bottomHeight,r=this._height>e?1:this._height/e;t[9]=t[11]=t[13]=t[15]=this._topHeight*r,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*r,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this._vertices,e=this._leftWidth+this._rightWidth,r=this._width>e?1:this._width/e;t[2]=t[10]=t[18]=t[26]=this._leftWidth*r,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*r,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._renderCanvas=function(t){var e=t.context;e.globalAlpha=this._worldAlpha,t.setBlendMode(this.blendMode);var r=this.worldMatrix;e.setTransform(r.a,r.b,r.c,r.d,r.tx,r.ty);var i=this.texture.baseTexture,n=i.source,o=i.width,a=i.height;this.drawSegment(e,n,o,a,0,1,10,11),this.drawSegment(e,n,o,a,2,3,12,13),this.drawSegment(e,n,o,a,4,5,14,15),this.drawSegment(e,n,o,a,8,9,18,19),this.drawSegment(e,n,o,a,10,11,20,21),this.drawSegment(e,n,o,a,12,13,22,23),this.drawSegment(e,n,o,a,16,17,26,27),this.drawSegment(e,n,o,a,18,19,28,29),this.drawSegment(e,n,o,a,20,21,30,31)},e.prototype.drawSegment=function(t,e,r,i,n,o,a,s){var h=this._uvs,u=this._vertices,l=(h[a]-h[n])*r,c=(h[s]-h[o])*i,p=u[a]-u[n],d=u[s]-u[o];l<1&&(l=1),c<1&&(c=1),p<1&&(p=1),d<1&&(d=1),t.drawImage(e,h[n]*r,h[o]*i,l,c,u[n],u[o],p,d)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._needRefresh=!0},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this._uvs,e=this.texture;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var r=1/this._origWidth,i=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this._vertexDirty++,this.multiplyUvs()},e}(ln),mn=function(t){function e(e,r){var i=t.call(this,e)||this;return i.points=r,i._vertices=new Float32Array(4*r.length),i._uvs=new Float32Array(4*r.length),i._indices=new Uint16Array(6*(r.length-1)),i.textureHeight=e.height,i.refresh(!0),i.refreshVertices(),i}return S(e,t),e.prototype._refresh=function(){var t=this.points;if(!(t.length<1)&&this.texture._uvs){this._vertices.length/4!==t.length&&(this._vertices=new Float32Array(4*t.length),this._uvs=new Float32Array(4*t.length),this._indices=new Uint16Array(6*(t.length-1)));var e=this._uvs,r=this._indices;e[0]=0,e[1]=0,e[2]=0,e[3]=1;for(var i=t.length,n=1;n<i;n++){var o=n/(i-1);e[s=4*n]=o,e[s+1]=0,e[s+2]=o,e[s+3]=1}var a=0;for(n=0;n<i-1;n++){var s=2*n;r[a++]=s,r[a++]=s+1,r[a++]=s+2,r[a++]=s+2,r[a++]=s+1,r[a++]=s+3}this.multiplyUvs()}},e.prototype.refreshVertices=function(){var t=this.points;if(!(t.length<1)){if(this._vertices.length/4!==t.length)return this._refresh(),void this.refreshVertices();for(var e,r=t[0],i=0,n=0,o=this._vertices,a=t.length,s=0;s<a;s++){var h=t[s],u=4*s;n=-((e=s<t.length-1?t[s+1]:h).x-r.x),i=e.y-r.y;var l=Math.sqrt(i*i+n*n),c=this.textureHeight/2;i/=l,n/=l,i*=c,n*=c,o[u]=h.x+i,o[u+1]=h.y+n,o[u+2]=h.x-i,o[u+3]=h.y-n,r=h}this._vertexDirty++}},e.prototype.update=function(){t.prototype.update.call(this),(this.autoUpdateVertices||this.textureHeight!==this.texture.height)&&(this.textureHeight=this.texture.height,this.refreshVertices())},e}(ln),yn=null,gn=new k;function xn(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null);var n=t.getLocalBounds(),o=e?e.width:n.width,a=e?e.height:n.height,s=e?e.x:n.x,h=e?e.y:n.y;if(yn)dn.width=o,dn.height=a;else{var u=G();u.width=o,u.height=a,dn=u,yn=new ui(u.getContext("2d"),o,a)}return r||(r={type:"png"}),t.transform.updateLocalMatrix(),gn.copy(t.transform.localMatrix),gn.invert(),gn.tx-=s,gn.ty-=h,yn.render(t,null,gn),t.transform._parentID=-1,dn.toDataURL("image/"+r.type,r.quality)}var _n=function(t){function e(){var e=t.call(this)||this;e._textAlpha=1,e._textAlign=l.LEFT,e._verticalAlign=c.UP,e._textWidth=0,e._textHeight=0,e._lineType=p.SINGLE,e._text="",e._font="Arial",e._size=12,e._fillColor="#ffffff",e._strokeColor="#ffffff",e._stroke=0,e._italic=!1,e._bold=!1,e._border=!1,e.realLines=[],e._instanceType="TextField";var r=G();return r.width=r.height=3,e.texture=me.fromCanvas(r,"textCanvas"),e.canvas=r,e.context=r.getContext("2d"),me.addToCache(e.texture,e.texture.baseTexture.textureCacheIds[0]),e.dirty=!0,e}return S(e,t),Object.defineProperty(e.prototype,"textAlpha",{get:function(){return this._textAlpha},set:function(t){this._textAlpha!=t&&(this._textAlpha=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textAlign",{get:function(){return this._textAlign},set:function(t){this._textAlign!=t&&(this._textAlign=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlign",{get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!=t&&(this._verticalAlign=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWidth",{get:function(){return this._textWidth?this._textWidth:(this.updateText(),this.width-20)},set:function(t){this._textWidth!=t&&(this._textWidth=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHeight",{get:function(){return this._textHeight?this._textHeight:(this.updateText(),this.height-20)},set:function(t){this._textHeight!=t&&(this._textHeight=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineHeight",{get:function(){return this._lineHeight||Math.round(1.4*this.size)},set:function(t){this._lineHeight!=t&&(this._lineHeight=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineType",{get:function(){return this._lineType},set:function(t){this._lineType!=t&&(this._lineType=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!=t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){this._font!=t&&(this._font=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){this._size!=t&&(this._size=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fillColor",{get:function(){return this._fillColor},set:function(t){this._fillColor!=t&&(this._fillColor=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strokeColor",{get:function(){return this._strokeColor},set:function(t){this._strokeColor!=t&&(this._strokeColor=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stroke",{get:function(){return this._stroke},set:function(t){this._stroke!=t&&(this._stroke=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"italic",{get:function(){return this._italic},set:function(t){this._italic!=t&&(this._italic=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bold",{get:function(){return this._bold},set:function(t){this._bold!=t&&(this._bold=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){return this._border},set:function(t){this._border!=t&&(this._border=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.prototype._prepContext=function(t){var e=this,r=e.size||12;r+="px ",r+=e.font,e._bold&&(r="bold "+r),e._italic&&(r="italic "+r),t.font=r,t.textAlign=e._textAlign||l.LEFT,t.textBaseline="middle",t.fillStyle=Nt(e._fillColor,e._textAlpha),t.lineJoin="round"},e.prototype.getTextWidth=function(t){void 0===t&&(t=0);var e=this;return e.updateText(),e.context.measureText(e.realLines[t]).width},Object.defineProperty(e.prototype,"lines",{get:function(){return this.realLines.length},enumerable:!1,configurable:!0}),e.prototype._getMeasuredWidth=function(t){return this.context.measureText(t).width},e.prototype._cutLines=function(t,e,r){void 0===e&&(e=this._textWidth),void 0===r&&(r=!1);for(var i=[],n=t[0],o=t.length,a=1;a<o;a++)if(this._getMeasuredWidth(n+t[a])>e){if(i.push(n),r)return i;n=t[a]}else n+=t[a];return n&&i.push(n),i},e.prototype.updateText=function(){var t=this;if(t.dirty){if(t.dirty=!1,t._text+="",!t._text)return t.canvas.width=0,t.canvas.height=0,t.anchorTexture={x:0,y:0},void t.texture.update();var e=t.canvas,r=t.context,i=t._text.toString().split(/(?:\r\n|\r|\n)/),n=[];t.realLines=n,t._prepContext(r);var o=t._textWidth;if(t._text.indexOf("\n")<0&&t._text.indexOf("\r")<0&&t._text.indexOf("\r\n")<0&&t.lineType==p.SINGLE){n[n.length]=i[0];var a=i[0],s=t._getMeasuredWidth(a);s>(o=o||s)&&(n[0]=t._cutLines(a,o,!0)[0])}else if(o)for(h=0,u=i.length;h<u;h++){(a=i[h])&&n.push.apply(n,t._cutLines(a,o))}else for(var h=0,u=i.length;h<u;h++){(a=i[h])&&(o=Math.max(t._getMeasuredWidth(a),o),n[n.length]=a)}var d=this.lineHeight,f=d*n.length,v=t._textHeight||f,m=o,y=0;t._textAlign==l.CENTER?y=.5*m:t._textAlign==l.RIGHT&&(y=m);var g=m+20,x=v+20;e.width=g,e.height=x,r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),t.border&&(r.beginPath(),r.strokeStyle="#000",r.lineWidth=1,r.strokeRect(10.5,10.5,m,v),r.closePath()),r.setTransform(1,0,0,1,y+10,10),t._prepContext(r);var _=0;t._textHeight&&(t._verticalAlign==c.MIDDLE?_=.5*(t._textHeight-f):t._verticalAlign!=c.DOWN&&t._verticalAlign!=c.BOTTOM||(_=t._textHeight-f)),"tb"==H()&&(_-=4);for(h=0;h<n.length;h++){var b=d/2;t.stroke&&(r.strokeStyle=t.strokeColor,r.lineWidth=2*t.stroke,r.strokeText(n[h],0,_+h*d+b)),r.fillText(n[h],0,_+h*d+b)}this.anchorTexture={x:10.5/g,y:10/x},t.texture.update()}},e.prototype.calculateBounds=function(){this.updateText(),t.prototype.calculateBounds.call(this)},e.prototype._renderCanvas=function(e){this.updateText(),t.prototype._renderCanvas.call(this,e)},e.prototype._renderWebGL=function(e){this.updateText(),t.prototype._renderWebGL.call(this,e)},e.prototype.destroy=function(){this.canvas=null,this.context=null,t.prototype.destroy.call(this)},e}(_e),bn=function(t){function e(){var e=t.call(this)||this;e._prompt="Please input",e._promptColor="#eeeeee",e._textColor="#000000",e._inputValue="",e._instanceType="EditableText";var r=e,i=function(){r.htmlElement&&r.htmlElement.blur(),r.htmlElement.style.display="none",r.htmlElement.value?(r.text=r.htmlElement.value,r.fillColor=r.textColor):(r.text=r.prompt,r.fillColor=r.promptColor),r._inputValue=r.htmlElement.value||"",window.scrollTo(0,0)};return e.addEventListener(be.CLICK,(function(t){r.initElement(),r.htmlElement.style.font=r.size+"px "+r.font,r.htmlElement.style.color=r.textColor,r.htmlElement.style.textAlign=r.textAlign,r.htmlElement.style.height=r.textHeight+"px",r.htmlElement.style.width=r.textWidth+"px",r.htmlElement.value!=r._inputValue&&(r.htmlElement.value=r._inputValue),r.text="",r.htmlElement.style.display="block",r.htmlElement.selectionStart=r._inputValue.length,r.htmlElement.selectionEnd=r._inputValue.length,r.htmlElement.focus();var e=r.transform.worldMatrix,n=r.stage._dpi||r.stage.dpi;r.htmlElement.style.transform=r.htmlElement.style.webkitTransform="matrix("+(e.a/n).toFixed(4)+","+(e.b/n).toFixed(4)+","+(e.c/n).toFixed(4)+","+(e.d/n).toFixed(4)+","+(e.tx/n).toFixed(4)+","+(e.ty/n).toFixed(4)+")",r.stage.once(be.MOUSE_UP,i)})),e}return S(e,t),Object.defineProperty(e.prototype,"prompt",{get:function(){return this._prompt},set:function(t){this._prompt!=t&&(this._prompt=t,this.dirty=!0,this._inputValue||(this.text=this._prompt))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promptColor",{get:function(){return this._promptColor},set:function(t){this._promptColor!=t&&(this._promptColor=t,this.dirty=!0,this._inputValue||(this.fillColor=this._promptColor))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor!=t&&(this._textColor=t,this.dirty=!0,this._inputValue&&(this.fillColor=this._textColor))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputValue",{get:function(){return this._inputValue},set:function(t){t=t||"",this.htmlElement&&(this.htmlElement.value=t),this.text=t||this._prompt,this.fillColor=t?this.textColor:this._promptColor,this._inputValue=t},enumerable:!1,configurable:!0}),e.prototype.initElement=function(){var t=this;if(!t.htmlElement){t.htmlElement=document.createElement("input");var e=t.htmlElement,r=e.style;e.type="input",r.position="absolute",r.display="none",r.transformOrigin=r.WebkitTransformOrigin=r.webkitTransformOrigin="0 0 0",r.outline="none",r.borderWidth="thin",r.borderColor="#000",r.boxSizing="border-box",r.padding="0",r.margin="0",e.placeholder="",r.borderStyle="none",r.backgroundColor="transparent";var i=t.stage.canvas.parentNode;i?i.insertBefore(e,i.childNodes[0]):document.body.appendChild(e),e.onblur=function(e){"ios"==rt()&&window.scrollTo({top:0,left:0,behavior:"smooth"}),t.hasEventListener(I.BLUR)&&t.dispatchEvent(I.BLUR,e)},e.oninput=function(r){setTimeout((function(){e.selectionStart==e.selectionEnd&&(t._inputValue=e.value||"",t.hasEventListener(I.INPUT)&&t.dispatchEvent(I.INPUT,r))}),0)},e.onfocus=function(e){t.hasEventListener(I.FOCUS)&&t.dispatchEvent(I.FOCUS,e)}}},e.prototype.destroy=function(){this.htmlElement&&this.htmlElement.parentNode&&(this.htmlElement.parentNode.removeChild(this.htmlElement),this.htmlElement=null),t.prototype.destroy.call(this)},e}(_n),Tn=function(t){function e(r){void 0===r&&(r=0);var i=t.call(this)||this;i.inputType=0,i.isAutoDownKeyBoard=!0;var n=null,o=i;o._instanceType="InputText",r<2?(n=document.createElement("input")).type=e._inputTypeList[r]:((n=document.createElement("textarea")).style.resize="none",n.style.overflow="hidden"),o.inputType=r;var a=function(){o.isAutoDownKeyBoard&&"pc"!=rt()&&(o.htmlElement&&o.htmlElement.blur(),window.scrollTo(0,0))}.bind(o);return o.addEventListener(I.REMOVED_FROM_STAGE,(function(t){o.stage.removeEventListener(be.MOUSE_UP,a)})),o.addEventListener(I.ADDED_TO_STAGE,(function(t){o.stage.addEventListener(be.MOUSE_UP,a)})),o.init(n),i}return S(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e);var r=this;r.htmlElement.style.outline="none",r.htmlElement.style.borderWidth="thin",r.htmlElement.style.borderColor="#000"},e.prototype.initInfo=function(t,e,r,i,n,o,a,s,h){void 0===h&&(h=!1);var u=this;u.htmlElement.placeholder=t,u.htmlElement.style.font=i+"px "+(n||"Arial"),u.htmlElement.style.color=e,u.htmlElement.style.textAlign=r,u.border=h,u.textWidth=o,u.textHeight=a,2==u.inputType&&(u.htmlElement.style.lineHeight=s+"px")},Object.defineProperty(e.prototype,"lineHeight",{get:function(){return parseInt(this.htmlElement.style.lineHeight)},set:function(t){this.htmlElement.style.lineHeight=t+"px"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bold",{get:function(){return"bold"==this.htmlElement.style.fontWeight},set:function(t){var e=this.htmlElement.style;e.fontWeight=t?"bold":"normal"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"italic",{get:function(){return"italic"==this.htmlElement.style.fontStyle},set:function(t){var e=this.htmlElement.style;e.fontStyle=t?"italic":"normal"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHeight",{get:function(){return parseInt(this.htmlElement.style.height)},set:function(t){this.htmlElement.style.height=t+"px"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWidth",{get:function(){return parseInt(this.htmlElement.style.width)},set:function(t){this.htmlElement.style.width=t+"px"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this.htmlElement.style.color},set:function(t){this.htmlElement.style.color=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"border",{get:function(){return"none"!=this.htmlElement.style.borderStyle},set:function(t){var e=this;t?(e.htmlElement.style.borderStyle="inset",e.htmlElement.style.backgroundColor="#fff"):(e.htmlElement.style.borderStyle="none",e.htmlElement.style.backgroundColor="transparent")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){if(this.htmlElement)return this.htmlElement.value},set:function(t){this.htmlElement&&(this.htmlElement.value=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxCharacters",{get:function(){var t=this.htmlElement.getAttribute("maxlength");return null===t?0:t},set:function(t){this.htmlElement.setAttribute("maxlength",t)},enumerable:!1,configurable:!0}),e.prototype.convertToTextField=function(t){return this.htmlElement&&this.text?((t=t||new _n).fillColor=this.color,t.text=this.text,t.size=parseInt(this.htmlElement.style.font.split("px")[0]),t.textAlign=this.htmlElement.style.textAlign,t.bold=this.bold,t.italic=this.italic,t.textWidth=this.textWidth,t.lineType=2==this.inputType?p.MULTI:p.SINGLE,t.position.copy(this.position),t.scale.copy(this.scale),t.rotation=this.rotation,t):null},e._inputTypeList=["input","password","textarea"],e}(ie),wn=[],Mn=function(t){function e(e){var r=t.call(this)||this;return r._textAlign=l.CENTER,r._verticalAlign=c.MIDDLE,r._gap=0,r.textures=e,r}return S(e,t),Object.defineProperty(e.prototype,"textAlign",{get:function(){return this._textAlign},set:function(t){this._textAlign!==t&&(this._textAlign=t,this.adaptate())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlign",{get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this.adaptate())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gap",{get:function(){return this._gap},set:function(t){this._gap!=t&&(this._gap=t,this.adaptate())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){if(t!==this._text){this._text=t;for(var e=t||[],r=0;r<e.length;r++)if(this.children[r])this.children[r].text=e[r];else{var i=wn.shift();i?i.reset(this.textures):i=new Sn(this.textures),i.text=e[r],this.addChild(i)}if(this.children.length>e.length)for(r=this.children.length-1;r>=e.length;r--){var n=this.children[r];this.removeChild(n),wn.push(n)}this.adaptate()}},enumerable:!1,configurable:!0}),e.prototype.adaptate=function(){if(this.children.length){for(var t,e=this.children.length,r=0,i=0;i<e;i++)r+=this.children[i].width;r+=(e-1)*this._gap,t=this._textAlign==l.LEFT?0:this._textAlign==l.RIGHT?-r:-r/2;for(var n=0,o=0;o<this.children.length;o++)this.children[o].x=t+n,n+=this.children[o].width+this._gap;var a=0;this._verticalAlign==c.DOWN||this._verticalAlign==c.BOTTOM?a=-1:this._verticalAlign==c.MIDDLE&&(a=-.5),this.children.forEach((function(t){t.y=t.height*a}))}},e}(te),Sn=function(t){function e(e){var r=t.call(this)||this;return r.textures=e,r}return S(e,t),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this.texture=this.textures[this._text]},enumerable:!1,configurable:!0}),e.prototype.reset=function(t){this.textures=t},e}(_e);function En(t,e){for(var r=e,i=Object.keys(r),n=0,o={};n<i.length;){var a=i[n],s=r[a],h=null,u=null,l=new B(0,0,Math.floor(s.sw),Math.floor(s.sh));h=s.ro?new B(Math.floor(s.x),Math.floor(s.y),Math.floor(s.h),Math.floor(s.w)):new B(Math.floor(s.x),Math.floor(s.y),Math.floor(s.w),Math.floor(s.h)),(s.ox||s.oy||s.w!=s.sw||s.h!=s.sh)&&(u=new B(Math.floor(s.ox),Math.floor(s.oy),Math.floor(s.w),Math.floor(s.h)));var c=new me(t,h,l,u,s.ro?2:0);me.addToCache(c,a),o[a]=c,n++}return o}function Cn(t,e,r,i){i=i||t.substring(0,t.lastIndexOf("."))+".png",Promise.all([new Promise((function(e){se(t,e,(function(){return e(null)}))})),new Promise((function(t){ae(i,(function(e){return t(fe.fromImage(e))}),(function(){return t(null)}))}))]).then((function(i){if(i[0]&&i[1]){var n=En(i[1],i[0]);e&&e(n)}else r&&r("load failed for sht:"+t)}))}var An,Pn=function(){function t(t,e,r){this._target=null,this._useTicks=!1,this.ignoreGlobalPause=!1,this.loop=!1,this.pluginData=null,this._steps=null,this.paused=!1,this.duration=0,this._prevPos=-1,this.position=null,this._prevPosition=0,this._stepPosition=0,this.passive=!1,this.initialize(t,e,r)}return t.get=function(e,r,i,n){return void 0===i&&(i=null),void 0===n&&(n=!1),n&&t.removeTweens(e),new t(e,r,i)},t.removeTweens=function(e){if(e.tween_count){for(var r=t._tweens,i=r.length-1;i>=0;i--)r[i]._target==e&&(r[i].paused=!0,r.splice(i,1));e.tween_count=0}},t.removeTweenSelf=function(e){if(e&&e._target&&e._target.tween_count){e.paused=!0;var r=t._tweens,i=r.indexOf(e);i>-1&&r.splice(i,1),e._target.tween_count--}},t.pauseTweens=function(e){if(e.tween_count)for(var r=t._tweens,i=r.length-1;i>=0;i--)r[i]._target==e&&(r[i].paused=!0)},t.resumeTweens=function(e){if(e.tween_count)for(var r=t._tweens,i=r.length-1;i>=0;i--)r[i]._target==e&&(r[i].paused=!1)},t.tick=function(e,r){void 0===r&&(r=!1);var i=e-t._lastTime;t._lastTime=e;for(var n=t._tweens.concat(),o=n.length-1;o>=0;o--){var a=n[o];r&&!a.ignoreGlobalPause||a.paused||a.$tick(a._useTicks?1:i)}return!1},t.flush=function(){var e=Date.now(),r=t._lastTime?e-t._lastTime:16.67;t._lastTime=e;for(var i=t._tweens.concat(),n=i.length-1;n>=0;n--){var o=i[n];o.paused||o.$tick(o._useTicks?1:r)}},t._register=function(e,r){var i=e._target,n=t._tweens;if(r)i&&(i.tween_count=i.tween_count>0?i.tween_count+1:1),n.push(e),t._inited||(t._inited=!0);else{i&&i.tween_count--;for(var o=n.length;o--;)if(n[o]==e)return void n.splice(o,1)}},t.removeAllTweens=function(){for(var e=t._tweens,r=0,i=e.length;r<i;r++){var n=e[r];n.paused=!0,n._target.tween_count=0}e.length=0},t.prototype.initialize=function(e,r,i){this._target=e,r&&(this._useTicks=r.useTicks,this.ignoreGlobalPause=r.ignoreGlobalPause,this.loop=r.loop,r.onChange?this.onChange=r.onChange.bind(r.onChangeObj):this.onChange=null,r.override&&t.removeTweens(e)),this.pluginData=i||{},this._curQueueProps={},this._initQueueProps={},this._steps=[],r&&r.paused?this.paused=!0:t._register(this,!0),r&&null!=r.position&&this.setPosition(r.position,t.NONE)},t.prototype.setPosition=function(t,e){void 0===e&&(e=1),t<0&&(t=0);var r=t,i=!1;if(r>=this.duration)if(this.loop){var n=r%this.duration;r=r>0&&0===n?this.duration:n}else r=this.duration,i=!0;if(r==this._prevPos)return i;i&&this.setPaused(!0);var o=this._prevPos;if(this.position=this._prevPos=r,this._prevPosition=t,this._target&&this._steps.length>0){for(var a=this._steps.length,s=-1,h=0;h<a&&!("step"==this._steps[h].type&&(s=h,this._steps[h].t<=r&&this._steps[h].t+this._steps[h].d>=r));h++);for(h=0;h<a;h++)if("action"==this._steps[h].type)0!=e&&(this._useTicks?this._runAction(this._steps[h],r,r):1==e&&r<o?(o!=this.duration&&this._runAction(this._steps[h],o,this.duration),this._runAction(this._steps[h],0,r,!0)):this._runAction(this._steps[h],o,r));else if("step"==this._steps[h].type&&s==h){var u=this._steps[s];this._updateTargetProps(u,Math.min((this._stepPosition=r-u.t)/u.d,1))}}return this.onChange&&this.onChange(),i},t.prototype._runAction=function(t,e,r,i){void 0===i&&(i=!1);var n=e,o=r;e>r&&(n=r,o=e);var a=t.t;(a==o||a>n&&a<o||i&&a==e)&&t.f.apply(t.o,t.p)},t.prototype._updateTargetProps=function(e,r){var i,n,o,a,s,h;if(e||1!=r){if(this.passive=!!e.v,this.passive)return;e.e&&(r=e.e(r,0,1,1)),i=e.p0,n=e.p1}else this.passive=!1,i=n=this._curQueueProps;for(var u in this._initQueueProps){null==(a=i[u])&&(i[u]=a=this._initQueueProps[u]),null==(s=n[u])&&(n[u]=s=a),o=a==s||0==r||1==r||"number"!=typeof a?1==r?s:a:a+(s-a)*r;var l=!1;if(h=t._plugins[u])for(var c=0,p=h.length;c<p;c++){var d=h[c].tween(this,u,o,i,n,r,!!e&&i==n,!e);d==t.IGNORE?l=!0:o=d}l||(this._target[u]=o)}},t.prototype.setPaused=function(e){return this.paused==e||(this.paused=e,t._register(this,!e)),this},t.prototype._cloneProps=function(t){var e={};for(var r in t)e[r]=t[r];return e},t.prototype._addStep=function(t){return t.d>0&&(t.type="step",this._steps.push(t),t.t=this.duration,this.duration+=t.d),this},t.prototype._appendQueueProps=function(e){var r,i,n,o,a;for(var s in e)if(void 0===this._initQueueProps[s]){if(i=this._target[s],r=t._plugins[s])for(n=0,o=r.length;n<o;n++)i=r[n].init(this,s,i);this._initQueueProps[s]=this._curQueueProps[s]=void 0===i?null:i}else i=this._curQueueProps[s];for(var s in e){if(i=this._curQueueProps[s],r=t._plugins[s])for(a=a||{},n=0,o=r.length;n<o;n++)r[n].step&&r[n].step(this,s,i,e[s],a);this._curQueueProps[s]=e[s]}return a&&this._appendQueueProps(a),this._curQueueProps},t.prototype._addAction=function(t){return t.t=this.duration,t.type="action",this._steps.push(t),this},t.prototype._set=function(t,e){for(var r in t)e[r]=t[r]},t.prototype.wait=function(t,e){if(null==t||t<=0)return this;var r=this._cloneProps(this._curQueueProps);return this._addStep({d:t,p0:r,p1:r,v:e})},t.prototype.to=function(t,e,r){return void 0===r&&(r=void 0),(isNaN(e)||e<0)&&(e=0),this._addStep({d:e||0,p0:this._cloneProps(this._curQueueProps),e:r,p1:this._cloneProps(this._appendQueueProps(t))}),this.set(t)},t.prototype.by=function(t,e,r){for(var i in void 0===e&&(e=0),void 0===r&&(r=void 0),t)t[i]+=this._curQueueProps[i]||this._target[i];return this.to(t,e,r)},t.prototype.call=function(t,e,r){return void 0===e&&(e=void 0),void 0===r&&(r=void 0),this._addAction({f:t,p:r||[],o:e||this._target})},t.prototype.set=function(t,e){return void 0===e&&(e=null),this._appendQueueProps(t),this._addAction({f:this._set,o:this,p:[t,e||this._target]})},t.prototype.play=function(t){return t||(t=this),this.call(t.setPaused,t,[!1])},t.prototype.pause=function(t){return t||(t=this),this.call(t.setPaused,t,[!0])},t.prototype.$tick=function(t){this.paused||this.setPosition(this._prevPosition+t)},t.NONE=0,t.LOOP=1,t.REVERSE=2,t._tweens=[],t.IGNORE={},t._plugins={},t._inited=!1,t._lastTime=0,t}(),On=function(t){function e(e,r,i){var n=t.call(this,e)||this;return n._clicked=!1,An||console.warn('Class Button will be abandoned later,maybe you can:\nfunction addClickZoom(dis: DisplayObject, zoomCenter: boolean = true) {\n    if (zoomCenter) {\n        dis.anchorX = dis.width / 2;\n        dis.anchorY = dis.height / 2;\n    }\n    dis.addEventListener("onMouseDown", _mouseEvent, dis)\n        .addEventListener("onMouseUp", _mouseEvent, dis)\n        .addEventListener("onMouseOut", _mouseEvent, dis);\n    let s = dis;\n    function _mouseEvent(e: MouseEvent) {\n        if (e.type == MouseEvent.MOUSE_DOWN) {\n            Tween.removeTweens(s);\n            Tween.get(s).to({ scaleX: 0.9, scaleY: 0.9 }, 50);\n        } else {\n            Tween.removeTweens(s);\n            Tween.get(s).to({ scaleX: 1, scaleY: 1 }, 50);\n        }\n    }\n}'),An=!0,n._instanceType="Button",n.textureUp=e,n.textureDown=r===e?null:r,n.textureDisable=i||e,n.textureUp&&(n.anchorX=n.textureUp.width/2,n.anchorY=n.textureUp.height/2),n.initButton(),n}return S(e,t),e.prototype.changeTexture=function(t,e,r){this.textureUp=t,this.textureDown=e===t?null:e,this.textureDisable=r||t,this.textureUp&&(this.anchorX=this.textureUp.width/2,this.anchorY=this.textureUp.height/2),this._clicked&&this.textureDown?this.texture=this.textureDown:this.mouseEnable||this.textureStatusEnable?this.texture=this.textureUp:this.texture=this.textureDisable},e.prototype._mouseEvent=function(t){var e=this;e._clicked||(t.type==be.MOUSE_DOWN?e.textureDown?e.texture=e.textureDown:(this.frames=null,Pn.removeTweens(this),Pn.get(this).to({scaleX:.9,scaleY:.9},50)):e.textureDown?e.texture=e.textureUp:(this.frames=this.framesOri,Pn.removeTweens(this),Pn.get(this).to({scaleX:1,scaleY:1},50)))},e.prototype.initButton=function(){var t=this;t.mouseChildren=!1,t.addEventListener("onMouseDown",t._mouseEvent,t),t.addEventListener("onMouseUp",t._mouseEvent,t),t.addEventListener("onMouseOut",t._mouseEvent,t),t.texture=t.textureUp},Object.defineProperty(e.prototype,"clicked",{get:function(){return this._clicked},set:function(t){var e=this;t!=e._clicked&&(t&&e._mouseEvent({type:"onMouseDown"}),e._clicked=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textureStatusEnable",{set:function(t){t?this.texture=this.textureUp:this.textureDisable&&(this.texture=this.textureDisable,this.frames=null)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{set:function(t){this.mouseEnable=t,this.textureStatusEnable=t},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){this.textureUp=null,this.textureDown=null,this.textureDisable=null,Pn.removeTweens(this),t.prototype.destroy.call(this)},e}(_e),Rn=function(t){function e(e){var r=t.call(this)||this;return r._instanceType="AnimationNode",r.init(e),r}return S(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this.videoWidth},set:function(t){var e=kt(this.scale.x)||1;this.scale.x=e*t/this.videoWidth,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this.videoHeight},set:function(t){var e=kt(this.scale.y)||1;this.scale.y=e*t/this.videoHeight,this._height=t},enumerable:!1,configurable:!0}),e.prototype._onRawDataUpdate=function(){this._width&&(this.width=this._width),this._height&&(this.height=this._height)},e.prototype.update=function(){if(this.animationClip){var e=Date.now(),r=this.lastTime?.001*(e-this.lastTime):.01667;this.lastTime=e,this.animationClip.update(r*this.fps)}t.prototype.update.call(this)},e.prototype.play=function(t,e){this.animationClip&&(arguments.length&&"boolean"!=typeof arguments[0]?(t=t||0,this.animationClip.startAniRange(0,this.animationClip.totalTime,t,e)):this.animationClip.play(arguments[0]))},e.prototype.stop=function(t){void 0===t&&(t=!1),this.animationClip&&(t?this.animationClip.gotoAndStop(0,!0):this.animationClip.stop())},Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this.animationClip?Math.round(this.animationClip.currentTime):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return!!this.animationClip&&this.animationClip.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFront",{get:function(){return!this.animationClip||this.animationClip.isFront},enumerable:!1,configurable:!0}),e}(te);["gotoAndStop","gotoAndPlay","startAniRange"].forEach((function(t){Object.defineProperty(Rn.prototype,t,{value:function(){var e;this.animationClip&&(e=this.animationClip)[t].apply(e,Array.prototype.slice.call(arguments))},writable:!0,enumerable:!0})}));var In=function(t){function e(e,r){var i=t.call(this)||this;return i._isPlaying=!0,i._isFront=!0,i.lastTime=null,i.curTime=0,i._endMark=!1,i._instanceType="AnimationClip",i.tracks=e,i._totalTime=r,i}return S(e,t),Object.defineProperty(e.prototype,"totalTime",{get:function(){return this._totalTime},enumerable:!1,configurable:!0}),e.prototype.init=function(t,e){this.tracks=t,this._totalTime=e,this.startAniRangeFun&&this.removeEventListener(I.ENTER_FRAME,this.startAniRangeFun,this)},Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFront",{get:function(){return this._isFront},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.curTime},enumerable:!1,configurable:!0}),e.prototype.update=function(t){if(this.tracks&&this.tracks.length)return this.curTime!==this.lastTime?(this.rectify(),void(this._endMark=!1)):void(t<=0||!this._isPlaying||(this._endMark=!1,this._isFront?(this.curTime+=t,this.curTime>this._totalTime&&(this.curTime=0,this._endMark=!0)):(this.curTime-=t,this.curTime<0&&(this.curTime=this._totalTime,this._endMark=!0)),this.curTime!==this.lastTime&&(this.rectify(),this.dispatchEvent(I.ENTER_FRAME),this._endMark&&this.hasEventListener(I.END_FRAME)&&this.dispatchEvent(I.END_FRAME))))},e.prototype.play=function(t){void 0===t&&(t=!0),this._isFront=t,this._isPlaying=!0},e.prototype.stop=function(){this._isPlaying=!1,this.lastTime=this.curTime},e.prototype.gotoAndPlay=function(t,e){void 0===e&&(e=!0);var r=this;r._isFront=e,r._isPlaying=!0,t=Xt(t,0,r._totalTime),r.curTime=t},e.prototype.gotoAndStop=function(t,e){void 0===e&&(e=!1),this._isPlaying=!1,t=Xt(t,0,this._totalTime),this.curTime=t,e&&(this.lastTime=null)},e.prototype.startAniRange=function(t,e,r,i){var n=this;if(void 0===t&&(t=0),void 0===e&&(e=this._totalTime),void 0===r&&(r=1),r=r||0,r=Math.max(0,r),t=Xt(t,0,this._totalTime),e=Xt(e,0,this._totalTime),t!==e){if(t<e)this._isFront=!0;else{this._isFront=!1;var o=t;t=e,e=o}this.startAniRangeFun&&this.removeEventListener(I.ENTER_FRAME,this.startAniRangeFun,this),this.curTime=t,this._isPlaying=!0;var a=r?r+.5>>0:1/0;this.addEventListener(I.ENTER_FRAME,this.startAniRangeFun=function(r){var o=r.target;o._isFront?(o.curTime>=e||o._endMark)&&(--a<=0?(o.gotoAndStop(e),o.removeEventListener(I.ENTER_FRAME,n.startAniRangeFun,n),n.startAniRangeFun=null,i&&i(a),o.rectify()):o.gotoAndPlay(t)):(o.curTime<=t||o._endMark)&&(--a<=0?(o.gotoAndStop(t),o.removeEventListener(I.ENTER_FRAME,n.startAniRangeFun,n),n.startAniRangeFun=null,i&&i(a),o.rectify()):o.gotoAndPlay(e,!1))},this)}else this.gotoAndStop(t)},e.prototype.rectify=function(){if(this.tracks&&this.tracks.length){for(var t=0;t<this.tracks.length;t++)this.tracks[t].setValue(this.curTime);this.lastTime=this.curTime}},e.prototype.resetState=function(){this.stop();for(var t=0;t<this.tracks.length;t++)this.tracks[t].resetValue()},e}(D),Dn=function(t){function e(e){var r=t.call(this,e)||this;return r.fps=30,r._instanceType="FrameAni",r}return S(e,t),e.prototype.getCurrentFrame=function(){return console.warn("method getCurrentFrame will be abandoned soon,use property currentFrame instead"),this.currentFrame},Object.defineProperty(e.prototype,"totalTime",{get:function(){return this.rawData&&this.rawData.length*(1/this.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this.rawData&&this.rawData.length||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoWidth",{get:function(){return this.rawData&&this.rawData.length?Math.max.apply(Math,this.rawData.map((function(t){return t.width}))):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoHeight",{get:function(){return this.rawData&&this.rawData.length?Math.max.apply(Math,this.rawData.map((function(t){return t.height}))):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frameRate",{get:function(){return console.warn("method frameRate will be abandoned soon,use property fps instead"),this._fps},set:function(t){console.warn("method frameRate will be abandoned soon,use property fps instead"),this._fps=t},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(t&&t.length&&t!=this.rawData){this.rawData=t,this.showImage||(this.showImage=this.addChild(new _e),this.showImage.anchorTexture.set(.5,.5)),this.frameTrack?this.frameTrack.textures=t:this.frameTrack=new Fn(this.showImage,t),this.frameTrack.resetValue();var e=[this.frameTrack];this.animationClip?this.animationClip.init(e,this.totalFrames):this.animationClip=new In(e,this.totalFrames),this._onRawDataUpdate()}},e.prototype.reset=function(t){void 0===t&&(t=0),console.warn("method reset will be abandoned soon,use method gotoAndStop instead"),this.gotoAndStop(t)},e.prototype.resetTexturesAll=function(t){console.warn("method resetTexturesAll will be abandoned soon,use method init instead"),this.init(t)},e}(Rn),Fn=function(t){function e(e,r){var i=t.call(this)||this;return i.sprite=e,i.textures=r,i._instanceType="FrameTrack",i}return S(e,t),e.prototype.setValue=function(t){t=Math.round(Xt(t,0,this.textures.length-1)),this.sprite.texture=this.textures[t]},e.prototype.resetValue=function(){this.setValue(0)},e.prototype.destroy=function(){this.sprite=null,this.textures=null},e}(R),Nn=function(){function t(){}return t.get=function(t){return t<-1&&(t=-1),t>1&&(t=1),function(e){return 0==t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}},t.getPowIn=function(t){return function(e){return Math.pow(e,t)}},t.getPowOut=function(t){return function(e){return 1-Math.pow(1-e,t)}},t.getPowInOut=function(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}},t.sineIn=function(t){return 1-Math.cos(t*Math.PI/2)},t.sineOut=function(t){return Math.sin(t*Math.PI/2)},t.sineInOut=function(t){return-.5*(Math.cos(Math.PI*t)-1)},t.getBackIn=function(t){return function(e){return e*e*((t+1)*e-t)}},t.getBackOut=function(t){return function(e){return--e*e*((t+1)*e+t)+1}},t.getBackInOut=function(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},t.circIn=function(t){return-(Math.sqrt(1-t*t)-1)},t.circOut=function(t){return Math.sqrt(1- --t*t)},t.circInOut=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},t.bounceIn=function(e){return 1-t.bounceOut(1-e)},t.bounceOut=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},t.bounceInOut=function(e){return e<.5?.5*t.bounceIn(2*e):.5*t.bounceOut(2*e-1)+.5},t.getElasticIn=function(t,e){var r=2*Math.PI;return function(i){if(0==i||1==i)return i;var n=e/r*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*r/e)}},t.getElasticOut=function(t,e){var r=2*Math.PI;return function(i){if(0==i||1==i)return i;var n=e/r*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*r/e)+1}},t.getElasticInOut=function(t,e){var r=2*Math.PI;return function(i){var n=e/r*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*r/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*r/e)*.5+1}},t.quadIn=t.getPowIn(2),t.quadOut=t.getPowOut(2),t.quadInOut=t.getPowInOut(2),t.cubicIn=t.getPowIn(3),t.cubicOut=t.getPowOut(3),t.cubicInOut=t.getPowInOut(3),t.quartIn=t.getPowIn(4),t.quartOut=t.getPowOut(4),t.quartInOut=t.getPowInOut(4),t.quintIn=t.getPowIn(5),t.quintOut=t.getPowOut(5),t.quintInOut=t.getPowInOut(5),t.backIn=t.getBackIn(1.7),t.backOut=t.getBackOut(1.7),t.backInOut=t.getBackInOut(1.7),t.elasticIn=t.getElasticIn(1,.3),t.elasticOut=t.getElasticOut(1,.3),t.elasticInOut=t.getElasticInOut(1,.3*1.5),t}(),kn=function(t){function e(e,r,i,n,o){void 0===n&&(n=!0),void 0===o&&(o=!1);var a=t.call(this)||this;a.isVertical=!0,a.viewWidth=0,a.viewHeight=0,a._tweenId=0,a.maxDistance=1040,a.distance=0,a.minDis=2,a.maskObj=new on,a.view=new te,a.lastValue=0,a.speed=0,a.addSpeed=0,a.isStop=!0,a.maxSpeed=100,a.fSpeed=20,a.paramXY="y",a.stopTimes=-1,a.isMouseDownState=0,a.autoScroll=!1,a.isSpringBack=!0,console.warn("class ScrollPage will be abandoned soon, use class ScrollView instead");var s=a;return s._instanceType="ScrollPage",s.addChild(s.maskObj),s.addChild(s.view),o||(s.view.mask=s.maskObj,s.maskObj._isUsedToMask=!1),s.maskObj.alpha=0,s.maxDistance=i,s.setViewRect(e,r,n),s.addEventListener(I.ADDED_TO_STAGE,(function(t){s.stage.addEventListener(be.MOUSE_MOVE,s.onMouseEvent,s),s.stage.addEventListener(be.MOUSE_UP,s.onMouseEvent,s)})),s.addEventListener(I.REMOVED_FROM_STAGE,(function(t){s.stage.removeEventListener(be.MOUSE_MOVE,s.onMouseEvent,s),s.stage.removeEventListener(be.MOUSE_UP,s.onMouseEvent,s)})),s.addEventListener(be.MOUSE_DOWN,s.onMouseEvent,s,!1),s.addEventListener(I.ENTER_FRAME,(function(){var t=s.view;if(!s.autoScroll){if(!s.isSpringBack){if(t[s.paramXY]>0)return s.addSpeed=0,s.speed=0,s.isStop=!0,void(t[s.paramXY]=0);if(t[s.paramXY]<s.distance-s.maxDistance)return s.addSpeed=0,s.speed=0,s.isStop=!0,t[s.paramXY]=s.distance-s.maxDistance,void(s.distance>s.maxDistance&&(t[s.paramXY]=0))}if(s.isStop)s.stopTimes>=0&&(s.stopTimes++,s.stopTimes>=15&&(s.speed=0,(t[s.paramXY]>0||t[s.paramXY]<s.distance-s.maxDistance)&&(s.isStop=!1,s.stopTimes=-1,s.isMouseDownState=0)));else if(Math.abs(s.speed)>0)t[s.paramXY]+=s.speed,t[s.paramXY]>0||t[s.paramXY]<s.distance-s.maxDistance?s.speed+=s.addSpeed*s.fSpeed:s.speed+=s.addSpeed,s.speed*s.addSpeed>0&&(s.dispatchEvent(I.SCROLL_STOP),s.speed=0);else if(0!=s.addSpeed){if(t[s.paramXY]>0||t[s.paramXY]<s.distance-s.maxDistance){var e=0;t[s.paramXY]<s.distance-s.maxDistance&&s.distance<s.maxDistance&&(e=s.distance-s.maxDistance),t[s.paramXY]+=.4*(e-t[s.paramXY]),Math.abs(e-t[s.paramXY])<.1&&(s.isStop=!0,s.addSpeed>0?s.dispatchEvent(I.SCROLL_TO_END):s.dispatchEvent(I.SCROLL_TO_HEAD),s.addSpeed=0)}}else s.isStop=!0}})),a}return S(e,t),e.prototype.setViewRect=function(t,e,r){var i=this;i.maskObj.clear(),i.maskObj.beginFill("#000000"),i.maskObj.drawRect(0,0,t,e),i.viewWidth=t,i.viewHeight=e,i.maskObj.endFill(),i.isVertical=r,r?(i.distance=i.viewHeight,i.paramXY="y"):(i.distance=i.viewWidth,i.paramXY="x"),i.isVertical=r},e.prototype.onMouseEvent=function(t){var e=this,r=e.view;if(t.type==be.MOUSE_DOWN)t.stopPropagation(),e.isStop||(e.isStop=!0),e.autoScroll&&(e.autoScroll=!1,Pn.removeTweens(e.view)),e.isVertical?e.lastValue=t.stageY:e.lastValue=t.stageX,e.speed=0,e.isMouseDownState=1;else if(t.type==be.MOUSE_MOVE){if(0==e.isMouseDownState)return;1==e.isMouseDownState&&e.dispatchEvent(I.SCROLL_START),e.isMouseDownState=2;var i=void 0;if(i=e.isVertical?t.stageY:t.stageX,e.speed=i-e.lastValue,e.speed>e.minDis?(e.addSpeed=-2,e.speed>e.maxSpeed&&(e.speed=e.maxSpeed)):e.speed<-e.minDis?(e.speed<-e.maxSpeed&&(e.speed=-e.maxSpeed),e.addSpeed=2):e.speed=0,0!=e.speed){var n=1;(r[e.paramXY]>0||r[e.paramXY]<e.distance-e.maxDistance)&&(n=.2),r[e.paramXY]+=(i-e.lastValue)*n}e.lastValue=i,e.stopTimes=0}else{if(!e.isMouseDownState)return;e.isStop=!1,e.stopTimes=-1,0==e.speed&&2==e.isMouseDownState&&e.dispatchEvent(I.SCROLL_STOP),e.isMouseDownState=0}},e.prototype.scrollTo=function(t,e){var r;void 0===e&&(e=0);var i=this,n="x"==i.paramXY?i.viewWidth:i.viewHeight;t<0?t=0:t>i.maxDistance-n&&(t=i.maxDistance-n),Math.abs(i.view[i.paramXY]+t)>2&&(i.autoScroll=!0,i.isStop=!0,i.isMouseDownState=0,Pn.removeTweens(i.view),Pn.get(i.view).to((r={},r[i.paramXY]=-t,r),e).call((function(){i.view[i.paramXY]=-t,i.autoScroll=!1})),0==i.speed&&i.dispatchEvent(I.SCROLL_START))},e.prototype.destroy=function(){Pn.removeTweens(this.view);var e=this;e.maskObj.destroy(),e.view.destroy(),e.maskObj=null,e.view=null,t.prototype.destroy.call(this)},e}(te),Ln=function(t){function e(e,r,i,n,o){var a=t.call(this)||this;a.viewWidth=0,a.viewHeight=0,a.velocitys=[],a.isBounce=!0,a.bounceTime=300,a.hasMomentum=!0,a.damping=.002,a.mouseStatus=0;var s=a;return s._instanceType="ScrollView",s._content=t.prototype.addChildAt.call(a,new te,0),s.maskObj=t.prototype.addChildAt.call(a,new on,0),s.maskObj.alpha=0,"number"==typeof i&&(s._scrollWidth=i),"number"==typeof n&&(s._scrollHeight=n),s.setViewRect(e,r,o),s.addEventListener(I.ADDED_TO_STAGE,(function(t){s.stage.addEventListener(be.MOUSE_MOVE,s.onMouseEvent,s),s.stage.addEventListener(be.MOUSE_UP,s.onMouseEvent,s)})),s.addEventListener(I.REMOVED_FROM_STAGE,(function(t){s.stage.removeEventListener(be.MOUSE_MOVE,s.onMouseEvent,s),s.stage.removeEventListener(be.MOUSE_UP,s.onMouseEvent,s)})),s.addEventListener(be.MOUSE_DOWN,s.onMouseEvent,s,!1),s.addEventListener(I.ENTER_FRAME,s.onEnterFrame,s),a}return S(e,t),Object.defineProperty(e.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){this._scrollWidth!=t&&(this._scrollWidth=t,this.checkPosition(this.bounceTime))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){this._scrollHeight!=t&&(this._scrollHeight=t,this.checkPosition(this.bounceTime))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this.scrollWidth?Math.min(this.viewWidth-this.scrollWidth,0):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this.scrollHeight?Math.min(this.viewHeight-this.scrollHeight,0):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){return this._content},enumerable:!1,configurable:!0}),e.prototype.setViewRect=function(t,e,r){var i=this;r?i._content.mask=null:(i._content.mask=i.maskObj,i.maskObj._isUsedToMask=!1,i.maskObj.clear().beginFill(0).drawRect(0,0,t,e).endFill()),i.viewWidth=t,i.viewHeight=e,this.checkPosition(i.bounceTime)},e.prototype.onMouseEvent=function(t){var r=this;if(t.type==be.MOUSE_DOWN)r.isRunning=!1,t.stopPropagation(),r.mouseStatus=1,r.lastTouchTime=Date.now(),r.downX=t.stageX,r.downY=t.stageY,r.distX=0,r.distY=0;else if(t.type==be.MOUSE_MOVE){if(r.mouseStatus<1)return;var i=t.stageX-r.downX,n=t.stageY-r.downY,o=Date.now();r.downX=t.stageX,r.downY=t.stageY,r.distX+=i,r.distY+=n;var a=Math.abs(r.distX),s=Math.abs(r.distY);if(1==r.mouseStatus&&a<10&&s<10)return void(r.lastTouchTime=o);var h=r._content.x,u=r._content.y;i=r.scrollWidth?i:0,n=r.scrollHeight?n:0;var l=o-r.lastTouchTime,c=0,p=0,d=u+n;(f=h+i)>0||f<r.maxScrollX?f=r.isBounce?h+i/3:f>0?0:r.maxScrollX:c=i/l,d>0||d<r.maxScrollY?d=r.isBounce?u+n/3:d>0?0:r.maxScrollY:p=n/l,r.pushVelocitys(c,p),r.lastTouchTime=o,r._translate(f,d),1==r.mouseStatus&&r.dispatchEvent(I.SCROLL_START,{x:-f,y:-d,deltaX:h-f,deltaY:u-d}),r.mouseStatus=2}else{if(r.checkPosition(r.bounceTime))return void(r.mouseStatus=0);if(2!=r.mouseStatus)return void(r.mouseStatus=0);r.mouseStatus=0;var f=r._content.x,v=(d=r._content.y,0);if(r.hasMomentum&&r.velocitys.length){for(var m={x:0,y:0},y=0,g=0;g<r.velocitys.length;g++){var x=r.velocitys[g],_=e.weight[g];m.x+=x[0]*_,m.y+=x[1]*_,y+=_}r.velocitys.length=0;c=m.x/y,p=m.y/y;var b=r.scrollWidth&&Math.abs(c)>.02?Bn(f,c,r.maxScrollX,r.damping):{destination:f,duration:0},T=r.scrollHeight&&Math.abs(p)>.02?Bn(d,p,r.maxScrollY,r.damping):{destination:d,duration:0};f=b.destination,d=T.destination,v=Math.max(b.duration,T.duration)}if(f!=r._content.x||d!=r._content.y)return void r._scrollTo(f,d,v);r.dispatchEvent(I.SCROLL_STOP,{x:-r._content.x,y:-r._content.y,deltaX:0,deltaY:0})}},e.prototype.onEnterFrame=function(t){var e=this,r=Date.now();if(e.mouseStatus&&e.lastTouchTime&&r-e.lastTouchTime>100&&r-e.lastTouchTime<300&&e.pushVelocitys(0,0),e.isRunning)if(r>=e.destTime){e.isRunning=!1;var i=e._content,n=i.x,o=i.y;if(e._translate(e.destX,e.destY),!e.checkPosition(e.bounceTime)){var a={x:-e.destX,y:-e.destY,deltaX:n-e.destX,deltaY:o-e.destX};e.dispatchEvent(I.SCROLL_STOP,a),0==e.destX&&0==e.destY&&e.dispatchEvent(I.SCROLL_TO_HEAD,a),e.destX==e.maxScrollX&&e.destY==e.maxScrollY&&e.dispatchEvent(I.SCROLL_TO_END,a)}}else{r=(r-e.startTime)/e.duration;var s=e.easeFn(r);e._translate((e.destX-e.startX)*s+e.startX,(e.destY-e.startY)*s+e.startY)}},e.prototype.pushVelocitys=function(t,r){this.velocitys.push([t,r]),this.velocitys.length>e.weight.length&&this.velocitys.shift()},e.prototype.scrollTo=function(t,e,r,i){void 0===r&&(r=0);var n=this._modifyXY(-t,-e),o=n[0],a=n[1];this._scrollTo(o,a,r,i)},e.prototype.scrollBy=function(t,e,r,i){void 0===r&&(r=0);var n=this;t=n._content.x-t,e=n._content.y-e;var o=this._modifyXY(t,e),a=o[0],s=o[1];n._scrollTo(a,s,r,i)},e.prototype._scrollTo=function(t,e,r,i){void 0===r&&(r=0);var n=this;isNaN(t)||isNaN(e)||(r?(n.startX=n._content.x,n.startY=n._content.y,n.startTime=Date.now(),n.destTime=n.startTime+r,n.destX=t,n.destY=e,n.duration=r,n.easeFn=i||Nn.quadOut,n.isRunning=!0):(n.isRunning=!1,n._translate(t,e)))},e.prototype._translate=function(t,e){var r=this,i=r._content,n=i.x,o=i.y;r._content.x=t,r._content.y=e,n==t&&o==e||r.dispatchEvent(I.SCROLLING,{x:-t,y:-e,deltaX:n-t,deltaY:o-e})},e.prototype.checkPosition=function(t){void 0===t&&(t=0);var e=this._content,r=e.x,i=e.y,n=this._modifyXY(r,i),o=n[0],a=n[1];return(r!=o||i!=a)&&(this._scrollTo(o,a,t),!0)},e.prototype._modifyXY=function(t,e){var r=this,i=r.scrollWidth,n=r.maxScrollX,o=r.scrollHeight,a=r.maxScrollY;return!i||t>0?t=0:t<n&&(t=n),!o||e>0?e=0:e<a&&(e=a),[t,e]},e.prototype.destroy=function(){var e=this;t.prototype.removeChildAt.call(this,0).destroy(),t.prototype.removeChildAt.call(this,0).destroy(),e.maskObj=null,e._content=null,e.easeFn=null,t.prototype.destroy.call(this)},e.weight=[1,1.33,1.66,2,2.33],e}(te);function Bn(t,e,r,i){void 0===i&&(i=6e-4);var n=Math.abs(e)/i,o=t+n*(e/2);return o<r?(o=r,n=Math.abs((o-t)/(e/2))):o>0&&(o=0,n=Math.abs(t/(e/2))),{destination:o,duration:n}}te._childrenOperationMethods.forEach((function(t){Object.defineProperty(Ln.prototype,t,{value:function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return console.warn("Maybe you want to operate children in its view rather then in it when it is a ScrollView!"),(e=te.prototype[t]).call.apply(e,P([this],r))},writable:!0,enumerable:!0})}));var zn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e.prototype.onDataChanged=function(t){},e}(te),Un=function(t){function e(e,r,i,n,o,a,s){void 0===a&&(a=!0),void 0===s&&(s=1);var h=t.call(this,n,o,0,0)||this;h._items=null,h._isInit=0,h._lastFirstId=-1;var u=h;return u._instanceType="ScrollList",u._itemW=r,u._itemH=i,u._items=[],u._itemClass=e,u._itemCount=0,u._cols=s,u._isVertical=a,u._updateRowCol(),u.addEventListener(I.SCROLLING,u.flushData,u),h}return S(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollWidth",{get:function(){return this._scrollWidth},set:function(t){console.warn("ScrollWidth can not be set manually in ScrollLists!")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(t){console.warn("ScrollHeight can not set manually in ScrollLists!")},enumerable:!1,configurable:!0}),e.prototype.setData=function(t,e){void 0===e&&(e=!0);var r=this;t=t||[],!r._isInit||e?r._data=t:r._data=r._data.concat(t),r._isInit=1,r._lastFirstId=-1;var i=Math.ceil(r.data.length/r._cols)*r._itemRow;r[r._isVertical?"_scrollHeight":"_scrollWidth"]=i,r.checkPosition(r.bounceTime)||r.flushData()},e.prototype.updateData=function(t,e){void 0===e&&(e=!0),console.warn("Method updateData will be abandoned soon,use method setData instead!"),this.setData(t,e)},e.prototype.flushData=function(t){var e=this;if(e._isInit){var r,i,n;e._isVertical?(r="y",i="x",t&&t.data&&(n=t.data.deltaY)):(r="x",i="y",t&&t.data&&(n=t.data.deltaX));var o=e._content[r],a=o>0?0:(Math.abs(Math.floor(o/e._itemRow))-1)*e._cols;if((a=Math.max(0,a))!=e._lastFirstId){if(e._lastFirstId=a,n)for(var s=0;s<e._cols;s++)n<0?e._items.unshift(e._items.pop()):e._items.push(e._items.shift());for(var h=0;h<e._itemCount;h++){var u=e._items[h];1==e._isInit&&(u.sroll_id=-1),u.sroll_id!==a&&(a<e.data.length?(u.onDataChanged(u.data=e.data[a]),u.visible=!0,u[r]=Math.floor(a/e._cols)*e._itemRow,u[i]=a%e._cols*e._itemCol,u.sroll_id=a):(u.data=null,u.visible=!1,u.sroll_id=-1)),a++}e._isInit=2}}},e.prototype.setViewRect=function(e,r,i){void 0===i&&(i=!0),t.prototype.setViewRect.call(this,e,r,!1);var n=this,o=n._isVertical===i;if(n._isVertical=i,n._itemRow&&n._itemCol)if(n._updateRowCol(),o)n.flushData();else{var a=n.bounceTime;n.bounceTime=0,n.setData(n._data,!0),n.bounceTime=a}},e.prototype._updateRowCol=function(){var t,e=this;e._isVertical?(e._itemRow=e._itemH,e._itemCol=e._itemW,t=e.viewHeight,e._scrollWidth=0):(e._itemRow=e._itemW,e._itemCol=e._itemH,t=e.viewWidth,e._scrollHeight=0);var r=(Math.ceil(t/e._itemRow)+1)*e._cols;if(r!=e._itemCount){if(r>e._itemCount)for(var i=e._itemCount;i<r;i++){var n=new e._itemClass;n.visible=!1,n.data=null,e._items.push(n),e._content.addChild(n)}else for(i=0;i<e._itemCount-r;i++)e._content.removeChild(e._items.pop());e._itemCount=r,e._lastFirstId=-1}},e.prototype.scrollTo=function(e,r){void 0===r&&(r=0);var i=0,n=0;this._isVertical?n=e:i=e,t.prototype.scrollTo.call(this,i,n,r)},e.prototype.scrollBy=function(e,r){void 0===r&&(r=0);var i=0,n=0;this._isVertical?n=e:i=e,t.prototype.scrollBy.call(this,i,n,r)},e.prototype.destroy=function(){var e=this;e._items=null,e._itemClass=null,e._data=null,t.prototype.destroy.call(this)},e}(Ln);te._childrenOperationMethods.forEach((function(t){Object.defineProperty(Un.prototype,t,{value:function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return console.warn("You'd better do not operate children in a ScrollList or its view!"),(e=te.prototype[t]).call.apply(e,P([this],r))},writable:!0,enumerable:!0})}));var jn=function(t){function e(e){var r=t.call(this)||this;r.lockStep=!1,r._curFrame=1,r._isPlaying=!0,r._isFront=!0,r.frameCount=0,r._lastFrame=0,r.commonDeltaTime=1e3/60;var i=r;return i._instanceType="MovieClip",e&&i.init(e),console.warn("class MovieClip will be deleted soon,use class SvgaAni instead"),r}return S(e,t),Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._curFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFront",{get:function(){return this._isFront},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this.rawData&&this.rawData.frames||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoWidth",{get:function(){return this.rawData&&this.rawData.videoSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoHeight",{get:function(){return this.rawData&&this.rawData.videoSize.height},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(t){if(this.removeAllChildren(),this.startAniRangeFun&&this.removeEventListener(I.ENTER_FRAME,this.startAniRangeFun,this),this.rawData=t,this.timeInterval=1e3/t.FPS,this.startTime=Date.now(),this.startFrame=1,this.deltaFrame=60/t.FPS,this.frameCount=this.deltaFrame,this._curFrame=1,t.images&&!t.textures)for(var e in t.textures={},t.images){var r=t.images[e];0!==r.indexOf("iVBO")&&0!==r.indexOf("/9j/2w")||(r="data:image/png;base64,"+r);var i=J();i.src=r,t.textures[e]=new me(new fe(i))}this.initChildren(t.sprites)}},e.prototype.initChildren=function(t){for(var e=0,r=t.length;e<r;e++){var i=t[e];if(i.imageKey){var n=this.addChild(new _e(this.rawData.textures?this.rawData.textures[i.imageKey]:Bt[i.imageKey]||Bt[i.imageKey+".png"]||null));n.frames=i.frames,i.frames[0].alpha<.05?n.alpha=0:(n.alpha=i.frames[0].alpha,n.transform.localMatrix.copy(i.frames[0].transform),n.transform._parentID=-1),n.framesOri=i.frames,n.imageKey=i.imageKey}}},e.prototype.setImage=function(t,e){for(var r=[],i=0;i<this.children.length;i++)this.children[i].imageKey==t&&r.push(this.children[i]);if(r.length){var n=r[0].texture,o=n.width,a=n.height,s=J();s.onload=function(){var t;if(s.width==o&&s.height==a)t=me.from(s);else{var e=G();e.width=o,e.height=a;var i=e.getContext("2d"),n=o/a,h=s.width/s.height;n>h?i.drawImage(s,0,0,s.width,s.height,(o-h*a)/2,0,h*a,a):i.drawImage(s,0,0,s.width,s.height,0,(a-o/h)/2,o,o/h),t=me.fromCanvas(e)}r.forEach((function(e){e.texture=t}))},s.src=e}},e.prototype.stop=function(){this._isPlaying=!1},e.prototype.nextFrame=function(){var t=this;t._curFrame<t.totalFrames&&t._curFrame++,t._isPlaying=!1},e.prototype.prevFrame=function(){var t=this;t._curFrame>1&&t._curFrame--,t._isPlaying=!1},e.prototype.gotoAndStop=function(t){var e=this;e._isPlaying=!1,t>e.totalFrames&&(t=e.totalFrames),t<1&&(t=1),e._curFrame=t},e.prototype.play=function(t){void 0===t&&(t=!0);var e=this;e.frameCount=e.deltaFrame,e.startTime=Date.now(),e.startFrame=e._curFrame,e._isPlaying=!0,e._isFront=t},Object.defineProperty(e.prototype,"isInTimeFrame",{get:function(){return this.frameCount==this.deltaFrame},enumerable:!1,configurable:!0}),e.prototype.gotoAndPlay=function(t,e){void 0===e&&(e=!0);var r=this;r._isFront=e,r._isPlaying=!0,t>r.totalFrames&&(t=r.totalFrames),t<1&&(t=1),r.frameCount=r.deltaFrame,r.startTime=Date.now(),r._curFrame=t,r.startFrame=r._curFrame},e.prototype.startAniRange=function(t,e,r,i){var n=this;if(void 0===t&&(t=1),void 0===e&&(e=this.totalFrames),void 0===r&&(r=1),t=t||1,e=e||this.totalFrames,r=r||0,r=Math.max(0,r),t<1&&(t=1),t>this.totalFrames&&(t=this.totalFrames),e<1&&(e=1),e>this.totalFrames&&(e=this.totalFrames),t!==e){this._isFront=t<e,this.startAniRangeFun&&this.removeEventListener(I.ENTER_FRAME,this.startAniRangeFun,this),this._curFrame=t,this.frameCount=this.deltaFrame,this.startTime=Date.now(),this.startFrame=this._curFrame,this._isPlaying=!0;var o=r?r+.5>>0:1/0;this.addEventListener(I.ENTER_FRAME,this.startAniRangeFun=function(r){r.target._isFront?(r.target.currentFrame>=e||r.target._endMark)&&(--o<=0?(r.target.gotoAndStop(e),r.target.removeEventListener(I.ENTER_FRAME,n.startAniRangeFun,n),n.startAniRangeFun=null,i&&i()):r.target.gotoAndPlay(t)):(r.target.currentFrame<=t||r.target._endMark)&&(--o<=0?(r.target.gotoAndStop(t),r.target.removeEventListener(I.ENTER_FRAME,n.startAniRangeFun,n),n.startAniRangeFun=null,i&&i()):r.target.gotoAndPlay(e,!1))},this)}else this.gotoAndStop(t)},e.prototype.updateFrame=function(){var t=this;if(0!=t.totalFrames&&1!=t.totalFrames){var r=!1;if(t._lastFrame!=t._curFrame?(r=!0,t._lastFrame=t._curFrame,t.startTime=Date.now(),t.startFrame=t._curFrame,t._endMark=!1):t._isPlaying&&(t.lockStep?r=t.getCurFrameWhenLockStep():0==--t.frameCount&&(t.frameCount=t.deltaFrame,r=!0,t._isFront?(t._curFrame++,t._curFrame>t.totalFrames&&(t._curFrame=1)):(t._curFrame--,t._curFrame<1&&(t._curFrame=t.totalFrames)),t._lastFrame=t._curFrame)),r){for(var i=0,n=t.children.length;i<n;i++){var o=t.children[i];if(o.frames&&o.frames[t._curFrame-1]){var a=o.frames[t._curFrame-1];if(a.alpha<.05)o.alpha=0;else if(o.alpha=a.alpha,k.isEqual(o.transform.localMatrix,a.transform)||(o.transform.localMatrix.copy(a.transform),o.transform._parentID=-1),a.maskPath){o.cusMask||(o.cusMask=new sn),o.mask||(o.mask=o.addChild(o.cusMask));var s=o.mask;e.drawBezierShape(s,a.maskPath)}else o.mask&&(o.removeChild(o.mask),o.mask=null)}}t.lockStep?t._endMark&&t.hasEventListener(I.END_FRAME)&&t.dispatchEvent(I.END_FRAME,{frameIndex:t._curFrame,frameName:"endFrame"}):(1==t._curFrame&&!t._isFront||t._curFrame==t.totalFrames&&t._isFront)&&t.hasEventListener(I.END_FRAME)&&t.dispatchEvent(I.END_FRAME,{frameIndex:t._curFrame,frameName:"endFrame"})}}},e.prototype.getCurFrameWhenLockStep=function(){var t=(Date.now()-this.startTime)/this.timeInterval>>0;return t==this.lastDeltaFrame?(this.frameCount=0,!1):(this._endMark=!1,this.frameCount=this.deltaFrame,this.lastDeltaFrame=t,this._isFront?(this._curFrame=(this.startFrame+t)%this.totalFrames,0==this._curFrame?(this._curFrame=this.totalFrames,this._endMark=!0):this._lastFrame>this._curFrame&&this._lastFrame!=this.totalFrames&&(this._endMark=!0)):(this._curFrame=(this.startFrame-t)%this.totalFrames,0==this._curFrame?this._curFrame=this.totalFrames:this._curFrame<0&&(this._curFrame+=this.totalFrames),(1==this._curFrame||this._lastFrame<this._curFrame&&1!=this._lastFrame)&&(this._endMark=!0)),this._lastFrame=this._curFrame,!0)},e.prototype.update=function(){this.updateFrame(),t.prototype.update.call(this)},e.prototype.destroy=function(){this.rawData=null,t.prototype.destroy.call(this)},e.deepCopyFrames=function(t,e,r,i,n,o,a,s){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0);var h=[];o*=Math.PI/180;var u={};u.a=Math.cos(o)*i,u.b=Math.sin(o)*i,u.c=-Math.sin(o)*n,u.d=Math.cos(o)*n,u.tx=e+a-(a*u.a+s*u.c),u.ty=r+s-(a*u.b+s*u.d);for(var l=0;l<t.length;l++){var c=t[l],p=c.transform,d={alpha:0,transform:null};d.alpha=c.alpha,d.transform={a:u.a*p.a+u.b*p.c,b:u.a*p.b+u.b*p.d,c:u.c*p.a+u.d*p.c,d:u.c*p.b+u.d*p.d,tx:u.tx*p.a+u.ty*p.c+p.tx,ty:u.tx*p.b+u.ty*p.d+p.ty},h.push(d)}return h},e.drawBezierShape=function(t,e,r){void 0===t&&(t=new sn),void 0===r&&(r=!1),t.clear();var i=e._styles;r&&i?(i.stroke&&t.beginStroke(Ft(i.stroke),i.strokeWidth||void 0,i.lineCap||void 0,i.lineJoin||void 0,i.miterLimit||void 0,i.stroke[3]),i.fill&&t.beginFill(Ft(i.fill),i.fill[3])):t.beginFill(),e._transform&&(t.transform.localMatrix.copy(e._transform),t.transform._parentID=-1);var n={x:0,y:0,x1:0,y1:0,x2:0,y2:0};return e._d.replace(/([a-zA-Z])/g,"|||$1 ").replace(/,/g," ").split("|||").forEach((function(e){if(0!=e.length){var r=e.substr(0,1);if("MLHVCSQRZmlhvcsqrz".indexOf(r)>=0){var i=e.substr(1).trim().split(" ");switch(r){case"M":n.x=Number(i[0]),n.y=Number(i[1]),t.moveTo(n.x,n.y);break;case"m":n.x+=Number(i[0]),n.y+=Number(i[1]),t.moveTo(n.x,n.y);break;case"L":n.x=Number(i[0]),n.y=Number(i[1]),t.lineTo(n.x,n.y);break;case"l":n.x+=Number(i[0]),n.y+=Number(i[1]),t.lineTo(n.x,n.y);break;case"H":n.x=Number(i[0]),t.lineTo(n.x,n.y);break;case"h":n.x+=Number(i[0]),t.lineTo(n.x,n.y);break;case"V":n.y=Number(i[0]),t.lineTo(n.x,n.y);break;case"v":n.y+=Number(i[0]),t.lineTo(n.x,n.y);break;case"C":n.x1=Number(i[0]),n.y1=Number(i[1]),n.x2=Number(i[2]),n.y2=Number(i[3]),n.x=Number(i[4]),n.y=Number(i[5]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y);break;case"c":n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x2=n.x+Number(i[2]),n.y2=n.y+Number(i[3]),n.x+=Number(i[4]),n.y+=Number(i[5]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y);break;case"S":n.x1&&n.y1&&n.x2&&n.y2?(n.x1=n.x-n.x2+n.x,n.y1=n.y-n.y2+n.y,n.x2=Number(i[0]),n.y2=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y)):(n.x1=Number(i[0]),n.y1=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y));break;case"s":n.x1&&n.y1&&n.x2&&n.y2?(n.x1=n.x-n.x2+n.x,n.y1=n.y-n.y2+n.y,n.x2=n.x+Number(i[0]),n.y2=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y)):(n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y));break;case"Q":n.x1=Number(i[0]),n.y1=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y);break;case"q":n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y);break;case"A":case"a":break;case"Z":case"z":t.closePath()}}}})),r&&i?(i.fill&&t.endFill(),i.stroke&&t.endStroke()):t.endFill(),t},e}(te),Vn=function(t){function e(e){var r=t.call(this,e)||this;return r._instanceType="SvgaAni",r}return S(e,t),Object.defineProperty(e.prototype,"totalTime",{get:function(){return this.rawData&&this.rawData.frames*(1/this.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this.rawData&&this.rawData.frames||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoWidth",{get:function(){return this.rawData&&this.rawData.videoSize.width||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoHeight",{get:function(){return this.rawData&&this.rawData.videoSize.height||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fps",{get:function(){return this._fps||this.rawData&&this.rawData.FPS||null},set:function(t){this._fps=t},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var e=this;if(t&&t!=this.rawData){if(this.rawData=t,this.removeAllChildren(),t.images&&!t.textures)for(var r in t.textures={},t.images){var i=t.images[r];0!==i.indexOf("iVBO")&&0!==i.indexOf("/9j/2w")||(i="data:image/png;base64,"+i);var n=J();n.src=i,t.textures[r]=new me(new fe(n))}var o=[];t.sprites.forEach((function(t){if(t.imageKey){var r=e.addChild(new _e(e.rawData.textures?e.rawData.textures[t.imageKey]:Bt[t.imageKey]||Bt[t.imageKey+".png"]||null));r.imageKey=t.imageKey,o.push(new Xn(r,t.frames))}})),o.forEach((function(t){t.resetValue()})),this.animationClip?this.animationClip.init(o,this.totalFrames):this.animationClip=new In(o,this.totalFrames),this._onRawDataUpdate()}},e.prototype.addAniPart=function(t,r,i,n,o,a,s,h,u,l){if(r&&t&&this.rawData&&this.animationClip){for(var c,p=this.rawData.sprites,d=0;d<p.length;d++)if(p[d].imageKey==t){c=p[d].frames;break}if(c){var f=e.deepCopyFrames(c,n,o,a,s,h,u,l);return this.animationClip.tracks.push(new Xn(this.addChildAt(r,i),f)),r}console.warn("no matched data for "+t)}},e.prototype.removeAniPart=function(t){this.removeChild(t);for(var e=this.animationClip.tracks,r=0;r<e.length;r++)if(e[r].obj==t){e.splice(r,1);break}return t},e.prototype.setImage=function(t,e){var r=this.getSpritesByImageKey(t);if(r.length){var i=r[0].texture,n=i.width,o=i.height,a=J();a.onload=function(){var t;if(a.width==n&&a.height==o)t=me.from(a);else{var e=G();e.width=n,e.height=o;var i=e.getContext("2d"),s=n/o,h=a.width/a.height;s>h?i.drawImage(a,0,0,a.width,a.height,(n-h*o)/2,0,h*o,o):i.drawImage(a,0,0,a.width,a.height,0,(o-n/h)/2,n,n/h),t=me.fromCanvas(e)}r.forEach((function(e){e.texture=t}))},a.src=e}},e.prototype.setTexture=function(t,e){this.getSpritesByImageKey(t).forEach((function(t){t.texture=e}))},e.prototype.getSpritesByImageKey=function(t){for(var e=[],r=0;r<this.children.length;r++)this.children[r].imageKey==t&&e.push(this.children[r]);return e},e.deepCopyFrames=function(t,e,r,i,n,o,a,s){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0);var h=[];o*=Math.PI/180;var u={};u.a=Math.cos(o)*i,u.b=Math.sin(o)*i,u.c=-Math.sin(o)*n,u.d=Math.cos(o)*n,u.tx=e+a-(a*u.a+s*u.c),u.ty=r+s-(a*u.b+s*u.d);for(var l=0;l<t.length;l++){var c=t[l],p=c.transform,d={alpha:0,transform:null};d.alpha=c.alpha,d.transform={a:u.a*p.a+u.b*p.c,b:u.a*p.b+u.b*p.d,c:u.c*p.a+u.d*p.c,d:u.c*p.b+u.d*p.d,tx:u.tx*p.a+u.ty*p.c+p.tx,ty:u.tx*p.b+u.ty*p.d+p.ty},h.push(d)}return h},e}(Rn),Xn=function(t){function e(e,r){var i=t.call(this)||this;return i.obj=e,i.frames=r,i._instanceType="SvgaTrack",i}return S(e,t),e.prototype.setValue=function(t){t=Math.round(Xt(t,0,this.frames.length-1));var e=this.frames[t],r=this.obj;e.alpha<.05?r.alpha=0:(r.alpha=e.alpha,k.isEqual(r.transform.localMatrix,e.transform)||(r.transform.localMatrix.copy(e.transform),r.transform._parentID=-1),e.maskPath?(r.cusMask||(r.cusMask=new sn),r.mask||(r.mask=r.addChild(r.cusMask)),function(t,e,r){void 0===t&&(t=new sn);void 0===r&&(r=!1);t.clear();var i=e._styles;r&&i?(i.stroke&&t.beginStroke(Ft(i.stroke),i.strokeWidth||void 0,i.lineCap||void 0,i.lineJoin||void 0,i.miterLimit||void 0,i.stroke[3]),i.fill&&t.beginFill(Ft(i.fill),i.fill[3])):t.beginFill();e._transform&&(t.transform.localMatrix.copy(e._transform),t.transform._parentID=-1);var n={x:0,y:0,x1:0,y1:0,x2:0,y2:0},o="MLHVCSQRZmlhvcsqrz";e._d.replace(/([a-zA-Z])/g,"|||$1 ").replace(/,/g," ").split("|||").forEach((function(e){if(0!=e.length){var r=e.substr(0,1);if(o.indexOf(r)>=0){var i=e.substr(1).trim().split(" ");switch(r){case"M":n.x=Number(i[0]),n.y=Number(i[1]),t.moveTo(n.x,n.y);break;case"m":n.x+=Number(i[0]),n.y+=Number(i[1]),t.moveTo(n.x,n.y);break;case"L":n.x=Number(i[0]),n.y=Number(i[1]),t.lineTo(n.x,n.y);break;case"l":n.x+=Number(i[0]),n.y+=Number(i[1]),t.lineTo(n.x,n.y);break;case"H":n.x=Number(i[0]),t.lineTo(n.x,n.y);break;case"h":n.x+=Number(i[0]),t.lineTo(n.x,n.y);break;case"V":n.y=Number(i[0]),t.lineTo(n.x,n.y);break;case"v":n.y+=Number(i[0]),t.lineTo(n.x,n.y);break;case"C":n.x1=Number(i[0]),n.y1=Number(i[1]),n.x2=Number(i[2]),n.y2=Number(i[3]),n.x=Number(i[4]),n.y=Number(i[5]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y);break;case"c":n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x2=n.x+Number(i[2]),n.y2=n.y+Number(i[3]),n.x+=Number(i[4]),n.y+=Number(i[5]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y);break;case"S":n.x1&&n.y1&&n.x2&&n.y2?(n.x1=n.x-n.x2+n.x,n.y1=n.y-n.y2+n.y,n.x2=Number(i[0]),n.y2=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y)):(n.x1=Number(i[0]),n.y1=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y));break;case"s":n.x1&&n.y1&&n.x2&&n.y2?(n.x1=n.x-n.x2+n.x,n.y1=n.y-n.y2+n.y,n.x2=n.x+Number(i[0]),n.y2=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y)):(n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y));break;case"Q":n.x1=Number(i[0]),n.y1=Number(i[1]),n.x=Number(i[2]),n.y=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y);break;case"q":n.x1=n.x+Number(i[0]),n.y1=n.y+Number(i[1]),n.x+=Number(i[2]),n.y+=Number(i[3]),t.quadraticCurveTo(n.x1,n.y1,n.x,n.y);break;case"A":case"a":break;case"Z":case"z":t.closePath()}}}})),r&&i?(i.fill&&t.endFill(),i.stroke&&t.endStroke()):t.endFill()}(r.mask,e.maskPath)):r.mask&&(r.removeChild(r.mask),r.mask=null))},e.prototype.resetValue=function(){this.setValue(0)},e.prototype.destroy=function(){this.obj=null},e}(R);var Wn=function(){var t={};var e=.1,r="function"==typeof Float32Array;function i(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function o(t){return 3*t}function a(t,e,r){return((i(e,r)*t+n(e,r))*t+o(e))*t}function s(t,e,r){return 3*i(e,r)*t*t+2*n(e,r)*t+o(e)}function h(t){this._p=t,this._mSampleValues=r?new Float32Array(11):new Array(11),this._precomputed=!1,this.get=this.get.bind(this)}return h.prototype={get:function(t){var e=this._p[0],r=this._p[1],i=this._p[2],n=this._p[3];return this._precomputed||this._precompute(),e===r&&i===n?t:0===t?0:1===t?1:a(this._getTForX(t),r,n)},_precompute:function(){var t=this._p[0],e=this._p[1],r=this._p[2],i=this._p[3];this._precomputed=!0,t===e&&r===i||this._calcSampleValues()},_calcSampleValues:function(){for(var t=this._p[0],r=this._p[2],i=0;i<11;++i)this._mSampleValues[i]=a(i*e,t,r)},_getTForX:function(t){for(var r=this._p[0],i=this._p[2],n=this._mSampleValues,o=0,h=1;10!==h&&n[h]<=t;++h)o+=e;var u=o+(t-n[--h])/(n[h+1]-n[h])*e,l=s(u,r,i);return l>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var o=s(e,r,i);if(0===o)return e;e-=(a(e,r,i)-t)/o}return e}(t,u,r,i):0===l?u:function(t,e,r,i,n){var o,s,h=0;do{(o=a(s=e+(r-e)/2,i,n)-t)>0?r=s:e=s}while(Math.abs(o)>1e-7&&++h<10);return s}(t,o,o+e,r,i)}},function(e,r,i,n,o){var a=o||("bez_"+e+"_"+r+"_"+i+"_"+n).replace(/\./g,"p");if(t[a])return t[a];var s=new h([e,r,i,n]);return t[a]=s,s}}();function Hn(t,e,r,i,n,o,a,s){var h=function(t,e,r,i){var n=(t[0]+"_"+t[1]+"_"+e[0]+"_"+e[1]+"_"+r[0]+"_"+r[1]+"_"+i[0]+"_"+i[1]).replace(/\./g,"p");if(!Yn[n]){var o,a,s,h,u,l,c,p=150,d=0,f=null;2===t.length&&(t[0]!=e[0]||t[1]!=e[1])&&Gn(t[0],t[1],e[0],e[1],t[0]+r[0],t[1]+r[1])&&Gn(t[0],t[1],e[0],e[1],e[0]+i[0],e[1]+i[1])&&(p=2);var v={segmentLength:0,points:new Array(p)};for(s=r.length,o=0;o<p;o+=1){for(c=new Array(s),u=o/(p-1),l=0,a=0;a<s;a+=1)h=Math.pow(1-u,3)*t[a]+3*Math.pow(1-u,2)*u*(t[a]+r[a])+3*(1-u)*Math.pow(u,2)*(e[a]+i[a])+Math.pow(u,3)*e[a],c[a]=h,null!==f&&(l+=Math.pow(c[a]-f[a],2));d+=l=Math.sqrt(l),v.points[o]={partialLength:l,preLength:d,point:c},f=c}v.segmentLength=d,Yn[n]=v}return Yn[n]}(t,e,r,i),u=s((a-n)/(o-n)),l=h.segmentLength*u;return 0==u?h.points[0].point:1==u?h.points[h.points.length-1].point:function(t,e){for(var r=0;r<e.length;r++){if(t<e[r].preLength){for(var i=(t-e[r-1].preLength)/e[r].partialLength,n=e[r-1].point.length,o=[],a=0;a<n;a+=1)o[a]=e[r-1].point[a]+(e[r].point[a]-e[r-1].point[a])*i;return o}}return e[e.length-1].point}(l,h.points)}var Yn={};function Gn(t,e,r,i,n,o){var a=t*i+e*n+r*o-n*i-o*t-r*e;return a>-.001&&a<.001}var qn,Zn=function(t){function e(e){var r=t.call(this,e)||this;return r._instanceType="Lottie",r}return S(e,t),Object.defineProperty(e.prototype,"totalTime",{get:function(){if(!this.rawData)return 0;var t=this.rawData;return(t.op-t.ip)*(1/this.fps)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalFrames",{get:function(){if(!this.rawData)return 0;var t=this.rawData;return t.op-t.ip},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoWidth",{get:function(){return this.rawData&&this.rawData.w||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoHeight",{get:function(){return this.rawData&&this.rawData.h||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fps",{get:function(){return this._fps||this.rawData&&this.rawData.fr||null},set:function(t){this._fps=t},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(t&&t!=this.rawData){this.rawData=t,this.name=t.nm,t.assets&&!t.textures&&(t.textures={},t.assets.forEach((function(e){if(e.layers)return t.compositions=t.compositions||{},void(t.compositions[e.id]=e.layers);var r=J();r.src=e.p,t.textures[e.id]=new me(new fe(r))}))),this.lottieContainer&&this.lottieContainer.destroy(),this.lottieContainer=this.addChild(new io);var e=no(this.lottieContainer,t.layers,t.ip,t.textures,t.compositions);e.forEach((function(e){e.resetValue(),"LottieExpressionTrack"==e.instanceType&&(e.frameRate=t.fr)})),this.animationClip?this.animationClip.init(e,this.totalFrames):this.animationClip=new In(e,this.totalFrames),this._onRawDataUpdate()}},e.useGraphicsMask=!1,e}(Rn);!function(t){t.pingpong="pingpong",t.cycle="cycle"}(qn||(qn={}));var Kn=function(t){function e(e,r,i,n,o,a){void 0===o&&(o=0),void 0===a&&(a=null);var s=t.call(this)||this;return s.obj=e,s.type=r,s.times=i,s.loop=n,s.ip=o,s.xy=a,s._instanceType="LottieBaseTrack",s}return S(e,t),e.prototype.setValue=function(t){t-=this.ip,ro(this.obj,this.cacValue(t),this.type,this.xy)},e.prototype.cacValue=function(t){if(this.loop&&this.loop.loopInOrOut&&(t=(1==this.loop.loopInOrOut?to:$n)(this.loop.type,this.loop.duration,this.times,t)),t<=this.times[0].t)return this.times[0].s;if(t>=this.times[this.times.length-1].t)return this.times[this.times.length-1].s||this.times[this.times.length-2].e;var e,r=this.findIndex(t),i=r-1,n=this.times[r],o=this.times[i],a=o.s,s=n.s||o.e;if(o.to)o.fnc=o.fnc||Wn(o.o.x,o.o.y,o.i.x,o.i.y).get,e=Hn(a,s,o.to,o.ti,o.t,n.t,t,o.fnc);else if(1===o.h)e=a;else{o.fnc=o.fnc||function(t,e,r){if(!t||!e)return null;var i,n,o,a;if(t.x.constructor===Array){for(var s=[],h=0;h<r;h++)i=void 0===t.x[h]?t.x[0]:t.x[h],n=void 0===t.y[h]?t.y[0]:t.y[h],o=void 0===e.x[h]?e.x[0]:e.x[h],a=void 0===e.y[h]?e.y[0]:e.y[h],s[h]=Wn(i,n,o,a).get;return s}return i=t.x,n=t.y,o=e.x,a=e.y,Wn(i,n,o,a).get}(o.o,o.i,a.length);for(var h,u=[],l=n.t-o.t,c=0;c<a.length;c+=1)h=t>=n.t?1:t<o.t?0:o.fnc?o.fnc.constructor===Array?o.fnc[c]((t-o.t)/l):o.fnc((t-o.t)/l):(t-o.t)/l,u[c]=a[c]+(s[c]-a[c])*h;e=u}return e},e.prototype.findIndex=function(t){var e=0,r=this.times.length-2;if(0==r)return 1;for(var i=r>>>1;;){if(this.times[i+1].t<=t?e=i+1:r=i,e==r)return e+1;i=e+r>>>1}},e.prototype.resetValue=function(){this.setValue(0)},e.prototype.destroy=function(){this.obj=null},e}(R),Qn=function(t){function e(e,r,i,n,o){void 0===o&&(o=0);var a=t.call(this)||this;return a.obj=e,a.inTime=r,a.outTime=i,a.startTime=n,a.ip=o,a._instanceType="LottieVisibleTrack",a}return S(e,t),e.prototype.setValue=function(t){t-=this.ip,this.obj.visible=this.inTime<=t&&this.outTime>t},e.prototype.resetValue=function(){this.setValue(0)},e.prototype.destroy=function(){this.obj=null},e}(R),Jn=function(t){function e(e,r,i,n,o){void 0===o&&(o=0);var a=t.call(this)||this;a.obj=e,a.type=r,a.expression=i,a.origionValue=n,a.ip=o,a._instanceType="LottieExpressionTrack";var s=a.expression.split("$bm_rt = ")[1];return a.node=function(t){var e,r,i=0,n="",o=[];for(;r=t[i++];)switch(r){case"(":e={op:n,args:[]},n="",o.push(e);break;case")":a(),e=o[o.length-1],o.pop();break;case",":a();break;case" ":break;default:n+=r}return e;function a(){var t=n;o[o.length-1].args.push(n?t:e),n=""}}(s),a}return S(e,t),e.prototype.setValue=function(t){t-=this.ip,t/=this.frameRate,ro(this.obj,function(t,e){return r(t.op,t.args[0],t.args[1],e);function r(t,e,i,n){return e.op?e=r(e.op,e.args[0],e.args[1],n):"time"==e&&(e=n),i.op?i=r(i.op,i.args[0],i.args[1],n):"time"==i&&(i=n),ao[t](+e,+i)}}(this.node,t),this.type)},e.prototype.resetValue=function(){ro(this.obj,this.origionValue,this.type)},e.prototype.destroy=function(){this.obj=null},e}(R);function $n(t,e,r,i){var n=r[r.length-1].t;if(i<=n)return i;(!e||e>r.length-1)&&(e=r.length-1);var o=r[r.length-1-e].t,a=n-o;if("pingpong"===t&&Math.floor((i-o)/a)%2!=0)return a-(i-o)%a+o;return(i-o)%a+o}function to(t,e,r,i){var n=r[0].t;if(i>=n)return i;(!e||e>r.length-1)&&(e=r.length-1);var o=r[e].t-n;if(t===qn.pingpong&&Math.floor((n-i)/o)%2==0)return(n-i)%o+n;return o-(n-i)%o+n}function eo(t){if(!t)return null;var e,r=+t.replace(/[^0-9]/gi,""),i=0;return t.indexOf("loopOut")>=0?i=2:t.indexOf("loopIn")>=0&&(i=1),t.indexOf("pingpong")>=0?e=qn.pingpong:t.indexOf("cycle")>=0&&(e=qn.cycle),{loopInOrOut:i,type:e,duration:r}}function ro(t,e,r,i){switch("number"==typeof e&&(e=[e]),r){case"r":t.rotation=e[0];break;case"o":t.alpha=e[0]/100;break;case"s":i?t["x"==i?"scaleX":"scaleY"]=e[0]/100:t.scale.set(e[0]/100,e[1]/100);break;case"p":i?t[i]=e[0]-("x"==i?t.anchorX:t.anchorY):t.position.set(e[0]-t.anchorX,e[1]-t.anchorY)}}var io=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e.prototype.updateTransform=function(){var t=this;this.displayObjectUpdateTransform(),this.children.forEach((function(e){t._recursivePostUpdateTransformAA(e)})),this.children.forEach((function(t){t._mark=!1}))},e.prototype.findChildByInd=function(t){for(var e=0;e<this.children.length;e++)if(this.children[e]._ind===t)return this.children[e];return null},e.prototype._recursivePostUpdateTransformAA=function(t){if(t._isLottieLayer&&t._parentId){var e=this.findChildByInd(t._parentId);if(this._recursivePostUpdateTransformAA(e),!t._mark){t._mark=!0;var r=t.parent;t.parent=e,t.updateTransform(),t.parent=r,t._worldAlpha=t.alpha*t.parent._worldAlpha}}else t._mark||(t.updateTransform(),t._mark=!0)},e}(te);function no(t,e,r,i,n,o){void 0===o&&(o=[]);for(var a,s=function(){var s,u=e[h],l=u.ty,c=u.refId,p=u.ks,d=u.parent,f=u.ind,v=u.ip,m=u.op,y=u.st,g=u.hasMask,x=u.masksProperties;0==l&&n?no(s=t.addChild(new io),n[c],r+v,i,n,o):s=4==l&&u.shapes?t.addChild(co(u.shapes)):t.addChild(new _e(c?i&&i[c]||Bt[c]||Bt[c+".png"]:null)),g&&x&&x.length&&(s.mask=s.addChild(function(t,e,r){var i=Zn.useGraphicsMask?new on:new sn;return i.beginFill(),t.forEach((function(t){if("n"!==t.mode){t.inv&&(i.moveTo(0,0),i.lineTo(e,0),i.lineTo(e,r),i.lineTo(0,r),i.lineTo(0,0));var n=t.pt.k;i.moveTo(n.v[0][0],n.v[0][1]);var o,a=n.v.length;for(o=1;o<a;o++)i.bezierCurveTo(n.o[o-1][0]+n.v[o-1][0],n.o[o-1][1]+n.v[o-1][1],n.i[o][0]+n.v[o][0],n.i[o][1]+n.v[o][1],n.v[o][0],n.v[o][1]);i.bezierCurveTo(n.o[o-1][0]+n.v[o-1][0],n.o[o-1][1]+n.v[o-1][1],n.i[0][0]+n.v[0][0],n.i[0][1]+n.v[0][1],n.v[0][0],n.v[0][1]),n.c}})),i.endFill(),i}(x,u.w,u.h))),s._isLottieLayer=!0,s._ind=f,s._parentId=d,a="number"==typeof p.a.k[0]?p.a.k:p.a.k[0].s,s.anchor.set(a[0],a[1]),o.push(new Qn(s,v,m,y,r)),["o","r","p","s"].forEach((function(t){var e=p[t].k,i=p[t].x;if(e)("o"==t||"r"==t)&&e.length||("s"==t||"p"==t)&&"number"!=typeof e[0]?o.push(new Kn(s,t,e,eo(i),r)):(ro(s,e,t),i&&-1==i.indexOf("loop")&&"s"!==t&&"p"!==t&&o.push(new Jn(s,t,i,e,r)));else{if(!p[t].s||"r"==t||"o"==t)return;["x","y"].forEach((function(e){var i=p[t][e].k,n=p[t][e].x;i.length?o.push(new Kn(s,t,i,eo(n),r,e)):ro(s,i,t,e)}))}}))},h=e.length-1;h>=0;h--)s();return o}var oo,ao={$bm_sum:function(t,e){return t+e},$bm_sub:function(t,e){return t-e},$bm_mul:function(t,e){return t*e},$bm_div:function(t,e){return t/e}};!function(t){t.gr="gr",t.fl="fl",t.st="st",t.tm="tm",t.tr="tr",t.el="el",t.sr="sr",t.sh="sh",t.rc="rc",t.rd="rd",t.rp="rp",t.gf="gf"}(oo||(oo={}));var so,ho=!0,uo={1:"butt",2:"round",3:"square"},lo={1:"miter",2:"round",3:"bevel"};function co(t,e){void 0===e&&(e=new sn);for(var r=t.length-1;r>=0;r--){var i=t[r],n=i.ty;if("gr"==n)co(i.it,e),ho?e.endFill():e.endStroke();else if("rc"==n){var o=i.p,a=void 0===o?{k:[0,0]}:o,s=i.s,h=i.r,u=void 0===h?{k:0}:h,l=so.transformPoint(a.k[0],a.k[1]);e[u.k?"drawRoundedRect":"drawRect"](l.x,l.y,s.k[0],s.k[1],u.k)}else if("el"==n){var c=i.p;a=void 0===c?{k:[0,0]}:c,s=i.s,l=so.transformPoint(a.k[0],a.k[1]);e.drawEllipse(l.x,l.y,s.k[0]/2,s.k[1]/2)}else if("fl"==n||"st"==n){var p=i.c,d=void 0===p?{k:[0,0,0,1]}:p,f=i.o,v=void 0===f?{k:1}:f,m=Ft([d.k[0],d.k[1],d.k[2]]),y=d.k[3]*v.k/100;if("fl"==n)e.beginFill(m,y),ho=!0;else{var g=i.w,x=i.lc,_=i.lj,b=i.ml;i.hd,i.d,e.beginStroke(m,g&&g.k||1,uo[x],lo[_],b,y),ho=!1}}else if("tr"==n){so=so||new k;var w=i.p,M=(a=void 0===w?{k:[0,0]}:w,i.a),S=void 0===M?{k:[0,0]}:M,E=i.s,C=(s=void 0===E?{k:[0,0]}:E,i.r);u=void 0===C?{k:0}:C,v=i.o;i.sk,i.sa,so.createBox(a.k[0],a.k[1],s.k[0]/100,s.k[1]/100,u.k*T,0,0,S.k[0],S.k[1]),so.tx-=S.k[0],so.ty-=S.k[1]}}return e}var po,fo=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},t.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},t.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},t.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){var t=1/(this.length()||1);return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},t.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},t.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},t.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},t.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},t.prototype.clampScalar=function(e,r){return this.clamp(new t(e,e,e),new t(r,r,r))},t.prototype.clampLength=function(t,e){return this.divideScalar(this.length()||1).multiplyScalar(Math.max(t,Math.min(e,length)))},t.prototype.applyMatrix4=function(t){var e=this.x,r=this.y,i=this.z,n=t.elements,o=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*o,this},t.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},t.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=i,this},t.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,4*e)},t.prototype.transformDirection=function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[10]*i,this.normalize()},t.prototype.project=function(t){return this.applyMatrix4(t.worldMatrixInverse).applyMatrix4(t.projectionMatrix)},t.prototype.unproject=function(t){return this.applyMatrix4((new vo).setInverseOf(t.projectionMatrix)).applyMatrix4(t._worldMatrix)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},t.prototype.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},t}(),vo=function(){function t(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return t.prototype.setIdentity=function(){var t=this.elements;return t[0]=1,t[4]=0,t[8]=0,t[12]=0,t[1]=0,t[5]=1,t[9]=0,t[13]=0,t[2]=0,t[6]=0,t[10]=1,t[14]=0,t[3]=0,t[7]=0,t[11]=0,t[15]=1,this},t.prototype.set=function(t,e,r,i,n,o,a,s,h,u,l,c,p,d,f,v){var m=this.elements;return m[0]=t,m[4]=e,m[8]=r,m[12]=i,m[1]=n,m[5]=o,m[9]=a,m[13]=s,m[2]=h,m[6]=u,m[10]=l,m[14]=c,m[3]=p,m[7]=d,m[11]=f,m[15]=v,this},t.prototype.copy=function(t){var e,r,i;for(r=t.elements,i=this.elements,e=0;e<16;++e)i[e]=r[e];return this},t.prototype.clone=function(){return(new t).fromArray(this.elements)},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(e[i]!==r[i])return!1;return!0},t.prototype.fromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[r+e];return this},t.prototype.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},t.prototype.concat=function(t){var e,r,i,n,o,a,s,h;if(r=this.elements,i=this.elements,r===(n=t.elements))for(n=new Float32Array(16),e=0;e<16;++e)n[e]=r[e];for(e=0;e<4;e++)o=i[e],a=i[e+4],s=i[e+8],h=i[e+12],r[e]=o*n[0]+a*n[1]+s*n[2]+h*n[3],r[e+4]=o*n[4]+a*n[5]+s*n[6]+h*n[7],r[e+8]=o*n[8]+a*n[9]+s*n[10]+h*n[11],r[e+12]=o*n[12]+a*n[13]+s*n[14]+h*n[15];return this},t.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],u=r[1],l=r[5],c=r[9],p=r[13],d=r[2],f=r[6],v=r[10],m=r[14],y=r[3],g=r[7],x=r[11],_=r[15],b=i[0],T=i[4],w=i[8],M=i[12],S=i[1],E=i[5],C=i[9],A=i[13],P=i[2],O=i[6],R=i[10],I=i[14],D=i[3],F=i[7],N=i[11],k=i[15];return n[0]=o*b+a*S+s*P+h*D,n[4]=o*T+a*E+s*O+h*F,n[8]=o*w+a*C+s*R+h*N,n[12]=o*M+a*A+s*I+h*k,n[1]=u*b+l*S+c*P+p*D,n[5]=u*T+l*E+c*O+p*F,n[9]=u*w+l*C+c*R+p*N,n[13]=u*M+l*A+c*I+p*k,n[2]=d*b+f*S+v*P+m*D,n[6]=d*T+f*E+v*O+m*F,n[10]=d*w+f*C+v*R+m*N,n[14]=d*M+f*A+v*I+m*k,n[3]=y*b+g*S+x*P+_*D,n[7]=y*T+g*E+x*O+_*F,n[11]=y*w+g*C+x*R+_*N,n[15]=y*M+g*A+x*I+_*k,this},t.prototype.multiplyVector3=function(t){var e=this.elements;return(new fo).set(t.x*e[0]+t.y*e[4]+t.z*e[8]+e[12],t.x*e[1]+t.y*e[5]+t.z*e[9]+e[13],t.x*e[2]+t.y*e[6]+t.z*e[10]+e[14])},t.prototype.transpose=function(){var t,e;return e=(t=this.elements)[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},t.prototype.setInverseOf=function(t){var e,r,i,n,o;if(r=t.elements,i=this.elements,(n=new Float32Array(16))[0]=r[5]*r[10]*r[15]-r[5]*r[11]*r[14]-r[9]*r[6]*r[15]+r[9]*r[7]*r[14]+r[13]*r[6]*r[11]-r[13]*r[7]*r[10],n[4]=-r[4]*r[10]*r[15]+r[4]*r[11]*r[14]+r[8]*r[6]*r[15]-r[8]*r[7]*r[14]-r[12]*r[6]*r[11]+r[12]*r[7]*r[10],n[8]=r[4]*r[9]*r[15]-r[4]*r[11]*r[13]-r[8]*r[5]*r[15]+r[8]*r[7]*r[13]+r[12]*r[5]*r[11]-r[12]*r[7]*r[9],n[12]=-r[4]*r[9]*r[14]+r[4]*r[10]*r[13]+r[8]*r[5]*r[14]-r[8]*r[6]*r[13]-r[12]*r[5]*r[10]+r[12]*r[6]*r[9],n[1]=-r[1]*r[10]*r[15]+r[1]*r[11]*r[14]+r[9]*r[2]*r[15]-r[9]*r[3]*r[14]-r[13]*r[2]*r[11]+r[13]*r[3]*r[10],n[5]=r[0]*r[10]*r[15]-r[0]*r[11]*r[14]-r[8]*r[2]*r[15]+r[8]*r[3]*r[14]+r[12]*r[2]*r[11]-r[12]*r[3]*r[10],n[9]=-r[0]*r[9]*r[15]+r[0]*r[11]*r[13]+r[8]*r[1]*r[15]-r[8]*r[3]*r[13]-r[12]*r[1]*r[11]+r[12]*r[3]*r[9],n[13]=r[0]*r[9]*r[14]-r[0]*r[10]*r[13]-r[8]*r[1]*r[14]+r[8]*r[2]*r[13]+r[12]*r[1]*r[10]-r[12]*r[2]*r[9],n[2]=r[1]*r[6]*r[15]-r[1]*r[7]*r[14]-r[5]*r[2]*r[15]+r[5]*r[3]*r[14]+r[13]*r[2]*r[7]-r[13]*r[3]*r[6],n[6]=-r[0]*r[6]*r[15]+r[0]*r[7]*r[14]+r[4]*r[2]*r[15]-r[4]*r[3]*r[14]-r[12]*r[2]*r[7]+r[12]*r[3]*r[6],n[10]=r[0]*r[5]*r[15]-r[0]*r[7]*r[13]-r[4]*r[1]*r[15]+r[4]*r[3]*r[13]+r[12]*r[1]*r[7]-r[12]*r[3]*r[5],n[14]=-r[0]*r[5]*r[14]+r[0]*r[6]*r[13]+r[4]*r[1]*r[14]-r[4]*r[2]*r[13]-r[12]*r[1]*r[6]+r[12]*r[2]*r[5],n[3]=-r[1]*r[6]*r[11]+r[1]*r[7]*r[10]+r[5]*r[2]*r[11]-r[5]*r[3]*r[10]-r[9]*r[2]*r[7]+r[9]*r[3]*r[6],n[7]=r[0]*r[6]*r[11]-r[0]*r[7]*r[10]-r[4]*r[2]*r[11]+r[4]*r[3]*r[10]+r[8]*r[2]*r[7]-r[8]*r[3]*r[6],n[11]=-r[0]*r[5]*r[11]+r[0]*r[7]*r[9]+r[4]*r[1]*r[11]-r[4]*r[3]*r[9]-r[8]*r[1]*r[7]+r[8]*r[3]*r[5],n[15]=r[0]*r[5]*r[10]-r[0]*r[6]*r[9]-r[4]*r[1]*r[10]+r[4]*r[2]*r[9]+r[8]*r[1]*r[6]-r[8]*r[2]*r[5],0===(o=r[0]*n[0]+r[1]*n[4]+r[2]*n[8]+r[3]*n[12]))return this;for(o=1/o,e=0;e<16;e++)i[e]=n[e]*o;return this},t.prototype.invert=function(){return this.setInverseOf(this)},t.prototype.setOrtho=function(t,e,r,i,n,o){var a,s,h,u;if(t===e||i===r||n===o)throw"null frustum";return s=1/(e-t),h=1/(r-i),u=1/(o-n),(a=this.elements)[0]=2*s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2*u,a[11]=0,a[12]=-(e+t)*s,a[13]=-(r+i)*h,a[14]=-(o+n)*u,a[15]=1,this},t.prototype.ortho=function(e,r,i,n,o,a){return this.concat((new t).setOrtho(e,r,i,n,o,a))},t.prototype.setFrustum=function(t,e,r,i,n,o){var a,s,h,u;if(t===e||i===r||n===o)throw"null frustum";if(n<=0)throw"near <= 0";if(o<=0)throw"far <= 0";return s=1/(e-t),h=1/(i-r),u=1/(o-n),(a=this.elements)[0]=2*n*s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*n*h,a[6]=0,a[7]=0,a[8]=(e+t)*s,a[9]=(i+r)*h,a[10]=-(o+n)*u,a[11]=-1,a[12]=0,a[13]=0,a[14]=-2*n*o*u,a[15]=0,this},t.prototype.frustum=function(e,r,i,n,o,a){return this.concat((new t).setFrustum(e,r,i,n,o,a))},t.prototype.setPerspective=function(t,e,r,i){var n,o,a,s;if(r===i||0===e)throw"null frustum";if(r<=0)throw"near <= 0";if(i<=0)throw"far <= 0";if(t=Math.PI*t/180/2,0===(a=Math.sin(t)))throw"null frustum";return o=1/(i-r),s=Math.cos(t)/a,(n=this.elements)[0]=s/e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-(i+r)*o,n[11]=-1,n[12]=0,n[13]=0,n[14]=-2*r*i*o,n[15]=0,this},t.prototype.makePerspective=function(t,e,r,i,n,o){var a=this.elements,s=2*n/(e-t),h=2*n/(r-i),u=(e+t)/(e-t),l=(r+i)/(r-i),c=-(o+n)/(o-n),p=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=h,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=c,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},t.prototype.perspective=function(e,r,i,n){return this.concat((new t).setPerspective(e,r,i,n))},t.prototype.setScale=function(t,e,r){var i=this.elements;return i[0]=t,i[4]=0,i[8]=0,i[12]=0,i[1]=0,i[5]=e,i[9]=0,i[13]=0,i[2]=0,i[6]=0,i[10]=r,i[14]=0,i[3]=0,i[7]=0,i[11]=0,i[15]=1,this},t.prototype.scale=function(t,e,r){var i=this.elements;return i[0]*=t,i[4]*=e,i[8]*=r,i[1]*=t,i[5]*=e,i[9]*=r,i[2]*=t,i[6]*=e,i[10]*=r,i[3]*=t,i[7]*=e,i[11]*=r,this},t.prototype.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,i))},t.prototype.setTranslate=function(t,e,r){var i=this.elements;return i[0]=1,i[4]=0,i[8]=0,i[12]=t,i[1]=0,i[5]=1,i[9]=0,i[13]=e,i[2]=0,i[6]=0,i[10]=1,i[14]=r,i[3]=0,i[7]=0,i[11]=0,i[15]=1,this},t.prototype.translate=function(t,e,r){var i=this.elements;return i[12]+=i[0]*t+i[4]*e+i[8]*r,i[13]+=i[1]*t+i[5]*e+i[9]*r,i[14]+=i[2]*t+i[6]*e+i[10]*r,i[15]+=i[3]*t+i[7]*e+i[11]*r,this},t.prototype.setRotate=function(t,e,r,i){var n,o,a,s,h,u,l,c,p,d,f,v;return t=Math.PI*t/180,n=this.elements,o=Math.sin(t),a=Math.cos(t),0!==e&&0===r&&0===i?(e<0&&(o=-o),n[0]=1,n[4]=0,n[8]=0,n[12]=0,n[1]=0,n[5]=a,n[9]=-o,n[13]=0,n[2]=0,n[6]=o,n[10]=a,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1):0===e&&0!==r&&0===i?(r<0&&(o=-o),n[0]=a,n[4]=0,n[8]=o,n[12]=0,n[1]=0,n[5]=1,n[9]=0,n[13]=0,n[2]=-o,n[6]=0,n[10]=a,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1):0===e&&0===r&&0!==i?(i<0&&(o=-o),n[0]=a,n[4]=-o,n[8]=0,n[12]=0,n[1]=o,n[5]=a,n[9]=0,n[13]=0,n[2]=0,n[6]=0,n[10]=1,n[14]=0,n[3]=0,n[7]=0,n[11]=0,n[15]=1):(1!==(s=Math.sqrt(e*e+r*r+i*i))&&(e*=h=1/s,r*=h,i*=h),u=1-a,l=e*r,c=r*i,p=i*e,d=e*o,f=r*o,v=i*o,n[0]=e*e*u+a,n[1]=l*u+v,n[2]=p*u-f,n[3]=0,n[4]=l*u-v,n[5]=r*r*u+a,n[6]=c*u+d,n[7]=0,n[8]=p*u+f,n[9]=c*u-d,n[10]=i*i*u+a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1),this},t.prototype.rotate=function(e,r,i,n){return this.concat((new t).setRotate(e,r,i,n))},t.prototype.setLookAt=function(t,e,r,i,n,o,a,s,h){var u,l,c,p,d,f,v,m,y,g,x,_;return l=i-t,c=n-e,p=o-r,f=(c*=d=1/Math.sqrt(l*l+c*c+p*p))*h-(p*=d)*s,v=p*a-(l*=d)*h,m=l*s-c*a,g=(v*=y=1/Math.sqrt(f*f+v*v+m*m))*p-(m*=y)*c,x=m*l-(f*=y)*p,_=f*c-v*l,(u=this.elements)[0]=f,u[1]=g,u[2]=-l,u[3]=0,u[4]=v,u[5]=x,u[6]=-c,u[7]=0,u[8]=m,u[9]=_,u[10]=-p,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,this.translate(-t,-e,-r)},t.prototype.lookAt=function(t,e,r){var i=new fo,n=new fo,o=new fo,a=this.elements;return o.subVectors(t,e),0===o.lengthSq()&&(o.z=1),o.normalize(),i.crossVectors(r,o),0===i.lengthSq()&&(1===Math.abs(r.z)?o.x+=1e-4:o.z+=1e-4,o.normalize(),i.crossVectors(r,o)),i.normalize(),n.crossVectors(o,i),a[0]=i.x,a[4]=n.x,a[8]=o.x,a[1]=i.y,a[5]=n.y,a[9]=o.y,a[2]=i.z,a[6]=n.z,a[10]=o.z,this},t.prototype.dropShadow=function(e,r){var i=new t,n=i.elements,o=e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3];return n[0]=o-r[0]*e[0],n[1]=-r[1]*e[0],n[2]=-r[2]*e[0],n[3]=-r[3]*e[0],n[4]=-r[0]*e[1],n[5]=o-r[1]*e[1],n[6]=-r[2]*e[1],n[7]=-r[3]*e[1],n[8]=-r[0]*e[2],n[9]=-r[1]*e[2],n[10]=o-r[2]*e[2],n[11]=-r[3]*e[2],n[12]=-r[0]*e[3],n[13]=-r[1]*e[3],n[14]=-r[2]*e[3],n[15]=o-r[3]*e[3],this.concat(i)},t.prototype.dropShadowDirectionally=function(t,e,r,i,n,o,a,s,h){var u=i*t+n*e+o*r;return this.dropShadow([t,e,r,-u],[a,s,h,0])},t.prototype.makeRotationFromQuaternion=function(t){var e=new fo(0,0,0),r=new fo(1,1,1);return this.compose(e,t,r)},t.prototype.compose=function(t,e,r){var i=this.elements,n=e.x,o=e.y,a=e.z,s=e.w,h=n+n,u=o+o,l=a+a,c=n*h,p=n*u,d=n*l,f=o*u,v=o*l,m=a*l,y=s*h,g=s*u,x=s*l,_=r.x,b=r.y,T=r.z;return i[0]=(1-(f+m))*_,i[1]=(p+x)*_,i[2]=(d-g)*_,i[3]=0,i[4]=(p-x)*b,i[5]=(1-(c+m))*b,i[6]=(v+y)*b,i[7]=0,i[8]=(d+g)*T,i[9]=(v-y)*T,i[10]=(1-(c+f))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this},t.prototype.decompose=function(e,r,i){var n=new fo,o=new t,a=this.elements,s=n.set(a[0],a[1],a[2]).length(),h=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14],o.copy(this);var l=1/s,c=1/h,p=1/u;return o.elements[0]*=l,o.elements[1]*=l,o.elements[2]*=l,o.elements[4]*=c,o.elements[5]*=c,o.elements[6]*=c,o.elements[8]*=p,o.elements[9]*=p,o.elements[10]*=p,r.setFromRotationMatrix(o),i.x=s,i.y=h,i.z=u,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],u=t[2],l=t[6],c=t[10],p=t[14];return t[3]*(+n*s*l-i*h*l-n*a*c+r*h*c+i*a*p-r*s*p)+t[7]*(+e*s*p-e*h*c+n*o*c-i*o*p+i*h*u-n*s*u)+t[11]*(+e*h*l-e*a*p-n*o*l+r*o*p+n*a*u-r*h*u)+t[15]*(-i*a*u-e*s*l+e*a*c+i*o*l-r*o*c+r*s*u)},t.prototype.extractRotation=function(t){var e=new fo,r=this.elements,i=t.elements,n=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[3]=0,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[7]=0,r[8]=i[8]*a,r[9]=i[9]*a,r[10]=i[10]*a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this},t}(),mo=function(){function t(t,e,r,i){var n,o;this.setFromUnitVectors=(o=new fo,function(t,e){return void 0===o&&(o=new fo),(n=t.dot(e)+1)<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?o.set(-t.y,t.x,0):o.set(0,-t.z,t.y)):o.crossVectors(t,e),this._x=o.x,this._y=o.y,this._z=o.z,this._w=n,this.normalize()}),this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1}return t.slerp=function(t,e,r,i){return r.copy(t).slerp(e,i)},t.slerpFlat=function(t,e,r,i,n,o,a){var s=r[i+0],h=r[i+1],u=r[i+2],l=r[i+3],c=n[o+0],p=n[o+1],d=n[o+2],f=n[o+3];if(l!==f||s!==c||h!==p||u!==d){var v=1-a,m=s*c+h*p+u*d+l*f,y=m>=0?1:-1,g=1-m*m;if(g>1e-19){var x=Math.sqrt(g),_=Math.atan2(x,m*y);v=Math.sin(v*_)/x,a=Math.sin(a*_)/x}var b=a*y;if(s=s*v+c*b,h=h*v+p*b,u=u*v+d*b,l=l*v+f*b,v===1-a){var T=1/Math.sqrt(s*s+h*h+u*u+l*l);s*=T,h*=T,u*=T,l*=T}}t[e]=s,t[e+1]=h,t[e+2]=u,t[e+3]=l},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),t.prototype.set=function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},t.prototype.clone=function(){return new t(this._x,this._y,this._z,this._w)},t.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},t.prototype.setFromEuler=function(t,e){var r=t._x,i=t._y,n=t._z,o=t.order,a=Math.cos,s=Math.sin,h=a(r/2),u=a(i/2),l=a(n/2),c=s(r/2),p=s(i/2),d=s(n/2);return"XYZ"===o?(this._x=c*u*l+h*p*d,this._y=h*p*l-c*u*d,this._z=h*u*d+c*p*l,this._w=h*u*l-c*p*d):"YXZ"===o?(this._x=c*u*l+h*p*d,this._y=h*p*l-c*u*d,this._z=h*u*d-c*p*l,this._w=h*u*l+c*p*d):"ZXY"===o?(this._x=c*u*l-h*p*d,this._y=h*p*l+c*u*d,this._z=h*u*d+c*p*l,this._w=h*u*l-c*p*d):"ZYX"===o?(this._x=c*u*l-h*p*d,this._y=h*p*l+c*u*d,this._z=h*u*d-c*p*l,this._w=h*u*l+c*p*d):"YZX"===o?(this._x=c*u*l+h*p*d,this._y=h*p*l+c*u*d,this._z=h*u*d-c*p*l,this._w=h*u*l-c*p*d):"XZY"===o&&(this._x=c*u*l-h*p*d,this._y=h*p*l-c*u*d,this._z=h*u*d+c*p*l,this._w=h*u*l+c*p*d),!1!==e&&this.onChangeCallback(),this},t.prototype.setFromAxisAngle=function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},t.prototype.setFromRotationMatrix=function(t){var e,r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],h=r[9],u=r[2],l=r[6],c=r[10],p=i+s+c;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-h)*e,this._y=(o-u)*e,this._z=(a-n)*e):i>s&&i>c?(e=2*Math.sqrt(1+i-s-c),this._w=(l-h)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(o+u)/e):s>c?(e=2*Math.sqrt(1+s-i-c),this._w=(o-u)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(h+l)/e):(e=2*Math.sqrt(1+c-i-s),this._w=(a-n)/e,this._x=(o+u)/e,this._y=(h+l)/e,this._z=.25*e),this.onChangeCallback(),this},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Xt(this.dot(t),-1,1)))},t.prototype.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},t.prototype.inverse=function(){return this.conjugate()},t.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},t.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},t.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},t.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},t.prototype.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},t.prototype.multiply=function(t,e){return void 0!==e?(console.warn(""),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.multiplyQuaternions=function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,u=e._w;return this._x=r*u+o*a+i*h-n*s,this._y=i*u+o*s+n*a-r*h,this._z=n*u+o*h+r*s-i*a,this._w=o*u-r*a-i*s-n*h,this.onChangeCallback(),this},t.prototype.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*t._w+r*t._x+i*t._y+n*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=1-a*a;if(s<=1e-13){var h=1-e;return this._w=h*o+e*this._w,this._x=h*r+e*this._x,this._y=h*i+e*this._y,this._z=h*n+e*this._z,this.normalize()}var u=Math.sqrt(s),l=Math.atan2(u,a),c=Math.sin((1-e)*l)/u,p=Math.sin(e*l)/u;return this._w=o*c+this._w*p,this._x=r*c+this._x*p,this._y=i*c+this._y*p,this._z=n*c+this._z*p,this.onChangeCallback(),this},t.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},t.prototype.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},t.prototype.onChange=function(t){return this.onChangeCallback=t,this},t.prototype.onChangeCallback=function(){},t}();!function(t){t.XYZ="XYZ",t.YZX="YZX",t.ZXY="ZXY",t.XZY="XZY",t.YXZ="YXZ",t.ZYX="ZYX"}(po||(po={}));var yo,go,xo=function(){function t(t,e,r,i){var n,o;void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=po.XYZ),this._x=t,this._y=e,this._z=r,this._order=i,this.setFromQuaternion=(n=new vo,function(t,e,r){return n.makeRotationFromQuaternion(t),this.setFromRotationMatrix(n,e,r)}),this.reorder=(o=new mo,function(t){return o.setFromEuler(this),this.setFromQuaternion(o,t)})}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()},enumerable:!1,configurable:!0}),t.prototype.set=function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},t.prototype.clone=function(){return new t(this._x,this._y,this._z,this._order)},t.prototype.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},t.prototype.setFromRotationMatrix=function(t,e,r){var i=t.elements,n=i[0],o=i[4],a=i[8],s=i[1],h=i[5],u=i[9],l=i[2],c=i[6],p=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(Xt(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,n)):(this._x=Math.atan2(c,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-Xt(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(a,p),this._z=Math.atan2(s,h)):(this._y=Math.atan2(-l,n),this._z=0)):"ZXY"===e?(this._x=Math.asin(Xt(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(s,n))):"ZYX"===e?(this._y=Math.asin(-Xt(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(c,p),this._z=Math.atan2(s,n)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(Xt(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-l,n)):(this._x=0,this._y=Math.atan2(a,p))):"XZY"===e?(this._z=Math.asin(-Xt(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},t.prototype.setFromVector3=function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},t.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},t.prototype.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},t.prototype.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},t.prototype.toVector3=function(t){return t?t.set(this._x,this._y,this._z):new fo(this._x,this._y,this._z)},t.prototype.onChange=function(t){return this.onChangeCallback=t,this},t.prototype.onChangeCallback=function(){},t}(),_o=new fo,bo=function(t){function e(){var r=t.call(this)||this;r.name=null,r.visible=!0,r.mouseEnable=!0,r.mouseChildren=!0,r.castShadow=!1,r.receiveShadow=!1,r.children=[],r.parent=null,r._worldMatrix=new vo,r._localMatrix=new vo,r.up=e.DefaultUp.clone(),r.position=new fo,r.scale=new fo(1,1,1),r._instanceType="Object3D";var i=new xo,n=new mo;return i.onChange((function(){n.setFromEuler(i,!1)})),n.onChange((function(){i.setFromQuaternion(n,void 0,!1)})),r.rotation=i,r.quaternion=n,r}return S(e,t),e.prototype.addChild=function(t){return this.addChildAt(t,this.children.length),t},e.prototype.addChildAt=function(t,e){if(t){var r,i=this,n=i==t.parent;if(t.parent)if(n){r=i.children.length;for(var o=0;o<r;o++)if(i.children[o]==t){i.children.splice(o,1);break}}else t.parent.removeChild(t);return t.parent=i,e>=(r=i.children.length)?(i.children[i.children.length]=t,e=r):0==e||e<0?(i.children.unshift(t),e=0):i.children.splice(e,0,t),i.scene&&!n&&t._onDispatchBubbledEvent("onAddedToScene"),t}},e.prototype.addChildren=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.forEach((function(e){t.addChild(e)})),e},e.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1!==e&&(t.parent=null,t._onDispatchBubbledEvent("onRemovedFromScene"),this.children.splice(e,1)),t},e.prototype._onDispatchBubbledEvent=function(t){var e=this;if("onRemovedFromScene"!=t||e.scene){"onRemovedFromScene"==t?(e.dispatchEvent(t),e.scene=null):"onAddedToScene"==t&&(e.scene=e.parent.scene,e.dispatchEvent(t));for(var r=e.children.length,i=0;i<r;i++)e.children[i]._onDispatchBubbledEvent(t)}},e.prototype.clone=function(t){return void 0===t&&(t=!0),(new e).copy(this,t)},e.prototype.copy=function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.visible=t.visible,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this._localMatrix.copy(t._localMatrix),this._worldMatrix.copy(t._worldMatrix),this.visible=t.visible,!0===e)for(var r=0;r<t.children.length;r++){var i=t.children[r];this.addChild(i.clone())}return this},e.prototype.lookAt=function(t,e,r){var i=new mo,n=new vo,o=new fo,a=new fo;"object"==typeof t?o.copy(t):o.set(t,e,r);var s=this.parent;this.updateWorldMatrix(!0,!1),a.setFromMatrixPosition(this._worldMatrix),"Camera"==this._instanceType||"PerspectiveCamera"==this._instanceType||"OrthographicCamera"==this._instanceType?n.lookAt(a,o,this.up):n.lookAt(o,a,this.up),this.quaternion.setFromRotationMatrix(n),s&&(n.extractRotation(s._worldMatrix),i.setFromRotationMatrix(n),this.quaternion.premultiply(i.inverse()))},e.prototype.applyMatrix=function(t){this._localMatrix.multiplyMatrices(t,this._localMatrix),this._localMatrix.decompose(this.position,this.quaternion,this.scale)},e.prototype.applyQuaternion=function(t){return this.quaternion.premultiply(t),this},e.prototype.localToGlobal=function(t){return t.applyMatrix4(this._worldMatrix)},e.prototype.globalToLocal=function(t){if(t instanceof fo){var e=new vo;return t.applyMatrix4(e.setInverseOf(this._worldMatrix))}return t},Object.defineProperty(e.prototype,"stagePos",{get:function(){return this.getPosition2d()},enumerable:!1,configurable:!0}),e.prototype.getPosition2d=function(t){if(!this.scene)return null;t=t||{x:0,y:0,z:0};var e=this.scene;this.localToGlobal(_o.copy(t)),_o.project(e.camera);var r=e.viewWidth/2,i=e.viewHeight/2;return{x:Math.round(_o.x*r+r)+e.viewX,y:Math.round(-_o.y*i+i)+e.viewY}},e.prototype.updateLocalMatrix=function(){this._localMatrix.compose(this.position,this.quaternion,this.scale)},e.prototype.updateWorldMatrix=function(t,r){void 0===t&&(t=!1),void 0===r&&(r=!0);var i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix&&i.updateWorldMatrix(!0,!1),this.updateLocalMatrix(),null!==this.parent&&this.parent instanceof e?this._worldMatrix.multiplyMatrices(this.parent._worldMatrix,this._localMatrix):this._worldMatrix.copy(this._localMatrix),!0===r)for(var n=this.children,o=0,a=n.length;o<a;o++)n[o].updateWorldMatrix(!1,!0)},e.prototype.update=function(){this.hasEventListener(I.ENTER_FRAME)&&this.dispatchEvent(I.ENTER_FRAME);for(var t=this.children.length-1;t>=0;t--){var e=this.children[t];e.visible&&e.update()}},e.prototype.getChildByName=function(t,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!1),!t)return null;var n;n="string"==typeof t?new RegExp("^"+t+"$"):t;var o=[];e._getElementsByName(n,this,r,i,o);var a=o.length;return 0==a?null:1==a?o[0]:o},e._getElementsByName=function(t,r,i,n,o){var a=r.children.length;if(a>0)for(var s=void 0,h=void 0,u=0;u<a;u++){if((s=(h=r.children[u]).name)&&""!=s&&t.test(s)&&(o[o.length]=h,i))return;n&&null!=h.children&&e._getElementsByName(t,h,i,n,o)}},e.prototype.render=function(t){this._render(t);for(var e=0;e<this.children.length;e++){var r=this.children[e];r.visible&&r.render(t)}},e.prototype._render=function(t){},e.prototype.raycast=function(t,e){},e.prototype.destroy=function(){for(var t=this.children.length-1;t>=0;t--)this.children[t].destroy();this.parent&&this.parent.removeChild(this),this.removeAllEventListener()},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this.position.z},set:function(t){this.position.z=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleX",{get:function(){return this.scale.x},set:function(t){this.scale.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleY",{get:function(){return this.scale.y},set:function(t){this.scale.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleZ",{get:function(){return this.scale.z},set:function(t){this.scale.z=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationX",{get:function(){return this.rotation.x*T},set:function(t){this.rotation.x=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationY",{get:function(){return this.rotation.y*T},set:function(t){this.rotation.y=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationZ",{get:function(){return this.rotation.z*T},set:function(t){this.rotation.z=t*w},enumerable:!1,configurable:!0}),e.DefaultUp=new fo(0,1,0),e}(D);!function(t){t.ENVMAP_BLENDING_MULTIPLY="ENVMAP_BLENDING_MULTIPLY",t.ENVMAP_BLENDING_MIX="ENVMAP_BLENDING_MIX",t.ENVMAP_BLENDING_ADD="ENVMAP_BLENDING_ADD"}(yo||(yo={})),function(t){t[t.FrontSide=0]="FrontSide",t[t.BackSide=1]="BackSide",t[t.DoubleSide=2]="DoubleSide"}(go||(go={}));var To=function(t){function e(e){var r=t.call(this)||this;if(r._color=16777215,r._colorArr=new Float32Array([1,1,1]),r.alpha=1,r.combine=yo.ENVMAP_BLENDING_MULTIPLY,r.reflectivity=1,r.morphTargets=!1,r.morphNormals=!1,r.skinning=!1,r.useVertexColor=!1,r.wireframe=!1,r.side=go.FrontSide,r.useFog=!0,r._lightAffect=!1,r._instanceType="BaseMaterial",e)for(var i in e)r[i]=e[i];return r}return S(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){if(this._color!==t){this._color=t;var e=Rt(t);this._colorArr[0]=e[0],this._colorArr[1]=e[1],this._colorArr[2]=e[2]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorArr",{get:function(){return this._colorArr},enumerable:!1,configurable:!0}),e.prototype.copy=function(t){return this.color=t.color,this.map=t.map,this.alpha=t.alpha,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.skinning=t.skinning,this.wireframe=t.wireframe,this.side=t.side,this._lightAffect=t._lightAffect,this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.destroy=function(){this._color=null},e}(R),wo=function(){function t(t,e){void 0===t&&(t=new fo),void 0===e&&(e=new fo),this.origin=t,this.direction=e}return t.prototype.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.copy=function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},t.prototype.at=function(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)},t.prototype.lookAt=function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},t.prototype.recast=function(t){var e=new fo;return this.origin.copy(this.at(t,e)),this},t.prototype.closestPointToPoint=function(t,e){void 0===e&&(e=new fo),e.subVectors(t,this.origin);var r=e.dot(this.direction);return r<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(r).add(this.origin)},t.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},t.prototype.distanceSqToPoint=function(t){var e=new fo,r=e.subVectors(t,this.origin).dot(this.direction);return r<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))},t.prototype.intersectSphere=function(t,e){var r=new fo;r.subVectors(t.center,this.origin);var i=r.dot(this.direction),n=r.dot(r)-i*i,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,h=i+a;return s<0&&h<0?null:s<0?this.at(h,e):this.at(s,e)},t.prototype.intersectsSphere=function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,h=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,c=this.origin;return h>=0?(r=(t.min.x-c.x)*h,i=(t.max.x-c.x)*h):(r=(t.max.x-c.x)*h,i=(t.min.x-c.x)*h),u>=0?(n=(t.min.y-c.y)*u,o=(t.max.y-c.y)*u):(n=(t.max.y-c.y)*u,o=(t.min.y-c.y)*u),r>o||n>i?null:((n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),l>=0?(a=(t.min.z-c.z)*l,s=(t.max.z-c.z)*l):(a=(t.max.z-c.z)*l,s=(t.min.z-c.z)*l),r>s||a>i?null:((a>r||r!=r)&&(r=a),(s<i||i!=i)&&(i=s),i<0?null:this.at(r>=0?r:i,e)))},t.prototype.intersectsBox=function(t){return null!==this.intersectBox(t,new fo)},t.prototype.intersectTriangle=function(t,e,r,i,n){var o=new fo,a=new fo,s=new fo,h=new fo;a.subVectors(e,t),s.subVectors(r,t),h.crossVectors(a,s);var u,l=this.direction.dot(h);if(l>0){if(i)return null;u=1}else{if(!(l<0))return null;u=-1,l=-l}o.subVectors(this.origin,t);var c=u*this.direction.dot(s.crossVectors(o,s));if(c<0)return null;var p=u*this.direction.dot(a.cross(o));if(p<0)return null;if(c+p>l)return null;var d=-u*o.dot(h);return d<0?null:this.at(d/l,n)},t.prototype.applyMatrix4=function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},t.prototype.equals=function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},t}(),Mo=function(){function t(t,e){void 0===t&&(t=new fo(1/0,1/0,1/0)),void 0===e&&(e=new fo(-1/0,-1/0,-1/0)),this.min=t,this.max=e}return t.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},t.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new fo),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new fo),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},t.prototype.setFromArray=function(t){for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;s<h;s+=3){var u=t[s],l=t[s+1],c=t[s+2];u<e&&(e=u),l<r&&(r=l),c<i&&(i=c),u>n&&(n=u),l>o&&(o=l),c>a&&(a=c)}return this.min.set(e,r,i),this.max.set(n,o,a),this},t.prototype.setFromCenterAndSize=function(t,e){var r=(new fo).copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},t.prototype.expandByObject=function(t){var e=this,r=new fo;return t.updateWorldMatrix(),function t(i){var n=i.geometry;if(void 0!==n&&n._vertices)for(var o=n._vertices,a=0;a<o.length;a+=3)r.set(o[a],o[a+1],o[a+2]).applyMatrix4(i._worldMatrix),e.expandByPoint(r);for(var s=0;s<i.children.length;s++)t(i.children[s])}(t),e},t.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},t.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},t.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},t.prototype.intersectsSphere=function(t){var e=new fo;return this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new fo),e.copy(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return(new fo).copy(t).clamp(this.min,this.max).sub(t).length()},t.prototype.getBoundingSphere=function(t){void 0===t&&(t=new So);var e=new fo;return this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t){var e=[new fo,new fo,new fo,new fo,new fo,new fo,new fo,new fo];return this.isEmpty()||(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e)),this},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),So=function(){function t(t,e){void 0===t&&(t=new fo),void 0===e&&(e=0),this.center=t,this.radius=e}return t.prototype.set=function(t,e){return this.center.copy(t),this.radius=e,this},t.prototype.setFromPoints=function(t,e){var r=new Mo,i=this.center;void 0!==e?i.copy(e):r.setFromPoints(t).getCenter(i);for(var n=0,o=0,a=t.length;o<a;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},t.prototype.empty=function(){return this.radius<=0},t.prototype.containsPoint=function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distanceTo(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){void 0===e&&(e=new fo);var r=this.center.distanceToSquared(t);return e.copy(t),r>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new Mo),t.set(this.center,this.center),t.expandByScalar(this.radius),t},t.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t}(),Eo=new So,Co=new vo,Ao=new wo,Po=new fo,Oo=function(t){function e(e,r){var i=t.call(this)||this;return i.geometry=e,i.material=r,i._instanceType="Mesh3D",i.updateMorphTargets(),i}return S(e,t),Object.defineProperty(e.prototype,"morphTargetInfluences",{get:function(){return this._morphTargetInfluences},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this.visible&&this.material.alpha&&(t.batchManager.setObjectRenderer(t.plugins.d3),t.plugins.d3.render(this))},e.prototype.updateMorphTargets=function(){var t=this.geometry._morphPositions;if(t){this._morphTargetInfluences=[];for(var e=0;e<t.length;e++)this._morphTargetInfluences.push(0)}},e.prototype.raycast=function(t,e){if(this.visible&&this.geometry&&this.material&&!this.material.wireframe){var r=this.geometry,i=this._worldMatrix;if(r.boundingSphere||r.computeBoundingSphere(),Eo.copy(r.boundingSphere),Eo.applyMatrix4(i),!1!==t.ray.intersectsSphere(Eo)&&(Co.setInverseOf(i),Ao.copy(t.ray).applyMatrix4(Co),null===r.boundingBox||!1!==Ao.intersectsBox(r.boundingBox)))if(r.doHitFace){var n,o=new fo,a=new fo,s=new fo,h=r._indices,u=r._vertices;if(h)for(var l=0;l<h.length;l+=3){var c=h[l],p=h[l+1],d=h[l+2];if(o.set(u[3*c],u[3*c+1],u[3*c+2]),a.set(u[3*p],u[3*p+1],u[3*p+2]),s.set(u[3*d],u[3*d+1],u[3*d+2]),n=Io(this,t,Ao,o,a,s,Po)){e.push(n);break}}else if(u)for(l=0;l<u.length;l+=9)if(o.set(u[l],u[l+1],u[l+2]),a.set(u[l+3],u[l+4],u[l+5]),s.set(u[l+6],u[l+7],u[l+8]),n=Io(this,t,Ao,o,a,s,Po)){e.push(n);break}}else e.push({distance:t.ray.origin.distanceTo(Eo.center)-Eo.radius,object:this})}},e.prototype.copy=function(e,r){return void 0===r&&(r=!0),t.prototype.copy.call(this,e,r),e.morphTargetInfluences&&(this._morphTargetInfluences=e.morphTargetInfluences.slice()),this},e.prototype.clone=function(t){return void 0===t&&(t=!0),new e(this.geometry,this.material).copy(this,t)},e}(bo),Ro=new fo;function Io(t,e,r,i,n,o,a){var s=t.material;if(null===(s.side===go.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==go.DoubleSide,a)))return null;Ro.copy(a),Ro.applyMatrix4(t._worldMatrix);var h=e.ray.origin.distanceTo(Ro);return h<e.near||h>e.far?null:{distance:h,point:Ro.clone(),object:t}}var Do,Fo=function(t){function e(e,r,i,n,o){var a=t.call(this)||this;return a._vertByteSize=44,a.attrBufferNeedUpdate=!1,a.boundingBox=null,a.boundingSphere=null,a.doHitFace=!1,a._instanceType="Geometry",a._glVaoBuffer={},a._vertices=e,a._normals=i||new Float32Array(e.length),a._colors=n||function(){for(var t=new Float32Array(e.length),r=0;r<e.length;r++)t[r]=1;return t}(),a._uvs=o||new Float32Array(e.length/3*2),a._indices=r?new Uint16Array(r):null,a}return S(e,t),e.prototype.computeBoundingBox=function(){this.boundingBox||(this.boundingBox=new Mo);var t=this._vertices;t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error("error vertices data")},e.prototype.computeBoundingSphere=function(){var t=new Mo,e=new fo;this.boundingSphere||(this.boundingSphere=new So);var r=this._vertices;if(r){var i=this.boundingSphere.center;t.setFromArray(r),t.getCenter(i);for(var n=0,o=0,a=r.length;o<a;o+=3)e.x=r[o],e.y=r[o+1],e.z=r[o+2],n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("error vertices data")}},e.prototype.destroy=function(){},e}(R),No=function(t){function e(){var e=t.call(this)||this;return e._instanceType="Camera",e.worldMatrixInverse=new vo,e.projectionMatrix=new vo,e.projectionMatrixInverse=new vo,e}return S(e,t),e.prototype.clone=function(){return(new e).copy(this)},e.prototype.copy=function(e,r){return t.prototype.copy.call(this,e,r),this.worldMatrixInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},e.prototype.getWorldDirection=function(t){this.updateWorldMatrix();var e=this._worldMatrix.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},e.prototype.updateWorldMatrix=function(){t.prototype.updateWorldMatrix.call(this),this.worldMatrixInverse.setInverseOf(this._worldMatrix)},e}(bo),ko=function(t){function e(e,r,i,n){void 0===e&&(e=50),void 0===r&&(r=1),void 0===i&&(i=.1),void 0===n&&(n=2e3);var o=t.call(this)||this;return o.fov=e,o.aspect=r,o.near=i,o.far=n,o._instanceType="PerspectiveCamera",o.zoom=1,o.focus=10,o.updateProjectionMatrix(),o}return S(e,t),e.prototype.set=function(t,e,r,i){void 0===t&&(t=50),void 0===e&&(e=1),void 0===r&&(r=.1),void 0===i&&(i=2e3),this.fov=t,this.aspect=e,this.near=r,this.far=i,this.zoom=1,this.focus=10,this.updateProjectionMatrix()},e.prototype.copy=function(e,r){return void 0===r&&(r=!0),t.prototype.copy.call(this,e,r),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.updateProjectionMatrix(),this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.updateProjectionMatrix=function(){this.projectionMatrix.setPerspective(this.fov,this.aspect,this.near,this.far),this.projectionMatrixInverse.setInverseOf(this.projectionMatrix)},e}(No),Lo=function(t){function e(e,r){void 0===r&&(r=1);var i=t.call(this)||this;return i.intensity=r,i._color=16777215,i._colorArr=new Float32Array([1,1,1]),i._colorVec3=new fo(1,1,1),i.color=e,i._instanceType="Light",i}return S(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){if(this._color!==t){this._color=t;var e=Rt(t);this._colorArr[0]=this._colorVec3.x=e[0],this._colorArr[1]=this._colorVec3.y=e[1],this._colorArr[2]=this._colorVec3.z=e[2]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorArr",{get:function(){return this._colorArr},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorVec3",{get:function(){return this._colorVec3},enumerable:!1,configurable:!0}),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color=e.color,this.intensity=e.intensity,this.shadow=e.shadow.clone(),this},e}(bo),Bo=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},t.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},t.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},t.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},t.prototype.applyMatrix3=function(t){var e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},t.prototype.normalize=function(){return this.divideScalar(this.length()||1)},t.prototype.angle=function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},t.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},t.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},t.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},t.prototype.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},t}(),zo=function(t){function e(e,r,i,n){void 0===i&&(i=0),void 0===n&&(n=1/0);var o=t.call(this)||this;return o.near=i,o.far=n,o._instanceType="Raycaster",o.ray=new wo(e,r),o}return S(e,t),e.prototype.set=function(t,e){this.ray.set(t,e)},e.prototype.copy=function(t){return this.ray.copy(t.ray),this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.setFromCamera=function(t,e){this.ray.origin.setFromMatrixPosition(e._worldMatrix),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()},e.prototype.intersectObject=function(t,e){var r=e||[];return jo(t,this,r),r.sort(Uo),r},e.prototype.destroy=function(){},e}(R);function Uo(t,e){return t.distance-e.distance}function jo(t,e,r){if(!1!==t.visible&&(t.mouseEnable&&t.raycast(e,r),t.mouseChildren))for(var i=t.children,n=0,o=i.length;n<o;n++)jo(i[n],e,r)}!function(t){t.basic="SHADOWMAP_TYPE_BASIC",t.pcf="SHADOWMAP_TYPE_PCF"}(Do||(Do={}));var Vo,Xo=function(t){function e(){var e=t.call(this)||this;return e._viewId=-1,e._viewX=0,e._viewY=0,e._viewWidth=750,e._viewHeight=1624,e.visible=!0,e.raycaster=new zo,e.shadowType=Do.basic,e._instanceType="Scene3D",e.scene=e,e.transform={_parentId:0},e.camera=new ko,e}return S(e,t),Object.defineProperty(e.prototype,"viewX",{get:function(){return this._viewX},set:function(t){t=t||0,this._viewX!==t&&(this._viewX=t,this._viewId=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewY",{get:function(){return this._viewY},set:function(t){t=t||0,this._viewY!==t&&(this._viewY=t,this._viewId=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewWidth",{get:function(){return this._viewWidth},set:function(t){t=t||0,this._viewWidth!==t&&(this._viewWidth=t,this._viewId=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){t=t||0,this._viewHeight!==t&&(this._viewHeight=t,this._viewId=-1)},enumerable:!1,configurable:!0}),e.prototype.setViewRect=function(t,e,r,i){this.viewX=t,this.viewY=e,this.viewWidth=r,this.viewHeight=i,this._viewId=-1},e.prototype.setFog=function(t,e,r){void 0===t&&(t=16777215),void 0===e&&(e=0),void 0===r&&(r=100);var i=Rt(t);this._fog?(this._fog.color[0]=i[0],this._fog.color[1]=i[1],this._fog.color[2]=i[2],this._fog.near=e,this._fog.far=r):this._fog={color:new Float32Array(i),near:e,far:r}},e.prototype.removeFog=function(){this._fog=null},Object.defineProperty(e.prototype,"filters",{get:function(){return this._filters&&this._filters.slice()},set:function(t){this._filters=t&&t.slice()},enumerable:!1,configurable:!0}),e.prototype.updateTransform=function(){this.visible&&this.updateWorldMatrix()},e.prototype.renderWebGL=function(t){if(this.visible){var e=t.plugins.d3;if(this.camera.updateWorldMatrix(),e.camera=this.camera,e.lightsConfig=this.getLightConfig(),e.fog=this._fog||null,e.shadowType=this.shadowType,t.batchManager.setObjectRenderer(e),this.setViewport(t),e.viewport=this._viewport,this.filters&&this.filters.length){var r=this.filters;if(r){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var i=0;i<r.length;i++)r[i].enabled&&this._enabledFilters.push(r[i]);this._enabledFilters.length&&t.filterManager.pushFilter(this,this._enabledFilters)}this.render(t),t.batchManager.flush(),r&&this._enabledFilters&&this._enabledFilters.length&&t.filterManager.popFilter()}else this.render(t)}},e.prototype.setViewport=function(t){if(this._viewId!==this.parent.transform._worldID){this._viewId=this.parent.transform._worldID;var e=this.parent.transform.worldMatrix,r=this.viewX*e.a+this.viewY*e.c+e.tx,i=this.viewX*e.b+this.viewY*e.d+e.ty,n=Math.sqrt(e.a*e.a+e.b*e.b),o=Math.sqrt(e.c*e.c+e.d*e.d);this._viewport={x:r,y:t.height-i-this.viewHeight*o,width:this.viewWidth*n,height:this.viewHeight*o}}this._viewport&&t.gl.viewport(this._viewport.x,this._viewport.y,this._viewport.width,this._viewport.height)},e.prototype.getBounds=function(){var t=this.parent.transform.worldMatrix,e=this.viewX*t.b+this.viewY*t.d+t.ty;return new B(this._viewport.x,e,this._viewport.width,this._viewport.height)},e.prototype.getLightConfig=function(t,e){void 0===t&&(t=this),void 0===e&&(e={pointLights:[],directionalLights:[],ambientLightColor:[0,0,0]});for(var r=this.camera.worldMatrixInverse,i=0;i<t.children.length;i++){var n=t.children[i];if(n instanceof Lo){var o=n.colorVec3.clone().multiplyScalar(n.intensity).toArray();if("AmbientLight"==n.instanceType)e.ambientLightColor[0]+=o[0],e.ambientLightColor[1]+=o[1],e.ambientLightColor[2]+=o[2];else if("PointLight"==n.instanceType){var a=(new fo).setFromMatrixPosition(n._worldMatrix);a.applyMatrix4(r),e.pointLights.push({color:o,position:a.toArray(),distance:n.distance,decay:0===n.distance?0:n.decay})}else if("DirectionalLight"==n.instanceType){var s,h=(new fo).setFromMatrixPosition(n._worldMatrix);if(h.sub((new fo).setFromMatrixPosition(n.target._worldMatrix)),h.transformDirection(r),n.castShadow){n.shadow.map;var u=n.shadow.camera,l=n.shadow.matrix,c=n._worldMatrix.elements.slice(12,15),p=n.target._worldMatrix.elements.slice(12,15);u.position.set(c[0],c[1],c[2]),u.lookAt(p[0],p[1],p[2]),u.updateWorldMatrix(),s=l.setIdentity().multiply(u.projectionMatrix).multiply(u.worldMatrixInverse).toArray(),l.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),l.multiply(u.projectionMatrix),l.multiply(u.worldMatrixInverse)}e.directionalLights.push({color:o,direction:h.normalize().toArray(),castShadow:n.castShadow,shadowMatrixDepth:s,shadowMatrix:n.shadow.matrix.toArray(),bias:n.shadow.bias,radius:n.shadow.radius,mapSize:[n.shadow.mapSize.x,n.shadow.mapSize.y]})}}n.children&&n.children.length&&this.getLightConfig(n,e)}return e},e.prototype.hitTestPoint=function(t,e){if(!this.parent||!this.mouseEnable)return null;var r=this.parent.transform.worldMatrix,i=this.viewX*r.a+this.viewY*r.c+r.tx,n=this.viewX*r.b+this.viewY*r.d+r.ty,o=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d),s=this.viewWidth*o,h=this.viewHeight*a;if(!(t.x>=i&&t.x<=i+s&&t.y>=n&&t.y<=n+h))return null;if(this.mouseChildren){i=(t.x-i)/s*2-1,n=-(t.y-n)/h*2+1,this.raycaster.setFromCamera(new fo(i,n,.5),this.camera);var u=this.raycaster.intersectObject(this);if(u.length)return u[0].object}return this},e.prototype.setOrbCtrCfg=function(t){var e=this.orbitControlConfig;if(e&&t)for(var r in t)void 0!==e[r]&&(e[r]=t[r])},e.prototype.setOrbitControl=function(t){var e=this;if(!this.orbitControlConfig){this.orbitControlConfig={enabled:!0,enableDamping:!0,dampingFactor:.25,userZoom:!0,userZoomSpeed:1,userRotate:!0,userRotateSpeed:1,autoRotate:!1,autoRotateSpeed:2,minPolarAngle:0,maxPolarAngle:Math.PI,minDistance:0,maxDistance:1/0,enablePitch:!0},this.setOrbCtrCfg(t);var r=this.orbitControlConfig,i=new fo,n=1e-6,o=new Bo,a=new Bo,s=new Bo,h=0,u=0,l=1,c=[],p=0;this.addEventListener(be.MOUSE_DOWN,(function(t){if(r.enabled){if(c.push({x:t.clientX,y:t.clientY,id:t.identifier}),c.length>=2){var e=c[c.length-1],i=c[c.length-2];p=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}o.set(t.clientX,t.clientY)}}),this),this.addEventListener(be.MOUSE_MOVE,(function(t){var e;if(r.enabled&&c.length)if(1==c.length){if(!r.userRotate)return;if(!o.x&&!o.y)return;a.set(t.clientX,t.clientY),s.subVectors(a,o),m(2*Math.PI*s.x/1800*r.userRotateSpeed),r.enablePitch&&(void 0===(e=2*Math.PI*s.y/1800*r.userRotateSpeed)&&(e=f()),h-=e),o.copy(a)}else{if(!1===r.userZoom)return;var i=c[c.length-1],n=c[c.length-2];if(t.identifier==i.id)i.x=t.clientX,i.y=t.clientY;else{if(t.identifier!=n.id)return;n.x=t.clientX,n.y=t.clientY}var u=Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2));u-p>0?g(Math.pow(.95,r.userZoomSpeed/3)):y(Math.pow(.95,r.userZoomSpeed/3)),p=u}}),this);var d=function(t){c.length=0};this.addEventListener(be.MOUSE_UP,d,this),this.addEventListener(be.MOUSE_OUT,d,this),this.addEventListener(be.ENTER_FRAME,(function(){!function(){if(!(Math.abs(u)<1e-4&&Math.abs(h)<1e-4&&Math.abs(l-1)<1e-4)||r.autoRotate){var t=e.camera.position,o=t.clone().sub(i),a=Math.atan2(o.x,o.z),s=Math.atan2(Math.sqrt(o.x*o.x+o.z*o.z),o.y);r.autoRotate&&m(),a+=u,s+=h,s=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,s)),s=Math.max(n,Math.min(Math.PI-n,s));var c=o.length()*l;c=Math.max(r.minDistance,Math.min(r.maxDistance,c)),o.x=c*Math.sin(s)*Math.sin(a),o.y=c*Math.cos(s),o.z=c*Math.sin(s)*Math.cos(a),t.copy(i).add(o),e.camera.lookAt(i.x,i.y,i.z),r.enableDamping?(u*=1-r.dampingFactor,h*=1-r.dampingFactor):(u=0,h=0),l=1}}()}),this),document&&document.addEventListener("mousewheel",(function(t){if(r.enabled&&r.userZoom){var e=0;t.wheelDelta?e=t.wheelDelta:t.detail&&(e=-t.detail),e>0?g():y()}}),!1)}function f(){return 2*Math.PI/60/60*r.autoRotateSpeed}function v(){return Math.pow(.95,r.userZoomSpeed)}function m(t){void 0===t&&(t=f()),u-=t}function y(t){void 0===t&&(t=v()),l/=t}function g(t){void 0===t&&(t=v()),l*=t}},e}(bo),Wo=function(t){function e(e,r,i,n,o,a,s){void 0===e&&(e=1),void 0===r&&(r=8),void 0===i&&(i=6),void 0===n&&(n=0),void 0===o&&(o=2*Math.PI),void 0===a&&(a=0),void 0===s&&(s=Math.PI);var h=this;r=Math.max(3,Math.floor(r)),i=Math.max(2,Math.floor(i));var u,l,c=a+s,p=0,d=[],f=new fo,v=new fo,m=[],y=[],g=[],x=[];for(l=0;l<=i;l++){var _=[],b=l/i;for(u=0;u<=r;u++){var T=u/r;f.x=-e*Math.cos(n+T*o)*Math.sin(a+b*s),f.y=e*Math.cos(a+b*s),f.z=e*Math.sin(n+T*o)*Math.sin(a+b*s),y.push(f.x,f.y,f.z),v.set(f.x,f.y,f.z).normalize(),g.push(v.x,v.y,v.z),x.push(T,b),_.push(p++)}d.push(_)}for(l=0;l<i;l++)for(u=0;u<r;u++){var w=d[l][u+1],M=d[l][u],S=d[l+1][u],E=d[l+1][u+1];(0!==l||a>0)&&m.push(w,M,E),(l!==i-1||c<Math.PI)&&m.push(M,S,E)}return(h=t.call(this,y,m,g,null,x)||this).boundingSphere=new So(new fo,e),h}return S(e,t),e}(Fo),Ho=function(t){function e(e,r,i,n,o,a){void 0===e&&(e=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===o&&(o=1),void 0===a&&(a=1);var s=this;n=Math.floor(n)||1,o=Math.floor(o)||1,a=Math.floor(a)||1;var h=[],u=[],l=[],c=[],p=0;function d(t,e,r,i,n,o,a,s,d,f,v){var m,y,g=o/d,x=a/f,_=o/2,b=a/2,T=s/2,w=d+1,M=f+1,S=0,E=new fo;for(y=0;y<M;y++){var C=y*x-b;for(m=0;m<w;m++){var A=m*g-_;E[t]=A*i,E[e]=C*n,E[r]=T,u.push(E.x,E.y,E.z),E[t]=0,E[e]=0,E[r]=s>0?1:-1,l.push(E.x,E.y,E.z),c.push(m/d),c.push(y/f),S+=1}}for(y=0;y<f;y++)for(m=0;m<d;m++){var P=p+m+w*y,O=p+m+w*(y+1),R=p+(m+1)+w*(y+1),I=p+(m+1)+w*y;h.push(P,O,I),h.push(O,R,I)}p+=S}return d("z","y","x",-1,-1,i,r,e,a,o),d("z","y","x",1,-1,i,r,-e,a,o),d("x","z","y",1,1,e,i,r,n,a),d("x","z","y",1,-1,e,i,-r,n,a),d("x","y","z",1,-1,e,r,i,n,o),d("x","y","z",-1,-1,e,r,-i,n,o),(s=t.call(this,u,h,l,null,c)||this).boundingBox=new Mo(new fo(-e/2,-r/2,-i/2),new fo(e/2,r/2,i/2)),s.boundingSphere=new So(new fo,Math.sqrt(e*e+r*r+i*i)),s}return S(e,t),e}(Fo),Yo=function(t){function e(e,r,i,n){void 0===e&&(e=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===n&&(n=1);var o,a,s=e/2,h=r/2,u=Math.floor(i),l=Math.floor(n),c=u+1,p=l+1,d=e/u,f=r/l,v=[],m=[],y=[],g=[];for(a=0;a<p;a++){var x=a*f-h;for(o=0;o<c;o++){var _=o*d-s;m.push(_,-x,0),y.push(0,0,1),g.push(o/u),g.push(a/l)}}for(a=0;a<l;a++)for(o=0;o<u;o++){var b=o+c*a,T=o+c*(a+1),w=o+1+c*(a+1),M=o+1+c*a;v.push(b,T,M),v.push(T,w,M)}return t.call(this,m,v,y,null,g)||this}return S(e,t),e}(Fo),Go=function(t){function e(e,r,i,n){void 0===e&&(e=1),void 0===r&&(r=8),void 0===i&&(i=0),void 0===n&&(n=2*Math.PI);r=Math.max(3,r);var o,a,s=[],h=[],u=[],l=[],c=new fo,p=new Bo;for(h.push(0,0,0),u.push(0,0,1),l.push(.5,.5),a=0,o=3;a<=r;a++,o+=3){var d=i+a/r*n;c.x=e*Math.cos(d),c.y=e*Math.sin(d),h.push(c.x,c.y,c.z),u.push(0,0,1),p.x=(h[o]/e+1)/2,p.y=1-(h[o+1]/e+1)/2,l.push(p.x,p.y)}for(o=1;o<=r;o++)s.push(o,o+1,0);return t.call(this,h,s,u,null,l)||this}return S(e,t),e}(Fo),qo=function(t){function e(e,r,i,n,o,a,s,h){void 0===e&&(e=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===n&&(n=8),void 0===o&&(o=1),void 0===a&&(a=!1),void 0===s&&(s=0),void 0===h&&(h=2*Math.PI);n=Math.floor(n)||8,o=Math.floor(o)||1;var u=[],l=[],c=[],p=[],d=0,f=[],v=i/2;function m(t){var i,o,a,f=new Bo,m=new fo,y=!0===t?e:r,g=!0===t?1:-1;for(o=d,i=1;i<=n;i++)l.push(0,v*g,0),c.push(0,g,0),p.push(.5,.5),d++;for(a=d,i=0;i<=n;i++){var x=i/n*h+s,_=Math.cos(x),b=Math.sin(x);m.x=y*b,m.y=v*g,m.z=y*_,l.push(m.x,m.y,m.z),c.push(0,g,0),f.x=.5*_+.5,f.y=.5*b*g+.5,p.push(f.x,f.y),d++}for(i=0;i<n;i++){var T=o+i,w=a+i;!0===t?u.push(w,w+1,T):u.push(w+1,w,T)}}return function(){var t,a,m=new fo,y=new fo,g=(r-e)/i;for(a=0;a<=o;a++){var x=[],_=a/o,b=_*(r-e)+e;for(t=0;t<=n;t++){var T=t/n,w=T*h+s,M=Math.sin(w),S=Math.cos(w);y.x=b*M,y.y=-_*i+v,y.z=b*S,l.push(y.x,y.y,y.z),m.set(M,g,S).normalize(),c.push(m.x,m.y,m.z),p.push(T,_),x.push(d++)}f.push(x)}for(t=0;t<n;t++)for(a=0;a<o;a++){var E=f[a][t],C=f[a+1][t],A=f[a+1][t+1],P=f[a][t+1];u.push(E,C,P),u.push(C,A,P)}}(),a||(e>0&&m(!0),r>0&&m(!1)),t.call(this,l,u,c,null,p)||this}return S(e,t),e}(Fo),Zo=function(t){function e(e,r,i,n,o,a){void 0===e&&(e=.5),void 0===r&&(r=1),void 0===i&&(i=8),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=2*Math.PI);i=Math.max(3,i);var s,h,u,l=[],c=[],p=[],d=[],f=e,v=(r-e)/(n=Math.max(1,n)),m=new fo,y=new Bo;for(h=0;h<=n;h++){for(u=0;u<=i;u++)s=o+u/i*a,m.x=f*Math.cos(s),m.y=f*Math.sin(s),c.push(m.x,m.y,m.z),p.push(0,0,1),y.x=(m.x/r+1)/2,y.y=1-(m.y/r+1)/2,d.push(y.x,y.y);f+=v}for(h=0;h<n;h++){var g=h*(i+1);for(u=0;u<i;u++){var x=s=u+g,_=s+i+1,b=s+i+2,T=s+1;l.push(x,_,T),l.push(_,b,T)}}return t.call(this,c,l,p,null,d)||this}return S(e,t),e}(Fo),Ko=function(t){function e(e,r,i,n,o){void 0===e&&(e=1),void 0===r&&(r=.4),void 0===i&&(i=8),void 0===n&&(n=6),void 0===o&&(o=2*Math.PI);i=Math.floor(i),n=Math.floor(n);var a,s,h=[],u=[],l=[],c=[],p=new fo,d=new fo,f=new fo;for(a=0;a<=i;a++)for(s=0;s<=n;s++){var v=s/n*o,m=a/i*Math.PI*2;d.x=(e+r*Math.cos(m))*Math.cos(v),d.y=(e+r*Math.cos(m))*Math.sin(v),d.z=r*Math.sin(m),u.push(d.x,d.y,d.z),p.x=e*Math.cos(v),p.y=e*Math.sin(v),f.subVectors(d,p).normalize(),l.push(f.x,f.y,f.z),c.push(s/n),c.push(1-a/i)}for(a=1;a<=i;a++)for(s=1;s<=n;s++){var y=(n+1)*a+s-1,g=(n+1)*(a-1)+s-1,x=(n+1)*(a-1)+s,_=(n+1)*a+s;h.push(y,g,_),h.push(g,x,_)}return t.call(this,u,h,l,null,c)||this}return S(e,t),e}(Fo),Qo=function(t){function e(e){var r=t.call(this,e)||this;return r._instanceType="LightMaterial",r._lightAffect=!0,r}return S(e,t),e.prototype.clone=function(){return(new e).copy(this)},e}(To),Jo="attribute vec3 aPosition;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uModelMatrix;\nvoid main() {\n    gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4( aPosition, 1.0 );\n}",$o="void main() {\n    gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",ta=function(t){function e(e,r,i){void 0===e&&(e=Jo),void 0===r&&(r=$o),void 0===i&&(i={});var n=t.call(this)||this;return n.vertexShader=e,n.fragmentShader=r,n.uniforms=i,n.wireframe=!1,n.side=go.FrontSide,n.shaders={},n.vertexShader=e||Jo,n.fragmentShader=r||$o,n._instanceType="ShaderMaterial",n}return S(e,t),Object.defineProperty(e.prototype,"isShaderMaterial",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.getShader=function(t){var e=t.CONTEXT_UID;return this.shaders[e]||(this.shaders[e]=new Ze(t.gl,this.vertexShader,this.fragmentShader),this.shaders[e]._glShaderKey="customShaderid"+e+"instanceId"+this.instanceId),this.shaders[e]},e.prototype.destroy=function(){for(var t in this.shaders)this.shaders[t].destroy(),delete this.shaders[t];this.shaders=null,this.vertexShader=null,this.fragmentShader=null},e}(R);!function(t){t.float="f",t.texture="t",t.color="c",t.vector2="v2",t.vector3="v3",t.vector4="v4",t.matrix4="m4",t.matrix3="m3",t.any="any"}(Vo||(Vo={}));var ea=function(t){function e(){var e=t.call(this,"precision mediump float;\nattribute vec3 aPosition;\nattribute vec2 aTextureCoord;\nvarying vec2 vTextureCoord;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uModelMatrix;\n\nuniform vec2 center;\n\nuniform float rotation;\n\nuniform mat3 uvTransform;\n\nvoid main() {\n    vTextureCoord = ( uvTransform * vec3( aTextureCoord, 1 ) ).xy;\n    vec4 mvPosition = uViewMatrix * uModelMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n    vec2 scale;\n\tscale.x = length( vec3( uModelMatrix[ 0 ].x, uModelMatrix[ 0 ].y, uModelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( uModelMatrix[ 1 ].x, uModelMatrix[ 1 ].y, uModelMatrix[ 1 ].z ) );\n    \n    #ifndef USE_SIZEATTENUATION\n        bool isPerspective = ( uProjectionMatrix[ 2 ][ 3 ] == - 1.0 );\n        if ( isPerspective ) scale *= - mvPosition.z;\n    #endif\n\n    vec2 alignedPosition = ( aPosition.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = uProjectionMatrix * mvPosition;\n}","precision mediump float;\nuniform vec3 color;\nuniform float alpha;\nuniform sampler2D map;\nuniform vec4 uFrameUvs;\nvarying vec2 vTextureCoord;\nvoid main() {\n    vec4 mapColor = texture2D( map, vTextureCoord );\n    vec2 s = step(vec2(uFrameUvs.x,uFrameUvs.y),vTextureCoord) - step(vec2(uFrameUvs.z,uFrameUvs.w),vTextureCoord);\n    mapColor *= abs(s.x * s.y);\n    gl_FragColor = vec4( color*alpha, alpha )*mapColor;\n}",{center:{type:Vo.vector2,value:new Bo(.5,.5)},rotation:{type:Vo.float,value:0},color:{type:Vo.color,value:16777215},alpha:{type:Vo.float,value:1},map:{type:Vo.texture,value:me.WHITE},uvTransform:{type:Vo.matrix3,value:new k},uFrameUvs:{type:Vo.any,value:[0,0,1,1]}})||this;return e.sizeAttenuation=!0,e._instanceType="Sprite3dMaterial",e}return S(e,t),e.prototype.getShader=function(t){var e=""+t.CONTEXT_UID+this.sizeAttenuation;return this.shaders[e]||(this.shaders[e]=new Ze(t.gl,(this.sizeAttenuation?"#define USE_SIZEATTENUATION\n":"")+this.vertexShader,this.fragmentShader),this.shaders[e]._glShaderKey="customShaderid"+e+"instanceId"+this.instanceId+"sizeAttenuation"+this.sizeAttenuation),this.shaders[e]},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center.value},set:function(t){this.uniforms.center.value=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.uniforms.rotation.value*T},set:function(t){this.uniforms.rotation.value=t*w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha.value},set:function(t){this.uniforms.alpha.value=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t,t.transform||(t.transform=new Er(t)),t.transform.update(),this.uniforms.uvTransform.value.copy(t.transform.mapCoord);var e=t._uvs,r=e.x0,i=e.y0,n=e.x2,o=e.y2;this.uniforms.uFrameUvs.value=[r,i,n,o]},enumerable:!1,configurable:!0}),e}(ta),ra=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i._instanceType="AmbientLight",i}return S(e,t),e}(Lo),ia=function(t){function e(e,r,i,n,o,a){void 0===e&&(e=-1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===n&&(n=-1),void 0===o&&(o=.1),void 0===a&&(a=2e3);var s=t.call(this)||this;return s.left=e,s.right=r,s.top=i,s.bottom=n,s.near=o,s.far=a,s._instanceType="OrthographicCamera",s.zoom=1,s.updateProjectionMatrix(),s}return S(e,t),e.prototype.set=function(t,e,r,i,n,o){void 0===n&&(n=.1),void 0===o&&(o=2e3),this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=n,this.far=o,this.updateProjectionMatrix()},e.prototype.copy=function(e,r){return void 0===r&&(r=!0),t.prototype.copy.call(this,e,r),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.updateProjectionMatrix(),this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-t,o=r+t,a=i+e,s=i-e;this.projectionMatrix.setOrtho(n,o,a,s,this.near,this.far),this.projectionMatrixInverse.setInverseOf(this.projectionMatrix)},e}(No),na=function(t){function e(){return t.call(this,new ia(-5,5,5,-5,.5,500))||this}return S(e,t),e.prototype.clone=function(){return(new e).copy(this)},e}(function(t){function e(e){var r=t.call(this)||this;return r.camera=e,r.bias=0,r.radius=1,r.mapSize=new Bo(512,512),r.matrix=new vo,r._instanceType="LightShadow",r}return S(e,t),e.prototype.copy=function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.destroy=function(){this.mapSize=null,this.camera.destroy(),this.camera=null},e}(R)),oa=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i._instanceType="DirectionalLight",i.position.copy(bo.DefaultUp),i.updateLocalMatrix(),i.target=new bo,i.shadow=new na,i}return S(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.target=e.target.clone(),this},e}(Lo),aa=function(t){function e(e,r,i,n){void 0===i&&(i=0),void 0===n&&(n=1);var o=t.call(this,e,r)||this;return o.distance=i,o.decay=n,o._instanceType="PointLight",o}return S(e,t),Object.defineProperty(e.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)},enumerable:!1,configurable:!0}),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this},e}(Lo),sa=function(t){function e(e){void 0===e&&(e=1);var r=new Fo([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],null,null,[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),i=new To({wireframe:!0,useVertexColor:!0});return t.call(this,r,i)||this}return S(e,t),e}(Oo),ha=function(t){function e(e,r,i,n){void 0===e&&(e=10),void 0===r&&(r=10),void 0===i&&(i=4473924),void 0===n&&(n=8947848);for(var o=r/2,a=e/r,s=e/2,h=Rt(i),u=Rt(n),l=[],c=[],p=0,d=-s;p<=r;p++,d+=a){l.push(-s,0,d,s,0,d),l.push(d,0,-s,d,0,s);for(var f=p===o?h:u,v=4;v--;)c.push(f[0],f[1],f[2])}var m=new Fo(l,null,null,c),y=new To({wireframe:!0,useVertexColor:!0});return t.call(this,m,y)||this}return S(e,t),e}(Oo),ua=function(t){function e(e,r){void 0===r&&(r=16776960);var i=this;return(i=t.call(this,new Fo([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),new To({wireframe:!0,color:r}))||this).box=e,i.mouseChildren=i.mouseEnable=!1,i}return S(e,t),e.prototype.updateWorldMatrix=function(e,r){void 0===e&&(e=!1),void 0===r&&(r=!0);var i=this.box;i.isEmpty()||(i.getCenter(this.position),i.getSize(this.scale),this.scale.multiplyScalar(.5),t.prototype.updateWorldMatrix.call(this,e,r))},e}(Oo);function la(t,e,r,i,n,o,a,s){for(var h,u={glUid:t.CONTEXT_UID,precision:pa(t),pointLightsNum:r.pointLights.length,dirLightsNum:r.directionalLights.length,morphTargets:i.morphTargetInfluences&&e.morphTargets,morphNormals:i.morphTargetInfluences&&e.morphTargets&&e.morphNormals,skinning:e.skinning&&n>0,maxBones:n||0,useVertexTexture:o,lightAffect:e._lightAffect,useMap:!!e.map&&e.map.valid,useEnvMap:!!e.envMap&&e.envMap.valid,combine:e.combine,useVertexColor:!!e.useVertexColor,useFog:a&&e.useFog,useShadow:s&&i.receiveShadow&&e._lightAffect,shadowType:s&&s.shadowType},l=function(t){for(var e=[],r=0;r<ma.length;r++)e.push(t[ma[r]]);return e.join()}(u),c=0;c<va.length;c++)if(va[c]._glShaderKey===l){++(h=va[c]).usedTimes;break}return h||((h=new da(t.gl,u))._glShaderKey=l,va.push(h)),h}var ca={};function pa(t){var e;return ca[t.CONTEXT_UID]||(ca[t.CONTEXT_UID]=(e=t.gl).getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0?"highp":e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"),ca[t.CONTEXT_UID]}var da=function(t){function e(e,r){var i=this,n=["precision "+r.precision+" float;","precision "+r.precision+" int;",r.lightAffect?"#define USE_LIGHT":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals?"#define USE_MORPHNORMALS":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"","#define MAX_BONES "+r.maxBones,r.useMap?"#define USE_MAP":"",r.useEnvMap?"#define USE_ENVMAP":"",r.useVertexColor?"#define USE_VERTEXCOLOR":"",r.useFog?"#define USE_FOG":"",r.useShadow?"#define USE_SHADOW":""].filter((function(t){return""!==t})).join("\n");n&&(n+="\n");var o=["precision "+r.precision+" float;","precision "+r.precision+" int;",r.lightAffect?"#define USE_LIGHT":"",r.useMap?"#define USE_MAP":"",r.useEnvMap?"#define USE_ENVMAP":"",r.useEnvMap?"#define "+r.combine:"",r.useVertexColor?"#define USE_VERTEXCOLOR":"",r.useFog?"#define USE_FOG":"",r.useShadow?"#define USE_SHADOW":"",r.useShadow?"#define "+r.shadowType:""].filter((function(t){return""!==t})).join("\n");o&&(o+="\n");var a=ga.replace(new RegExp(fa.POINT_LIGHTS_NUM,"gm"),r.pointLightsNum+"").replace(new RegExp(fa.DIR_LIGHTS_NUM,"gm"),r.dirLightsNum+"");return(i=t.call(this,e,n+ya,o+a)||this).uniformData=function(t,e){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),n=0;n<i;n++){var o=t.getActiveUniform(e,n),a=0==o.name.indexOf("morphTargetInfluences")||0==o.name.indexOf("uBoneMatrices")?o.name.replace(/\[.*?\]/,""):o.name,s=Ne(t,o.type);r[a]={type:s,size:o.size,location:t.getUniformLocation(e,a),value:Ue(s,o.size)}}return r}(e,i.program),i.uniforms=Xe(e,i.uniformData),i.usedTimes=0,i}return S(e,t),e}(Ze);var fa,va=[],ma=["glUid","precision","pointLightsNum","dirLightsNum","morphTargets","morphNormals","skinning","maxBones","useVertexTexture","lightAffect","useMap","useEnvMap","combine","useVertexColor","useFog","useShadow","shadowType"];!function(t){t.POINT_LIGHTS_NUM="POINT_LIGHTS_NUM",t.DIR_LIGHTS_NUM="DIR_LIGHTS_NUM"}(fa||(fa={}));var ya=["attribute vec3 aPosition;","uniform mat4 uViewMatrix;","uniform mat4 uProjectionMatrix;","uniform mat4 uModelMatrix;","#ifdef USE_VERTEXCOLOR","   attribute vec3 aColor;","   varying vec3 vColor;","#endif","#ifdef USE_MAP","   attribute vec2 aTextureCoord;","   varying vec2 vTextureCoord;","   uniform mat3 uUvTransform;","#endif","#if defined( USE_ENVMAP ) || defined( USE_LIGHT )","   attribute vec3 aNormal;","   uniform mat4 uNormalMatrix;","   varying vec3 vNormal;","   varying vec3 vWorldPosition;","   varying vec3 vViewPosition;","#endif","#ifdef USE_ENVMAP","   varying vec3 vReflect;","   uniform vec3 uCameraPosition;","#endif","#ifdef USE_SKINNING","   uniform mat4 uBindMatrix;","   uniform mat4 uBindMatrixInverse;","   #ifdef BONE_TEXTURE","      uniform sampler2D uBoneTexture;","      uniform int uBoneTextureSize;","      mat4 getBoneMatrix( const in float i ) {","         float j = i * 4.0;","         float x = mod( j, float( uBoneTextureSize ) );","         float y = floor( j / float( uBoneTextureSize ) );","         float dx = 1.0 / float( uBoneTextureSize );","         float dy = 1.0 / float( uBoneTextureSize );","         y = dy * ( y + 0.5 );","         vec4 v1 = texture2D( uBoneTexture, vec2( dx * ( x + 0.5 ), y ) );","         vec4 v2 = texture2D( uBoneTexture, vec2( dx * ( x + 1.5 ), y ) );","         vec4 v3 = texture2D( uBoneTexture, vec2( dx * ( x + 2.5 ), y ) );","         vec4 v4 = texture2D( uBoneTexture, vec2( dx * ( x + 3.5 ), y ) );","         mat4 bone = mat4( v1, v2, v3, v4 );","         return bone;","      }","   #else","      uniform mat4 uBoneMatrices[ MAX_BONES ];","      mat4 getBoneMatrix( const in float i ) {","         mat4 bone = uBoneMatrices[ int(i) ];","         return bone;","      }","   #endif","\tattribute vec4 aSkinIndex;","\tattribute vec4 aSkinWeight;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","       uniform float morphTargetInfluences[ 4 ];","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","       uniform float morphTargetInfluences[ 8 ];","\t#endif","#endif","#ifdef USE_FOG","    varying float vFogDepth;","#endif","#ifdef USE_SHADOW","      uniform mat4 uDirectionalShadowMatrix;","      varying vec4 vDirectionalShadowCoord;","#endif","void main() {","   vec3 transformed = vec3( aPosition );","   #ifdef USE_MORPHTARGETS","      transformed += ( morphTarget0 - aPosition ) * morphTargetInfluences[ 0 ];","      transformed += ( morphTarget1 - aPosition ) * morphTargetInfluences[ 1 ];","      transformed += ( morphTarget2 - aPosition ) * morphTargetInfluences[ 2 ];","      transformed += ( morphTarget3 - aPosition ) * morphTargetInfluences[ 3 ];","      #ifndef USE_MORPHNORMALS","         transformed += ( morphTarget4 - aPosition ) * morphTargetInfluences[ 4 ];","         transformed += ( morphTarget5 - aPosition ) * morphTargetInfluences[ 5 ];","         transformed += ( morphTarget6 - aPosition ) * morphTargetInfluences[ 6 ];","         transformed += ( morphTarget7 - aPosition ) * morphTargetInfluences[ 7 ];","      #endif","   #endif","   #ifdef USE_SKINNING","      mat4 boneMatX = getBoneMatrix( aSkinIndex.x );","      mat4 boneMatY = getBoneMatrix( aSkinIndex.y );","      mat4 boneMatZ = getBoneMatrix( aSkinIndex.z );","      mat4 boneMatW = getBoneMatrix( aSkinIndex.w );","      vec4 skinVertex = uBindMatrix * vec4( transformed, 1.0 );","      vec4 skinned = vec4( 0.0 );","      skinned += boneMatX * skinVertex * aSkinWeight.x;","      skinned += boneMatY * skinVertex * aSkinWeight.y;","      skinned += boneMatZ * skinVertex * aSkinWeight.z;","      skinned += boneMatW * skinVertex * aSkinWeight.w;","      transformed = ( uBindMatrixInverse * skinned ).xyz;","   #endif","   vec4 mvPosition = uViewMatrix * uModelMatrix * vec4( transformed, 1.0 );","   gl_Position = uProjectionMatrix * mvPosition;","   #ifdef USE_VERTEXCOLOR","      vColor = aColor;","   #endif","   #ifdef USE_MAP","      vTextureCoord = ( uUvTransform * vec3( aTextureCoord, 1 ) ).xy;","   #endif","   #if defined( USE_ENVMAP ) || defined( USE_LIGHT )","      vec3 objectNormal = vec3( aNormal );","      #ifdef USE_MORPHNORMALS","         objectNormal += ( morphNormal0 - aNormal ) * morphTargetInfluences[ 0 ];","         objectNormal += ( morphNormal1 - aNormal ) * morphTargetInfluences[ 1 ];","         objectNormal += ( morphNormal2 - aNormal ) * morphTargetInfluences[ 2 ];","         objectNormal += ( morphNormal3 - aNormal ) * morphTargetInfluences[ 3 ];","      #endif","      #ifdef USE_SKINNING","         mat4 skinMatrix = mat4( 0.0 );","         skinMatrix += aSkinWeight.x * boneMatX;","         skinMatrix += aSkinWeight.y * boneMatY;","         skinMatrix += aSkinWeight.z * boneMatZ;","         skinMatrix += aSkinWeight.w * boneMatW;","         skinMatrix  = uBindMatrixInverse * skinMatrix * uBindMatrix;","         objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;","      #endif","      vViewPosition = -mvPosition.xyz;","      vWorldPosition = vec3(uModelMatrix * vec4(transformed,1.0));","      vec3 vTransformedNormal = vec3(uNormalMatrix * vec4(objectNormal,1.0));","      vNormal = normalize(vTransformedNormal);","      #ifdef USE_ENVMAP","         vec3 cameraToVertex = normalize( vWorldPosition.xyz - uCameraPosition );","         vec3 worldNormal = normalize( ( vec4( vTransformedNormal, 0.0 ) * uViewMatrix ).xyz );","         vReflect = reflect(cameraToVertex, worldNormal);","      #endif","   #endif","   #ifdef USE_FOG","      vFogDepth = -mvPosition.z;","   #endif","   #ifdef USE_SHADOW","         vDirectionalShadowCoord = uDirectionalShadowMatrix * (uModelMatrix * vec4(transformed,1.0));","   #endif","}"].join("\n"),ga=["uniform vec3 uMatColor;","uniform float uMatAlpha;","#ifdef USE_MAP","   uniform sampler2D uMap;","   uniform vec4 uFrameUvs;","   varying vec2 vTextureCoord;","#endif","#ifdef USE_VERTEXCOLOR","   varying vec3 vColor;","#endif","#if defined( USE_ENVMAP ) || defined( USE_LIGHT )","   varying vec3 vNormal;","   varying vec3 vWorldPosition;","   varying vec3 vViewPosition;","#endif","#ifdef USE_ENVMAP","   uniform sampler2D uEnvMap;","   uniform float uReflectivity;","   uniform mat4 uViewMatrix;","   varying vec3 vReflect;","#endif","#ifdef USE_LIGHT","   float calcSpecular(vec3 lightDir, vec3 viewDir, vec3 normal) {","      vec3 halfwayDir = normalize(lightDir + viewDir);","      float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);","      return spec;","   }","   #if "+fa.POINT_LIGHTS_NUM+" > 0","      #define saturate(a) clamp( a, 0.0, 1.0 )","      float calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {","         if ( decayExponent > 0.0 ) {","            return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );","         }","         return 1.0;","      }","      struct PointLight {","         vec3 color;","         vec3 position;","         float distance;","         float decay;","      };","      uniform PointLight pointLights["+fa.POINT_LIGHTS_NUM+"];","   #endif","   #if "+fa.DIR_LIGHTS_NUM+" > 0","      struct DirectionalLight {","         vec3 direction;","         vec3 color;","         int shadow;","         float shadowBias;","\t      float shadowRadius;","\t      vec2 shadowMapSize;","      };","      uniform DirectionalLight directionalLights["+fa.DIR_LIGHTS_NUM+"];","   #endif","   uniform vec3 uAmbientLightColor;","#endif","#ifdef USE_FOG","   uniform vec3 uFogColor;","   varying float vFogDepth;","   uniform float uFogNear;","   uniform float uFogFar;","#endif","#ifdef USE_SHADOW","      uniform sampler2D uDirectionalShadowMap;","      varying vec4 vDirectionalShadowCoord;","      const float UnpackDownscale = 255. / 256.;","      const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );","      const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );","      float unpackRGBAToDepth( const in vec4 v ) {","          return dot( v, UnpackFactors );","      }","   float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {","      return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );","   }","   float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {","      float shadow = 1.0;","      shadowCoord.xyz /= shadowCoord.w;","      shadowCoord.z += shadowBias;","      bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );","      bool inFrustum = all( inFrustumVec );","      bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );","      bool frustumTest = all( frustumTestVec );","      if ( frustumTest ) {","         #if defined( SHADOWMAP_TYPE_PCF )","            vec2 texelSize = vec2( 1.0 ) / shadowMapSize;","            float dx0 = - texelSize.x * shadowRadius;","\t         float dy0 = - texelSize.y * shadowRadius;","\t         float dx1 = + texelSize.x * shadowRadius;","\t         float dy1 = + texelSize.y * shadowRadius;","            shadow =(","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +","               texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )","            ) * ( 1.0 / 9.0 );","         #elif defined( SHADOWMAP_TYPE_PCF_SOFT )","         #else","            shadow = texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);","         #endif","      }","      return shadow;","   }","#endif","void main() {","   vec4 color = vec4( uMatColor, uMatAlpha );","   color.rgb *= color.a;","   #ifdef USE_MAP","      vec4 mapColor = texture2D( uMap, vTextureCoord );","      color *= mapColor;","      vec2 s = step(vec2(uFrameUvs.x,uFrameUvs.y),vTextureCoord) - step(vec2(uFrameUvs.z,uFrameUvs.w),vTextureCoord);","      color *= abs(s.x * s.y);","   #endif","   #ifdef USE_VERTEXCOLOR","      color *= vec4(vColor,1.0);","   #endif","   vec3 colorRgb = color.rgb;","   #ifdef USE_LIGHT","      vec3 totalDiffuseLight = vec3( 0.0 );","      vec3 totalSpecularLight = vec3( 0.0 );","      vec3 viewDir = normalize(vViewPosition);","      vec3 lightDirection;","      float diffuse;","      float specular;","      #if "+fa.POINT_LIGHTS_NUM+" > 0","         float attenuation;","         for ( int i = 0; i < "+fa.POINT_LIGHTS_NUM+"; i ++ ) {","            lightDirection = pointLights[i].position + vViewPosition;","            attenuation = calcLightAttenuation( length( lightDirection ), pointLights[ i ].distance, pointLights[ i ].decay );","            lightDirection = normalize(lightDirection);","            diffuse = max( dot( vNormal, lightDirection ), 0.0 );","            totalDiffuseLight += pointLights[i].color * (diffuse * attenuation);","            specular = calcSpecular(lightDirection,viewDir,vNormal);","            totalSpecularLight += pointLights[i].color *(specular * attenuation);","         }","      #endif","      #if "+fa.DIR_LIGHTS_NUM+" > 0","         DirectionalLight directionalLight;","         for( int i = 0; i < "+fa.DIR_LIGHTS_NUM+"; i++ ) {","            directionalLight = directionalLights[ i ];","            vec3 dColor = directionalLight.color;","            #ifdef USE_SHADOW","               dColor *= all( bvec2( directionalLight.shadow, 1.0 ) ) ? getShadow( uDirectionalShadowMap, directionalLight.shadowMapSize, directionalLight.shadowBias,directionalLight.shadowRadius, vDirectionalShadowCoord ) : 1.0;","            #endif","            lightDirection = directionalLight.direction;","            diffuse = max( dot( vNormal, lightDirection ), 0.0 );","            totalDiffuseLight += dColor * diffuse;","            specular = calcSpecular(lightDirection,viewDir,vNormal);","            totalSpecularLight += dColor * specular;","         }","      #endif","      colorRgb = (totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * colorRgb;","   #endif","   #ifdef USE_ENVMAP","      vec2 envUv;","      vec3 reflectVec = normalize( vReflect );","      envUv.y =0.5 - asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * 0.31830988618;","      envUv.x = atan( reflectVec.z, reflectVec.x ) * 0.15915494 + 0.5;","\t   vec4 envColor = texture2D( uEnvMap, envUv );","      #ifdef ENVMAP_BLENDING_MULTIPLY","         colorRgb = mix(colorRgb, colorRgb * envColor.xyz,  uReflectivity);","      #elif defined( ENVMAP_BLENDING_MIX )","         colorRgb = mix( colorRgb, envColor.xyz,   uReflectivity );","      #elif defined( ENVMAP_BLENDING_ADD )","         colorRgb += envColor.xyz  * uReflectivity;","      #endif","   #endif","   gl_FragColor = vec4( colorRgb, color.a );","#ifdef USE_FOG","   float fogFactor = smoothstep( uFogNear, uFogFar, vFogDepth );","   gl_FragColor.rgb = mix( gl_FragColor.rgb, uFogColor*color.a, fogFactor );","#endif","}"].join("\n"),xa=function(t){function e(e){return t.call(this,e,"attribute vec3 aPosition;\nuniform mat4 uLightSpaceMatrix;\nuniform mat4 uModelMatrix;\nvoid main() {\n    gl_Position = uLightSpaceMatrix * uModelMatrix * vec4( aPosition, 1.0 );\n}","precision mediump float;\n    // uniform float uMatAlpha;\n    const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\n    vec4 packDepthToRGBA( const in float v ) {\n        vec4 r = vec4( fract( v * PackFactors ), v );\n        r.yzw -= r.xyz * (1. / 256.);\n        return r * (256. / 255.);\n    }\n    void main() {\n        // gl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), uMatAlpha );\n        gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n}")||this}return S(e,t),e}(Ze),_a=new fo,ba=new vo,Ta=function(t){function e(e){var r=t.call(this,e)||this;return r.meshes=[],r}return S(e,t),e.prototype.onContextChange=function(){var t=this.renderer.gl;this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),t.getExtension("OES_texture_float"),this.floatVertexTextures=!1},e.prototype.start=function(){this.renderer.state.setDepthTest(1)},e.prototype.stop=function(){this.flush(),this.renderer._activeRenderTarget.activate(),this.renderer.state.setState(this.renderer.state.defaultState)},e.prototype.render=function(t){if(t.geometry&&t.material){var e=t.material;t.geometry;for(var r=0;r<this.meshes.length;r++)if(this.meshes[r].material==e)return void this.meshes.splice(r,0,t);this.meshes.push(t)}},e.prototype.flush=function(){var t=function(t,e,r){var i=function(){if(!t||!t.directionalLights||!t.directionalLights.length)return null;for(var e=0,r=t.directionalLights;e<r.length;e++){var i=r[e];if(i.castShadow)return i}return null}();if(!i)return null;var n=[],o=[];if(e&&e.length)for(var a=0,s=e;a<s.length;a++){var h=s[a];h.castShadow&&h.material._lightAffect&&n.push(h),h.receiveShadow&&h.material._lightAffect&&o.push(h)}if(!n.length||!o.length)return null;var u=r.gl;Ma=Ma||new di(new pi(i.mapSize[0],i.mapSize[1])),r.bindRenderTexture(Ma,null),r.clear([1,1,1,1]),r.state.setBlend(!1);var l=Oa[r.CONTEXT_UID]||(Oa[r.CONTEXT_UID]=new xa(r.gl));r.bindShader(l,!1);var c=l.uniforms;return c.uLightSpaceMatrix=i.shadowMatrixDepth,r.state.setCullFace(1),r.state.setFrontFace(1),n.forEach((function(t){var e=t.geometry,i=t.material;c.uModelMatrix=t._worldMatrix.toArray();var n=Ra(e,r),o=n.vaos[r.CONTEXT_UID],a=l.attributes;o?(r.bindVao(o),wa(e)&&n.attrBuffer.upload(e._attrBuffer.vertices,0,!1)):(o=n.vaos[r.CONTEXT_UID]=r.createVao().addAttribute(n.attrBuffer,a.aPosition,u.FLOAT,!1,e._vertByteSize,0),e._indices&&o.addIndex(n.indexBuffer),r.bindVao(o),wa(e),n.attrBuffer.upload(e._attrBuffer.vertices,0,!1),e._indices&&n.indexBuffer.upload(e._indices,0,!1)),o.draw(i.isPointsMaterial?u.POINTS:i.wireframe?u.LINES:u.TRIANGLES)})),r.bindRenderTexture(null,null),r.state.setBlend(!0),{texture:Ma,lightSpaceMatrix:i.shadowMatrix,shadowType:null}}(this.lightsConfig,this.meshes,this.renderer);t&&(this.renderer.gl.viewport(this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height),t.shadowType=this.shadowType);for(var e=null,r=this.lightsConfig.pointLights.length,i=this.lightsConfig.directionalLights.length,n=this.renderer.gl,o=this.renderer.textureManager,a=0;a<this.meshes.length;a++){var s=this.meshes[a],h=s.material,u=s.geometry;if(h.isShaderMaterial){var l=h.getShader(this.renderer),c=l.uniforms,p=h.uniforms;for(var d in e!==l&&(e=l,this.renderer.bindShader(e,!1),c.uViewMatrix&&(c.uViewMatrix=this.camera.worldMatrixInverse.toArray()),c.uProjectionMatrix&&(c.uProjectionMatrix=this.camera.projectionMatrix.toArray())),c.uModelMatrix&&(c.uModelMatrix=s._worldMatrix.toArray()),p){var f=p[d],v=f.type,m=f.value;switch(v){case Vo.texture:c[d]=o.bindTexture(m,void 0,!1);break;case Vo.color:c[d]=Rt(m);break;case Vo.matrix3:c[d]=m.toArray(!0);break;case Vo.vector2:case Vo.vector3:case Vo.vector4:case Vo.matrix4:c[d]=m.toArray();break;default:c[d]=m}}}else{var y=this.getMaxBones(s),g=la(this.renderer,h,this.lightsConfig,s,y,this.floatVertexTextures,this.fog,t);c=g.uniforms;if(e!==g&&(e=g,this.renderer.bindShader(e,!1),c.uViewMatrix=this.camera.worldMatrixInverse.toArray(),c.uProjectionMatrix=this.camera.projectionMatrix.toArray(),h._lightAffect)){for(var x=0;x<r;x++){c[_="pointLights["+x+"]"].color=this.lightsConfig.pointLights[x].color,c[_].position=this.lightsConfig.pointLights[x].position,c[_].distance=this.lightsConfig.pointLights[x].distance,c[_].decay=this.lightsConfig.pointLights[x].decay}for(x=0;x<i;x++){var _="directionalLights["+x+"]",b=this.lightsConfig.directionalLights[x];c[_].color=b.color,c[_].direction=b.direction,c[_].shadow=+b.castShadow,c[_].shadowBias=b.bias,c[_].shadowRadius=b.radius,c[_].shadowMapSize=b.mapSize}c.uAmbientLightColor=this.lightsConfig.ambientLightColor,c.uDirectionalShadowMatrix&&(c.uDirectionalShadowMatrix=t.lightSpaceMatrix,c.uDirectionalShadowMap=o.bindTexture(t.texture,void 0,!1))}if(h.map&&h.map.valid){var T=h.map;c.uMap=o.bindTexture(T,void 0,!1),T.transform||(T.transform=new Er(T)),T.transform.update(),c.uUvTransform=T.transform.mapCoord.toArray(!0);var w=T._uvs,M=w.x0,S=w.y0,E=w.x2,C=w.y2;c.uFrameUvs=[M,S,E,C]}if(h.envMap&&h.envMap.valid&&(c.uEnvMap=o.bindTexture(h.envMap,void 0,!1),c.uReflectivity=h.reflectivity,c.uCameraPosition=_a.setFromMatrixPosition(this.camera._worldMatrix).toArray()),c.uMatColor=h.colorArr,c.uMatAlpha=h.alpha,h.useFog&&this.fog&&(c.uFogColor=this.fog.color,c.uFogNear=this.fog.near,c.uFogFar=this.fog.far),c.uModelMatrix=s._worldMatrix.toArray(),c.uNormalMatrix){var A=ba.multiplyMatrices(this.camera.worldMatrixInverse,s._worldMatrix).invert().transpose();c.uNormalMatrix=A.toArray()}if(h.skinning&&y>0){var P=s;c.uBindMatrix=P.bindMatrix.toArray(),c.uBindMatrixInverse=P.bindMatrixInverse.toArray();var O=P.skeleton;if(O){var R=O.bones;if(this.floatVertexTextures){if(!O.boneTexture){var I=Math.sqrt(4*R.length);I=function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}(I),I=Math.max(I,4);var D=new Float32Array(I*I*4);D.set(O.boneMatrices);var F=new fe({data:D,width:I,height:I});F.mipmap=!1,O.boneMatrices=D,O.boneTexture=F,O.boneTextureSize=I}var N=o.bindTexture(O.boneTexture,void 0,!1);c.uBoneTexture=N,c.uBoneTextureSize=O.boneTextureSize}else c.uBoneMatrices=P.skeleton.boneMatrices}}}var k,L=Ra(u,this.renderer),B=L.vaos[e._glShaderKey],z=e.attributes;if(B)s.morphTargetInfluences&&h.morphTargets&&(k=Aa(s.morphTargetInfluences,u,L,B,e,n)),this.renderer.bindVao(B,!!k),wa(u)&&L.attrBuffer.upload(u._attrBuffer.vertices,0,!1),k&&k.forEach((function(t){t.buffer.upload(t.data,0,!1)}));else B=L.vaos[e._glShaderKey]=this.renderer.createVao().addAttribute(L.attrBuffer,z.aPosition,n.FLOAT,!1,u._vertByteSize,0),z.aColor&&B.addAttribute(L.attrBuffer,z.aColor,n.FLOAT,!0,u._vertByteSize,12),z.aTextureCoord&&B.addAttribute(L.attrBuffer,z.aTextureCoord,n.FLOAT,!0,u._vertByteSize,24),z.aNormal&&B.addAttribute(L.attrBuffer,z.aNormal,n.FLOAT,!1,u._vertByteSize,32),u._indices&&B.addIndex(L.indexBuffer),z.aSkinWeight&&B.addAttribute(L.skinWeightBuffer,z.aSkinWeight,n.FLOAT,!1,0,0),z.aSkinIndex&&B.addAttribute(L.skinIndexBuffer,z.aSkinIndex,n.UNSIGNED_BYTE,!1,0,0),s.morphTargetInfluences&&h.morphTargets&&(k=Aa(s.morphTargetInfluences,u,L,B,e,n)),this.renderer.bindVao(B),wa(u),L.attrBuffer.upload(u._attrBuffer.vertices,0,!1),u._indices&&L.indexBuffer.upload(u._indices,0,!1),z.aSkinWeight&&L.skinWeightBuffer.upload(new Float32Array(u._skinWeight),0,!1),z.aSkinIndex&&L.skinIndexBuffer.upload(new Uint8Array(u._skinIndex),0,!1),k&&k.forEach((function(t){t.buffer.upload(t.data,0,!1)}));h.side==go.DoubleSide?this.renderer.state.setCullFace(0):(this.renderer.state.setCullFace(1),this.renderer.state.setFrontFace(h.side)),B.draw(h.isPointsMaterial?n.POINTS:h.wireframe?n.LINES:n.TRIANGLES)}this.meshes.length=0},e.prototype.getMaxBones=function(t){if("SkinnedMesh3D"!==t.instanceType)return 0;if(this.floatVertexTextures)return 1024;var e=t.skeleton.bones,r=Math.floor((this.maxVertexUniforms-20)/4),i=Math.min(r,e.length);return i<e.length?(console.warn("Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i},e}(we);function wa(t){var e=t._vertices.length/3*t._vertByteSize;if(t._attrBuffer){if(t._attrBuffer.vertices.byteLength!==e)t._attrBuffer.destroy(),t._attrBuffer=new Ce(e);else if(!t.attrBufferNeedUpdate)return!1}else t._attrBuffer=new Ce(e);for(var r=t._attrBuffer.float32View,i=0,n=0;n<t._vertices.length/3;n++)r[i++]=t._vertices[3*n],r[i++]=t._vertices[3*n+1],r[i++]=t._vertices[3*n+2],r[i++]=t._colors[3*n],r[i++]=t._colors[3*n+1],r[i++]=t._colors[3*n+2],r[i++]=t._uvs[2*n],r[i++]=t._uvs[2*n+1],r[i++]=t._normals[3*n],r[i++]=t._normals[3*n+1],r[i++]=t._normals[3*n+2];return t.attrBufferNeedUpdate=!1,!0}var Ma,Sa={},Ea={},Ca=new Float32Array(8);function Aa(t,e,r,i,n,o){var a=e._morphPositions,s=e._morphNormals,h=t.length,u=[],l=Sa[e.instanceId];if(!l){l=[];for(var c=0;c<h;c++)l[c]=[c,0];Sa[e.instanceId]=l}var p=Ea[e.instanceId];p||((p=[]).length=8,Ea[e.instanceId]=p);for(c=0;c<8;c++){(v=l[c])&&0!==v[1]&&(a&&i.removeAttribute("morphTarget"+c),s&&c<4&&i.removeAttribute("morphNormal"+c))}for(c=0;c<h;c++){(v=l[c])[0]=c,v[1]=t[c]}l.sort(Pa);var d=n.attributes,f=s?4:8;for(c=0;c<f;c++){var v;if(v=l[c]){var m=v[0],y=v[1];if(y){if(a&&a[m]){var g=r.morphTargetBuffers[m];g||(g=r.morphTargetBuffers[m]=Re.createVertexBuffer(o,null,o.STATIC_DRAW)),p[c]!==m&&(p[c]=m,u.push({buffer:g,data:new Float32Array(a[m])})),i.addAttribute(g,d["morphTarget"+c],o.FLOAT,!1,0,0,"morphTarget"+c)}if(s&&s[m]){var x=r.morphNormalBuffers[m];x||(x=r.morphNormalBuffers[m]=Re.createVertexBuffer(o,null,o.STATIC_DRAW)),p[c+4]!==m&&(p[c+4]=m,u.push({buffer:x,data:new Float32Array(s[m])})),i.addAttribute(r.morphNormalBuffers[m],d["morphNormal"+c],o.FLOAT,!1,0,0,"morphNormal"+c)}Ca[c]=y;continue}}Ca[c]=0}return n.uniforms.morphTargetInfluences=Ca,u}function Pa(t,e){return Math.abs(e[1])-Math.abs(t[1])}Hr.registerPlugin("d3",Ta);var Oa={};function Ra(t,e){var r=e.gl,i=t._glVaoBuffer[e.CONTEXT_UID];return i||(i=t._glVaoBuffer[e.CONTEXT_UID]={attrBuffer:Re.createVertexBuffer(r,null,r.STATIC_DRAW),vaos:{}},t._indices&&(i.indexBuffer=Re.createIndexBuffer(r,null,r.STATIC_DRAW)),t._morphPositions&&(i.morphTargetBuffers=[]),t._morphNormals&&(i.morphNormalBuffers=[]),t._skinWeight&&(i.skinWeightBuffer=Re.createVertexBuffer(r,null,r.STATIC_DRAW)),t._skinIndex&&(i.skinIndexBuffer=Re.createVertexBuffer(r,null,r.STATIC_DRAW))),i}function Ia(t,e,r){return i=t,!ArrayBuffer.isView(i)||i instanceof DataView?t.slice(e,r):new t.constructor(t.subarray(e,void 0!==r?r:t.length));var i}var Da;!function(t){t.quaternion="quaternion",t.scale="scale",t.morphTargetInfluences="morphTargetInfluences",t.position="position"}(Da||(Da={}));var Fa=function(t){function e(e,r,i,n){var o=t.call(this)||this;switch(o.node=e,o.animationType=r,o.times=i,o.values=n,o._instanceType="AnimationTrack",o.animationType){case Da.position:case Da.scale:case Da.quaternion:var a=o.node[o.animationType].clone().toArray();o.resetValue=function(){o.node[o.animationType].fromArray(a)};break;case Da.morphTargetInfluences:if("Mesh3D"==o.node.instanceType||"SkinnedMesh3D"==o.node.instanceType){var s=o.node.morphTargetInfluences?o.node.morphTargetInfluences.slice():[];o.resetValue=function(){for(var t=o.node.morphTargetInfluences,e=0;e<t.length;e++)t[e]=s[e]||0}}}return o.resetValue||(o.resetValue=function(){}),o}return S(e,t),e.prototype.setValue=function(t){var e=this.getValue(t);switch(this.animationType){case Da.position:case Da.scale:case Da.quaternion:this.node[this.animationType].fromArray(e);break;case Da.morphTargetInfluences:if("Mesh3D"==this.node.instanceType||"SkinnedMesh3D"==this.node.instanceType)for(var r=this.node.morphTargetInfluences,i=0;i<r.length;i++)r[i]=e[i]||0}},e.prototype.getValue=function(t){var e=this.getValueSize();if(t<=0)return this.values.slice(0,e);if(t>=this.times[this.times.length-1])return this.values.slice(-e);var r=this.findPreIndex(t),i=r-1;if(i<0)return this.values.slice(0,e);var n=(t-this.times[i])/(this.times[r]-this.times[i]),o=this.values.slice(i*e,i*e+e),a=this.values.slice(r*e,r*e+e);return this.animationType==Da.quaternion?function(t,e,r){var i=[];return mo.slerpFlat(i,0,e,0,r,0,t),i}(n,o,a):function(t,e,r){for(var i=[],n=0;n!==e.length;++n)i[n]=e[n]*(1-t)+r[n]*t;return i}(n,o,a)},e.prototype.getValueSize=function(){return this.values.length/this.times.length},e.prototype.findPreIndex=function(t){for(var e=0,r=0;r<this.times.length;r++)if(this.times[r]>t){e=r;break}return e},e.prototype.destroy=function(){this.node=null,this.values=null,this.times=null},e}(R);var Na=new vo,ka=new vo,La=function(t){function e(e,r){void 0===e&&(e=[]);var i=t.call(this)||this;if(i._instanceType="Skeleton3D",i.bones=e.slice(0),i.boneMatrices=new Float32Array(16*i.bones.length),r)if(i.bones.length===r.length)i.boneInverses=r.slice(0);else{console.warn("boneInverses length error"),i.boneInverses=[];for(var n=0,o=i.bones.length;n<o;n++)i.boneInverses.push(new vo)}else i.calculateInverses();return i}return S(e,t),e.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new vo;this.bones[t]&&r.setInverseOf(this.bones[t]._worldMatrix),this.boneInverses.push(r)}},e.prototype.pose=function(){var t,e,r;for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t._worldMatrix.setInverseOf(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent&&"Bone3D"==t.parent.instanceType?(t._localMatrix.setInverseOf(t.parent._worldMatrix),t._localMatrix.multiply(t._worldMatrix)):t._localMatrix.copy(t._worldMatrix),t._localMatrix.decompose(t.position,t.quaternion,t.scale))},e.prototype.update=function(){for(var t=this.bones,e=this.boneInverses,r=this.boneMatrices,i=this.boneTexture,n=0,o=t.length;n<o;n++){var a=t[n]?t[n]._worldMatrix:ka;Na.multiplyMatrices(a,e[n]),Na.toArray(r,16*n)}i&&i.update()},e.prototype.clone=function(){return new e(this.bones,this.boneInverses)},e.prototype.getBoneByName=function(t){for(var e=0,r=this.bones.length;e<r;e++){var i=this.bones[e];if(i.name===t)return i}return null},e.prototype.destroy=function(){},e}(R),Ba=function(t){function e(){var e=t.call(this)||this;return e._instanceType="Bone3D",e}return S(e,t),e}(bo),za=function(t){function e(e,r){var i=t.call(this,e,r)||this;i.bindMode="attached",i.bindMatrix=new vo,i.bindMatrixInverse=new vo,i._instanceType="SkinnedMesh3D";var n=i.initBones(),o=new La(n);return i.bind(o,i._worldMatrix),i.normalizeSkinWeights(),i}return S(e,t),e.prototype.initBones=function(){var t,e,r,i,n=[];if(this.geometry&&void 0!==this.geometry.bones){for(r=0,i=this.geometry.bones.length;r<i;r++)e=this.geometry.bones[r],t=new Ba,n.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(r=0,i=this.geometry.bones.length;r<i;r++)-1!==(e=this.geometry.bones[r]).par&&null!==e.par&&void 0!==n[e.par]?n[e.par].addChild(n[r]):this.addChild(n[r])}return this.updateWorldMatrix(),n},e.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateWorldMatrix(),this.skeleton.calculateInverses(),e=this._worldMatrix),this.bindMatrix.copy(e),this.bindMatrixInverse.setInverseOf(e)},e.prototype.pose=function(){this.skeleton.pose()},e.prototype.normalizeSkinWeights=function(){var t,e;if(this.geometry){var r=new Ua,i=this.geometry._skinWeight,n=i.length/4||0;for(e=0;e<n;e++)r.x=i[4*e],r.y=i[4*e+1],r.z=i[4*e+2],r.w=i[4*e+3],(t=1/r.manhattanLength())!==1/0?r.multiplyScalar(t):r.set(1,0,0,0),i[4*e]=r.x,i[4*e+1]=r.y,i[4*e+2]=r.z,i[4*e+3]=r.w}},e.prototype.updateWorldMatrix=function(){t.prototype.updateWorldMatrix.call(this),"attached"===this.bindMode?this.bindMatrixInverse.setInverseOf(this._worldMatrix):"detached"===this.bindMode&&this.bindMatrixInverse.setInverseOf(this.bindMatrix)},e.prototype.update=function(){this.visible&&(this.skeleton.update(),t.prototype.update.call(this))},e.prototype.clone=function(){return new e(this.geometry,this.material).copy(this)},e}(Oo),Ua=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},t}(),ja=function(t){function e(e){var r=t.call(this)||this;return r.animationClips=e,r._instanceType="AnimationManager",r.stop(),r}return S(e,t),e.prototype.getAniClipByName=function(t){for(var e=0;e<this.animationClips.length;e++)if(this.animationClips[e].name==t)return this.animationClips[e];return null},e.prototype.showAni=function(t,e,r){void 0===e&&(e=0);var i=this.getAniClipByName(t);return i?(this.currentClip&&this.currentClip.resetState(),this.currentClip=i,i.startAniRange(0,void 0,e,r),i):null},e.prototype.stop=function(){this.animationClips.forEach((function(t){t.stop()})),this.currentClip=null},e.prototype.reset=function(){this.animationClips.forEach((function(t){t.resetState()})),this.currentClip=null},e.prototype.update=function(t){void 0===t&&(t=.0167);for(var e=0;e<this.animationClips.length;e++)this.animationClips[e].update(t)},e.prototype.destroy=function(){this.animationClips=null,this.currentClip=null},e}(R),Va="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Xa(t,e){void 0===e&&(e=!1);var r,i,n,o,a,s,h="",u=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<t.length;)r=Va.indexOf(t.charAt(u++))<<2|(o=Va.indexOf(t.charAt(u++)))>>4,i=(15&o)<<4|(a=Va.indexOf(t.charAt(u++)))>>2,n=(3&a)<<6|(s=Va.indexOf(t.charAt(u++))),h+=String.fromCharCode(r),64!=a&&(h+=String.fromCharCode(i)),64!=s&&(h+=String.fromCharCode(n));return e&&(h=function(t){var e="",r=0,i=0,n=0,o=0;for(;r<t.length;)(i=t.charCodeAt(r))<128?(e+=String.fromCharCode(i),r++):i>191&&i<224?(n=t.charCodeAt(r+1),e+=String.fromCharCode((31&i)<<6|63&n),r+=2):(n=t.charCodeAt(r+1),o=t.charCodeAt(r+2),e+=String.fromCharCode((15&i)<<12|(63&n)<<6|63&o),r+=3);return e}(h)),h}var Wa=1313821514,Ha=5130562,Ya="KHR_binary_glTF",Ga="KHR_draco_mesh_compression",qa="KHR_lights_punctual",Za="KHR_materials_pbrSpecularGlossiness",Ka="KHR_materials_unlit",Qa="MSFT_texture_dds",Ja=4,$a=5,ts=6,es={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},rs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},is={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences",position:"position"};function ns(t,e,r,i){"string"==typeof t&&(t=JSON.parse(t));var n=new ls(t,i);n.parse((function(t,r,i,o,a){var s={scene:t,scenes:r,cameras:i,animations:o,asset:a.asset,parser:n};o&&o.length&&(s.animationManager=new ja(o)),e(s)}),r)}function os(t,e,r){oe.loadAB((function(t,i){if(t)try{var n,o={};if("string"==typeof i)n=i;else if("glTF"===Ht(new Uint8Array(i,0,4))){try{o[Ya]=new ps(i)}catch(t){return void(r&&r(t))}n=o[Ya].content}else n=Ht(new Uint8Array(i));var a=JSON.parse(n);if(void 0===a.asset||a.asset.version[0]<2)return void(r&&r("version error"));ns(a,e,r,o)}catch(t){r&&r(t)}else r&&r(i)}),t)}function as(t){if(t.isInterleavedBufferAttribute){for(var e=t.count,r=t.itemSize,i=t.array.slice(0,e*r),n=0;n<e;++n)i[n*r]=t.getX(n),r>=2&&(i[n*r+1]=t.getY(n)),r>=3&&(i[n*r+2]=t.getZ(n)),r>=4&&(i[n*r+3]=t.getW(n));return new fs(i,r,t.normalized)}return t.clone()}function ss(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var r=0,i=e.weights.length;r<i;r++)t.morphTargetInfluences[r]=e.weights[r];if(e.extras&&Array.isArray(e.extras.targetNames)){var n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(r=0,i=n.length;r<i;r++)t.morphTargetDictionary[n[r]]=r}else console.warn("GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function hs(t,e){return t.indices===e.indices&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(t[r]!==e[r])return!1;return!0}(t.attributes,e.attributes)}function us(t,e){for(var r=0,i=t.length;r<i;r++){var n=t[r];if(hs(n.primitive,e))return n.promise}return null}var ls=function(){function t(t,e,r){void 0===t&&(t={}),void 0===e&&(e={}),void 0===r&&(r={}),this.json=t,this.extensions=e,this.options=r,this.cache=new ds,this.primitiveCache=[],this.multiplePrimitivesCache=[],this.multiPassGeometryCache=[],this.loadScene=function(){function t(e,r,i,n,o){var a=n[e],s=i.nodes[e];if(void 0!==s.skin)for(var h="Object3D"==a.instanceType?a.children:[a],u=0;u<h.length;u++){for(var l=h[u],c=o[s.skin],p=[],d=[],f=0,v=c.joints.length;f<v;f++){var m=c.joints[f],y=n[m];if(y){p.push(y);var g=new vo;void 0!==c.inverseBindMatrices&&g.fromArray(c.inverseBindMatrices.array,16*f),d.push(g)}else console.warn('Joint "%s" could not be found.',m)}l.bind(new La(p,d),l._worldMatrix)}if(r.addChild(a),s.children){var x=s.children;for(u=0;u<x.length;u++){var _=x[u];a&&t(_,a,i,n,o)}}}return function(e){var r=this.json;this.extensions;var i=this.json.scenes[e];return this.getMultiDependencies(["node","skin"]).then((function(e){var n=new Xo;void 0!==i.name&&(n.name=i.name);for(var o=i.nodes||[],a=0,s=o.length;a<s;a++)t(o[a],n,r,e.nodes,e.skins);return n}))}}()}return t.prototype.parse=function(t,e){var r=this.json;this.cache.removeAll(),this.markDefs(),this.getMultiDependencies(["scene","animation","camera"]).then((function(e){var i=e.scenes||[],n=i[r.scene||0],o=e.animations||[],a=e.cameras||[];t(n,i,a,o,r)})).catch(e)},t.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i={},n={},o=0,a=e.length;o<a;o++)for(var s=e[o].joints,h=0,u=s.length;h<u;h++)t[s[h]].isBone=!0;for(var l=0,c=t.length;l<c;l++){var p=t[l];void 0!==p.mesh&&(void 0===i[p.mesh]&&(i[p.mesh]=n[p.mesh]=0),i[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=i,this.json.meshUses=n},t.prototype.getDependency=function(t,e){var r=t+":"+e,i=this.cache.get(r);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this.loadNode(e);break;case"mesh":i=this.loadMesh(e);break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this.loadBufferView(e);break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this.loadMaterial(e);break;case"texture":i=this.loadTexture(e);break;case"skin":i=this.loadSkin(e);break;case"animation":i=this.loadAnimation(e);break;case"camera":i=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(r,i)}return i},t.prototype.getDependencies=function(t){var e=this.cache.get(t);if(!e){var r=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return r.getDependency(t,i)}))),this.cache.add(t,e)}return e},t.prototype.getMultiDependencies=function(t){for(var e={},r=[],i=0,n=t.length;i<n;i++){var o=t[i],a=this.getDependencies(o);a=a.then(function(t,r){e[t]=r}.bind(this,o+("mesh"===o?"es":"s"))),r.push(a)}return Promise.all(r).then((function(){return e}))},t.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&"arraybuffer"!==e.type)throw new Error("GLTFLoader: "+e.type+" buffer type is not supported.");return void 0===e.uri&&0===t?Promise.resolve(this.extensions[Ya].body):new Promise((function(t,r){var i=e.uri.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){i[1];var n=!!i[2],o=i[3];o=decodeURIComponent(o),n&&(o=(window&&window.atob||Xa)(o));for(var a=new Uint8Array(o.length),s=0;s<o.length;s++)a[s]=o.charCodeAt(s);t(a.buffer)}else r()}))},t.prototype.loadBufferView=function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var r=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+r)}))},t.prototype.loadAccessor=function(t){var e=this,r=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse)return null;var n=[];return void 0!==i.bufferView?n.push(this.getDependency("bufferView",i.bufferView)):n.push(null),void 0!==i.sparse&&(n.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(n).then((function(t){var n,o,a=t[0],s=rs[i.type],h=es[i.componentType],u=h.BYTES_PER_ELEMENT,l=u*s,c=i.byteOffset||0,p=void 0!==i.bufferView?r.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;if(p&&p!==l){var f="InterleavedBuffer:"+i.bufferView+":"+i.componentType,v=e.cache.get(f);v||(n=new h(a),v=new vs(n,p/u),e.cache.add(f,v)),o=as(new ms(v,s,c/u,d))}else n=null===a?new h(i.count*s):new h(a,c,i.count*s),o=new fs(n,s,d);if(void 0!==i.sparse){var m=rs.SCALAR,y=es[i.sparse.indices.componentType],g=i.sparse.indices.byteOffset||0,x=i.sparse.values.byteOffset||0,_=new y(t[1],g,i.sparse.count*m),b=new h(t[2],x,i.sparse.count*s);null!==a&&o.setArray(o.array.slice());for(var T=0,w=_.length;T<w;T++){var M=_[T];if(o.setX(M,b[T*s]),s>=2&&o.setY(M,b[T*s+1]),s>=3&&o.setZ(M,b[T*s+2]),s>=4&&o.setW(M,b[T*s+3]),s>=5)throw new Error("GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},t.prototype.loadTexture=function(t){var e=this.json;this.options;var r,i=e.textures[t],n=i.extensions||{},o=(r=n[Qa]?e.images[n[Qa].source]:e.images[i.source]).uri;return void 0!==r.bufferView&&(o=this.getDependency("bufferView",r.bufferView).then((function(t){var e=Wt(t);return"data:"+r.mimeType+";base64,"+e}))),Promise.resolve(o).then((function(t){return new Promise((function(e,r){var i,n;oe.loadImage((function(t,i){t?e(me.fromImage(i)):r()}),(n="","string"!=typeof(i=t)||""===i?"":/^(https?:)?\/\//i.test(i)||/^data:.*,.*$/i.test(i)||/^blob:.*$/i.test(i)?i:n+i))}))})).then((function(t){return void 0!==i.name&&(t.name=i.name),t}))},t.prototype.assignTexture=function(t,e,r){return this.getDependency("texture",r).then((function(r){t[e]=r}))},t.prototype.loadMaterial=function(t){var e=this.json;this.extensions;var r,i=e.materials[t],n={},o=i.extensions||{},a=[];if(o[Za]){r=Qo;var s=i.extensions[Za];if(n.color=16777215,n.alpha=1,Array.isArray(s.diffuseFactor)){var h=s.diffuseFactor;n.color=Ft(h),n.alpha=h[3]}void 0!==s.diffuseTexture&&a.push(this.assignTexture(n,"map",s.diffuseTexture.index))}else{r=o[Ka]?To:Qo;var u=i.pbrMetallicRoughness||{};if(n.color=16777215,n.alpha=1,Array.isArray(u.baseColorFactor)){h=u.baseColorFactor;n.color=Ft(h),n.alpha=h[3]}void 0!==u.baseColorTexture&&a.push(this.assignTexture(n,"map",u.baseColorTexture.index))}return!0===i.doubleSided&&(n.side=go.DoubleSide),Promise.all(a).then((function(){var t;return t=new r(n),void 0!==i.name&&(t.name=i.name),t}))},t.prototype.loadGeometries=function(t){this.extensions;var e=this.primitiveCache;return this.getDependencies("accessor").then((function(r){for(var i=[],n=0,o=t.length;n<o;n++){var a=t[n],s=us(e,a);if(s)i.push(s);else if(a.extensions&&a.extensions[Ga]);else{var h=cs(a,r),u=Promise.resolve(h);e.push({primitive:a,promise:u}),i.push(u)}}return Promise.all(i).then((function(t){return t}))}))},t.prototype.loadMesh=function(t){var e=this,r=this.json;this.extensions;var i=r.meshes[t];return this.getMultiDependencies(["accessor","material"]).then((function(r){for(var n=i.primitives,o=[],a=0,s=n.length;a<s;a++)o[a]=void 0===n[a].material?new Qo({color:16777215,side:0}):r.materials[n[a].material];return e.loadGeometries(n).then((function(r){for(var a=[],s=0,h=r.length;s<h;s++){var u,l=r[s],c=n[s],p=o[s];if(c.mode!==Ja&&c.mode!==$a&&c.mode!==ts&&void 0!==c.mode)throw new Error("GLTFLoader: Primitive mode unsupported: "+c.mode);"SkinnedMesh3D"===(u=!0===i.isSkinnedMesh?new za(l,p):new Oo(l,p)).instanceType&&u.normalizeSkinWeights(),u.geometry._morphPositions&&ss(u,i),u.name=i.name||"mesh_"+t,r.length>1&&(u.name+="_"+s),a.push(u);p=u.material;var d="SkinnedMesh3D"==u.instanceType,f=!!l._morphPositions,v=f&&!!l._morphNormals;if(d||f){var m="ClonedMaterial:"+p.instanceId+":";d&&(m+="skinning:"),f&&(m+="morph-targets:"),v&&(m+="morph-normals:");var y=e.cache.get(m);y||(y=p.clone(),d&&(y.skinning=!0),f&&(y.morphTargets=!0),v&&(y.morphNormals=!0),e.cache.add(m,y)),p=y}u.material=p}if(1===a.length)return a[0];var g=new bo;for(s=0;s<a.length;s++)g.addChild(a[s]);return g}))}))},t.prototype.loadCamera=function(t){var e,r=this.json.cameras[t],i=r[r.type];if(i)return"perspective"===r.type&&(e=new ko(T*i.yfov,i.aspectRatio||1,i.znear||1,i.zfar||2e6)),void 0!==r.name&&(e.name=r.name),Promise.resolve(e);console.warn("model camera params error")},t.prototype.loadSkin=function(t){var e=this.json.skins[t],r={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return r.inverseBindMatrices=t,r}))},t.prototype.loadAnimation=function(t){var e=this.json.animations[t];return this.getMultiDependencies(["accessor","node"]).then((function(r){for(var i=[],n=0,o=e.channels.length;n<o;n++){var a=e.channels[n],s=e.samplers[a.sampler];if(s){var h=a.target,u=void 0!==h.node?h.node:h.id,l=void 0!==e.parameters?e.parameters[s.input]:s.input,c=void 0!==e.parameters?e.parameters[s.output]:s.output,p=r.accessors[l],d=r.accessors[c],f=r.nodes[u];if(f){var v;switch(f.updateLocalMatrix(),is[h.path]){case is.weights:v=Da.morphTargetInfluences;break;case is.rotation:v=Da.quaternion;break;default:v=Da.position;break;case is.scale:v=Da.scale}var m=f.name?f.name:f.instanceId;void 0===s.interpolation||s.interpolation;var y=[];is[h.path]===is.weights?_s(f,(function(t){"Mesh3D"!==t.instanceType&&"SkinnedMesh3D"!==t.instanceType||!t.morphTargetInfluences||y.push(t.name?t.name:t.instanceId)})):y.push(m);for(var g=0,x=y.length;g<x;g++){var _=new Fa(f,v,Ia(p.array,0),Ia(d.array,0));i.push(_)}}}}u=void 0!==e.name?e.name:"animation_"+t;for(var b=0,T=0,w=i.length;T!==w;++T){var M=i[T];b=Math.max(b,M.times[M.times.length-1])}var S=new In(i,b);return S.name=u,S}))},t.prototype.loadNode=function(t){var e=this.json,r=this.extensions,i=e.meshReferences,n=e.meshUses,o=e.nodes[t];return this.getMultiDependencies(["mesh","skin","camera","light"]).then((function(t){var e;if(!0===o.isBone)e=new Ba;else if(void 0!==o.mesh){var a=t.meshes[o.mesh];if(i[o.mesh]>1){var s=n[o.mesh]++;(e=a.clone()).name+="_instance_"+s;for(var h=0,u=e.children.length;h<u;h++)e.children[h].name+="_instance_"+s}else e=a}else if(void 0!==o.camera)e=t.cameras[o.camera];else if(o.extensions&&o.extensions[qa]&&void 0!==o.extensions[qa].light){e=r[qa].lights[o.extensions[qa].light]}else e=new bo;if(void 0!==o.name&&(e.name=o.name.replace(/\s/g,"_").replace(xs,"")),void 0!==o.matrix){var l=new vo;l.fromArray(o.matrix),e.applyMatrix(l)}else void 0!==o.translation&&e.position.fromArray(o.translation),void 0!==o.rotation&&e.quaternion.fromArray(o.rotation),void 0!==o.scale&&e.scale.fromArray(o.scale);return e}))},t}();function cs(t,e){var r=t.attributes,i=e[r.POSITION],n=e[r.NORMAL],o=e[r.TEXCOORD_0]||e[r.TEXCOORD0],a=new Fo(ys(i),ys(e[t.indices]),n?ys(n):null,null,o?ys(o):null),s=e[r.WEIGHTS_0]||e[r.WEIGHTS];s&&(a._skinWeight=ys(s));var h=e[r.JOINTS_0]||e[r.JOINT];return h&&(a._skinIndex=ys(h)),void 0!==t.targets&&function(t,e,r){for(var i=!1,n=!1,o=0,a=e.length;o<a&&(void 0!==(u=e[o]).POSITION&&(i=!0),void 0!==u.NORMAL&&(n=!0),!i||!n);o++);if(i||n){var s=[],h=[];for(o=0,a=e.length;o<a;o++){var u=e[o],l="morphTarget"+o;if(i){var c=void 0;if(void 0!==u.POSITION){c=[];var p=as(r[u.POSITION]);p.name=l;for(var d=t._vertices,f=0,v=p.count;f<v;f++)c.push(p.getX(f)+d[3*f],p.getY(f)+d[3*f+1],p.getZ(f)+d[3*f+2])}else c=t._vertices;s.push(c)}if(n){var m=void 0;if(void 0!==u.NORMAL){m=[];var y=as(r[u.NORMAL]);y.name=l;var g=t._normals;for(f=0,v=y.count;f<v;f++)m.push(y.getX(f)+g[3*f],y.getY(f)+g[3*f+1],y.getZ(f)+g[3*f+2])}else m=t._normals;h.push(m)}}i&&(t._morphPositions=s),n&&(t._morphNormals=h)}}(a,t.targets,e),a}function ps(t){this.name=Ya,this.content=null,this.body=null;var e=new DataView(t,0,12);if(this.header={magic:Ht(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},"glTF"!==this.header.magic)throw new Error("GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var r=new DataView(t,12),i=0;i<r.byteLength;){var n=r.getUint32(i,!0);i+=4;var o=r.getUint32(i,!0);if(i+=4,o===Wa){var a=new Uint8Array(t,12+i,n);this.content=Ht(a)}else if(o===Ha){var s=12+i;this.body=t.slice(s,s+n)}i+=n}if(null===this.content)throw new Error("GLTFLoader: JSON content not found.")}var ds=function(){function t(){this.objects={}}return t.prototype.get=function(t){return this.objects[t]},t.prototype.add=function(t,e){this.objects[t]=e},t.prototype.remove=function(t){delete this.objects[t]},t.prototype.removeAll=function(){this.objects={}},t}(),fs=function(){function t(t,e,r){if(void 0===r&&(r=!1),this.array=t,this.itemSize=e,this.normalized=r,Array.isArray(t))throw new TypeError("Array should be a Typed Array");this.count=void 0!==t?t.length/e:0}return t.prototype.set=function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},t.prototype.setArray=function(t){if(Array.isArray(t))throw new TypeError("Array should be a Typed Array");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},t.prototype.getX=function(t){return this.array[t*this.itemSize]},t.prototype.setX=function(t,e){return this.array[t*this.itemSize]=e,this},t.prototype.getY=function(t){return this.array[t*this.itemSize+1]},t.prototype.setY=function(t,e){return this.array[t*this.itemSize+1]=e,this},t.prototype.getZ=function(t){return this.array[t*this.itemSize+2]},t.prototype.setZ=function(t,e){return this.array[t*this.itemSize+2]=e,this},t.prototype.getW=function(t){return this.array[t*this.itemSize+3]},t.prototype.setW=function(t,e){return this.array[t*this.itemSize+3]=e,this},t.prototype.setXY=function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},t.prototype.setXYZ=function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},t.prototype.setXYZW=function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},t.prototype.copy=function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this},t.prototype.clone=function(){return new t(this.array,this.itemSize).copy(this)},t}(),vs=function(){function t(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0}return t.prototype.setArray=function(t){if(Array.isArray(t))throw new TypeError("Array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},t.prototype.copy=function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this},t.prototype.set=function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},t.prototype.clone=function(){return(new t).copy(this)},t}(),ms=function(){function t(t,e,r,i){void 0===i&&(i=!1),this.itemSize=e,this.offset=r,this.normalized=i,this.isInterleavedBufferAttribute=!0,this.data=t}return Object.defineProperty(t.prototype,"count",{get:function(){return this.data.count},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"array",{get:function(){return this.data.array},enumerable:!1,configurable:!0}),t.prototype.setX=function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},t.prototype.setY=function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},t.prototype.setZ=function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},t.prototype.setW=function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},t.prototype.getX=function(t){return this.data.array[t*this.data.stride+this.offset]},t.prototype.getY=function(t){return this.data.array[t*this.data.stride+this.offset+1]},t.prototype.getZ=function(t){return this.data.array[t*this.data.stride+this.offset+2]},t.prototype.getW=function(t){return this.data.array[t*this.data.stride+this.offset+3]},t.prototype.setXY=function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},t.prototype.setXYZ=function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},t.prototype.setXYZW=function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this},t}();function ys(t){for(var e=[],r=0;r<t.count;r++)e.push(t.getX(r)),t.itemSize>=2&&e.push(t.getY(r)),t.itemSize>=3&&e.push(t.getZ(r)),t.itemSize>=4&&e.push(t.getW(r));return e}var gs,xs=new RegExp("[\\[\\]\\.:\\/]","g");function _s(t,e){e(t);for(var r=t.children,i=0,n=r.length;i<n;i++){_s(r[i],e)}}var bs,Ts=function(t){function e(e){if(!gs){gs=new Fo([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],[0,1,2,0,2,3],null,null,[0,1,1,1,1,0,0,0])}return t.call(this,gs,e)||this}return S(e,t),e}(Oo),ws=function(t){function e(e,r){var i=t.call(this)||this;return i.data=e,i.root=r,i.ax=0,i.ay=0,i.arotation=0,i.ascaleX=0,i.ascaleY=0,i.ashearX=0,i.ashearY=0,i.appliedValid=!1,i.sorted=!1,i.shearX=0,i.shearY=0,i._instanceType="Bone",i.name=e.name,i.data.x=i.data.x||0,i.data.y=i.data.y||0,i.data.scaleX=i.data.scaleX||1,i.data.scaleY=i.data.scaleY||1,i.data.rotation=i.data.rotation||0,i.data.shearX=i.data.shearX||0,i.data.shearY=i.data.shearY||0,i.setToSetupPose(),r&&(i.debugBone=i.addChild(new on).beginFill(16711680).drawRect(0,0,e.length||10,10).endFill()),i}return S(e,t),Object.defineProperty(e.prototype,"matrix",{get:function(){return this.worldMatrix},enumerable:!1,configurable:!0}),e.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.skewX=-t.shearY,this.skewY=t.shearX},e.prototype.updateTransform=function(){this.appliedSelf();var t=e.yDown?-1:1;if(this.parent){var r=this.parent;if("Bone"==this.parent.instanceType){this.transform._worldID++;var i=r.transform.worldMatrix,n=this.localMatrix,o=this.worldMatrix,a=i.a,s=i.c,h=i.b,u=i.d;switch(o.tx=a*this.x+s*this.y+i.tx,o.ty=h*this.x+u*this.y+i.ty,this.data.transform){case bs.onlyTranslation:this.transform.updateLocalMatrix(),o.a=n.a,o.c=n.c,o.b=n.b,o.d=n.d;break;case bs.noRotationOrReflection:var l=0;(y=a*a+h*h)>1e-4?(s=h*(y=Math.abs(a*u-s*h)/y),u=a*y,l=Math.atan2(h,a)*T):(a=0,h=0,l=90-Math.atan2(u,s)*T);var c=this.rotation+this.shearX-l,p=this.rotation+this.shearY-l+90,d=Math.cos(c*w)*this.scaleX,f=Math.cos(p*w)*this.scaleY*t,v=Math.sin(c*w)*this.scaleX,m=Math.sin(p*w)*this.scaleY*t;o.a=a*d-s*v,o.c=a*f-s*m,o.b=h*d+u*v,o.d=h*f+u*m;break;case bs.noScale:case bs.noScaleOrReflection:var y,g=Math.cos(this.rotation*w),x=Math.sin(this.rotation*w),_=(a*g+s*x)/1,b=(h*g+u*x)/1;(y=Math.sqrt(_*_+b*b))>1e-5&&(y=1/y),_*=y,b*=y,y=Math.sqrt(_*_+b*b),this.data.transform==bs.noScale&&a*u-s*h<0!=!e.yDown&&(y=-y);var M=Math.PI/2+Math.atan2(b,_),S=Math.cos(M)*y,E=Math.sin(M)*y;d=Math.cos(this.shearX*w)*this.scaleX,f=Math.cos((90+this.shearY)*w)*this.scaleY,v=Math.sin(this.shearX*w)*this.scaleX,m=Math.sin((90+this.shearY)*w)*this.scaleY;o.a=_*d+S*v,o.c=_*f+S*m,o.b=b*d+E*v,o.d=b*f+E*m;break;case bs.normal:default:this.displayObjectUpdateTransform()}}else{var C=this.parent;this.parent=this._tempDisplayObjectParent,this.transform.updateWorldMatrix(this.parent.transform),this.parent=C}}for(var A=0,P=this.children.length;A<P;++A){var O=this.children[A];O.updateTransform(),O==this.debugBone&&O.worldMatrix.prepend(this.root.worldMatrix)}},e.prototype.updateWorldTransformWith=function(t,e,r,i,n,o,a){this.ax=this.x=t,this.ay=this.y=e,this.arotation=this.rotation=r,this.ascaleX=this.scaleX=i,this.ascaleY=this.scaleY=n,this.ashearX=o,this.ashearY=a,this.appliedValid=!0,this.skewX=-a,this.skewY=o,this.updateTransform()},e.prototype.appliedSelf=function(){this.ax=this.x,this.ay=this.y,this.arotation=this.rotation,this.ascaleX=this.scaleX,this.ascaleY=this.scaleY,this.ashearX=this.shearX,this.ashearY=this.shearY,this.appliedValid=!0},e.yDown=!0,e}(te);!function(t){t.normal="normal",t.onlyTranslation="onlyTranslation",t.noRotationOrReflection="noRotationOrReflection",t.noScale="noScale",t.noScaleOrReflection="noScaleOrReflection"}(bs||(bs={}));var Ms,Ss,Es=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,r,i){return this.r+=t,this.g+=e,this.b+=r,this.a+=i,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.fromString=function(e){return(new t).setFromString(e)},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}(),Cs=function(t){function e(e,r,i){var n=t.call(this)||this;return n.bone=e,n.data=r,n.spine=i,n.deform=new Array,n.name=n.data.name,n.color=new Es(1,1,1,1),n.data.color&&n.color.setFromString(n.data.color),n.data.sColor=(new Es).setFromColor(n.color),n}return S(e,t),e.prototype.getAttachment=function(){return this.attachment},e.prototype.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.deform.length=0)},e.prototype.setToSetupPose=function(){this.color.setFromColor(this.data.sColor),null==this.data.attachment?this.attachment=null:(this.attachment=null,this.setAttachment(this.spine.getAttachment(this.spine.findSlotIndex(this.name),this.data.attachment)))},e}(te),As=function(){function t(t){this.name=t,this.attachments=new Array}return t.prototype.addAttachment=function(t,e,r){var i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=r},t.prototype.getAttachment=function(t,e){var r=this.attachments[t];return r?r[e]:null},t.prototype.attachAll=function(t,e){for(var r=0,i=0;i<t.length;i++){var n=t[i],o=n.getAttachment();if(o&&r<e.attachments.length){var a=e.attachments[r];for(var s in a){if(o==a[s]){var h=this.getAttachment(r,s);null!=h&&n.setAttachment(h);break}}}r++}},t}(),Ps=function(t){this.name=t},Os=function(t){function e(r){var i=t.call(this,r)||this;return i.id=(65535&e.nextID++)<<11,i.worldVerticesLength=0,i.deformAttachment=i,i}return S(e,t),e.prototype.applyDeform=function(t){return this==t},e.prototype.computeWorldVerticesOld=function(t,e,r){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2,r)},e.prototype.computeWorldVertices=function(t,e,r,i,n,o,a){r=n+(r>>1)*o;var s=t.deform,h=this.vertices,u=this.bones;if(null!=u){for(var l=0,c=0,p=0;p<e;p+=2){l+=(v=u[l])+1,c+=v}if(0==s.length)for(C=n,w=3*c;C<r;C+=o){var d=0,f=0,v=u[l++];for(v+=l;l<v;l++,w+=3){x=a[u[l]].matrix,A=h[w],P=h[w+1];var m=h[w+2];d+=(A*x.a+P*x.c+x.tx)*m,f+=(A*x.b+P*x.d+x.ty)*m}i[C]=d,i[C+1]=f}else for(var y=s,g=(C=n,w=3*c,c<<1);C<r;C+=o){d=0,f=0,v=u[l++];for(v+=l;l<v;l++,w+=3,g+=2){x=a[u[l]].matrix,A=h[w]+y[g],P=h[w+1]+y[g+1],m=h[w+2];d+=(A*x.a+P*x.c+x.tx)*m,f+=(A*x.b+P*x.d+x.ty)*m}i[C]=d,i[C+1]=f}}else{s.length>0&&(h=s);for(var x,_=(x=t.bone.matrix).tx,b=x.ty,T=x.a,w=x.c,M=x.b,S=x.d,E=e,C=n;C<r;E+=2,C+=o){var A=h[E],P=h[E+1];i[C]=A*T+P*w+_,i[C+1]=A*M+P*S+b}}},e.nextID=0,e}(Ps),Rs=function(t){function e(e,r,i,n,o,a,s,h,u){void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===h&&(h=0);var l=t.call(this,e)||this;return l.x=r,l.y=i,l.scaleX=n,l.scaleY=o,l.rotation=a,l.width=s,l.height=h,l.texture=u,l.color=new Es(1,1,1,1),l}return S(e,t),e}(Ps),Is=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.color=new Es(1,1,1,1),e}return S(e,t),e}(Os),Ds=function(){function t(e){this.curves=new Float32Array((e-1)*t.BEZIER_SIZE)}return t.prototype.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},t.prototype.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},t.prototype.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},t.prototype.getCurveType=function(e){var r=e*t.BEZIER_SIZE;if(r==this.curves.length)return t.LINEAR;var i=this.curves[r];return i==t.LINEAR?t.LINEAR:i==t.STEPPED?t.STEPPED:t.BEZIER},t.prototype.setCurve=function(e,r,i,n,o){var a=.03*(2*-r+n),s=.03*(2*-i+o),h=.006*(3*(r-n)+1),u=.006*(3*(i-o)+1),l=2*a+h,c=2*s+u,p=.3*r+a+.16666667*h,d=.3*i+s+.16666667*u,f=e*t.BEZIER_SIZE,v=this.curves;v[f++]=t.BEZIER;for(var m=p,y=d,g=f+t.BEZIER_SIZE-1;f<g;f+=2)v[f]=m,v[f+1]=y,p+=l,d+=c,l+=h,c+=u,m+=p,y+=d},t.prototype.getCurvePercent=function(e,r){r=Xt(r,0,1);var i=this.curves,n=e*t.BEZIER_SIZE,o=i[n];if(o==t.LINEAR)return r;if(o==t.STEPPED)return 0;for(var a=0,s=++n,h=n+t.BEZIER_SIZE-1;n<h;n+=2)if((a=i[n])>=r){var u=void 0,l=void 0;return n==s?(u=0,l=0):(u=i[n-2],l=i[n-1]),l+(i[n+1]-l)*(r-u)/(a-u)}var c=i[n-1];return c+(1-c)*(r-a)/(1-a)},t.LINEAR=0,t.STEPPED=1,t.BEZIER=2,t.BEZIER_SIZE=19,t}();function Fs(t,e,r){if(t.hasOwnProperty("curve"))if("stepped"===t.curve)e.setStepped(r);else if("[object Array]"===Object.prototype.toString.call(t.curve)){var i=t.curve;e.setCurve(r,i[0],i[1],i[2],i[3])}else e.setCurve(r,t.curve,t.c2||0,t.c3||1,t.c4||1)}function Ns(t,e,r){void 0===r&&(r=1);var i=0,n=t.length/r-2;if(0==n)return r;for(var o=n>>>1;;){if(t[(o+1)*r]<=e?i=o+1:n=o,i==n)return(i+1)*r;o=i+n>>>1}}function ks(t,e,r,i,n){for(var o=e,a=i;o<e+n;o++,a++)r[a]=t[o]}function Ls(t,e,r){void 0===r&&(r=0);var i=t.length;if(i==e)return t;if(t.length=e,i<e)for(var n=i;n<e;n++)t[n]=r;return t}function Bs(t,e){for(var r=new Array(t),i=0;i<t;i++)r[i]=e;return r}!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(Ms||(Ms={})),function(t){t[t.in=0]="in",t[t.out=1]="out"}(Ss||(Ss={}));var zs,Us=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e.prototype.setValue=function(t,e,r,i){},e.prototype.resetValue=function(){},e.prototype.destroy=function(){},e}(R);!function(t){t.rotate="rotate",t.translate="translate",t.scale="scale",t.shear="shear"}(zs||(zs={}));var js=function(t){function e(e,r,i){var n=t.call(this)||this;n.bone=e,n.animationType=r,n.times=i,n._instanceType="SpineBoneAniTrack",i.forEach((function(t){switch(t.time=t.time||0,r){case zs.rotate:t.angle=t.angle||0;break;case zs.scale:t.x=void 0===t.x?1:t.x,t.y=void 0===t.y?1:t.y;break;case zs.translate:case zs.shear:t.x=t.x||0,t.y=t.y||0}})),n.curve=new Ds(i.length);for(var o=0,a=0;a<i.length;a++){Fs(i[a],n.curve,o),o++}return n}return S(e,t),e.prototype.resetValue=function(){this.bone.setToSetupPose()},e.prototype.setValue=function(t,e,r,i){switch(void 0===e&&(e=1),void 0===r&&(r=Ms.replace),void 0===i&&(i=Ss.in),this.animationType){case zs.translate:this.setPosition(t,e,r);break;case zs.scale:this.setScale(t,e,r,i);break;case zs.shear:this.setShear(t,e,r);break;case zs.rotate:this.setRotation(t,e,r)}},e.prototype.setRotation=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=Ms.replace);var i=this.times,n=this.bone;if(t<i[0].time)switch(r){case Ms.setup:return void(n.rotation=n.data.rotation);case Ms.first:var o=n.data.rotation-n.rotation;n.rotation+=(o-Vs(o))*e}else if(t>=i[i.length-1].time){var a=i[i.length-1].angle;switch(r){case Ms.setup:n.rotation=n.data.rotation+a*e;break;case Ms.first:case Ms.replace:a+=n.data.rotation-n.rotation,a-=Vs(a);case Ms.add:n.rotation+=a*e}}else{var s=this.findPreIndex(t),h=i[s-1].angle,u=i[s].time,l=this.curve.getCurvePercent(s-1,1-(t-u)/(i[s-1].time-u)),c=i[s].angle-h;switch(c=h+(c-Vs(c))*l,r){case Ms.setup:n.rotation=n.data.rotation+(c-Vs(c))*e;break;case Ms.first:case Ms.replace:c+=n.data.rotation-n.rotation;case Ms.add:n.rotation+=(c-Vs(c))*e}}},e.prototype.setPosition=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=Ms.replace);var i=this.times,n=this.bone;if(t<i[0].time)switch(r){case Ms.setup:return n.x=n.data.x,void(n.y=n.data.y);case Ms.first:n.x+=(n.data.x-n.x)*e,n.y+=(n.data.y-n.y)*e}else{var o=0,a=0;if(t>=i[i.length-1].time)o=i[i.length-1].x,a=i[i.length-1].y;else{var s=this.findPreIndex(t);o=i[s-1].x,a=i[s-1].y;var h=i[s].time,u=this.curve.getCurvePercent(s-1,1-(t-h)/(i[s-1].time-h));o+=(i[s].x-o)*u,a+=(i[s].y-a)*u}switch(r){case Ms.setup:n.x=n.data.x+o*e,n.y=n.data.y+a*e;break;case Ms.first:case Ms.replace:n.x+=(n.data.x+o-n.x)*e,n.y+=(n.data.y+a-n.y)*e;break;case Ms.add:n.x+=o*e,n.y+=a*e}}},e.prototype.setScale=function(t,e,r,i){void 0===e&&(e=1),void 0===r&&(r=Ms.replace),void 0===i&&(i=Ss.in);var n=this.times,o=this.bone;if(t<n[0].time)switch(r){case Ms.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case Ms.first:o.scaleX+=(o.data.scaleX-o.scaleX)*e,o.scaleY+=(o.data.scaleY-o.scaleY)*e}else{var a=0,s=0;if(t>=n[n.length-1].time)a=n[n.length-1].x*o.data.scaleX,s=n[n.length-1].y*o.data.scaleY;else{var h=this.findPreIndex(t);a=n[h-1].x,s=n[h-1].y;var u=n[h].time,l=this.curve.getCurvePercent(h-1,1-(t-u)/(n[h-1].time-u));a=(a+(n[h].x-a)*l)*o.data.scaleX,s=(s+(n[h].y-s)*l)*o.data.scaleY}if(1==e)r==Ms.add?(o.scaleX+=a-o.data.scaleX,o.scaleY+=s-o.data.scaleY):(o.scaleX=a,o.scaleY=s);else{var c=0,p=0;if(i==Ss.out)switch(r){case Ms.setup:c=o.data.scaleX,p=o.data.scaleY,o.scaleX=c+(Math.abs(a)*kt(c)-c)*e,o.scaleY=p+(Math.abs(s)*kt(p)-p)*e;break;case Ms.first:case Ms.replace:c=o.scaleX,p=o.scaleY,o.scaleX=c+(Math.abs(a)*kt(c)-c)*e,o.scaleY=p+(Math.abs(s)*kt(p)-p)*e;break;case Ms.add:c=o.scaleX,p=o.scaleY,o.scaleX=c+(Math.abs(a)*kt(c)-o.data.scaleX)*e,o.scaleY=p+(Math.abs(s)*kt(p)-o.data.scaleY)*e}else switch(r){case Ms.setup:c=Math.abs(o.data.scaleX)*kt(a),p=Math.abs(o.data.scaleY)*kt(s),o.scaleX=c+(a-c)*e,o.scaleY=p+(s-p)*e;break;case Ms.first:case Ms.replace:c=Math.abs(o.scaleX)*kt(a),p=Math.abs(o.scaleY)*kt(s),o.scaleX=c+(a-c)*e,o.scaleY=p+(s-p)*e;break;case Ms.add:c=kt(a),p=kt(s),o.scaleX=Math.abs(o.scaleX)*c+(a-Math.abs(o.data.scaleX)*c)*e,o.scaleY=Math.abs(o.scaleY)*p+(s-Math.abs(o.data.scaleY)*p)*e}}}},e.prototype.setShear=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=Ms.replace);var i=this.times,n=this.bone;if(t<i[0].time)switch(r){case Ms.setup:return n.shearX=n.data.shearX,n.shearY=n.data.shearY,n.skewX=-n.shearY,void(n.skewY=n.shearX);case Ms.first:n.shearX+=(n.data.shearX-n.shearX)*e,n.shearY+=(n.data.shearY-n.shearY)*e,n.skewX=-n.shearY,n.skewY=n.shearX}else{var o=0,a=0;if(t>=i[i.length-1].time)o=i[i.length-1].x,a=i[i.length-1].y;else{var s=this.findPreIndex(t);o=i[s-1].x,a=i[s-1].y;var h=i[s].time,u=this.curve.getCurvePercent(s-1,1-(t-h)/(i[s-1].time-h));o+=(i[s].x-o)*u,a+=(i[s].y-a)*u}switch(r){case Ms.setup:n.shearX=n.data.shearX+o*e,n.shearY=n.data.shearY+a*e;break;case Ms.first:case Ms.replace:n.shearX+=(n.data.shearX+o-n.shearX)*e,n.shearY+=(n.data.shearY+a-n.shearY)*e;break;case Ms.add:n.shearX+=o*e,n.shearY+=a*e}n.skewX=-n.shearY,n.skewY=n.shearX}},e.prototype.findPreIndex=function(t){for(var e=0,r=0;r<this.times.length;r++)if(this.times[r].time>t){e=r;break}return e},e.prototype.destroy=function(){this.bone=null,this.times=null},e}(Us);function Vs(t){return 360*(16384-(16384.499999999996-t/360|0))}var Xs=function(t){function e(r,i){var n=t.call(this)||this;n.slot=r,n._instanceType="SpineColorAniTrack";var o=i.length;n.frames=new Float32Array(o*e.ENTRIES),n.curve=new Ds(o);for(var a=0,s=0;s<o;s++){var h=i[s],u=(new Es).setFromString(h.color||"ffffffff"),l=a*e.ENTRIES;n.frames[l]=h.time||0,n.frames[l+e.R]=u.r,n.frames[l+e.G]=u.g,n.frames[l+e.B]=u.b,n.frames[l+e.A]=u.a,Fs(h,n.curve,a),a++}return n}return S(e,t),e.prototype.resetValue=function(){this.slot.setToSetupPose()},e.prototype.setValue=function(t,r,i){void 0===r&&(r=1),void 0===i&&(i=Ms.replace);var n=this.slot,o=this.frames;if(t<o[0])switch(i){case Ms.setup:return void n.color.setFromColor(n.data.sColor);case Ms.first:case Ms.replace:var a=n.color,s=n.data.sColor;a.add((s.r-a.r)*r,(s.g-a.g)*r,(s.b-a.b)*r,(s.a-a.a)*r)}else{var h=0,u=0,l=0,c=0;if(t>=o[o.length-e.ENTRIES]){var p=o.length;h=o[p+e.PREV_R],u=o[p+e.PREV_G],l=o[p+e.PREV_B],c=o[p+e.PREV_A]}else{var d=Ns(o,t,e.ENTRIES);h=o[d+e.PREV_R],u=o[d+e.PREV_G],l=o[d+e.PREV_B],c=o[d+e.PREV_A];var f=o[d],v=this.curve.getCurvePercent(d/e.ENTRIES-1,1-(t-f)/(o[d+e.PREV_TIME]-f));h+=(o[d+e.R]-h)*v,u+=(o[d+e.G]-u)*v,l+=(o[d+e.B]-l)*v,c+=(o[d+e.A]-c)*v}if(1==r)n.color.set(h,u,l,c);else{a=n.color;i==Ms.setup&&a.setFromColor(n.data.sColor),a.add((h-a.r)*r,(u-a.g)*r,(l-a.b)*r,(c-a.a)*r)}}},e.ENTRIES=5,e.PREV_TIME=-5,e.PREV_R=-4,e.PREV_G=-3,e.PREV_B=-2,e.PREV_A=-1,e.R=1,e.G=2,e.B=3,e.A=4,e}(Us),Ws=function(t){function e(e,r,i){var n=t.call(this)||this;n.slot=e,n.attachment=r,n.times=i,n._instanceType="SpineDeformAniTrack";var o=null!=r.bones,a=r.vertices,s=o?a.length/3*2:a.length;n.frameTimes=new Float32Array(i.length),n.frameVertices=new Array(i.length),n.curve=new Ds(i.length);for(var h=0,u=0;u<i.length;u++){var l=i[u],c=void 0,p=l.vertices||null;if(null==p)c=o?new Float32Array(s):a;else if(ks(p,0,c=new Float32Array(s),l.offset||0,p.length),!o)for(var d=0;d<s;d++)c[d]+=a[d];n.frameTimes[h]=l.time||0,n.frameVertices[h]=c,Fs(l,n.curve,h),h++}return n}return S(e,t),e.prototype.setValue=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=Ms.replace);var i=this.slot.getAttachment();if(i instanceof Os&&i.applyDeform(this.attachment)){var n=this.slot.deform;0==n.length&&(r=Ms.setup);var o=this.frameVertices,a=o[0].length,s=this.frameTimes;if(t<s[0]){var h=i;switch(r){case Ms.setup:return void(n.length=0);case Ms.first:if(1==e){n.length=0;break}var u=Ls(n,a);if(null==h.bones)for(var l=h.vertices,c=0;c<a;c++)u[c]+=(l[c]-u[c])*e;else{e=1-e;for(c=0;c<a;c++)u[c]*=e}}}else{var p=Ls(n,a);if(t>=s[s.length-1]){var d=o[s.length-1];if(1==e)if(r==Ms.add)if(null==(h=i).bones)for(l=h.vertices,c=0;c<a;c++)p[c]+=d[c]-l[c];else for(c=0;c<a;c++)p[c]+=d[c];else ks(d,0,p,0,a);else switch(r){case Ms.setup:var f=i;if(null==f.bones)for(l=f.vertices,c=0;c<a;c++){var v=l[c];p[c]=v+(d[c]-v)*e}else for(c=0;c<a;c++)p[c]=d[c]*e;break;case Ms.first:case Ms.replace:for(c=0;c<a;c++)p[c]+=(d[c]-p[c])*e;case Ms.add:if(null==(h=i).bones)for(l=h.vertices,c=0;c<a;c++)p[c]+=(d[c]-l[c])*e;else for(c=0;c<a;c++)p[c]+=d[c]*e}}else{var m=Ns(s,t),y=o[m-1],g=o[m],x=s[m],_=this.curve.getCurvePercent(m-1,1-(t-x)/(s[m-1]-x));if(1==e)if(r==Ms.add)if(null==(h=i).bones)for(l=h.vertices,c=0;c<a;c++){var b=y[c];p[c]+=b+(g[c]-b)*_-l[c]}else for(c=0;c<a;c++){b=y[c];p[c]+=b+(g[c]-b)*_}else for(c=0;c<a;c++){b=y[c];p[c]=b+(g[c]-b)*_}else switch(r){case Ms.setup:var T=i;if(null==T.bones)for(l=T.vertices,c=0;c<a;c++){b=y[c],v=l[c];p[c]=v+(b+(g[c]-b)*_-v)*e}else for(c=0;c<a;c++){b=y[c];p[c]=(b+(g[c]-b)*_)*e}break;case Ms.first:case Ms.replace:for(c=0;c<a;c++){b=y[c];p[c]+=(b+(g[c]-b)*_-p[c])*e}break;case Ms.add:if(null==(h=i).bones)for(l=h.vertices,c=0;c<a;c++){b=y[c];p[c]+=(b+(g[c]-b)*_-l[c])*e}else for(c=0;c<a;c++){b=y[c];p[c]+=(b+(g[c]-b)*_)*e}}}}}},e}(Us),Hs=function(t){function e(e,r,i){var n=t.call(this)||this;return n.slot=e,n.times=r,n.spine=i,n._instanceType="AttachmentAniTrack",r.forEach((function(t){t.time=t.time||0})),n}return S(e,t),e.prototype.resetValue=function(){this.slot.setToSetupPose()},e.prototype.setValue=function(t,e,r,i){void 0===r&&(r=Ms.replace),void 0===i&&(i=Ss.in);var n=this.slot;if(i!=Ss.out||r!=Ms.setup){var o=this.times;if(t<o[0].time){if(r==Ms.setup||r==Ms.first||r==Ms.replace){s=n.data.attachment;n.setAttachment(s?this.spine.getAttachment(this.spine.slots.indexOf(n),s):null)}}else{var a=o[t>=o[o.length-1].time?o.length-1:function(t,e){var r=0,i=t.length-2;if(0==i)return 1;var n=i>>>1;for(;;){if(t[n+1].time<=e?r=n+1:i=n,r==i)return r+1;n=r+i>>>1}}(o,t)-1].name;n.setAttachment(null==a?null:this.spine.getAttachment(this.spine.slots.indexOf(n),a))}}else{var s=n.data.attachment;n.setAttachment(s?this.spine.getAttachment(this.spine.slots.indexOf(n),s):null)}},e}(Us);var Ys=function(t){function e(e,r,i){var n=t.call(this)||this;return n.slots=e,n.drawOrder=r,n.times=i,n._instanceType="DrawOrderAniTrack",n}return S(e,t),e.prototype.setValue=function(t,e,r,i){void 0===r&&(r=Ms.replace),void 0===i&&(i=Ss.in);var n=this.drawOrder,o=this.slots;if(i!=Ss.out||r!=Ms.setup){var a=this.times;if(t<a[0].time)r!=Ms.setup&&r!=Ms.first||ks(o,0,n,0,o.length);else{var s=a[t>=a[a.length-1].time?a.length-1:function(t,e){var r=0,i=t.length-2;if(0==i)return 1;var n=i>>>1;for(;;){if(t[n+1].time<=e?r=n+1:i=n,r==i)return r+1;n=r+i>>>1}}(a,t)-1].drawOrder;if(s)for(var h=0,u=s.length;h<u;h++)n[h]=o[s[h]];else ks(o,0,n,0,o.length)}}else ks(o,0,n,0,o.length)},e.prototype.resetValue=function(){var t=this;this.slots.forEach((function(e,r){t.drawOrder[r]=e}))},e}(Us);var Gs,qs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.alpha=1,e.blend=Ms.replace,e.direction=Ss.in,e}return S(e,t),e.prototype.rectify=function(){if(this.tracks&&this.tracks.length){for(var t=0;t<this.tracks.length;t++)this.tracks[t].setValue(this.curTime,this.alpha,this.blend,this.direction);this.lastTime=this.curTime}},e}(In),Zs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e.prototype.showAni=function(e,r,i,n){if(void 0===r&&(r=0),void 0===n&&(n=0),!n||!this.currentClip)return t.prototype.showAni.call(this,e,r,i);var o=this.currentClip,a=this.getAniClipByName(e);return a?o==a?t.prototype.showAni.call(this,e,r,i):(o.fromClip&&(this.resetFrom(o.fromClip),o.fromClip=null),a.mixTime=0,a.mixDuration=n,a.fromClip=o,(this.currentClip=a).startAniRange(0,void 0,r,i),this.currentClip):null},e.prototype.update=function(e){void 0===e&&(e=.0167),this.applyMixingFrom(this.currentClip,e,Ms.first),t.prototype.update.call(this,e)},e.prototype.applyMixingFrom=function(t,e,r){if(t){var i=t.fromClip;if(i){t.mixTime+=e;var n=0;0==t.mixDuration?(n=1,r==Ms.first&&(r=Ms.setup)):((n=t.mixTime/t.mixDuration)>1&&(n=1),r!=Ms.first&&(r=i.blend)),t.alpha=n,i.alpha=1-n,i.blend=r,0==i.alpha&&(this.resetFrom(i),t.fromClip.tracks.forEach((function(t){"AttachmentAniTrack"==t.instanceType&&t.resetValue()})),t.fromClip=null)}}},e.prototype.resetFrom=function(t){t._isPlaying=!1,t.alpha=1,t.blend=Ms.replace},e}(ja),Ks=function(t){function e(e,r){var i=t.call(this)||this;return i.bendDirection=1,i.compress=!1,i.stretch=!1,i.uniform=!1,i.mix=1,i.softness=0,i.active=!1,i._instanceType="IkConstraint",i.target=e,i.bones=r,i}return S(e,t),e.prototype.destroy=function(){},e.prototype.isActive=function(){return this.active},e.prototype.apply=function(){this.update()},e.prototype.update=function(){var t=this.target,e=this.bones,r=t.worldMatrix.tx,i=t.worldMatrix.ty;switch(e.length){case 1:this.apply1(e[0],r,i,this.compress,this.stretch,this.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],r,i,this.bendDirection,this.stretch,this.softness,this.mix)}},e.prototype.apply1=function(t,e,r,i,n,o,a){var s=t.parent.worldMatrix,h=s.a,u=s.c,l=s.b,c=s.d,p=-t.ashearX-t.arotation,d=0,f=0;switch(t.data.transform){case bs.onlyTranslation:d=e-t.worldMatrix.tx,f=r-t.worldMatrix.ty;break;case bs.noRotationOrReflection:p+=Math.atan2(l,h)*T;var v=Math.abs(h*c-u*l)/(h*h+l*l);u=-l*v,c=h*v;default:var m=e-s.tx,y=r-s.ty,g=h*c-u*l;d=(m*c-y*u)/g-t.ax,f=(y*h-m*l)/g-t.ay}p+=Math.atan2(f,d)*T,t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);var x=t.ascaleX,_=t.ascaleY;if(i||n){switch(t.data.transform){case bs.noScale:case bs.noScaleOrReflection:d=e-t.worldMatrix.tx,f=r-t.worldMatrix.ty}var b=t.data.length*x,w=Math.sqrt(d*d+f*f);if(i&&w<b||n&&w>b&&b>1e-4){var M=(w/b-1)*a+1;x*=M,o&&(_*=M)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*a,x,_,t.ashearX,t.ashearY)},e.prototype.apply2=function(t,e,r,i,n,o,a,s){if(0!=s){var h=t.ax,u=t.ay,l=t.ascaleX,c=l,p=t.ascaleY,d=e.ascaleX,f=t.matrix,v=0,m=0,y=0;l<0?(l=-l,v=180,y=-1):(v=0,y=1),p<0&&(p=-p,y=-y),d<0?(d=-d,m=180):m=0;var g=e.ax,x=0,_=0,b=0,w=f.a,M=f.c,S=f.b,E=f.d,C=Math.abs(l-p)<=1e-4;C?(_=w*g+M*(x=e.ay)+f.tx,b=S*g+E*x+f.ty):(x=0,_=w*g+f.tx,b=S*g+f.ty);var A=t.parent.worldMatrix;w=A.a,M=A.c,S=A.b;var P,O,R=1/(w*(E=A.d)-M*S),I=_-A.tx,D=b-A.ty,F=(I*E-D*M)*R-h,N=(D*w-I*S)*R-u,k=Math.sqrt(F*F+N*N),L=e.data.length*d;if(k<1e-4)return this.apply1(t,r,i,!1,o,!1,s),void e.updateWorldTransformWith(g,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((I=r-A.tx)*E-(D=i-A.ty)*M)*R-h,z=(D*w-I*S)*R-u,U=B*B+z*z;if(0!=a){a*=l*(d+1)/2;var j=Math.sqrt(U),V=j-k-L*l+a;if(V>0){var X=Math.min(1,V/(2*a))-1;U=(B-=(X=(V-a*(1-X*X))/j)*B)*B+(z-=X*z)*z}}t:if(C){var W=(U-k*k-(L*=l)*L)/(2*k*L);W<-1?W=-1:W>1&&(W=1,o&&(c*=(Math.sqrt(U)/(k+L)-1)*s+1)),O=Math.acos(W)*n,w=k+L*W,M=L*Math.sin(O),P=Math.atan2(z*w-B*M,B*w+z*M)}else{var H=(w=l*L)*w,Y=(M=p*L)*M,G=Math.atan2(z,B),q=-2*Y*k,Z=Y-H;if((E=q*q-4*Z*(S=Y*k*k+H*U-H*Y))>=0){var K=Math.sqrt(E);q<0&&(K=-K);var Q=(K=-(q+K)/2)/Z,J=S/K,$=Math.abs(Q)<Math.abs(J)?Q:J;if($*$<=U){D=Math.sqrt(U-$*$)*n,P=G-Math.atan2(D,$),O=Math.atan2(D/p,($-k)/l);break t}}var tt=Math.PI,et=k-w,rt=et*et,it=0,nt=0,ot=k+w,at=ot*ot,st=0;(S=-w*k/(H-Y))>=-1&&S<=1&&(S=Math.acos(S),(E=(I=w*Math.cos(S)+k)*I+(D=M*Math.sin(S))*D)<rt&&(tt=S,rt=E,et=I,it=D),E>at&&(nt=S,at=E,ot=I,st=D)),U<=(rt+at)/2?(P=G-Math.atan2(it*n,et),O=tt*n):(P=G-Math.atan2(st*n,ot),O=nt*n)}var ht=Math.atan2(x,g)*y,ut=t.arotation;(P=(P-ht)*T+v-ut)>180?P-=360:P<-180&&(P+=360),t.updateWorldTransformWith(h,u,ut+P*s,c,t.ascaleY,0,0),ut=e.arotation,(O=((O+ht)*T-e.ashearX)*y+m-ut)>180?O-=360:O<-180&&(O+=360),e.updateWorldTransformWith(g,x,ut+O*s,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},e}(R),Qs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.color=new Es(.2275,.2275,.8078,1),e}return S(e,t),e}(Os);!function(t){t.region="region",t.mesh="mesh",t.clipping="clipping",t.linkedmesh="linkedmesh",t.path="path",t.point="point"}(Gs||(Gs={}));var Js=[0,0,0],$s=function(t){function e(e,r){void 0===r&&(r=!1);var i=t.call(this)||this;i.spineData=e,i.fps=60,i._instanceType="Spine";var n=e;if(e.textures||(r=!0),i.scaleY=-1,n.bones){i.boneContainer=i.addChild(new te),i.bones=[];for(var o=0;o<n.bones.length;o++){var a=new ws(n.bones[o],r?i.boneContainer:null);if(i.bones.push(a),a.data.parent){var s=i.findBone(a.data.parent);s&&s.addChild(a)}else i.boneContainer.addChild(a)}}if(n.ik&&(i.ikConstraints=[],n.ik.forEach((function(t){var e=new Ks(i.findBone(t.target),t.bones.map((function(t){return i.findBone(t)})));e.mix=void 0===t.mix?1:t.mix,e.softness=void 0===t.softness?0:t.softness,e.bendDirection=void 0===t.bendDirection||t.bendDirection?1:-1,e.compress=void 0!==t.compress&&t.compress,e.stretch=void 0!==t.stretch&&t.stretch,e.uniform=void 0!==t.uniform&&t.uniform,i.ikConstraints.push(e)}))),n.slots){i.slotContainer=i.addChildAt(new te,0),i.slots=[],i.tempClipContainers=[];for(var h=0;h<n.slots.length;h++){var u=n.slots[h];a=i.findBone(u.bone);i.slots.push(i.slotContainer.addChild(new Cs(a,u,i))),i.tempClipContainers.push(null)}i.drawOrder=i.slots.slice()}if(n.skins){i.skins=[];var l=n.skins;for(var c in"[object Array]"===Object.prototype.toString.call(n.skins)&&(l={},n.skins.forEach((function(t){l[t.name]=t.attachments}))),l){var p=l[c],d=new As(c);for(var f in p){var v=i.findSlotIndex(f);if(-1==v)throw new Error("Slot not found: "+f);var m=p[f];for(var y in m){var g=i.readAttachment(m[y],d,v,y,null);null!=g&&d.addAttachment(v,y,g)}}i.skins.push(d),"default"==d.name&&(i.defaultSkin=d)}}if(n.animations){var x=[];for(var _ in n.animations){var b=[],T=0,w=n.animations[_];if(w.bones)for(var M in w.bones){var S=w.bones[M];a=i.findBone(M);for(var E in S){var C=new js(a,E,S[E]);b.push(C),T=Math.max(T,C.times[C.times.length-1].time)}}if(w.slots)for(var A in w.slots){var P=w.slots[A],O=i.findSlotIndex(A),R=i.slots[O];for(var I in P){var D=P[I],F=D[D.length-1].time;"attachment"==I?(b.push(new Hs(R,D,i)),T=Math.max(T,F||0)):"color"==I&&(b.push(new Xs(R,D)),T=Math.max(T,F||0))}}if(w.deform)for(var N in w.deform){var k=w.deform[N],L=i.findSkin(N);for(var f in k){var B=k[f],z=i.findSlotIndex(f);R=i.slots[z];for(var U in B){var j=B[U],V=L.getAttachment(z,U),X=new Ws(R,V,j);b.push(X),T=Math.max(T,X.frameTimes[X.frameTimes.length-1])}}}var W=w.drawOrder;if(W){var H=new Ys(i.slots,i.drawOrder,W.map((function(t){return{time:t.time||0,drawOrder:function(){var e=t.offsets;if(!e)return null;for(var r=i.slots.length,n=Bs(r,-1),o=Bs(r-e.length,0),a=0,s=0,h=0;h<e.length;h++){for(var u=e[h],l=i.findSlotIndex(u.slot);a!=l;)o[s++]=a++;n[a+u.offset]=a++}for(;a<r;)o[s++]=a++;for(h=r-1;h>=0;h--)-1==n[h]&&(n[h]=o[--s]);return n}()}})));b.push(H),T=Math.max(T,H.times[H.times.length-1].time)}var Y=new qs(b,T);Y.name=_,x.push(Y)}i.animationManager=new Zs(x)}if(n.slots)for(var G=0;G<i.slots.length;G++){if((R=i.slots[G]).data.attachment){var q=i.defaultSkin.getAttachment(G,R.data.attachment);if(R.setAttachment(q),q instanceof Rs){var Z=q.name,K=i.createSprite(R,q,Z);R.currentSprite=K,R.currentSpriteName=Z,R.addChild(K)}else if(q instanceof Is){var Q=i.createMesh(R,q);R.currentMesh=Q,R.currentMeshName=q.name,R.addChild(Q)}else q instanceof Qs&&(i.createGraphics(R,q),R.addChild(R.clippingContainer),R.addChild(R.currentGraphics))}}return i}return S(e,t),e.prototype.findBone=function(t){for(var e=this.bones,r=0,i=e.length;r<i;r++){var n=e[r];if(n.name==t)return n}return null},e.prototype.sortBone=function(t){if(!t.sorted){var e=t.parent;e&&this.sortBone(e),t.sorted=!0,this.orderCalculations.push(t)}},e.prototype.findSlot=function(t){for(var e=this.slots,r=0;r<e.length;r++)if(e[r].name==t)return e[r];return null},e.prototype.findSlotIndex=function(t){for(var e=this.slots,r=0;r<e.length;r++)if(e[r].name==t)return r;return-1},e.prototype.findSkin=function(t){for(var e=this.skins,r=0,i=e.length;r<i;r++){var n=e[r];if(n.name==t)return n}return null},e.prototype.getAttachment=function(t,e){var r;if(this.skin&&(r=this.skin.getAttachment(t,e)))return r;if(this.defaultSkin&&(r=this.defaultSkin.getAttachment(t,e)))return r;return null},e.prototype.update=function(){var e=Date.now(),r=this.lastTime?.001*(e-this.lastTime):.01667;this.lastTime=e,this.animationManager.update(r*this.fps/60),t.prototype.update.call(this)},e.prototype.updateTransform=function(){this.transform.updateWorldMatrix(this.parent.transform),this._worldAlpha=this.alpha*this.parent._worldAlpha,this.boneContainer&&this.boneContainer.updateTransform(),this.ikConstraints&&this.ikConstraints.forEach((function(t){t.update()})),this.updateSlots(),this.updateDrawOrder(),this.slotContainer.updateTransform()},e.prototype.updateSlots=function(){for(var t=0,e=this.slots.length;t<e;t++){var r=this.slots[t],i=r.attachment;if(i){var n=i.color;if(i instanceof Rs){if(r.currentMesh&&(r.currentMesh.visible=!1,r.currentMesh=null,r.currentMeshName=void 0),!r.currentSpriteName||r.currentSpriteName!==i.name){var o=i.name;if(r.currentSprite&&(r.currentSprite.visible=!1),r.sprites=r.sprites||{},void 0!==r.sprites[o])r.sprites[o].visible=!0;else{var a=this.createSprite(r,i,o);r.addChild(a)}r.currentSprite=r.sprites[o],r.currentSpriteName=o}var s=r.transform;r.bone.matrix.decompose(s),s._localID++,Js[0]=r.color.r*n.r,Js[1]=r.color.g*n.g,Js[2]=r.color.b*n.b,r.currentSprite.tint=Ft(Js)}else if(i instanceof Is){if(r.currentSprite)r.currentSprite.visible=!1,r.currentSprite=null,r.currentSpriteName=void 0,(s=new z)._parentID=-1,s._worldID=r.transform._worldID,r.transform=s;if(!r.currentMeshName||r.currentMeshName!==i.name){var h=i.name;if(r.currentMesh&&(r.currentMesh.visible=!1),r.meshes=r.meshes||{},void 0!==r.meshes[h])r.meshes[h].visible=!0;else{var u=this.createMesh(r,i);r.addChild(u)}r.currentMesh=r.meshes[h],r.currentMeshName=h}i.computeWorldVerticesOld(r,r.currentMesh._vertices,this.bones),r.currentMesh._vertexDirty++,Js[0]=r.color.r*n.r,Js[1]=r.color.g*n.g,Js[2]=r.color.b*n.b,r.currentMesh.tint=Ft(Js)}else{if(!(i instanceof Qs)){r.visible=!1;continue}r.currentGraphics||(this.createGraphics(r,i),r.addChild(r.clippingContainer),r.addChild(r.currentGraphics)),this.updateGraphics(r,i)}r.visible=!0,r.alpha=r.color.a}else r.visible=!1}},e.prototype.updateDrawOrder=function(){for(var t=this.drawOrder,e=null,r=null,i=0,n=t.length;i<n;i++){var o=this.slots.indexOf(t[i]),a=this.slots[o];if(a.currentGraphics&&a.attachment)r=a.clippingContainer,e=a.attachment,r.removeAllChildren(),this.slotContainer.addChildAt(a,i),e.endSlot==a.data&&(e.endSlot=null);else if(r){var s=this.tempClipContainers[i];s||((s=this.tempClipContainers[i]=new te).visible=!1),this.slotContainer.addChildAt(s,i),r.addChild(a),e.endSlot==a.data&&(r=null,e=null)}else this.slotContainer.addChildAt(a,i)}},e.prototype.readAttachment=function(t,e,r,i,n){var o=this.spineData.textures;switch(i=t.name||i,t.type||Gs.region){case Gs.region:var a=new Rs(i,t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,o&&o[t.path||i]);return t.color&&a.color.setFromString(t.color),a;case Gs.mesh:var s=new Is(i);s.texture=o&&o[t.path||i];var h=t.uvs;return this.readVertices(t,s,h.length),s.triangles=t.triangles,s.regionUVs=new Float32Array(h),s.hullLength=2*t.hull||0,s;case Gs.clipping:var u=new Qs(i);if(null==u)return null;var l=t.end;if(l){var c=this.findSlot(l);if(null==c)throw new Error("Clipping end slot not found: "+l);u.endSlot=c.data}var p=t.vertexCount;this.readVertices(t,u,p<<1);var d=t.color;return d&&u.color.setFromString(d),u}return null},e.prototype.readVertices=function(t,e,r){e.worldVerticesLength=r;var i=t.vertices;if(r!=i.length){for(var n=new Array,o=new Array,a=0,s=i.length;a<s;){var h=i[a++];o.push(h);for(var u=a+4*h;a<u;a+=4)o.push(i[a]),n.push(i[a+1]),n.push(i[a+2]),n.push(i[a+3])}e.bones=o,e.vertices=new Float32Array(n)}else{var l=new Float32Array(i);e.vertices=l}},e.prototype.createSprite=function(t,e,r){var i=new _e(e.texture);return i.rotation=e.rotation||0,i.anchorTexture.set(.5,.5),i.position.x=e.x,i.position.y=e.y,i.alpha=e.color.a,e.texture&&(i.scaleX=e.scaleX*e.width/e.texture.width,i.scaleY=-e.scaleY*e.height/e.texture.height),t.sprites=t.sprites||{},t.sprites[r]=i,i},e.prototype.createMesh=function(t,e){var r=new ln(e.texture,new Float32Array(e.regionUVs.length),e.regionUVs,new Uint16Array(e.triangles));return r.canvasPadding=1.5,r.refresh(!0),r.multiplyUvs(),t.meshes=t.meshes||{},t.meshes[e.name]=r,r},e.prototype.createGraphics=function(t,e){var r=new on;return r.beginFill(16777215,1),r.drawPolygon([]),t.currentGraphics=r,t.clippingContainer=new te,t.clippingContainer.mask=t.currentGraphics,r},e.prototype.updateGraphics=function(t,e){var r=t.currentGraphics.graphicsData[0].shape.points,i=e.worldVerticesLength;r.length=i,e.computeWorldVertices(t,0,i,r,0,2,this.bones)},e.prototype.clone=function(){return new e(this.spineData)},e.prototype.setSkin=function(t){var e=this.findSkin(t);e&&this.skin!=e&&(this.addSkin(e)||(e==this.defaultSkin?this.resetSkin():(this.resetSkin(),this.addSkin(e))))},e.prototype.resetSkin=function(){this.skin=this.defaultSkin,this.slots.forEach((function(t){t.setToSetupPose()}))},e.prototype.addSkin=function(t){if(this.skin&&this.skin!=this.defaultSkin)return!1;for(var e=this.slots,r=0,i=e.length;r<i;r++){var n=e[r],o=n.data.attachment;if(o){var a=t.getAttachment(r,o);a&&n.setAttachment(a)}}return this.skin=t,!0},Object.defineProperty(e.prototype,"skinNames",{get:function(){return this.skins&&this.skins.length?this.skins.map((function(t){return t.name})):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aniNames",{get:function(){var t=this.animationManager;return t&&t.animationClips&&t.animationClips.length?t.animationClips.map((function(t){return t.name})):[]},enumerable:!1,configurable:!0}),e}(te);function th(t,e,r,i){i=i||t.replace(".atlas",".png"),Promise.all([new Promise((function(e){oe.loadText((function(t,r){e(t?r:null)}),t)})),new Promise((function(t){oe.loadImage((function(e,r){t(e?fe.fromImage(r):null)}),i)}))]).then((function(i){if(i[0]&&i[1]){var n=eh(i[1],i[0]);e&&e(n)}else r&&r("load failed for atlas:"+t)}))}function eh(t,e){for(var r={},i=new rh(e),n=new Array(4),o=null;;){var a=i.readLine();if(null==a)break;if(0==(a=a.trim()).length);else if(o){var s="true"==i.readValue()?6:0;i.readTuple(n);var h=parseInt(n[0]),u=parseInt(n[1]);i.readTuple(n);var l=parseInt(n[0]),c=parseInt(n[1]);4==i.readTuple(n)&&4==i.readTuple(n)&&i.readTuple(n);var p=parseInt(n[0]),d=parseInt(n[1]);i.readTuple(n);var f=parseInt(n[0]),v=parseInt(n[1]),m=null,y=null,g=new B(0,0,Math.floor(p),Math.floor(d));m=s?new B(Math.floor(h),Math.floor(u),Math.floor(c),Math.floor(l)):new B(Math.floor(h),Math.floor(u),Math.floor(l),Math.floor(c)),(f||v||l!=p||c!=d)&&(y=new B(f,d-c-v,l,c)),r[a]=new me(t,m,g,y,s),i.readValue()}else o={},2==i.readTuple(n)&&i.readTuple(n),i.readTuple(n),i.readValue()}return r}var rh=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}return t.prototype.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var i=0,n=r+1;i<3;i++){var o=e.indexOf(",",n);if(-1==o)break;t[i]=e.substr(n,o-n).trim(),n=o+1}return t[i]=e.substring(n).trim(),i+1},t}();function ih(t,e,r){var i=this;oe.loadAB((function(t,n){return C(i,void 0,void 0,(function(){return A(this,(function(i){if(!t)return r&&r(n),[2];try{nh(n,e)}catch(t){r&&r(t)}return[2]}))}))}),t)}function nh(t,e){var r=new DataView(t,0,12),i=r.getUint32(0,!0),n=r.getUint32(4,!0),o=r.getUint32(8,!0),a="data:image/png;base64,"+Wt(t.slice(12,i+12)),s=Ht(new Uint8Array(t,12+i,n)),h=JSON.parse(Ht(new Uint8Array(t,12+i+n,o)));oe.loadImage((function(t,r){h.textures=eh(fe.fromImage(r),s),e&&e(h)}),a)}var oh=function(t){function e(){var e=t.call(this)||this;e.bgColor="#002002",e.textColor="#0ff0ff",e.PR=3,e.WIDTH=80*e.PR,e.HEIGHT=48*e.PR,e.TEXT_X=3*e.PR,e.TEXT_Y=2*e.PR,e.GRAPH_X=3*e.PR,e.GRAPH_Y=15*e.PR,e.GRAPH_WIDTH=74*e.PR,e.GRAPH_HEIGHT=30*e.PR,e.GRAPH_SIZE=74,e.maxValue=120,e.min=1/0,e.max=0,e.items=[],e.lastTime=Date.now(),e.frames=0;var r=G();return r.width=e.WIDTH,r.height=e.HEIGHT,e.texture=me.fromCanvas(r),e.context=r.getContext("2d"),e.context.font="bold "+9*e.PR+"px Helvetica,Arial,sans-serif",e.context.textBaseline="top",e.updateText("FPS"),e}return S(e,t),e.prototype.reset=function(){this.lastTime=Date.now(),this.min=1/0,this.max=0,this.items.length=0,this.frames=0},e.prototype.update=function(){this.frames++;var e=Date.now();if(e>=this.lastTime+1e3){var r=1e3*this.frames/(e-this.lastTime);this.updatePanel(r),this.lastTime=e,this.frames=0}t.prototype.update.call(this)},e.prototype.updatePanel=function(t){var e=this,r=e.items,i=e.GRAPH_SIZE,n=e.context,o=e.GRAPH_X,a=e.textColor,s=e.GRAPH_Y,h=e.PR,u=e.GRAPH_HEIGHT,l=e.bgColor,c=e.maxValue;for(r.push(t);r.length>i;)r.shift();this.min=Math.min(this.min,t),this.max=Math.max(this.max,t),this.updateText(Math.round(t)+" FPS ("+Math.round(this.min)+"-"+Math.round(this.max)+")");for(var p=0;p<r.length;p++){var d=o+(p+i-r.length)*h;n.fillStyle=a,n.globalAlpha=1,n.fillRect(d,s,h,u),n.fillStyle=l,n.globalAlpha=.9,n.fillRect(d,s,h,Math.round((1-r[p]/c)*u))}this.texture.update()},e.prototype.updateText=function(t){var e=this,r=e.context,i=e.bgColor,n=e.textColor,o=e.WIDTH,a=e.HEIGHT,s=e.TEXT_X,h=e.TEXT_Y,u=e.GRAPH_X,l=e.GRAPH_Y,c=e.GRAPH_WIDTH,p=e.GRAPH_HEIGHT;r.fillStyle=i,r.globalAlpha=1,r.fillRect(0,0,o,a),r.fillStyle=n,r.fillText(t,s,h),r.fillRect(u,l,c,p),r.fillStyle=i,r.globalAlpha=.9,r.fillRect(u,l,c,p)},e}(_e);export{Br as AdjustmentFilter,kr as AdvancedBloomFilter,Mr as AlphaFilter,ra as AmbientLight,Fa as AnimationTrack3D,Da as AnimationType3D,Wt as ArrayBufferToBase64,sa as AxesHelper,m as BLEND_MODES,To as BaseMaterial,fe as BaseTexture,zt as BaseTextureCache,Mn as BitmapText,Tr as BlurFilter,Pr as BlurFilterNew,_r as BlurXFilter,br as BlurYFilter,ua as Box3Helper,Ho as BoxGeometry,On as Button,ui as CanvasRenderer,Go as CircleGeometry,wr as ColorMatrixFilter,te as Container,qo as CylinderGeometry,Ta as D3Renderer,w as DEG_TO_RAD,y as DRAW_MODES,oa as DirectionalLight,dr as DisplacementFilter,$t as DisplayObject,Nn as Ease,bn as EditableText,yo as EnvBlendType,O as EnvType,xo as Euler,I as Event,D as EventDispatcher,lr as FXAAFilter,hr as Filter,ie as FloatDisplay,oh as FpsPanel,Dn as FrameAni,_ as GC_MODES,Fo as Geometry,oe as GlobalLoader,on as Graphics,ha as GridHelper,Jt as GroupD8,nt as INT_BITS1,ot as INT_MAX,at as INT_MIN,Tn as InputText,d as LINE_ALIGNMENT,f as LINE_CAP,v as LINE_JOIN,Qo as LightMaterial,ne as Loader,Zn as Lottie,k as Matrix,vo as Matrix4,ln as Mesh,Oo as Mesh3D,be as MouseEvent,jn as MovieClip,vn as NineSlicePlane,pr as NoiseFilter,bo as Object3D,L as ObservablePoint,ia as OrthographicCamera,b as PI_2,h as PRECISION,ko as PerspectiveCamera,cn as Plane,Yo as PlaneGeometry,N as Point,aa as PointLight,mo as Quaternion,T as RAD_TO_DEG,a as RENDERER_TYPE,zo as Raycaster,B as Rectangle,go as RenderSideType,di as RenderTexture,re as ResponseDataType,Zo as RingGeometry,mn as Rope,po as RotationOrders,g as SCALE_MODES,s as SHAPES,Xo as Scene3D,Un as ScrollList,zn as ScrollListItem,kn as ScrollPage,Ln as ScrollView,ta as ShaderMaterial,Do as ShadowType,sn as Shape,Wo as SphereGeometry,$s as Spine,_e as Sprite,Ts as Sprite3D,ea as Sprite3dMaterial,Cr as SpriteMaskFilter,li as Stage,Vn as SvgaAni,l as TEXT_ALIGN,u as TEXT_GRADIENT,p as TEXT_lINETYPE,_n as TextField,me as Texture,Bt as TextureCache,Ko as TorusGeometry,z as Transform,Pn as Tween,Vo as UniformType,t as VERSION,c as VERTICAL_ALIGN,Bo as Vector2,fo as Vector3,x as WRAP_MODES,Hr as WebglRenderer,st as abs,pn as calculatePlaneIndices,tt as cancelAnimationFrame,Xt as clamp,jt as clearTextureCache,n as cos,ft as countTrailingZeros,G as createCanvas,J as createImage,En as createTextureSheet,eh as createTexturesByAtlas,Ht as decodeText,$o as defaultFragmentShader3d,Jo as defaultVertexShader3d,bt as deinterleave2,wt as deinterleave3,Q as destroyCanvasContent,K as destroyTbCanvas,Ut as destroyTextureCache,At as getBackupCanvasCtx,Ot as getCanvasBitmapStyle,it as getDevicePixelRatio,H as getEnv,Pt as getGradientColor,rt as getOsType,Nt as getRGBA,Rt as hex2rgb,It as hex2string,Z as initedByCanvas,q as initedByTbCanvas,_t as interleave2,Tt as interleave3,lt as isPow2,et as isWebGLSupported,he as loadArrayBuffer,th as loadAtlas,os as loadGltf,ae as loadImage,se as loadJson,le as loadRaw,Cn as loadSheet,ih as loadSpine,ue as loadText,pt as log10,ct as log2,ut as max,ht as min,Mt as nextCombination,vt as nextPow2,yt as parity,ns as parseGltf,nh as parseSpineData,dt as popCount,Lt as premultiplyTint,mt as prevPow2,Vt as removeItems,$ as requestAnimationFrame,xt as reverse,Ft as rgb2hex,Y as setEnv,kt as sign,o as sin,Dt as string2hex,xn as toDisplayDataURL,Ct as uid};
//# sourceMappingURL=fyge.esm.js.map
