@vvfx/sdk 0.1.19-alpha.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/dist/index.js +96633 -14
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +96736 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/config.d.ts +855 -0
- package/dist/src/exporter/config.d.ts +18 -0
- package/dist/src/exporter/const.d.ts +71 -0
- package/dist/src/exporter/export-media.d.ts +68 -0
- package/dist/src/exporter/exporter.d.ts +22 -0
- package/dist/src/exporter/index.d.ts +2 -0
- package/dist/src/exporter/types.d.ts +194 -0
- package/dist/src/exporter/utils.d.ts +22 -0
- package/dist/src/exporter/wav-audio.d.ts +27 -0
- package/dist/src/gesture-handler/gizmo/adsorption-gizmo.d.ts +68 -0
- package/dist/src/gesture-handler/gizmo/control-gizmo.d.ts +67 -0
- package/dist/src/gesture-handler/gizmo/gizmo.d.ts +59 -0
- package/dist/src/gesture-handler/gizmo/icon-gizmo.d.ts +44 -0
- package/dist/src/gesture-handler/gizmo/index.d.ts +6 -0
- package/dist/src/gesture-handler/gizmo/item-create-gizmo.d.ts +43 -0
- package/dist/src/gesture-handler/gizmo/loading-gizmo.d.ts +48 -0
- package/dist/src/gesture-handler/gizmo/mask-gizmo.d.ts +113 -0
- package/dist/src/gesture-handler/gizmo/picture-cut-gizmo.d.ts +94 -0
- package/dist/src/gesture-handler/gizmo/picture-expand-gizmo.d.ts +57 -0
- package/dist/src/gesture-handler/gizmo/preference-gizmo.d.ts +32 -0
- package/dist/src/gesture-handler/gizmo/selector-gizmo.d.ts +101 -0
- package/dist/src/gesture-handler/gizmo/sprite-text-edit-gizmo.d.ts +36 -0
- package/dist/src/gesture-handler/gizmo/text-gizmo.d.ts +128 -0
- package/dist/src/gesture-handler/gizmo/transform-gizmo.d.ts +233 -0
- package/dist/src/gesture-handler/gizmo/type.d.ts +402 -0
- package/dist/src/gesture-handler/index.d.ts +3 -0
- package/dist/src/gesture-handler/src/gesture-handler.d.ts +143 -0
- package/dist/src/gesture-handler/src/icons.d.ts +7 -0
- package/dist/src/gesture-handler/utils.d.ts +2 -0
- package/dist/src/html-overlay/auto-height-runtime.d.ts +13 -0
- package/dist/src/html-overlay/document-runtime.d.ts +4 -0
- package/dist/src/html-overlay/document-transform.d.ts +7 -0
- package/dist/src/html-overlay/dom-order.d.ts +1 -0
- package/dist/src/html-overlay/host-message-runtime.d.ts +3 -0
- package/dist/src/html-overlay/html-viewport-style.d.ts +1 -0
- package/dist/src/html-overlay/index.d.ts +1 -0
- package/dist/src/html-overlay/manager.d.ts +77 -0
- package/dist/src/html-overlay/mime-utils.d.ts +2 -0
- package/dist/src/html-overlay/overlay-transform.d.ts +13 -0
- package/dist/src/html-overlay/path-utils.d.ts +8 -0
- package/dist/src/html-overlay/shell-runtime.d.ts +6 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/math/box2.d.ts +166 -0
- package/dist/src/math/circle.d.ts +82 -0
- package/dist/src/math/euler.d.ts +20 -0
- package/dist/src/math/index.d.ts +13 -0
- package/dist/src/math/line2.d.ts +93 -0
- package/dist/src/math/line3.d.ts +17 -0
- package/dist/src/math/matrix4.d.ts +28 -0
- package/dist/src/math/plane.d.ts +14 -0
- package/dist/src/math/quaternion.d.ts +3 -0
- package/dist/src/math/ray-caster.d.ts +10 -0
- package/dist/src/math/ray.d.ts +18 -0
- package/dist/src/math/type.d.ts +32 -0
- package/dist/src/math/utils.d.ts +19 -0
- package/dist/src/math/vector2.d.ts +30 -0
- package/dist/src/math/vector3.d.ts +29 -0
- package/dist/src/screen-shot/index.d.ts +1 -0
- package/dist/src/screen-shot/screen-shot.d.ts +35 -0
- package/dist/src/sdk-item/base-item.d.ts +126 -0
- package/dist/src/sdk-item/card-item.d.ts +67 -0
- package/dist/src/sdk-item/effects-item.d.ts +70 -0
- package/dist/src/sdk-item/frame-item.d.ts +112 -0
- package/dist/src/sdk-item/generator-item.d.ts +86 -0
- package/dist/src/sdk-item/group-item.d.ts +57 -0
- package/dist/src/sdk-item/index.d.ts +36 -0
- package/dist/src/sdk-item/sprite-item.d.ts +67 -0
- package/dist/src/sdk-item/text-item.d.ts +107 -0
- package/dist/src/sdk-item/types.d.ts +153 -0
- package/dist/src/sdk-item/video-item.d.ts +87 -0
- package/dist/src/sdk.d.ts +589 -0
- package/dist/src/service/UndoRedo.d.ts +48 -0
- package/dist/src/shared/index.d.ts +1 -0
- package/dist/src/shared/player.d.ts +9 -0
- package/dist/src/size-adapte/index.d.ts +1 -0
- package/dist/src/size-adapte/size-adapt.d.ts +28 -0
- package/dist/src/types.d.ts +1298 -0
- package/dist/src/utils/background-manager.d.ts +72 -0
- package/dist/src/utils/common-utils.d.ts +28 -0
- package/dist/src/utils/index.d.ts +8 -0
- package/dist/src/utils/interaction-utils.d.ts +60 -0
- package/dist/src/utils/json-data-utils.d.ts +165 -0
- package/dist/src/utils/layout-utils.d.ts +219 -0
- package/dist/src/utils/page-data-utils.d.ts +372 -0
- package/dist/src/utils/player-data-utils.d.ts +11 -0
- package/dist/src/utils/types.d.ts +114 -0
- package/dist/src/wireframe/common/box.d.ts +1 -0
- package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
- package/dist/src/wireframe/common/line.d.ts +1 -0
- package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
- package/dist/src/wireframe/common/pixi.d.ts +18 -0
- package/dist/src/wireframe/index.d.ts +4 -0
- package/package.json +42 -22
- package/dist/index.cjs +0 -14
- package/dist/index.d.cts +0 -3485
- package/dist/index.d.ts +0 -3485
- package/dist/index.global.js +0 -333
package/dist/index.global.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
"use strict";var vvfxSDK=(()=>{var t,e,i,r,n,s,o,a,h,l,c,u,d,f,p=Object.create,m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,y=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,b=t=>{throw TypeError(t)},_=(t=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(t,{get:(t,e)=>("undefined"!=typeof require?require:t)[e]}):t)(function(t){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),w=(t,e)=>function(){return t&&(e=(0,t[v(t)[0]])(t=0)),e},T=(t,e)=>function(){return e||(0,t[v(t)[0]])((e={exports:{}}).exports,e),e.exports},E=(t,e)=>{for(var i in e)m(t,i,{get:e[i],enumerable:!0})},S=(t,e,i,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of v(e))x.call(t,n)||n===i||m(t,n,{get:()=>e[n],enumerable:!(r=g(e,n))||r.enumerable});return t},I=(t,e,i)=>(i=null!=t?p(y(t)):{},S(!e&&t&&t.__esModule?i:m(i,"default",{value:t,enumerable:!0}),t)),A=(t,e,i)=>((t,e,i)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i),C=(t,e,i)=>e.has(t)||b("Cannot "+i),P=(t,e,i)=>(C(t,e,"read from private field"),i?i.call(t):e.get(t)),M=(t,e,i)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),R=(t,e,i,r)=>(C(t,e,"write to private field"),r?r.call(t,i):e.set(t,i),i),O=T({"../../node_modules/.pnpm/eventemitter3@3.1.2/node_modules/eventemitter3/index.js"(t,e){var i=Object.prototype.hasOwnProperty,r="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new s(i,n||t,o),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new n:delete t._events[e]}function h(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),h.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)i.call(t,e)&&n.push(r?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},h.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o},h.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},h.prototype.emit=function(t,e,i,n,s,o){var a=r?r+t:t;if(!this._events[a])return!1;var h,l,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,n),!0;case 5:return c.fn.call(c.context,e,i,n,s),!0;case 6:return c.fn.call(c.context,e,i,n,s,o),!0}for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];c.fn.apply(c.context,h)}else{var d,f=c.length;for(l=0;l<f;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,i);break;case 4:c[l].fn.call(c[l].context,e,i,n);break;default:if(!h)for(d=1,h=new Array(u-1);d<u;d++)h[d-1]=arguments[d];c[l].fn.apply(c[l].context,h)}}return!0},h.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},h.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},h.prototype.removeListener=function(t,e,i,n){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||n&&!o.once||i&&o.context!==i||a(this,s);else{for(var h=0,l=[],c=o.length;h<c;h++)(o[h].fn!==e||n&&!o[h].once||i&&o[h].context!==i)&&l.push(o[h]);l.length?this._events[s]=1===l.length?l[0]:l:a(this,s)}return this},h.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=r,h.EventEmitter=h,void 0!==e&&(e.exports=h)}}),D=T({"../../node_modules/.pnpm/earcut@2.2.4/node_modules/earcut/src/earcut.js"(t,e){function i(t,e,i){i=i||2;var n,o,a,h,l,d,f,m=e&&e.length,g=m?e[0]*i:t.length,v=r(t,0,g,i,!0),y=[];if(!v||v.next===v.prev)return y;if(m&&(v=function(t,e,i,n){var s,o,a,h=[];for(s=0,o=e.length;s<o;s++)(a=r(t,e[s]*n,s<o-1?e[s+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),h.push(p(a));for(h.sort(c),s=0;s<h.length;s++)i=u(h[s],i);return i}(t,e,v,i)),t.length>80*i){n=a=t[0],o=h=t[1];for(var x=i;x<g;x+=i)(l=t[x])<n&&(n=l),(d=t[x+1])<o&&(o=d),l>a&&(a=l),d>h&&(h=d);f=0!==(f=Math.max(a-n,h-o))?32767/f:0}return s(v,y,i,n,o,f,0),y}function r(t,e,i,r,n){var s,o;if(n===A(t,e,i,r)>0)for(s=e;s<i;s+=r)o=E(s,t[s],t[s+1],o);else for(s=i-r;s>=e;s-=r)o=E(s,t[s],t[s+1],o);return o&&y(o,o.next)&&(S(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!y(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(S(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function s(t,e,i,r,c,u,d){if(t){!d&&u&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=f(n.x,n.y,e,i,r)),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,i,r,n,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,r=i,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(h=l;a>0||h>0&&r;)0!==a&&(0===h||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,h--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,l*=2}while(o>1)}(n)}(t,r,c,u);for(var p,m,g=t;t.prev!==t.next;)if(p=t.prev,m=t.next,u?a(t,r,c,u):o(t))e.push(p.i/i|0),e.push(t.i/i|0),e.push(m.i/i|0),S(t),t=m.next,g=m.next;else if((t=m)===g){d?1===d?s(t=h(n(t),e,i),e,i,r,c,u,2):2===d&&l(t,e,i,r,c,u):s(n(t),e,i,r,c,u,1);break}}}function o(t){var e=t.prev,i=t,r=t.next;if(v(e,i,r)>=0)return!1;for(var n=e.x,s=i.x,o=r.x,a=e.y,h=i.y,l=r.y,c=n<s?n<o?n:o:s<o?s:o,u=a<h?a<l?a:l:h<l?h:l,d=n>s?n>o?n:o:s>o?s:o,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==e;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&m(n,a,s,h,o,l,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function a(t,e,i,r){var n=t.prev,s=t,o=t.next;if(v(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,l=o.x,c=n.y,u=s.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,g=c<u?c<d?c:d:u<d?u:d,y=a>h?a>l?a:l:h>l?h:l,x=c>u?c>d?c:d:u>d?u:d,b=f(p,g,e,i,r),_=f(y,x,e,i,r),w=t.prevZ,T=t.nextZ;w&&w.z>=b&&T&&T.z<=_;){if(w.x>=p&&w.x<=y&&w.y>=g&&w.y<=x&&w!==n&&w!==o&&m(a,c,h,u,l,d,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,T.x>=p&&T.x<=y&&T.y>=g&&T.y<=x&&T!==n&&T!==o&&m(a,c,h,u,l,d,T.x,T.y)&&v(T.prev,T,T.next)>=0)return!1;T=T.nextZ}for(;w&&w.z>=b;){if(w.x>=p&&w.x<=y&&w.y>=g&&w.y<=x&&w!==n&&w!==o&&m(a,c,h,u,l,d,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;T&&T.z<=_;){if(T.x>=p&&T.x<=y&&T.y>=g&&T.y<=x&&T!==n&&T!==o&&m(a,c,h,u,l,d,T.x,T.y)&&v(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function h(t,e,i){var r=t;do{var s=r.prev,o=r.next.next;!y(s,o)&&x(s,r,r.next,o)&&w(s,o)&&w(o,s)&&(e.push(s.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),S(r),S(r.next),r=t=o),r=r.next}while(r!==t);return n(r)}function l(t,e,i,r,o,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&g(h,l)){var c=T(h,l);return h=n(h,h.next),c=n(c,c.next),s(h,e,i,r,o,a,0),void s(c,e,i,r,o,a,0)}l=l.next}h=h.next}while(h!==t)}function c(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,r=e,n=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o&&(o=a,i=r.x<r.next.x?r:r.next,a===n))return i}r=r.next}while(r!==e);if(!i)return null;var h,l=i,c=i.x,u=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&m(s<u?n:o,s,c,u,s<u?o:n,s,r.x,r.y)&&(h=Math.abs(s-r.y)/(n-r.x),w(r,t)&&(h<f||h===f&&(r.x>i.x||r.x===i.x&&d(i,r)))&&(i=r,f=h)),r=r.next}while(r!==l);return i}(t,e);if(!i)return e;var r=T(i,t);return n(r,r.next),n(i,i.next)}function d(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function f(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function m(t,e,i,r,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(n-o)*(r-a)}function g(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&x(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||y(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,i,r){var n=_(v(t,e,i)),s=_(v(t,e,r)),o=_(v(i,r,t)),a=_(v(i,r,e));return n!==s&&o!==a||(!(0!==n||!b(t,i,e))||(!(0!==s||!b(t,r,e))||(!(0!==o||!b(i,t,r))||!(0!==a||!b(i,e,r)))))}function b(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function _(t){return t>0?1:t<0?-1:0}function w(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function T(t,e){var i=new I(t.i,t.x,t.y),r=new I(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function E(t,e,i,r){var n=new I(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function S(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 I(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(t,e,i,r){for(var n=0,s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}e.exports=i,e.exports.default=i,i.deviation=function(t,e,i,r){var n=e&&e.length,s=n?e[0]*i:t.length,o=Math.abs(A(t,0,s,i));if(n)for(var a=0,h=e.length;a<h;a++){var l=e[a]*i,c=a<h-1?e[a+1]*i:t.length;o-=Math.abs(A(t,l,c,i))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,p=r[a+2]*i;u+=Math.abs((t[d]-t[p])*(t[f+1]-t[d+1])-(t[d]-t[f])*(t[p+1]-t[d+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},i.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)i.vertices.push(t[n][s][o]);n>0&&(r+=t[n-1].length,i.holes.push(r))}return i}}}),k=T({"../../node_modules/.pnpm/punycode@1.4.1/node_modules/punycode/punycode.js"(t,e){!function(i){var r="object"==typeof t&&t&&!t.nodeType&&t,n="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof global&&global;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var o,a,h=2147483647,l=36,c=/^xn--/,u=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,m=String.fromCharCode;function g(t){throw new RangeError(f[t])}function v(t,e){for(var i=t.length,r=[];i--;)r[i]=e(t[i]);return r}function y(t,e){var i=t.split("@"),r="";return i.length>1&&(r=i[0]+"@",t=i[1]),r+v((t=t.replace(d,".")).split("."),e).join(".")}function x(t){for(var e,i,r=[],n=0,s=t.length;n<s;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<s?56320==(64512&(i=t.charCodeAt(n++)))?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--):r.push(e);return r}function b(t){return v(t,function(t){var e="";return t>65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=m(t)}).join("")}function _(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:l}function w(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,i){var r=0;for(t=i?p(t/700):t>>1,t+=p(t/e);t>455;r+=l)t=p(t/35);return p(r+36*t/(t+38))}function E(t){var e,i,r,n,s,o,a,c,u,d,f=[],m=t.length,v=0,y=128,x=72;for((i=t.lastIndexOf("-"))<0&&(i=0),r=0;r<i;++r)t.charCodeAt(r)>=128&&g("not-basic"),f.push(t.charCodeAt(r));for(n=i>0?i+1:0;n<m;){for(s=v,o=1,a=l;n>=m&&g("invalid-input"),((c=_(t.charCodeAt(n++)))>=l||c>p((h-v)/o))&&g("overflow"),v+=c*o,!(c<(u=a<=x?1:a>=x+26?26:a-x));a+=l)o>p(h/(d=l-u))&&g("overflow"),o*=d;x=T(v-s,e=f.length+1,0==s),p(v/e)>h-y&&g("overflow"),y+=p(v/e),v%=e,f.splice(v++,0,y)}return b(f)}function S(t){var e,i,r,n,s,o,a,c,u,d,f,v,y,b,_,E=[];for(v=(t=x(t)).length,e=128,i=0,s=72,o=0;o<v;++o)(f=t[o])<128&&E.push(m(f));for(r=n=E.length,n&&E.push("-");r<v;){for(a=h,o=0;o<v;++o)(f=t[o])>=e&&f<a&&(a=f);for(a-e>p((h-i)/(y=r+1))&&g("overflow"),i+=(a-e)*y,e=a,o=0;o<v;++o)if((f=t[o])<e&&++i>h&&g("overflow"),f==e){for(c=i,u=l;!(c<(d=u<=s?1:u>=s+26?26:u-s));u+=l)_=c-d,b=l-d,E.push(m(w(d+_%b,0))),c=p(_/b);E.push(m(w(c,0))),s=T(i,y,r==n),i=0,++r}++i,++e}return E.join("")}if(o={version:"1.4.1",ucs2:{decode:x,encode:b},decode:E,encode:S,toASCII:function(t){return y(t,function(t){return u.test(t)?"xn--"+S(t):t})},toUnicode:function(t){return y(t,function(t){return c.test(t)?E(t.slice(4).toLowerCase()):t})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return o});else if(r&&n)if(e.exports==r)n.exports=o;else for(a in o)o.hasOwnProperty(a)&&(r[a]=o[a]);else i.punycode=o}(t)}}),L=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(t,e){e.exports=TypeError}}),F=T({"(disabled):../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/util.inspect"(){}}),N=T({"../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/index.js"(t,e){var i="function"==typeof Map&&Map.prototype,r=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=i&&r&&"function"==typeof r.get?r.get:null,s=i&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,a=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,h=o&&a&&"function"==typeof a.get?a.get:null,l=o&&Set.prototype.forEach,c="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,u="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,g=String.prototype.match,v=String.prototype.slice,y=String.prototype.replace,x=String.prototype.toUpperCase,b=String.prototype.toLowerCase,_=RegExp.prototype.test,w=Array.prototype.concat,T=Array.prototype.join,E=Array.prototype.slice,S=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,A=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,M="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,O=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function D(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||_.call(/e/,e))return e;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var r=t<0?-S(-t):S(t);if(r!==t){var n=String(r),s=v.call(e,n.length+1);return y.call(n,i,"$&_")+"."+y.call(y.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(e,i,"$&_")}var k=F(),L=k.custom,N=W(L)?L:null,B={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function U(t,e,i){var r=i.quoteStyle||e,n=B[r];return n+t+n}function V(t){return y.call(String(t),/"/g,""")}function G(t){return!M||!("object"==typeof t&&(M in t||void 0!==t[M]))}function j(t){return"[object Array]"===q(t)&&G(t)}function H(t){return"[object RegExp]"===q(t)&&G(t)}function W(t){if(P)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!C)return!1;try{return C.call(t),!0}catch(t){}return!1}e.exports=function t(e,i,r,o){var a=i||{};if(Y(a,"quoteStyle")&&!Y(B,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Y(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var p=!Y(a,"customInspect")||a.customInspect;if("boolean"!=typeof p&&"symbol"!==p)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Y(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Y(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var x=a.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return Z(e,a);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var _=String(e);return x?D(e,_):_}if("bigint"==typeof e){var S=String(e)+"n";return x?D(e,S):S}var A=void 0===a.depth?5:a.depth;if(void 0===r&&(r=0),r>=A&&A>0&&"object"==typeof e)return j(e)?"[Array]":"[Object]";var L=function(t,e){var i;if("\t"===t.indent)i="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;i=T.call(Array(t.indent+1)," ")}return{base:i,prev:T.call(Array(e+1),i)}}(a,r);if(void 0===o)o=[];else if(K(o,e)>=0)return"[Circular]";function F(e,i,n){if(i&&(o=E.call(o)).push(i),n){var s={depth:a.depth};return Y(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),t(e,s,r+1,o)}return t(e,a,r+1,o)}if("function"==typeof e&&!H(e)){var z=function(t){if(t.name)return t.name;var e=g.call(m.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),X=it(e,F);return"[Function"+(z?": "+z:" (anonymous)")+"]"+(X.length>0?" { "+T.call(X,", ")+" }":"")}if(W(e)){var J=P?y.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(e);return"object"!=typeof e||P?J:$(J)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var rt="<"+b.call(String(e.nodeName)),nt=e.attributes||[],st=0;st<nt.length;st++)rt+=" "+nt[st].name+"="+U(V(nt[st].value),"double",a);return rt+=">",e.childNodes&&e.childNodes.length&&(rt+="..."),rt+="</"+b.call(String(e.nodeName))+">"}if(j(e)){if(0===e.length)return"[]";var ot=it(e,F);return L&&!function(t){for(var e=0;e<t.length;e++)if(K(t[e],"\n")>=0)return!1;return!0}(ot)?"["+et(ot,L)+"]":"[ "+T.call(ot,", ")+" ]"}if(function(t){return"[object Error]"===q(t)&&G(t)}(e)){var at=it(e,F);return"cause"in Error.prototype||!("cause"in e)||R.call(e,"cause")?0===at.length?"["+String(e)+"]":"{ ["+String(e)+"] "+T.call(at,", ")+" }":"{ ["+String(e)+"] "+T.call(w.call("[cause]: "+F(e.cause),at),", ")+" }"}if("object"==typeof e&&p){if(N&&"function"==typeof e[N]&&k)return k(e,{depth:A-r});if("symbol"!==p&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!n||!t||"object"!=typeof t)return!1;try{n.call(t);try{h.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return s&&s.call(e,function(t,i){ht.push(F(i,e,!0)+" => "+F(t,e))}),tt("Map",n.call(e),ht,L)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t);try{n.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var lt=[];return l&&l.call(e,function(t){lt.push(F(t,e))}),tt("Set",h.call(e),lt,L)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{u.call(t,u)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t,u);try{c.call(t,c)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return"[object Number]"===q(t)&&G(t)}(e))return $(F(Number(e)));if(function(t){if(!t||"object"!=typeof t||!I)return!1;try{return I.call(t),!0}catch(t){}return!1}(e))return $(F(I.call(e)));if(function(t){return"[object Boolean]"===q(t)&&G(t)}(e))return $(f.call(e));if(function(t){return"[object String]"===q(t)&&G(t)}(e))return $(F(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||"undefined"!=typeof global&&e===global)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===q(t)&&G(t)}(e)&&!H(e)){var ct=it(e,F),ut=O?O(e)===Object.prototype:e instanceof Object||e.constructor===Object,dt=e instanceof Object?"":"null prototype",ft=!ut&&M&&Object(e)===e&&M in e?v.call(q(e),8,-1):dt?"Object":"",pt=(ut||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ft||dt?"["+T.call(w.call([],ft||[],dt||[]),": ")+"] ":"");return 0===ct.length?pt+"{}":L?pt+"{"+et(ct,L)+"}":pt+"{ "+T.call(ct,", ")+" }"}return String(e)};var X=Object.prototype.hasOwnProperty||function(t){return t in this};function Y(t,e){return X.call(t,e)}function q(t){return p.call(t)}function K(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,r=t.length;i<r;i++)if(t[i]===e)return i;return-1}function Z(t,e){if(t.length>e.maxStringLength){var i=t.length-e.maxStringLength,r="... "+i+" more character"+(i>1?"s":"");return Z(v.call(t,0,e.maxStringLength),e)+r}var n=z[e.quoteStyle||"single"];return n.lastIndex=0,U(y.call(y.call(t,n,"\\$1"),/[\x00-\x1f]/g,J),"single",e)}function J(t){var e=t.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return i?"\\"+i:"\\x"+(e<16?"0":"")+x.call(e.toString(16))}function $(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function tt(t,e,i,r){return t+" ("+e+") {"+(r?et(i,r):T.call(i,", "))+"}"}function et(t,e){if(0===t.length)return"";var i="\n"+e.prev+e.base;return i+T.call(t,","+i)+"\n"+e.prev}function it(t,e){var i=j(t),r=[];if(i){r.length=t.length;for(var n=0;n<t.length;n++)r[n]=Y(t,n)?e(t[n],t):""}var s,o="function"==typeof A?A(t):[];if(P){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var h in t)Y(t,h)&&(i&&String(Number(h))===h&&h<t.length||P&&s["$"+h]instanceof Symbol||(_.call(/[^\w$]/,h)?r.push(e(h,t)+": "+e(t[h],t)):r.push(h+": "+e(t[h],t))));if("function"==typeof A)for(var l=0;l<o.length;l++)R.call(t,o[l])&&r.push("["+e(o[l])+"]: "+e(t[o[l]],t));return r}}}),B=T({"../../node_modules/.pnpm/side-channel-list@1.0.0/node_modules/side-channel-list/index.js"(t,e){var i=N(),r=L(),n=function(t,e,i){for(var r,n=t;null!=(r=n.next);n=r)if(r.key===e)return n.next=r.next,i||(r.next=t.next,t.next=r),r};e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new r("Side channel does not contain "+i(t))},delete:function(e){var i=t&&t.next,r=function(t,e){if(t)return n(t,e,!0)}(t,e);return r&&i&&i===r&&(t=void 0),!!r},get:function(e){return function(t,e){if(t){var i=n(t,e);return i&&i.value}}(t,e)},has:function(e){return function(t,e){return!!t&&!!n(t,e)}(t,e)},set:function(e,i){t||(t={next:void 0}),function(t,e,i){var r=n(t,e);r?r.value=i:t.next={key:e,next:t.next,value:i}}(t,e,i)}};return e}}}),z=T({"../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(t,e){e.exports=Object}}),U=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(t,e){e.exports=Error}}),V=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(t,e){e.exports=EvalError}}),G=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(t,e){e.exports=RangeError}}),j=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(t,e){e.exports=ReferenceError}}),H=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(t,e){e.exports=SyntaxError}}),W=T({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(t,e){e.exports=URIError}}),X=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(t,e){e.exports=Math.abs}}),Y=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(t,e){e.exports=Math.floor}}),q=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(t,e){e.exports=Math.max}}),K=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(t,e){e.exports=Math.min}}),Z=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(t,e){e.exports=Math.pow}}),J=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(t,e){e.exports=Math.round}}),$=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(t,e){e.exports=Number.isNaN||function(t){return t!=t}}}),Q=T({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(t,e){var i=$();e.exports=function(t){return i(t)||0===t?t:t<0?-1:1}}}),tt=T({"../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(t,e){e.exports=Object.getOwnPropertyDescriptor}}),et=T({"../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(t,e){var i=tt();if(i)try{i([],"length")}catch(t){i=null}e.exports=i}}),it=T({"../../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(t,e){var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(t){i=!1}e.exports=i}}),rt=T({"../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(t,e){e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),i=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(var r in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(t,e);if(42!==s.value||!0!==s.enumerable)return!1}return!0}}}),nt=T({"../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(t,e){var i="undefined"!=typeof Symbol&&Symbol,r=rt();e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&r())))}}}),st=T({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(t,e){e.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null}}),ot=T({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(t,e){var i=z();e.exports=i.getPrototypeOf||null}}),at=T({"../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(t,e){var i=Object.prototype.toString,r=Math.max,n=function(t,e){for(var i=[],r=0;r<t.length;r+=1)i[r]=t[r];for(var n=0;n<e.length;n+=1)i[n+t.length]=e[n];return i};e.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==i.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var s,o=function(t,e){for(var i=[],r=e||0,n=0;r<t.length;r+=1,n+=1)i[n]=t[r];return i}(arguments,1),a=r(0,e.length-o.length),h=[],l=0;l<a;l++)h[l]="$"+l;if(s=Function("binder","return function ("+function(t,e){for(var i="",r=0;r<t.length;r+=1)i+=t[r],r+1<t.length&&(i+=e);return i}(h,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof s){var i=e.apply(this,n(o,arguments));return Object(i)===i?i:this}return e.apply(t,n(o,arguments))}),e.prototype){var c=function(){};c.prototype=e.prototype,s.prototype=new c,c.prototype=null}return s}}}),ht=T({"../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(t,e){var i=at();e.exports=Function.prototype.bind||i}}),lt=T({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(t,e){e.exports=Function.prototype.call}}),ct=T({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(t,e){e.exports=Function.prototype.apply}}),ut=T({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(t,e){e.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply}}),dt=T({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(t,e){var i=ht(),r=ct(),n=lt(),s=ut();e.exports=s||i.call(n,r)}}),ft=T({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(t,e){var i=ht(),r=L(),n=lt(),s=dt();e.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new r("a function is required");return s(i,n,t)}}}),pt=T({"../../node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(t,e){var i,r=ft(),n=et();try{i=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var s=!!i&&n&&n(Object.prototype,"__proto__"),o=Object,a=o.getPrototypeOf;e.exports=s&&"function"==typeof s.get?r([s.get]):"function"==typeof a&&function(t){return a(null==t?t:o(t))}}}),mt=T({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(t,e){var i=st(),r=ot(),n=pt();e.exports=i?function(t){return i(t)}:r?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return r(t)}:n?function(t){return n(t)}:null}}),gt=T({"../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(t,e){var i=Function.prototype.call,r=Object.prototype.hasOwnProperty,n=ht();e.exports=n.call(i,r)}}),vt=T({"../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(t,e){var i,r,n=z(),s=U(),o=V(),a=G(),h=j(),l=H(),c=L(),u=W(),d=X(),f=Y(),p=q(),m=K(),g=Z(),v=J(),y=Q(),x=Function,b=function(t){try{return x('"use strict"; return ('+t+").constructor;")()}catch(t){}},_=et(),w=it(),T=function(){throw new c},E=_?function(){try{return T}catch(t){try{return _(arguments,"callee").get}catch(t){return T}}}():T,S=nt()(),I=mt(),A=ot(),C=st(),P=ct(),M=lt(),R={},O="undefined"!=typeof Uint8Array&&I?I(Uint8Array):i,D={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":S&&I?I([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":s,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":R,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":S&&I?I(I([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&S&&I?I((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":a,"%ReferenceError%":h,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&S&&I?I((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":S&&I?I(""[Symbol.iterator]()):i,"%Symbol%":S?Symbol:i,"%SyntaxError%":l,"%ThrowTypeError%":E,"%TypedArray%":O,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":M,"%Function.prototype.apply%":P,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":A,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":v,"%Math.sign%":y,"%Reflect.getPrototypeOf%":C};if(I)try{null.error}catch(t){r=I(I(t)),D["%Error.prototype%"]=r}var k=function t(e){var i;if("%AsyncFunction%"===e)i=b("async function () {}");else if("%GeneratorFunction%"===e)i=b("function* () {}");else if("%AsyncGeneratorFunction%"===e)i=b("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(i=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&I&&(i=I(n.prototype))}return D[e]=i,i},F={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},N=ht(),B=gt(),$=N.call(M,Array.prototype.concat),tt=N.call(P,Array.prototype.splice),rt=N.call(M,String.prototype.replace),at=N.call(M,String.prototype.slice),ut=N.call(M,RegExp.prototype.exec),dt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ft=/\\(\\)?/g,pt=function(t,e){var i,r=t;if(B(F,r)&&(r="%"+(i=F[r])[0]+"%"),B(D,r)){var n=D[r];if(n===R&&(n=k(r)),void 0===n&&!e)throw new c("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:n}}throw new l("intrinsic "+t+" does not exist!")};e.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new c('"allowMissing" argument must be a boolean');if(null===ut(/^%?[^%]*%?$/,t))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(t){var e=at(t,0,1),i=at(t,-1);if("%"===e&&"%"!==i)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==e)throw new l("invalid intrinsic syntax, expected opening `%`");var r=[];return rt(t,dt,function(t,e,i,n){r[r.length]=i?rt(n,ft,"$1"):e||t}),r}(t),r=i.length>0?i[0]:"",n=pt("%"+r+"%",e),s=n.name,o=n.value,a=!1,h=n.alias;h&&(r=h[0],tt(i,$([0,1],h)));for(var u=1,d=!0;u<i.length;u+=1){var f=i[u],p=at(f,0,1),m=at(f,-1);if(('"'===p||"'"===p||"`"===p||'"'===m||"'"===m||"`"===m)&&p!==m)throw new l("property names with quotes must have matching quotes");if("constructor"!==f&&d||(a=!0),B(D,s="%"+(r+="."+f)+"%"))o=D[s];else if(null!=o){if(!(f in o)){if(!e)throw new c("base intrinsic for "+t+" exists, but the property is not available.");return}if(_&&u+1>=i.length){var g=_(o,f);o=(d=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:o[f]}else d=B(o,f),o=o[f];d&&!a&&(D[s]=o)}}return o}}}),yt=T({"../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(t,e){var i=vt(),r=ft(),n=r([i("%String.prototype.indexOf%")]);e.exports=function(t,e){var s=i(t,!!e);return"function"==typeof s&&n(t,".prototype.")>-1?r([s]):s}}}),xt=T({"../../node_modules/.pnpm/side-channel-map@1.0.1/node_modules/side-channel-map/index.js"(t,e){var i=vt(),r=yt(),n=N(),s=L(),o=i("%Map%",!0),a=r("Map.prototype.get",!0),h=r("Map.prototype.set",!0),l=r("Map.prototype.has",!0),c=r("Map.prototype.delete",!0),u=r("Map.prototype.size",!0);e.exports=!!o&&function(){var t,e={assert:function(t){if(!e.has(t))throw new s("Side channel does not contain "+n(t))},delete:function(e){if(t){var i=c(t,e);return 0===u(t)&&(t=void 0),i}return!1},get:function(e){if(t)return a(t,e)},has:function(e){return!!t&&l(t,e)},set:function(e,i){t||(t=new o),h(t,e,i)}};return e}}}),bt=T({"../../node_modules/.pnpm/side-channel-weakmap@1.0.2/node_modules/side-channel-weakmap/index.js"(t,e){var i=vt(),r=yt(),n=N(),s=xt(),o=L(),a=i("%WeakMap%",!0),h=r("WeakMap.prototype.get",!0),l=r("WeakMap.prototype.set",!0),c=r("WeakMap.prototype.has",!0),u=r("WeakMap.prototype.delete",!0);e.exports=a?function(){var t,e,i={assert:function(t){if(!i.has(t))throw new o("Side channel does not contain "+n(t))},delete:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(t)return u(t,i)}else if(s&&e)return e.delete(i);return!1},get:function(i){return a&&i&&("object"==typeof i||"function"==typeof i)&&t?h(t,i):e&&e.get(i)},has:function(i){return a&&i&&("object"==typeof i||"function"==typeof i)&&t?c(t,i):!!e&&e.has(i)},set:function(i,r){a&&i&&("object"==typeof i||"function"==typeof i)?(t||(t=new a),l(t,i,r)):s&&(e||(e=s()),e.set(i,r))}};return i}:s}}),_t=T({"../../node_modules/.pnpm/side-channel@1.1.0/node_modules/side-channel/index.js"(t,e){var i=L(),r=N(),n=B(),s=xt(),o=bt()||s||n;e.exports=function(){var t,e={assert:function(t){if(!e.has(t))throw new i("Side channel does not contain "+r(t))},delete:function(e){return!!t&&t.delete(e)},get:function(e){return t&&t.get(e)},has:function(e){return!!t&&t.has(e)},set:function(e,i){t||(t=o()),t.set(e,i)}};return e}}}),wt=T({"../../node_modules/.pnpm/qs@6.14.0/node_modules/qs/lib/formats.js"(t,e){var i=String.prototype.replace,r=/%20/g,n="RFC1738",s="RFC3986";e.exports={default:s,formatters:{RFC1738:function(t){return i.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:n,RFC3986:s}}}),Tt=T({"../../node_modules/.pnpm/qs@6.14.0/node_modules/qs/lib/utils.js"(t,e){var i=wt(),r=Object.prototype.hasOwnProperty,n=Array.isArray,s=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),o=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)void 0!==t[r]&&(i[r]=t[r]);return i},a=1024;e.exports={arrayToObject:o,assign:function(t,e){return Object.keys(e).reduce(function(t,i){return t[i]=e[i],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],r=0;r<e.length;++r)for(var s=e[r],o=s.obj[s.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],c=o[l];"object"==typeof c&&null!==c&&-1===i.indexOf(c)&&(e.push({obj:o,prop:l}),i.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(n(i)){for(var r=[],s=0;s<i.length;++s)void 0!==i[s]&&r.push(i[s]);e.obj[e.prop]=r}}}(e),t},decode:function(t,e,i){var r=t.replace(/\+/g," ");if("iso-8859-1"===i)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},encode:function(t,e,r,n,o){if(0===t.length)return t;var h=t;if("symbol"==typeof t?h=Symbol.prototype.toString.call(t):"string"!=typeof t&&(h=String(t)),"iso-8859-1"===r)return escape(h).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var l="",c=0;c<h.length;c+=a){for(var u=h.length>=a?h.slice(c,c+a):h,d=[],f=0;f<u.length;++f){var p=u.charCodeAt(f);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===i.RFC1738&&(40===p||41===p)?d[d.length]=u.charAt(f):p<128?d[d.length]=s[p]:p<2048?d[d.length]=s[192|p>>6]+s[128|63&p]:p<55296||p>=57344?d[d.length]=s[224|p>>12]+s[128|p>>6&63]+s[128|63&p]:(f+=1,p=65536+((1023&p)<<10|1023&u.charCodeAt(f)),d[d.length]=s[240|p>>18]+s[128|p>>12&63]+s[128|p>>6&63]+s[128|63&p])}l+=d.join("")}return l},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(n(t)){for(var i=[],r=0;r<t.length;r+=1)i.push(e(t[r]));return i}return e(t)},merge:function t(e,i,s){if(!i)return e;if("object"!=typeof i&&"function"!=typeof i){if(n(e))e.push(i);else{if(!e||"object"!=typeof e)return[e,i];(s&&(s.plainObjects||s.allowPrototypes)||!r.call(Object.prototype,i))&&(e[i]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(i);var a=e;return n(e)&&!n(i)&&(a=o(e,s)),n(e)&&n(i)?(i.forEach(function(i,n){if(r.call(e,n)){var o=e[n];o&&"object"==typeof o&&i&&"object"==typeof i?e[n]=t(o,i,s):e.push(i)}else e[n]=i}),e):Object.keys(i).reduce(function(e,n){var o=i[n];return r.call(e,n)?e[n]=t(e[n],o,s):e[n]=o,e},a)}}}}),Et=T({"../../node_modules/.pnpm/qs@6.14.0/node_modules/qs/lib/stringify.js"(t,e){var i=_t(),r=Tt(),n=wt(),s=Object.prototype.hasOwnProperty,o={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},a=Array.isArray,h=Array.prototype.push,l=function(t,e){h.apply(t,a(e)?e:[e])},c=Date.prototype.toISOString,u=n.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,filter:void 0,format:u,formatter:n.formatters[u],indices:!1,serializeDate:function(t){return c.call(t)},skipNulls:!1,strictNullHandling:!1},f={},p=function t(e,n,s,o,h,c,u,p,m,g,v,y,x,b,_,w,T,E){for(var S,I=e,A=E,C=0,P=!1;void 0!==(A=A.get(f))&&!P;){var M=A.get(e);if(C+=1,void 0!==M){if(M===C)throw new RangeError("Cyclic object value");P=!0}void 0===A.get(f)&&(C=0)}if("function"==typeof g?I=g(n,I):I instanceof Date?I=x(I):"comma"===s&&a(I)&&(I=r.maybeMap(I,function(t){return t instanceof Date?x(t):t})),null===I){if(c)return m&&!w?m(n,d.encoder,T,"key",b):n;I=""}if("string"==typeof(S=I)||"number"==typeof S||"boolean"==typeof S||"symbol"==typeof S||"bigint"==typeof S||r.isBuffer(I))return m?[_(w?n:m(n,d.encoder,T,"key",b))+"="+_(m(I,d.encoder,T,"value",b))]:[_(n)+"="+_(String(I))];var R,O=[];if(void 0===I)return O;if("comma"===s&&a(I))w&&m&&(I=r.maybeMap(I,m)),R=[{value:I.length>0?I.join(",")||null:void 0}];else if(a(g))R=g;else{var D=Object.keys(I);R=v?D.sort(v):D}var k=p?String(n).replace(/\./g,"%2E"):String(n),L=o&&a(I)&&1===I.length?k+"[]":k;if(h&&a(I)&&0===I.length)return L+"[]";for(var F=0;F<R.length;++F){var N=R[F],B="object"==typeof N&&N&&void 0!==N.value?N.value:I[N];if(!u||null!==B){var z=y&&p?String(N).replace(/\./g,"%2E"):String(N),U=a(I)?"function"==typeof s?s(L,z):L:L+(y?"."+z:"["+z+"]");E.set(e,C);var V=i();V.set(f,E),l(O,t(B,U,s,o,h,c,u,p,"comma"===s&&w&&a(I)?null:m,g,v,y,x,b,_,w,T,V))}}return O};e.exports=function(t,e){var r,h=t,c=function(t){if(!t)return d;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=n.default;if(void 0!==t.format){if(!s.call(n.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var r,h=n.formatters[i],l=d.filter;if(("function"==typeof t.filter||a(t.filter))&&(l=t.filter),r=t.arrayFormat in o?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":d.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=void 0===t.allowDots?!0===t.encodeDotInKeys||d.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:d.addQueryPrefix,allowDots:c,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:r,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:d.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?d.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:d.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:d.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:d.encodeValuesOnly,filter:l,format:i,formatter:h,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:d.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:d.strictNullHandling}}(e);"function"==typeof c.filter?h=(0,c.filter)("",h):a(c.filter)&&(r=c.filter);var u=[];if("object"!=typeof h||null===h)return"";var f=o[c.arrayFormat],m="comma"===f&&c.commaRoundTrip;r||(r=Object.keys(h)),c.sort&&r.sort(c.sort);for(var g=i(),v=0;v<r.length;++v){var y=r[v],x=h[y];c.skipNulls&&null===x||l(u,p(x,y,f,m,c.allowEmptyArrays,c.strictNullHandling,c.skipNulls,c.encodeDotInKeys,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,g))}var b=u.join(c.delimiter),_=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),b.length>0?_+b:""}}}),St=T({"../../node_modules/.pnpm/qs@6.14.0/node_modules/qs/lib/parse.js"(t,e){var i=Tt(),r=Object.prototype.hasOwnProperty,n=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},a=function(t,e,i){if(t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&i>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");return t},h=function(t,e,n,s){if(t){var o=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,h=/(\[[^[\]]*])/g,l=n.depth>0&&/(\[[^[\]]*])/.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!n.plainObjects&&r.call(Object.prototype,c)&&!n.allowPrototypes)return;u.push(c)}for(var d=0;n.depth>0&&null!==(l=h.exec(o))&&d<n.depth;){if(d+=1,!n.plainObjects&&r.call(Object.prototype,l[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(l[1])}if(l){if(!0===n.strictDepth)throw new RangeError("Input depth exceeded depth option of "+n.depth+" and strictDepth is true");u.push("["+o.slice(l.index)+"]")}return function(t,e,r,n){var s=0;if(t.length>0&&"[]"===t[t.length-1]){var o=t.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var h=n?e:a(e,r,s),l=t.length-1;l>=0;--l){var c,u=t[l];if("[]"===u&&r.parseArrays)c=r.allowEmptyArrays&&(""===h||r.strictNullHandling&&null===h)?[]:i.combine([],h);else{c=r.plainObjects?{__proto__:null}:{};var d="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,f=r.decodeDotInKeys?d.replace(/%2E/g,"."):d,p=parseInt(f,10);r.parseArrays||""!==f?!isNaN(p)&&u!==f&&String(p)===f&&p>=0&&r.parseArrays&&p<=r.arrayLimit?(c=[])[p]=h:"__proto__"!==f&&(c[f]=h):c={0:h}}h=c}return h}(u,e,n,s)}};e.exports=function(t,e){var l=function(t){if(!t)return s;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==t.throwOnLimitExceeded&&"boolean"!=typeof t.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=void 0===t.charset?s.charset:t.charset,r=void 0===t.duplicates?s.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||s.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:s.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:s.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:s.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:s.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:s.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:s.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:s.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:s.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:s.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:s.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:s.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof t.throwOnLimitExceeded&&t.throwOnLimitExceeded}}(e);if(""===t||null==t)return l.plainObjects?{__proto__:null}:{};for(var c="string"==typeof t?function(t,e){var h={__proto__:null},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;l=l.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var c=e.parameterLimit===1/0?void 0:e.parameterLimit,u=l.split(e.delimiter,e.throwOnLimitExceeded?c+1:c);if(e.throwOnLimitExceeded&&u.length>c)throw new RangeError("Parameter limit exceeded. Only "+c+" parameter"+(1===c?"":"s")+" allowed.");var d,f=-1,p=e.charset;if(e.charsetSentinel)for(d=0;d<u.length;++d)0===u[d].indexOf("utf8=")&&("utf8=%E2%9C%93"===u[d]?p="utf-8":"utf8=%26%2310003%3B"===u[d]&&(p="iso-8859-1"),f=d,d=u.length);for(d=0;d<u.length;++d)if(d!==f){var m,g,v=u[d],y=v.indexOf("]="),x=-1===y?v.indexOf("="):y+1;-1===x?(m=e.decoder(v,s.decoder,p,"key"),g=e.strictNullHandling?null:""):(m=e.decoder(v.slice(0,x),s.decoder,p,"key"),g=i.maybeMap(a(v.slice(x+1),e,n(h[m])?h[m].length:0),function(t){return e.decoder(t,s.decoder,p,"value")})),g&&e.interpretNumericEntities&&"iso-8859-1"===p&&(g=o(String(g))),v.indexOf("[]=")>-1&&(g=n(g)?[g]:g);var b=r.call(h,m);b&&"combine"===e.duplicates?h[m]=i.combine(h[m],g):b&&"last"!==e.duplicates||(h[m]=g)}return h}(t,l):t,u=l.plainObjects?{__proto__:null}:{},d=Object.keys(c),f=0;f<d.length;++f){var p=d[f],m=h(p,c[p],l,"string"==typeof t);u=i.merge(u,m,l)}return!0===l.allowSparse?u:i.compact(u)}}}),It=T({"../../node_modules/.pnpm/qs@6.14.0/node_modules/qs/lib/index.js"(t,e){var i=Et(),r=St(),n=wt();e.exports={formats:n,parse:r,stringify:i}}}),At=T({"../../node_modules/.pnpm/url@0.11.4/node_modules/url/url.js"(t){var e=k();function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,o=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),a=["'"].concat(o),h=["%","/","?",";","#"].concat(a),l=["/","?","#"],c=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},f={javascript:!0,"javascript:":!0},p={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=It();function g(t,e,r){if(t&&"object"==typeof t&&t instanceof i)return t;var n=new i;return n.parse(t,e,r),n}i.prototype.parse=function(t,i,n){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),g=-1!==o&&o<t.indexOf("#")?"?":"#",v=t.split(g);v[0]=v[0].replace(/\\/g,"/");var y=t=v.join(g);if(y=y.trim(),!n&&1===t.split("#").length){var x=s.exec(y);if(x)return this.path=y,this.href=y,this.pathname=x[1],x[2]?(this.search=x[2],this.query=i?m.parse(this.search.substr(1)):this.search.substr(1)):i&&(this.search="",this.query={}),this}var b=r.exec(y);if(b){var _=(b=b[0]).toLowerCase();this.protocol=_,y=y.substr(b.length)}if(n||b||y.match(/^\/\/[^@/]+@[^@/]+/)){var w="//"===y.substr(0,2);!w||b&&f[b]||(y=y.substr(2),this.slashes=!0)}if(!f[b]&&(w||b&&!p[b])){for(var T,E,S=-1,I=0;I<l.length;I++){-1!==(A=y.indexOf(l[I]))&&(-1===S||A<S)&&(S=A)}-1!==(E=-1===S?y.lastIndexOf("@"):y.lastIndexOf("@",S))&&(T=y.slice(0,E),y=y.slice(E+1),this.auth=decodeURIComponent(T)),S=-1;for(I=0;I<h.length;I++){var A;-1!==(A=y.indexOf(h[I]))&&(-1===S||A<S)&&(S=A)}-1===S&&(S=y.length),this.host=y.slice(0,S),y=y.slice(S),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var P=this.hostname.split(/\./),M=(I=0,P.length);I<M;I++){var R=P[I];if(R&&!R.match(c)){for(var O="",D=0,k=R.length;D<k;D++)R.charCodeAt(D)>127?O+="x":O+=R[D];if(!O.match(c)){var L=P.slice(0,I),F=P.slice(I+1),N=R.match(u);N&&(L.push(N[1]),F.unshift(N[2])),F.length&&(y="/"+F.join(".")+y),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=e.toASCII(this.hostname));var B=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+B,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!d[_])for(I=0,M=a.length;I<M;I++){var U=a[I];if(-1!==y.indexOf(U)){var V=encodeURIComponent(U);V===U&&(V=escape(U)),y=y.split(U).join(V)}}var G=y.indexOf("#");-1!==G&&(this.hash=y.substr(G),y=y.slice(0,G));var j=y.indexOf("?");if(-1!==j?(this.search=y.substr(j),this.query=y.substr(j+1),i&&(this.query=m.parse(this.query)),y=y.slice(0,j)):i&&(this.search="",this.query={}),y&&(this.pathname=y),p[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){B=this.pathname||"";var H=this.search||"";this.path=B+H}return this.href=this.format(),this},i.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",i=this.pathname||"",r=this.hash||"",n=!1,s="";this.host?n=t+this.host:this.hostname&&(n=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(s=m.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||p[e])&&!1!==n?(n="//"+(n||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):n||(n=""),r&&"#"!==r.charAt(0)&&(r="#"+r),o&&"?"!==o.charAt(0)&&(o="?"+o),e+n+(i=i.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(o=o.replace("#","%23"))+r},i.prototype.resolve=function(t){return this.resolveObject(g(t,!1,!0)).format()},i.prototype.resolveObject=function(t){if("string"==typeof t){var e=new i;e.parse(t,!1,!0),t=e}for(var r=new i,n=Object.keys(this),s=0;s<n.length;s++){var o=n[s];r[o]=this[o]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),h=0;h<a.length;h++){var l=a[h];"protocol"!==l&&(r[l]=t[l])}return p[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!p[t.protocol]){for(var c=Object.keys(t),u=0;u<c.length;u++){var d=c[u];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||f[t.protocol])r.pathname=t.pathname;else{for(var m=(t.pathname||"").split("/");m.length&&!(t.host=m.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==m[0]&&m.unshift(""),m.length<2&&m.unshift(""),r.pathname=m.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var g=r.pathname||"",v=r.search||"";r.path=g+v}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var y=r.pathname&&"/"===r.pathname.charAt(0),x=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=x||y||r.host&&t.pathname,_=b,w=r.pathname&&r.pathname.split("/")||[],T=(m=t.pathname&&t.pathname.split("/")||[],r.protocol&&!p[r.protocol]);if(T&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===m[0]?m[0]=t.host:m.unshift(t.host)),t.host=null),b=b&&(""===m[0]||""===w[0])),x)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=m;else if(m.length)w||(w=[]),w.pop(),w=w.concat(m),r.search=t.search,r.query=t.query;else if(null!=t.search){if(T)r.host=w.shift(),r.hostname=r.host,(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.hostname=C.shift(),r.host=r.hostname);return r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=w.slice(-1)[0],S=(r.host||t.host||w.length>1)&&("."===E||".."===E)||""===E,I=0,A=w.length;A>=0;A--)"."===(E=w[A])?w.splice(A,1):".."===E?(w.splice(A,1),I++):I&&(w.splice(A,1),I--);if(!b&&!_)for(;I--;I)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),S&&"/"!==w.join("/").substr(-1)&&w.push("");var C,P=""===w[0]||w[0]&&"/"===w[0].charAt(0);T&&(r.hostname=P?"":w.length?w.shift():"",r.host=r.hostname,(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.hostname=C.shift(),r.host=r.hostname));return(b=b||r.host&&w.length)&&!P&&w.unshift(""),w.length>0?r.pathname=w.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var t=this.host,e=n.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},t.parse=g,t.resolve=function(t,e){return g(t,!1,!0).resolve(e)},t.resolveObject=function(t,e){return t?g(t,!1,!0).resolveObject(e):e},t.format=function(t){return"string"==typeof t&&(t=g(t)),t instanceof i?t.format():i.prototype.format.call(t)},t.Url=i}}),Ct=T({"../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js"(t,e){var i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var s,o,a=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),h=1;h<arguments.length;h++){for(var l in s=Object(arguments[h]))r.call(s,l)&&(a[l]=s[l]);if(i){o=i(s);for(var c=0;c<o.length;c++)n.call(s,o[c])&&(a[o[c]]=s[o[c]])}}return a}}}),Pt=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/const.js"(){var e;(e=t||(t={})).LOAD="LOAD",e.EXEC="EXEC",e.FFPROBE="FFPROBE",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG",e.MOUNT="MOUNT",e.UNMOUNT="UNMOUNT"}}),Mt=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/utils.js"(){e=(()=>{let t=0;return()=>t++})()}}),Rt=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/errors.js"(){new Error("unknown message type"),i=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),r=new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js")}}),Ot=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js"(){Pt(),Mt(),Rt(),n={},d=class{constructor(){M(this,s,null),M(this,o,{}),M(this,a,{}),M(this,h,[]),M(this,l,[]),A(this,"loaded",!1),M(this,c,()=>{P(this,s)&&(P(this,s).onmessage=({data:{id:e,type:i,data:r}})=>{switch(i){case t.LOAD:this.loaded=!0,P(this,o)[e](r);break;case t.MOUNT:case t.UNMOUNT:case t.EXEC:case t.FFPROBE:case t.WRITE_FILE:case t.READ_FILE:case t.DELETE_FILE:case t.RENAME:case t.CREATE_DIR:case t.LIST_DIR:case t.DELETE_DIR:P(this,o)[e](r);break;case t.LOG:P(this,h).forEach(t=>t(r));break;case t.PROGRESS:P(this,l).forEach(t=>t(r));break;case t.ERROR:P(this,a)[e](r)}delete P(this,o)[e],delete P(this,a)[e]})}),M(this,u,({type:t,data:r},n=[],h)=>P(this,s)?new Promise((i,l)=>{const c=e();P(this,s)&&P(this,s).postMessage({id:c,type:t,data:r},n),P(this,o)[c]=i,P(this,a)[c]=l,h?.addEventListener("abort",()=>{l(new DOMException(`Message # ${c} was aborted`,"AbortError"))},{once:!0})}):Promise.reject(i)),A(this,"load",({classWorkerURL:e,...i}={},{signal:r}={})=>(P(this,s)||(R(this,s,e?new Worker(new URL(e,n.url),{type:"module"}):new Worker(new URL("./worker.js",n.url),{type:"module"})),P(this,c).call(this)),P(this,u).call(this,{type:t.LOAD,data:i},void 0,r))),A(this,"exec",(e,i=-1,{signal:r}={})=>P(this,u).call(this,{type:t.EXEC,data:{args:e,timeout:i}},void 0,r)),A(this,"ffprobe",(e,i=-1,{signal:r}={})=>P(this,u).call(this,{type:t.FFPROBE,data:{args:e,timeout:i}},void 0,r)),A(this,"terminate",()=>{const t=Object.keys(P(this,a));for(const e of t)P(this,a)[e](r),delete P(this,a)[e],delete P(this,o)[e];P(this,s)&&(P(this,s).terminate(),R(this,s,null),this.loaded=!1)}),A(this,"writeFile",(e,i,{signal:r}={})=>{const n=[];return i instanceof Uint8Array&&n.push(i.buffer),P(this,u).call(this,{type:t.WRITE_FILE,data:{path:e,data:i}},n,r)}),A(this,"mount",(e,i,r)=>P(this,u).call(this,{type:t.MOUNT,data:{fsType:e,options:i,mountPoint:r}},[])),A(this,"unmount",e=>P(this,u).call(this,{type:t.UNMOUNT,data:{mountPoint:e}},[])),A(this,"readFile",(e,i="binary",{signal:r}={})=>P(this,u).call(this,{type:t.READ_FILE,data:{path:e,encoding:i}},void 0,r)),A(this,"deleteFile",(e,{signal:i}={})=>P(this,u).call(this,{type:t.DELETE_FILE,data:{path:e}},void 0,i)),A(this,"rename",(e,i,{signal:r}={})=>P(this,u).call(this,{type:t.RENAME,data:{oldPath:e,newPath:i}},void 0,r)),A(this,"createDir",(e,{signal:i}={})=>P(this,u).call(this,{type:t.CREATE_DIR,data:{path:e}},void 0,i)),A(this,"listDir",(e,{signal:i}={})=>P(this,u).call(this,{type:t.LIST_DIR,data:{path:e}},void 0,i)),A(this,"deleteDir",(e,{signal:i}={})=>P(this,u).call(this,{type:t.DELETE_DIR,data:{path:e}},void 0,i))}on(t,e){"log"===t?P(this,h).push(e):"progress"===t&&P(this,l).push(e)}off(t,e){"log"===t?R(this,h,P(this,h).filter(t=>t!==e)):"progress"===t&&R(this,l,P(this,l).filter(t=>t!==e))}},s=new WeakMap,o=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap}}),Dt=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/types.js"(){var t;(t=f||(f={})).MEMFS="MEMFS",t.NODEFS="NODEFS",t.NODERAWFS="NODERAWFS",t.IDBFS="IDBFS",t.WORKERFS="WORKERFS",t.PROXYFS="PROXYFS"}}),kt={};E(kt,{FFFSType:()=>f,FFmpeg:()=>d});var Lt,Ft,Nt,Bt,zt,Ut,Vt,Gt,jt=w({"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/index.js"(){Ot(),Dt()}}),Ht=w({"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/errors.js"(){Lt=new Error("failed to get response body reader"),Ft=new Error("failed to complete download")}}),Wt=w({"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/const.js"(){Nt="Content-Length"}}),Xt={};E(Xt,{downloadWithProgress:()=>Vt,fetchFile:()=>zt,importScript:()=>Ut,toBlobURL:()=>Gt});var Yt,qt=w({"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/index.js"(){Ht(),Wt(),Bt=t=>new Promise((e,i)=>{const r=new FileReader;r.onload=()=>{const{result:t}=r;t instanceof ArrayBuffer?e(new Uint8Array(t)):e(new Uint8Array)},r.onerror=t=>{i(Error(`File could not be read! Code=${t?.target?.error?.code||-1}`))},r.readAsArrayBuffer(t)}),zt=async t=>{let e;if("string"==typeof t)e=/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(t)?atob(t.split(",")[1]).split("").map(t=>t.charCodeAt(0)):await(await fetch(t)).arrayBuffer();else if(t instanceof URL)e=await(await fetch(t)).arrayBuffer();else{if(!(t instanceof File||t instanceof Blob))return new Uint8Array;e=await Bt(t)}return new Uint8Array(e)},Ut=async t=>new Promise(e=>{const i=document.createElement("script"),r=()=>{i.removeEventListener("load",r),e()};i.src=t,i.type="text/javascript",i.addEventListener("load",r),document.getElementsByTagName("head")[0].appendChild(i)}),Vt=async(t,e)=>{const i=await fetch(t);let r;try{const n=parseInt(i.headers.get(Nt)||"-1"),s=i.body?.getReader();if(!s)throw Lt;const o=[];let a=0;for(;;){const{done:i,value:r}=await s.read(),h=r?r.length:0;if(i){if(-1!=n&&n!==a)throw Ft;e&&e({url:t,total:n,received:a,delta:h,done:i});break}o.push(r),a+=h,e&&e({url:t,total:n,received:a,delta:h,done:i})}const h=new Uint8Array(a);let l=0;for(const t of o)h.set(t,l),l+=t.length;r=h.buffer}catch(n){console.log("failed to send download progress event: ",n),r=await i.arrayBuffer(),e&&e({url:t,total:r.byteLength,received:r.byteLength,delta:0,done:!0})}return r},Gt=async(t,e,i=!1,r)=>{const n=i?await Vt(t,r):await(await fetch(t)).arrayBuffer(),s=new Blob([n],{type:e});return URL.createObjectURL(s)}}}),Kt=T({"../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js"(t,e){!function(i){"object"==typeof t&&void 0!==e?e.exports=i():"function"==typeof define&&define.amd?define([],i):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=i()}(function(){return function t(e,i,r){function n(o,a){if(!i[o]){if(!e[o]){var h="function"==typeof _&&_;if(!a&&h)return h(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[o]={exports:{}};e[o][0].call(c.exports,function(t){return n(e[o][1][t]||t)},c,c.exports,t,e,i,r)}return i[o].exports}for(var s="function"==typeof _&&_,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(t,e,i){var r=t("./utils"),n=t("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(t){for(var e,i,n,o,a,h,l,c=[],u=0,d=t.length,f=d,p="string"!==r.getTypeOf(t);u<t.length;)f=d-u,n=p?(e=t[u++],i=u<d?t[u++]:0,u<d?t[u++]:0):(e=t.charCodeAt(u++),i=u<d?t.charCodeAt(u++):0,u<d?t.charCodeAt(u++):0),o=e>>2,a=(3&e)<<4|i>>4,h=1<f?(15&i)<<2|n>>6:64,l=2<f?63&n:64,c.push(s.charAt(o)+s.charAt(a)+s.charAt(h)+s.charAt(l));return c.join("")},i.decode=function(t){var e,i,r,o,a,h,l=0,c=0,u="data:";if(t.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===s.charAt(64)&&f--,t.charAt(t.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=n.uint8array?new Uint8Array(0|f):new Array(0|f);l<t.length;)e=s.indexOf(t.charAt(l++))<<2|(o=s.indexOf(t.charAt(l++)))>>4,i=(15&o)<<4|(a=s.indexOf(t.charAt(l++)))>>2,r=(3&a)<<6|(h=s.indexOf(t.charAt(l++))),d[c++]=e,64!==a&&(d[c++]=i),64!==h&&(d[c++]=r);return d}},{"./support":30,"./utils":32}],2:[function(t,e,i){var r=t("./external"),n=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),o=t("./stream/DataLengthProbe");function a(t,e,i,r,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=r,this.compressedContent=n}a.prototype={getContentWorker:function(){var t=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,i){return t.pipe(new s).pipe(new o("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){var r=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){var r=t("./utils"),n=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,i){var r=n,s=0+i;t^=-1;for(var o=0;o<s;o++)t=t>>>8^r[255&(t^e[o])];return-1^t}(0|e,t,t.length):function(t,e,i){var r=n,s=0+i;t^=-1;for(var o=0;o<s;o++)t=t>>>8^r[255&(t^e.charCodeAt(o))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){var r;r="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:r}},{lie:37}],7:[function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=t("pako"),s=t("./utils"),o=t("./stream/GenericWorker"),a=r?"uint8array":"array";function h(t,e){o.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}i.magic="\b\0",s.inherits(h,o),h.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,t.data),!1)},h.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},i.compressWorker=function(t){return new h("Deflate",t)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){function r(t,e){var i,r="";for(i=0;i<e;i++)r+=String.fromCharCode(255&t),t>>>=8;return r}function n(t,e,i,n,o,c){var u,d,f=t.file,p=t.compression,m=c!==a.utf8encode,g=s.transformTo("string",c(f.name)),v=s.transformTo("string",a.utf8encode(f.name)),y=f.comment,x=s.transformTo("string",c(y)),b=s.transformTo("string",a.utf8encode(y)),_=v.length!==f.name.length,w=b.length!==y.length,T="",E="",S="",I=f.dir,A=f.date,C={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(C.crc32=t.crc32,C.compressedSize=t.compressedSize,C.uncompressedSize=t.uncompressedSize);var P=0;e&&(P|=8),m||!_&&!w||(P|=2048);var M,R,O,D=0,k=0;I&&(D|=16),"UNIX"===o?(k=798,D|=(M=f.unixPermissions,R=I,O=M,M||(O=R?16893:33204),(65535&O)<<16)):(k=20,D|=function(t){return 63&(t||0)}(f.dosPermissions)),u=A.getUTCHours(),u<<=6,u|=A.getUTCMinutes(),u<<=5,u|=A.getUTCSeconds()/2,d=A.getUTCFullYear()-1980,d<<=4,d|=A.getUTCMonth()+1,d<<=5,d|=A.getUTCDate(),_&&(E=r(1,1)+r(h(g),4)+v,T+="up"+r(E.length,2)+E),w&&(S=r(1,1)+r(h(x),4)+b,T+="uc"+r(S.length,2)+S);var L="";return L+="\n\0",L+=r(P,2),L+=p.magic,L+=r(u,2),L+=r(d,2),L+=r(C.crc32,4),L+=r(C.compressedSize,4),L+=r(C.uncompressedSize,4),L+=r(g.length,2),L+=r(T.length,2),{fileRecord:l.LOCAL_FILE_HEADER+L+g+T,dirRecord:l.CENTRAL_FILE_HEADER+r(k,2)+L+r(x.length,2)+"\0\0\0\0"+r(D,4)+r(n,4)+g+T+x}}var s=t("../utils"),o=t("../stream/GenericWorker"),a=t("../utf8"),h=t("../crc32"),l=t("../signature");function c(t,e,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(c,o),c.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,o.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-r-1))/i:100}}))},c.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=n(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(t){this.accumulate=!1;var e,i=this.streamFiles&&!t.file.dir,s=n(t,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(s.dirRecord),i)this.push({data:(e=t,l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:s.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var i,n,o,a,h,c,u=this.bytesWritten-t,d=(i=this.dirRecords.length,n=u,o=t,a=this.zipComment,h=this.encodeFileName,c=s.transformTo("string",h(a)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(i,2)+r(i,2)+r(n,4)+r(o,4)+r(c.length,2)+c);this.push({data:d,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),t.on("error",function(t){e.error(t)}),this},c.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(t){var e=this._sources;if(!o.prototype.error.call(this,t))return!1;for(var i=0;i<e.length;i++)try{e[i].error(t)}catch(t){}return!0},c.prototype.lock=function(){o.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,i){var r=t("../compressions"),n=t("./ZipFileWorker");i.generateWorker=function(t,e,i){var s=new n(e.streamFiles,i,e.platform,e.encodeFileName),o=0;try{t.forEach(function(t,i){o++;var n=function(t,e){var i=t||e,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,e.compression),a=i.options.compressionOptions||e.compressionOptions||{},h=i.dir,l=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:t,dir:h,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(s)}),s.entriesCount=o}catch(t){s.error(t)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new r;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(t,e){return(new r).loadAsync(t,e)},r.external=t("./external"),e.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,i){var r=t("./utils"),n=t("./external"),s=t("./utf8"),o=t("./zipEntries"),a=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function l(t){return new n.Promise(function(e,i){var r=t.decompressed.getContentWorker().pipe(new a);r.on("error",function(t){i(t)}).on("end",function(){r.streamInfo.crc32!==t.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}e.exports=function(t,e){var i=this;return e=r.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),h.isNode&&h.isStream(t)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var i=new o(e);return i.load(t),i}).then(function(t){var i=[n.Promise.resolve(t)],r=t.files;if(e.checkCRC32)for(var s=0;s<r.length;s++)i.push(l(r[s]));return n.Promise.all(i)}).then(function(t){for(var n=t.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],h=a.fileNameStr,l=r.resolve(a.fileNameStr);i.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:e.createFolders}),a.dir||(i.file(l).unsafeOriginalName=h)}return n.zipComment.length&&(i.comment=n.zipComment),i})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,i){var r=t("../utils"),n=t("../stream/GenericWorker");function s(t,e){n.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}r.inherits(s,n),s.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,i){var r=t("readable-stream").Readable;function n(t,e,i){r.call(this,e),this._helper=t;var n=this;t.on("data",function(t,e){n.push(t)||n._helper.pause(),i&&i(e)}).on("error",function(t){n.emit("error",t)}).on("end",function(){n.push(null)})}t("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},e.exports=n},{"../utils":32,"readable-stream":16}],14:[function(t,e,i){e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,i){function r(t,e,i){var r,n=s.getTypeOf(e),a=s.extend(i||{},h);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(t=m(t)),a.createFolders&&(r=p(t))&&g.call(this,r,!0);var u="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!u),(e instanceof l&&0===e.uncompressedSize||a.dir||!e||0===e.length)&&(a.base64=!1,a.binary=!0,e="",a.compression="STORE",n="string");var v;v=e instanceof l||e instanceof o?e:d.isNode&&d.isStream(e)?new f(t,e):s.prepareContent(t,e,a.binary,a.optimizedBinaryString,a.base64);var y=new c(t,v,a);this.files[t]=y}var n=t("./utf8"),s=t("./utils"),o=t("./stream/GenericWorker"),a=t("./stream/StreamHelper"),h=t("./defaults"),l=t("./compressedObject"),c=t("./zipObject"),u=t("./generate"),d=t("./nodejsUtils"),f=t("./nodejs/NodejsStreamInputAdapter"),p=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},m=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},g=function(t,e){return e=void 0!==e?e:h.createFolders,t=m(t),this.files[t]||r.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function v(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,i,r;for(e in this.files)r=this.files[e],(i=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(i,r)},filter:function(t){var e=[];return this.forEach(function(i,r){t(i,r)&&e.push(r)}),e},file:function(t,e,i){if(1!==arguments.length)return t=this.root+t,r.call(this,t,e,i),this;if(v(t)){var n=t;return this.filter(function(t,e){return!e.dir&&n.test(t)})}var s=this.files[this.root+t];return s&&!s.dir?s:null},folder:function(t){if(!t)return this;if(v(t))return this.filter(function(e,i){return i.dir&&t.test(e)});var e=this.root+t,i=g.call(this,e),r=this.clone();return r.root=i.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var i=this.filter(function(e,i){return i.name.slice(0,t.length)===t}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,i={};try{if((i=s.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");s.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";e=u.generateWorker(this,i,r)}catch(t){(e=new o("error")).error(t)}return new a(e,i.type||"string",i.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,i){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,i){var r=t("./DataReader");function n(t){r.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(n,r),n.prototype.byteAt=function(t){return this.data[this.zero+t]},n.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2),n=t.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===e&&this.data[s+1]===i&&this.data[s+2]===r&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2),n=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&i===s[1]&&r===s[2]&&n===s[3]},n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./DataReader":18}],18:[function(t,e,i){var r=t("../utils");function n(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,i=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=n},{"../utils":32}],19:[function(t,e,i){var r=t("./Uint8ArrayReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){var r=t("./DataReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},n.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},n.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){var r=t("./ArrayReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){var r=t("../utils"),n=t("../support"),s=t("./ArrayReader"),o=t("./StringReader"),a=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new a(t):n.uint8array?new h(r.transformTo("uint8array",t)):new s(r.transformTo("array",t)):new o(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,i){var r=t("./GenericWorker"),n=t("../utils");function s(t){r.call(this,"ConvertWorker to "+t),this.destType=t}n.inherits(s,r),s.prototype.processChunk=function(t){this.push({data:n.transformTo(this.destType,t.data),meta:t.meta})},e.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){var r=t("./GenericWorker"),n=t("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(s,r),s.prototype.processChunk=function(t){this.streamInfo.crc32=n(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){var r=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}r.inherits(s,n),s.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}n.prototype.processChunk.call(this,t)},e.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){var r=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=r.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}r.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){function r(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var i=0;i<this._listeners[t].length;i++)this._listeners[t][i].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=r},{}],29:[function(t,e,i){var r=t("../utils"),n=t("./ConvertWorker"),s=t("./GenericWorker"),o=t("../base64"),a=t("../support"),h=t("../external"),l=null;if(a.nodestream)try{l=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function c(t,e,i){var o=e;switch(e){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=e,this._mimeType=i,r.checkSupport(o),this._worker=t.pipe(new n(o)),t.lock()}catch(t){this._worker=new s("error"),this._worker.error(t)}}c.prototype={accumulate:function(t){return function(t,e){return new h.Promise(function(i,n){var s=[],a=t._internalType,h=t._outputType,l=t._mimeType;t.on("data",function(t,i){s.push(t),e&&e(i)}).on("error",function(t){s=[],n(t)}).on("end",function(){try{var t=function(t,e,i){switch(t){case"blob":return r.newBlob(r.transformTo("arraybuffer",e),i);case"base64":return o.encode(e);default:return r.transformTo(t,e)}}(h,function(t,e){var i,r=0,n=null,s=0;for(i=0;i<e.length;i++)s+=e[i].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(n=new Uint8Array(s),i=0;i<e.length;i++)n.set(e[i],r),r+=e[i].length;return n;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(a,s),l);i(t)}catch(t){n(t)}s=[]}).resume()})}(this,t)},on:function(t,e){var i=this;return"data"===t?this._worker.on(t,function(t){e.call(i,t.data,t.meta)}):this._worker.on(t,function(){r.delay(e,arguments,i)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(t){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(t){i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch(t){i.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,i){for(var r=t("./utils"),n=t("./support"),s=t("./nodejsUtils"),o=t("./stream/GenericWorker"),a=new Array(256),h=0;h<256;h++)a[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(t){return n.nodebuffer?s.newBufferFrom(t,"utf-8"):function(t){var e,i,r,s,o,a=t.length,h=0;for(s=0;s<a;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),h+=i<128?1:i<2048?2:i<65536?3:4;for(e=n.uint8array?new Uint8Array(h):new Array(h),s=o=0;o<h;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),i<128?e[o++]=i:(i<2048?e[o++]=192|i>>>6:(i<65536?e[o++]=224|i>>>12:(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63),e[o++]=128|i>>>6&63),e[o++]=128|63&i);return e}(t)},i.utf8decode=function(t){return n.nodebuffer?r.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,n,s,o=t.length,h=new Array(2*o);for(e=i=0;e<o;)if((n=t[e++])<128)h[i++]=n;else if(4<(s=a[n]))h[i++]=65533,e+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&e<o;)n=n<<6|63&t[e++],s--;1<s?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return h.length!==i&&(h.subarray?h=h.subarray(0,i):h.length=i),r.applyFromCharCode(h)}(t=r.transformTo(n.uint8array?"uint8array":"array",t))},r.inherits(l,o),l.prototype.processChunk=function(t){var e=r.transformTo(n.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=e;(e=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),e.set(s,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var o=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+a[t[i]]>e?i:e}(e),h=e;o!==e.length&&(n.uint8array?(h=e.subarray(0,o),this.leftOver=e.subarray(o,e.length)):(h=e.slice(0,o),this.leftOver=e.slice(o,e.length))),this.push({data:i.utf8decode(h),meta:t.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,r.inherits(c,o),c.prototype.processChunk=function(t){this.push({data:i.utf8encode(t.data),meta:t.meta})},i.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){var r=t("./support"),n=t("./base64"),s=t("./nodejsUtils"),o=t("./external");function a(t){return t}function h(t,e){for(var i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e}t("setimmediate"),i.newBlob=function(t,e){i.checkSupport("blob");try{return new Blob([t],{type:e})}catch(i){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(t),r.getBlob(e)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(t,e,i){var r=[],n=0,s=t.length;if(s<=i)return String.fromCharCode.apply(null,t);for(;n<s;)"array"===e||"nodebuffer"===e?r.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+i,s)))):r.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+i,s)))),n+=i;return r.join("")},stringifyByChar:function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(t){return!1}}()}};function c(t){var e=65536,r=i.getTypeOf(t),n=!0;if("uint8array"===r?n=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<e;)try{return l.stringifyByChunk(t,r,e)}catch(t){e=Math.floor(e/2)}return l.stringifyByChar(t)}function u(t,e){for(var i=0;i<t.length;i++)e[i]=t[i];return e}i.applyFromCharCode=c;var d={};d.string={string:a,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return d.string.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:function(t){return h(t,s.allocBuffer(t.length))}},d.array={string:c,array:a,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return s.newBufferFrom(t)}},d.arraybuffer={string:function(t){return c(new Uint8Array(t))},array:function(t){return u(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:a,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return s.newBufferFrom(new Uint8Array(t))}},d.uint8array={string:c,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:a,nodebuffer:function(t){return s.newBufferFrom(t)}},d.nodebuffer={string:c,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return d.nodebuffer.uint8array(t).buffer},uint8array:function(t){return u(t,new Uint8Array(t.length))},nodebuffer:a},i.transformTo=function(t,e){if(e=e||"",!t)return e;i.checkSupport(t);var r=i.getTypeOf(e);return d[r][t](e)},i.resolve=function(t){for(var e=t.split("/"),i=[],r=0;r<e.length;r++){var n=e[r];"."===n||""===n&&0!==r&&r!==e.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":r.nodebuffer&&s.isBuffer(t)?"nodebuffer":r.uint8array&&t instanceof Uint8Array?"uint8array":r.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(t){if(!r[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(t){var e,i,r="";for(i=0;i<(t||"").length;i++)r+="\\x"+((e=t.charCodeAt(i))<16?"0":"")+e.toString(16).toUpperCase();return r},i.delay=function(t,e,i){setImmediate(function(){t.apply(i||null,e||[])})},i.inherits=function(t,e){function i(){}i.prototype=e.prototype,t.prototype=new i},i.extend=function(){var t,e,i={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===i[e]&&(i[e]=arguments[t][e]);return i},i.prepareContent=function(t,e,s,a,l){return o.Promise.resolve(e).then(function(t){return r.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new o.Promise(function(e,i){var r=new FileReader;r.onload=function(t){e(t.target.result)},r.onerror=function(t){i(t.target.error)},r.readAsArrayBuffer(t)}):t}).then(function(e){var c,u=i.getTypeOf(e);return u?("arraybuffer"===u?e=i.transformTo("uint8array",e):"string"===u&&(l?e=n.decode(e):s&&!0!==a&&(e=h(c=e,r.uint8array?new Uint8Array(c.length):new Array(c.length)))),e):o.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,i){var r=t("./reader/readerFor"),n=t("./utils"),s=t("./signature"),o=t("./zipEntry"),a=t("./support");function h(t){this.files=[],this.loadOptions=t}h.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(e)+", expected "+n.pretty(t)+")")}},isSignature:function(t,e){var i=this.reader.index;this.reader.setIndex(t);var r=this.reader.readString(4)===e;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=a.uint8array?"uint8array":"array",i=n.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,i,r=this.zip64EndOfCentralSize-44;0<r;)t=this.reader.readInt(2),e=this.reader.readInt(4),i=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(t=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=e-i;if(0<r)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){this.reader=r(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,i){var r=t("./reader/readerFor"),n=t("./utils"),s=t("./compressedObject"),o=t("./crc32"),a=t("./utf8"),h=t("./compressions"),l=t("./support");function c(t,e){this.options=t,this.loadOptions=e}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(t){var e,i;if(t.skip(22),this.fileNameLength=t.readInt(2),i=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in h)if(Object.prototype.hasOwnProperty.call(h,e)&&h[e].magic===t)return h[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<n;)e=t.readInt(2),i=t.readInt(2),r=t.readData(i),this.extraFields[e]={id:e,length:i,value:r};t.setIndex(n)},handleUTF8:function(){var t=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var i=n.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var s=n.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=r(t.value);return 1!==e.readInt(1)||o(this.fileName)!==e.readInt(4)?null:a.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=r(t.value);return 1!==e.readInt(1)||o(this.fileComment)!==e.readInt(4)?null:a.utf8decode(e.readData(t.length-5))}return null}},e.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,i){function r(t,e,i){this.name=t,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=e,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=t("./stream/StreamHelper"),s=t("./stream/DataWorker"),o=t("./utf8"),a=t("./compressedObject"),h=t("./stream/GenericWorker");r.prototype={internalStream:function(t){var e=null,i="string";try{if(!t)throw new Error("No output type specified.");var r="string"===(i=t.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),e=this._decompressWorker();var s=!this._dataBinary;s&&!r&&(e=e.pipe(new o.Utf8EncodeWorker)),!s&&r&&(e=e.pipe(new o.Utf8DecodeWorker))}catch(t){(e=new h("error")).error(t)}return new n(e,i,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof a&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,t,e)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof h?this._data:new s(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)r.prototype[l[u]]=c;e.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,i){(function(t){var i,r,n=t.MutationObserver||t.WebKitMutationObserver;if(n){var s=0,o=new n(c),a=t.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)i="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var h=new t.MessageChannel;h.port1.onmessage=c,i=function(){h.port2.postMessage(0)}}var l=[];function c(){var t,e;r=!0;for(var i=l.length;i;){for(e=l,l=[],t=-1;++t<i;)e[t]();i=l.length}r=!1}e.exports=function(t){1!==l.push(t)||r||i()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,i){var r=t("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],h=["PENDING"];function l(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,t!==n&&f(this,t)}function c(t,e,i){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(t,e,i){r(function(){var r;try{r=e(i)}catch(e){return s.reject(t,e)}r===t?s.reject(t,new TypeError("Cannot resolve promise with itself")):s.resolve(t,r)})}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function f(t,e){var i=!1;function r(e){i||(i=!0,s.reject(t,e))}function n(e){i||(i=!0,s.resolve(t,e))}var o=p(function(){e(n,r)});"error"===o.status&&r(o.value)}function p(t,e){var i={};try{i.value=t(e),i.status="success"}catch(t){i.status="error",i.value=t}return i}(e.exports=l).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then(function(i){return e.resolve(t()).then(function(){return i})},function(i){return e.resolve(t()).then(function(){throw i})})},l.prototype.catch=function(t){return this.then(null,t)},l.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===o)return this;var i=new this.constructor(n);return this.state!==h?u(i,this.state===a?t:e,this.outcome):this.queue.push(new c(i,t,e)),i},c.prototype.callFulfilled=function(t){s.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){u(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){s.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){u(this.promise,this.onRejected,t)},s.resolve=function(t,e){var i=p(d,e);if("error"===i.status)return s.reject(t,i.value);var r=i.value;if(r)f(t,r);else{t.state=a,t.outcome=e;for(var n=-1,o=t.queue.length;++n<o;)t.queue[n].callFulfilled(e)}return t},s.reject=function(t,e){t.state=o,t.outcome=e;for(var i=-1,r=t.queue.length;++i<r;)t.queue[i].callRejected(e);return t},l.resolve=function(t){return t instanceof this?t:s.resolve(new this(n),t)},l.reject=function(t){var e=new this(n);return s.reject(e,t)},l.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,h=-1,l=new this(n);++h<i;)c(t[h],h);return l;function c(t,n){e.resolve(t).then(function(t){o[n]=t,++a!==i||r||(r=!0,s.resolve(l,o))},function(t){r||(r=!0,s.reject(l,t))})}},l.race=function(t){if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var e=t.length,i=!1;if(!e)return this.resolve([]);for(var r,o=-1,a=new this(n);++o<e;)r=t[o],this.resolve(r).then(function(t){i||(i=!0,s.resolve(a,t))},function(t){i||(i=!0,s.reject(a,t))});return a}},{immediate:36}],38:[function(t,e,i){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,i){var r=t("./zlib/deflate"),n=t("./utils/common"),s=t("./utils/strings"),o=t("./zlib/messages"),a=t("./zlib/zstream"),h=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==i)throw new Error(o[i]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var c;if(c="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(i=r.deflateSetDictionary(this.strm,c)))throw new Error(o[i]);this._dict_set=!0}}function c(t,e){var i=new l(e);if(i.push(t,!0),i.err)throw i.msg||o[i.err];return i.result}l.prototype.push=function(t,e){var i,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=e===~~e?e:!0===e?4:0,"string"==typeof t?a.input=s.string2buf(t):"[object ArrayBuffer]"===h.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(l),a.next_out=0,a.avail_out=l),1!==(i=r.deflate(a,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(a.avail_out=0))},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},i.Deflate=l,i.deflate=c,i.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},i.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,i){var r=t("./zlib/inflate"),n=t("./utils/common"),s=t("./utils/strings"),o=t("./zlib/constants"),a=t("./zlib/messages"),h=t("./zlib/zstream"),l=t("./zlib/gzheader"),c=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,e.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function d(t,e){var i=new u(e);if(i.push(t,!0),i.err)throw i.msg||a[i.err];return i.result}u.prototype.push=function(t,e){var i,a,h,l,u,d,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?f.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?f.input=new Uint8Array(t):f.input=t,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new n.Buf8(p),f.next_out=0,f.avail_out=p),(i=r.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(d="string"==typeof m?s.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,i=r.inflateSetDictionary(this.strm,d)),i===o.Z_BUF_ERROR&&!0===g&&(i=o.Z_OK,g=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);f.next_out&&(0!==f.avail_out&&i!==o.Z_STREAM_END&&(0!==f.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(h=s.utf8border(f.output,f.next_out),l=f.next_out-h,u=s.buf2string(f.output,h),f.next_out=l,f.avail_out=p-l,l&&n.arraySet(f.output,f.output,h,l,0),this.onData(u)):this.onData(n.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((0<f.avail_in||0===f.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(f.avail_out=0))},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},i.Inflate=u,i.inflate=d,i.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},i.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t},i.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var s=0;s<r;s++)t[n+s]=e[i+s]},flattenChunks:function(t){var e,i,r,n,s,o;for(e=r=0,i=t.length;e<i;e++)r+=t[e].length;for(o=new Uint8Array(r),e=n=0,i=t.length;e<i;e++)s=t[e],o.set(s,n),n+=s.length;return o}},s={arraySet:function(t,e,i,r,n){for(var s=0;s<r;s++)t[n+s]=e[i+s]},flattenChunks:function(t){return[].concat.apply([],t)}};i.setTyped=function(t){t?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,s))},i.setTyped(r)},{}],42:[function(t,e,i){var r=t("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function h(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var i="",o=0;o<e;o++)i+=String.fromCharCode(t[o]);return i}o[254]=o[254]=1,i.string2buf=function(t){var e,i,n,s,o,a=t.length,h=0;for(s=0;s<a;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),h+=i<128?1:i<2048?2:i<65536?3:4;for(e=new r.Buf8(h),s=o=0;o<h;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),i<128?e[o++]=i:(i<2048?e[o++]=192|i>>>6:(i<65536?e[o++]=224|i>>>12:(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63),e[o++]=128|i>>>6&63),e[o++]=128|63&i);return e},i.buf2binstring=function(t){return h(t,t.length)},i.binstring2buf=function(t){for(var e=new r.Buf8(t.length),i=0,n=e.length;i<n;i++)e[i]=t.charCodeAt(i);return e},i.buf2string=function(t,e){var i,r,n,s,a=e||t.length,l=new Array(2*a);for(i=r=0;i<a;)if((n=t[i++])<128)l[r++]=n;else if(4<(s=o[n]))l[r++]=65533,i+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&i<a;)n=n<<6|63&t[i++],s--;1<s?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n)}return h(l,r)},i.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+o[t[i]]>e?i:e}},{"./common":41}],43:[function(t,e,i){e.exports=function(t,e,i,r){for(var n=65535&t,s=t>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;s=s+(n=n+e[r++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16}},{}],44:[function(t,e,i){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,i){var r=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e,i,n){var s=r,o=n+i;t^=-1;for(var a=n;a<o;a++)t=t>>>8^s[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,i){var r,n=t("../utils/common"),s=t("./trees"),o=t("./adler32"),a=t("./crc32"),h=t("./messages"),l=-2,c=258,u=262,d=113;function f(t,e){return t.msg=h[e],e}function p(t){return(t<<1)-(4<t?9:0)}function m(t){for(var e=t.length;0<=--e;)t[e]=0}function g(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(n.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function v(t,e){s._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,g(t.strm)}function y(t,e){t.pending_buf[t.pending++]=e}function x(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function b(t,e){var i,r,n=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match,h=t.strstart>t.w_size-u?t.strstart-(t.w_size-u):0,l=t.window,d=t.w_mask,f=t.prev,p=t.strstart+c,m=l[s+o-1],g=l[s+o];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(l[(i=e)+o]===g&&l[i+o-1]===m&&l[i]===l[s]&&l[++i]===l[s+1]){s+=2,i++;do{}while(l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&s<p);if(r=c-(p-s),s=p-c,o<r){if(t.match_start=e,a<=(o=r))break;m=l[s+o-1],g=l[s+o]}}}while((e=f[e&d])>h&&0!=--n);return o<=t.lookahead?o:t.lookahead}function _(t){var e,i,r,s,h,l,c,d,f,p,m=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=m+(m-u)){for(n.arraySet(t.window,t.window,m,m,0),t.match_start-=m,t.strstart-=m,t.block_start-=m,e=i=t.hash_size;r=t.head[--e],t.head[e]=m<=r?r-m:0,--i;);for(e=i=m;r=t.prev[--e],t.prev[e]=m<=r?r-m:0,--i;);s+=m}if(0===t.strm.avail_in)break;if(l=t.strm,c=t.window,d=t.strstart+t.lookahead,p=void 0,(f=s)<(p=l.avail_in)&&(p=f),i=0===p?0:(l.avail_in-=p,n.arraySet(c,l.input,l.next_in,p,d),1===l.state.wrap?l.adler=o(l.adler,c,p,d):2===l.state.wrap&&(l.adler=a(l.adler,c,p,d)),l.next_in+=p,l.total_in+=p,p),t.lookahead+=i,t.lookahead+t.insert>=3)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+3-1])&t.hash_mask,t.prev[h&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=h,h++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<u&&0!==t.strm.avail_in)}function w(t,e){for(var i,r;;){if(t.lookahead<u){if(_(t),t.lookahead<u&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-u&&(t.match_length=b(t,i)),t.match_length>=3)if(r=s._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(v(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(v(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(v(t,!1),0===t.strm.avail_out)?1:2}function T(t,e){for(var i,r,n;;){if(t.lookahead<u){if(_(t),t.lookahead<u&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-u&&(t.match_length=b(t,i),t.match_length<=5&&(1===t.strategy||3===t.match_length&&4096<t.strstart-t.match_start)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){for(n=t.strstart+t.lookahead-3,r=s._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(v(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=s._tr_tally(t,0,t.window[t.strstart-1]))&&v(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=s._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(v(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(v(t,!1),0===t.strm.avail_out)?1:2}function E(t,e,i,r,n){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=n}function S(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function I(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:d,t.adler=2===e.wrap?0:1,e.last_flush=0,s._tr_init(e),0):f(t,l)}function A(t){var e,i=I(t);return 0===i&&((e=t.state).window_size=2*e.w_size,m(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i}function C(t,e,i,r,s,o){if(!t)return l;var a=1;if(-1===e&&(e=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),s<1||9<s||8!==i||r<8||15<r||e<0||9<e||o<0||4<o)return f(t,l);8===r&&(r=9);var h=new S;return(t.state=h).strm=t,h.wrap=a,h.gzhead=null,h.w_bits=r,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=s+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new n.Buf8(2*h.w_size),h.head=new n.Buf16(h.hash_size),h.prev=new n.Buf16(h.w_size),h.lit_bufsize=1<<s+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new n.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=o,h.method=i,A(t)}r=[new E(0,0,0,0,function(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(_(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,v(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-u&&(v(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(v(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(v(t,!1),t.strm.avail_out),1)}),new E(4,4,8,4,w),new E(4,5,16,8,w),new E(4,6,32,32,w),new E(4,4,16,16,T),new E(8,16,32,32,T),new E(8,16,128,128,T),new E(8,32,128,256,T),new E(32,128,258,1024,T),new E(32,258,258,4096,T)],i.deflateInit=function(t,e){return C(t,e,8,15,8,0)},i.deflateInit2=C,i.deflateReset=A,i.deflateResetKeep=I,i.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,0):l},i.deflate=function(t,e){var i,n,o,h;if(!t||!t.state||5<e||e<0)return t?f(t,l):l;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||666===n.status&&4!==e)return f(t,0===t.avail_out?-5:l);if(n.strm=t,i=n.last_flush,n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,y(n,31),y(n,139),y(n,8),n.gzhead?(y(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),y(n,255&n.gzhead.time),y(n,n.gzhead.time>>8&255),y(n,n.gzhead.time>>16&255),y(n,n.gzhead.time>>24&255),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(y(n,255&n.gzhead.extra.length),y(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=a(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(y(n,0),y(n,0),y(n,0),y(n,0),y(n,0),y(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),y(n,3),n.status=d);else{var u=8+(n.w_bits-8<<4)<<8;u|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=d,x(n,u),0!==n.strstart&&(x(n,t.adler>>>16),x(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),g(t),o=n.pending,n.pending!==n.pending_buf_size));)y(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),g(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,y(n,h)}while(0!==h);n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),g(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,y(n,h)}while(0!==h);n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(t),n.pending+2<=n.pending_buf_size&&(y(n,255&t.adler),y(n,t.adler>>8&255),t.adler=0,n.status=d)):n.status=d),0!==n.pending){if(g(t),0===t.avail_out)return n.last_flush=-1,0}else if(0===t.avail_in&&p(e)<=p(i)&&4!==e)return f(t,-5);if(666===n.status&&0!==t.avail_in)return f(t,-5);if(0!==t.avail_in||0!==n.lookahead||0!==e&&666!==n.status){var b=2===n.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&(_(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,i=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(v(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(v(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(v(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var i,r,n,o,a=t.window;;){if(t.lookahead<=c){if(_(t),t.lookahead<=c&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0<t.strstart&&(r=a[n=t.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=t.strstart+c;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);t.match_length=c-(o-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=s._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(v(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(v(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(v(t,!1),0===t.strm.avail_out)?1:2}(n,e):r[n.level].func(n,e);if(3!==b&&4!==b||(n.status=666),1===b||3===b)return 0===t.avail_out&&(n.last_flush=-1),0;if(2===b&&(1===e?s._tr_align(n):5!==e&&(s._tr_stored_block(n,0,0,!1),3===e&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(t),0===t.avail_out))return n.last_flush=-1,0}return 4!==e?0:n.wrap<=0?1:(2===n.wrap?(y(n,255&t.adler),y(n,t.adler>>8&255),y(n,t.adler>>16&255),y(n,t.adler>>24&255),y(n,255&t.total_in),y(n,t.total_in>>8&255),y(n,t.total_in>>16&255),y(n,t.total_in>>24&255)):(x(n,t.adler>>>16),x(n,65535&t.adler)),g(t),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&e!==d&&666!==e?f(t,l):(t.state=null,e===d?f(t,-3):0):l},i.deflateSetDictionary=function(t,e){var i,r,s,a,h,c,u,d,f=e.length;if(!t||!t.state)return l;if(2===(a=(i=t.state).wrap)||1===a&&42!==i.status||i.lookahead)return l;for(1===a&&(t.adler=o(t.adler,e,f,0)),i.wrap=0,f>=i.w_size&&(0===a&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,e,f-i.w_size,i.w_size,0),e=d,f=i.w_size),h=t.avail_in,c=t.next_in,u=t.input,t.avail_in=f,t.next_in=0,t.input=e,_(i);i.lookahead>=3;){for(r=i.strstart,s=i.lookahead-2;i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--s;);i.strstart=r,i.lookahead=2,_(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=c,t.input=u,t.avail_in=h,i.wrap=a,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,i){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,i){e.exports=function(t,e){var i,r,n,s,o,a,h,l,c,u,d,f,p,m,g,v,y,x,b,_,w,T,E,S,I;i=t.state,r=t.next_in,S=t.input,n=r+(t.avail_in-5),s=t.next_out,I=t.output,o=s-(e-t.avail_out),a=s+(t.avail_out-257),h=i.dmax,l=i.wsize,c=i.whave,u=i.wnext,d=i.window,f=i.hold,p=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{p<15&&(f+=S[r++]<<p,p+=8,f+=S[r++]<<p,p+=8),x=m[f&v];e:for(;;){if(f>>>=b=x>>>24,p-=b,0==(b=x>>>16&255))I[s++]=65535&x;else{if(!(16&b)){if(!(64&b)){x=m[(65535&x)+(f&(1<<b)-1)];continue e}if(32&b){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=65535&x,(b&=15)&&(p<b&&(f+=S[r++]<<p,p+=8),_+=f&(1<<b)-1,f>>>=b,p-=b),p<15&&(f+=S[r++]<<p,p+=8,f+=S[r++]<<p,p+=8),x=g[f&y];i:for(;;){if(f>>>=b=x>>>24,p-=b,!(16&(b=x>>>16&255))){if(!(64&b)){x=g[(65535&x)+(f&(1<<b)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&x,p<(b&=15)&&(f+=S[r++]<<p,(p+=8)<b&&(f+=S[r++]<<p,p+=8)),h<(w+=f&(1<<b)-1)){t.msg="invalid distance too far back",i.mode=30;break t}if(f>>>=b,p-=b,(b=s-o)<w){if(c<(b=w-b)&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(E=d,(T=0)===u){if(T+=l-b,b<_){for(_-=b;I[s++]=d[T++],--b;);T=s-w,E=I}}else if(u<b){if(T+=l+u-b,(b-=u)<_){for(_-=b;I[s++]=d[T++],--b;);if(T=0,u<_){for(_-=b=u;I[s++]=d[T++],--b;);T=s-w,E=I}}}else if(T+=u-b,b<_){for(_-=b;I[s++]=d[T++],--b;);T=s-w,E=I}for(;2<_;)I[s++]=E[T++],I[s++]=E[T++],I[s++]=E[T++],_-=3;_&&(I[s++]=E[T++],1<_&&(I[s++]=E[T++]))}else{for(T=s-w;I[s++]=I[T++],I[s++]=I[T++],I[s++]=I[T++],2<(_-=3););_&&(I[s++]=I[T++],1<_&&(I[s++]=I[T++]))}break}}break}}while(r<n&&s<a);r-=_=p>>3,f&=(1<<(p-=_<<3))-1,t.next_in=r,t.next_out=s,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=s<a?a-s+257:257-(s-a),i.hold=f,i.bits=p}},{}],49:[function(t,e,i){var r=t("../utils/common"),n=t("./adler32"),s=t("./crc32"),o=t("./inffast"),a=t("./inftrees"),h=-2;function l(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):h}function d(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,u(t)):h}function f(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?h:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,d(t))):h}function p(t,e){var i,r;return t?(r=new c,(t.state=r).window=null,0!==(i=f(t,e))&&(t.state=null),i):h}var m,g,v=!0;function y(t){if(v){var e;for(m=new r.Buf32(512),g=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(1,t.lens,0,288,m,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(2,t.lens,0,32,g,0,t.work,{bits:5}),v=!1}t.lencode=m,t.lenbits=9,t.distcode=g,t.distbits=5}function x(t,e,i,n){var s,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),r.arraySet(o.window,e,i-n,s,o.wnext),(n-=s)?(r.arraySet(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}i.inflateReset=d,i.inflateReset2=f,i.inflateResetKeep=u,i.inflateInit=function(t){return p(t,15)},i.inflateInit2=p,i.inflate=function(t,e){var i,c,u,d,f,p,m,g,v,b,_,w,T,E,S,I,A,C,P,M,R,O,D,k,L=0,F=new r.Buf8(4),N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return h;12===(i=t.state).mode&&(i.mode=13),f=t.next_out,u=t.output,m=t.avail_out,d=t.next_in,c=t.input,p=t.avail_in,g=i.hold,v=i.bits,b=p,_=m,O=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;v<16;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(2&i.wrap&&35615===g){F[i.check=0]=255&g,F[1]=g>>>8&255,i.check=s(i.check,F,2,0),v=g=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){t.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){t.msg="unknown compression method",i.mode=30;break}if(v-=4,R=8+(15&(g>>>=4)),0===i.wbits)i.wbits=R;else if(R>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<<R,t.adler=i.check=1,i.mode=512&g?10:12,v=g=0;break;case 2:for(;v<16;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(i.flags=g,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=g>>8&1),512&i.flags&&(F[0]=255&g,F[1]=g>>>8&255,i.check=s(i.check,F,2,0)),v=g=0,i.mode=3;case 3:for(;v<32;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.head&&(i.head.time=g),512&i.flags&&(F[0]=255&g,F[1]=g>>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,i.check=s(i.check,F,4,0)),v=g=0,i.mode=4;case 4:for(;v<16;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.head&&(i.head.xflags=255&g,i.head.os=g>>8),512&i.flags&&(F[0]=255&g,F[1]=g>>>8&255,i.check=s(i.check,F,2,0)),v=g=0,i.mode=5;case 5:if(1024&i.flags){for(;v<16;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.length=g,i.head&&(i.head.extra_len=g),512&i.flags&&(F[0]=255&g,F[1]=g>>>8&255,i.check=s(i.check,F,2,0)),v=g=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(p<(w=i.length)&&(w=p),w&&(i.head&&(R=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,c,d,w,R)),512&i.flags&&(i.check=s(i.check,c,w,d)),p-=w,d+=w,i.length-=w),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===p)break t;for(w=0;R=c[d+w++],i.head&&R&&i.length<65536&&(i.head.name+=String.fromCharCode(R)),R&&w<p;);if(512&i.flags&&(i.check=s(i.check,c,w,d)),p-=w,d+=w,R)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===p)break t;for(w=0;R=c[d+w++],i.head&&R&&i.length<65536&&(i.head.comment+=String.fromCharCode(R)),R&&w<p;);if(512&i.flags&&(i.check=s(i.check,c,w,d)),p-=w,d+=w,R)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;v<16;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(g!==(65535&i.check)){t.msg="header crc mismatch",i.mode=30;break}v=g=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;v<32;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}t.adler=i.check=l(g),v=g=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=f,t.avail_out=m,t.next_in=d,t.avail_in=p,i.hold=g,i.bits=v,2;t.adler=i.check=1,i.mode=12;case 12:if(5===e||6===e)break t;case 13:if(i.last){g>>>=7&v,v-=7&v,i.mode=27;break}for(;v<3;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}switch(i.last=1&g,v-=1,3&(g>>>=1)){case 0:i.mode=14;break;case 1:if(y(i),i.mode=20,6!==e)break;g>>>=2,v-=2;break t;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}g>>>=2,v-=2;break;case 14:for(g>>>=7&v,v-=7&v;v<32;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if((65535&g)!=(g>>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,v=g=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(w=i.length){if(p<w&&(w=p),m<w&&(w=m),0===w)break t;r.arraySet(u,c,d,w,f),p-=w,d+=w,m-=w,f+=w,i.length-=w;break}i.mode=12;break;case 17:for(;v<14;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(i.nlen=257+(31&g),g>>>=5,v-=5,i.ndist=1+(31&g),g>>>=5,v-=5,i.ncode=4+(15&g),g>>>=4,v-=4,286<i.nlen||30<i.ndist){t.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;v<3;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.lens[N[i.have++]]=7&g,g>>>=3,v-=3}for(;i.have<19;)i.lens[N[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,D={bits:i.lenbits},O=a(0,i.lens,0,19,i.lencode,0,i.work,D),i.lenbits=D.bits,O){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;I=(L=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,A=65535&L,!((S=L>>>24)<=v);){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(A<16)g>>>=S,v-=S,i.lens[i.have++]=A;else{if(16===A){for(k=S+2;v<k;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(g>>>=S,v-=S,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}R=i.lens[i.have-1],w=3+(3&g),g>>>=2,v-=2}else if(17===A){for(k=S+3;v<k;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}v-=S,R=0,w=3+(7&(g>>>=S)),g>>>=3,v-=3}else{for(k=S+7;v<k;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}v-=S,R=0,w=11+(127&(g>>>=S)),g>>>=7,v-=7}if(i.have+w>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=R}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,D={bits:i.lenbits},O=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,D),i.lenbits=D.bits,O){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,D={bits:i.distbits},O=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,D),i.distbits=D.bits,O){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(6<=p&&258<=m){t.next_out=f,t.avail_out=m,t.next_in=d,t.avail_in=p,i.hold=g,i.bits=v,o(t,_),f=t.next_out,u=t.output,m=t.avail_out,d=t.next_in,c=t.input,p=t.avail_in,g=i.hold,v=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;I=(L=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,A=65535&L,!((S=L>>>24)<=v);){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(I&&!(240&I)){for(C=S,P=I,M=A;I=(L=i.lencode[M+((g&(1<<C+P)-1)>>C)])>>>16&255,A=65535&L,!(C+(S=L>>>24)<=v);){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}g>>>=C,v-=C,i.back+=C}if(g>>>=S,v-=S,i.back+=S,i.length=A,0===I){i.mode=26;break}if(32&I){i.back=-1,i.mode=12;break}if(64&I){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&I,i.mode=22;case 22:if(i.extra){for(k=i.extra;v<k;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.length+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;I=(L=i.distcode[g&(1<<i.distbits)-1])>>>16&255,A=65535&L,!((S=L>>>24)<=v);){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(!(240&I)){for(C=S,P=I,M=A;I=(L=i.distcode[M+((g&(1<<C+P)-1)>>C)])>>>16&255,A=65535&L,!(C+(S=L>>>24)<=v);){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}g>>>=C,v-=C,i.back+=C}if(g>>>=S,v-=S,i.back+=S,64&I){t.msg="invalid distance code",i.mode=30;break}i.offset=A,i.extra=15&I,i.mode=24;case 24:if(i.extra){for(k=i.extra;v<k;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}i.offset+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break t;if(w=_-m,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}T=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),E=i.window}else E=u,T=f-i.offset,w=i.length;for(m<w&&(w=m),m-=w,i.length-=w;u[f++]=E[T++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break t;u[f++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;v<32;){if(0===p)break t;p--,g|=c[d++]<<v,v+=8}if(_-=m,t.total_out+=_,i.total+=_,_&&(t.adler=i.check=i.flags?s(i.check,u,_,f-_):n(i.check,u,_,f-_)),_=m,(i.flags?g:l(g))!==i.check){t.msg="incorrect data check",i.mode=30;break}v=g=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;v<32;){if(0===p)break t;p--,g+=c[d++]<<v,v+=8}if(g!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=30;break}v=g=0}i.mode=29;case 29:O=1;break t;case 30:O=-3;break t;case 31:return-4;default:return h}return t.next_out=f,t.avail_out=m,t.next_in=d,t.avail_in=p,i.hold=g,i.bits=v,(i.wsize||_!==t.avail_out&&i.mode<30&&(i.mode<27||4!==e))&&x(t,t.output,t.next_out,_-t.avail_out)?(i.mode=31,-4):(b-=t.avail_in,_-=t.avail_out,t.total_in+=b,t.total_out+=_,i.total+=_,i.wrap&&_&&(t.adler=i.check=i.flags?s(i.check,u,_,t.next_out-_):n(i.check,u,_,t.next_out-_)),t.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==b&&0===_||4===e)&&0===O&&(O=-5),O)},i.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,0},i.inflateGetHeader=function(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?((i.head=e).done=!1,0):h},i.inflateSetDictionary=function(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?h:11===i.mode&&n(1,e,r,0)!==i.check?-3:x(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):h},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,i){var r=t("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,i,h,l,c,u,d){var f,p,m,g,v,y,x,b,_,w=d.bits,T=0,E=0,S=0,I=0,A=0,C=0,P=0,M=0,R=0,O=0,D=null,k=0,L=new r.Buf16(16),F=new r.Buf16(16),N=null,B=0;for(T=0;T<=15;T++)L[T]=0;for(E=0;E<h;E++)L[e[i+E]]++;for(A=w,I=15;1<=I&&0===L[I];I--);if(I<A&&(A=I),0===I)return l[c++]=20971520,l[c++]=20971520,d.bits=1,0;for(S=1;S<I&&0===L[S];S++);for(A<S&&(A=S),T=M=1;T<=15;T++)if(M<<=1,(M-=L[T])<0)return-1;if(0<M&&(0===t||1!==I))return-1;for(F[1]=0,T=1;T<15;T++)F[T+1]=F[T]+L[T];for(E=0;E<h;E++)0!==e[i+E]&&(u[F[e[i+E]]++]=E);if(y=0===t?(D=N=u,19):1===t?(D=n,k-=257,N=s,B-=257,256):(D=o,N=a,-1),T=S,v=c,P=E=O=0,m=-1,g=(R=1<<(C=A))-1,1===t&&852<R||2===t&&592<R)return 1;for(;;){for(x=T-P,_=u[E]<y?(b=0,u[E]):u[E]>y?(b=N[B+u[E]],D[k+u[E]]):(b=96,0),f=1<<T-P,S=p=1<<C;l[v+(O>>P)+(p-=f)]=x<<24|b<<16|_,0!==p;);for(f=1<<T-1;O&f;)f>>=1;if(0!==f?(O&=f-1,O+=f):O=0,E++,0==--L[T]){if(T===I)break;T=e[i+u[E]]}if(A<T&&(O&g)!==m){for(0===P&&(P=A),v+=S,M=1<<(C=T-P);C+P<I&&!((M-=L[C+P])<=0);)C++,M<<=1;if(R+=1<<C,1===t&&852<R||2===t&&592<R)return 1;l[m=O&g]=A<<24|C<<16|v-c}}return 0!==O&&(l[v+O]=T-P<<24|64<<16),d.bits=A,0}},{"../utils/common":41}],51:[function(t,e,i){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,i){var r=t("../utils/common");function n(t){for(var e=t.length;0<=--e;)t[e]=0}var s=256,o=286,a=30,h=15,l=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],f=new Array(576);n(f);var p=new Array(60);n(p);var m=new Array(512);n(m);var g=new Array(256);n(g);var v=new Array(29);n(v);var y,x,b,_=new Array(a);function w(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function T(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function E(t){return t<256?m[t]:m[256+(t>>>7)]}function S(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function I(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,S(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function A(t,e,i){I(t,i[2*e],i[2*e+1])}function C(t,e){for(var i=0;i|=1&t,t>>>=1,i<<=1,0<--e;);return i>>>1}function P(t,e,i){var r,n,s=new Array(16),o=0;for(r=1;r<=h;r++)s[r]=o=o+i[r-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=C(s[a]++,a))}}function M(t){var e;for(e=0;e<o;e++)t.dyn_ltree[2*e]=0;for(e=0;e<a;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function R(t){8<t.bi_valid?S(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function O(t,e,i,r){var n=2*e,s=2*i;return t[n]<t[s]||t[n]===t[s]&&r[e]<=r[i]}function D(t,e,i){for(var r=t.heap[i],n=i<<1;n<=t.heap_len&&(n<t.heap_len&&O(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!O(e,r,t.heap[n],t.depth));)t.heap[i]=t.heap[n],i=n,n<<=1;t.heap[i]=r}function k(t,e,i){var r,n,o,a,h=0;if(0!==t.last_lit)for(;r=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],n=t.pending_buf[t.l_buf+h],h++,0===r?A(t,n,e):(A(t,(o=g[n])+s+1,e),0!==(a=l[o])&&I(t,n-=v[o],a),A(t,o=E(--r),i),0!==(a=c[o])&&I(t,r-=_[o],a)),h<t.last_lit;);A(t,256,e)}function L(t,e){var i,r,n,s=e.dyn_tree,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,l=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<l;i++)0!==s[2*i]?(t.heap[++t.heap_len]=c=i,t.depth[i]=0):s[2*i+1]=0;for(;t.heap_len<2;)s[2*(n=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[n]=0,t.opt_len--,a&&(t.static_len-=o[2*n+1]);for(e.max_code=c,i=t.heap_len>>1;1<=i;i--)D(t,s,i);for(n=l;i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],D(t,s,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,s[2*n]=s[2*i]+s[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,s[2*i+1]=s[2*r+1]=n,t.heap[1]=n++,D(t,s,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,n,s,o,a,l=e.dyn_tree,c=e.max_code,u=e.stat_desc.static_tree,d=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,m=e.stat_desc.max_length,g=0;for(s=0;s<=h;s++)t.bl_count[s]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)m<(s=l[2*l[2*(r=t.heap[i])+1]+1]+1)&&(s=m,g++),l[2*r+1]=s,c<r||(t.bl_count[s]++,o=0,p<=r&&(o=f[r-p]),a=l[2*r],t.opt_len+=a*(s+o),d&&(t.static_len+=a*(u[2*r+1]+o)));if(0!==g){do{for(s=m-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[m]--,g-=2}while(0<g);for(s=m;0!==s;s--)for(r=t.bl_count[s];0!==r;)c<(n=t.heap[--i])||(l[2*n+1]!==s&&(t.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),r--)}}(t,e),P(s,c,t.bl_count)}function F(t,e,i){var r,n,s=-1,o=e[1],a=0,h=7,l=4;for(0===o&&(h=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=e[2*(r+1)+1],++a<h&&n===o||(a<l?t.bl_tree[2*n]+=a:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=n,l=(a=0)===o?(h=138,3):n===o?(h=6,3):(h=7,4))}function N(t,e,i){var r,n,s=-1,o=e[1],a=0,h=7,l=4;for(0===o&&(h=138,l=3),r=0;r<=i;r++)if(n=o,o=e[2*(r+1)+1],!(++a<h&&n===o)){if(a<l)for(;A(t,n,t.bl_tree),0!=--a;);else 0!==n?(n!==s&&(A(t,n,t.bl_tree),a--),A(t,16,t.bl_tree),I(t,a-3,2)):a<=10?(A(t,17,t.bl_tree),I(t,a-3,3)):(A(t,18,t.bl_tree),I(t,a-11,7));s=n,l=(a=0)===o?(h=138,3):n===o?(h=6,3):(h=7,4)}}n(_);var B=!1;function z(t,e,i,n){var s,o,a;I(t,0+(n?1:0),3),o=e,a=i,R(s=t),S(s,a),S(s,~a),r.arraySet(s.pending_buf,s.window,o,a,s.pending),s.pending+=a}i._tr_init=function(t){B||(function(){var t,e,i,r,n,s=new Array(16);for(r=i=0;r<28;r++)for(v[r]=i,t=0;t<1<<l[r];t++)g[i++]=r;for(g[i-1]=r,r=n=0;r<16;r++)for(_[r]=n,t=0;t<1<<c[r];t++)m[n++]=r;for(n>>=7;r<a;r++)for(_[r]=n<<7,t=0;t<1<<c[r]-7;t++)m[256+n++]=r;for(e=0;e<=h;e++)s[e]=0;for(t=0;t<=143;)f[2*t+1]=8,t++,s[8]++;for(;t<=255;)f[2*t+1]=9,t++,s[9]++;for(;t<=279;)f[2*t+1]=7,t++,s[7]++;for(;t<=287;)f[2*t+1]=8,t++,s[8]++;for(P(f,287,s),t=0;t<a;t++)p[2*t+1]=5,p[2*t]=C(t,5);y=new w(f,l,257,o,h),x=new w(p,c,0,a,h),b=new w(new Array(0),u,0,19,7)}(),B=!0),t.l_desc=new T(t.dyn_ltree,y),t.d_desc=new T(t.dyn_dtree,x),t.bl_desc=new T(t.bl_tree,b),t.bi_buf=0,t.bi_valid=0,M(t)},i._tr_stored_block=z,i._tr_flush_block=function(t,e,i,r){var n,o,a=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<s;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),L(t,t.l_desc),L(t,t.d_desc),a=function(t){var e;for(F(t,t.dyn_ltree,t.l_desc.max_code),F(t,t.dyn_dtree,t.d_desc.max_code),L(t,t.bl_desc),e=18;3<=e&&0===t.bl_tree[2*d[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==e?z(t,e,i,r):4===t.strategy||o===n?(I(t,2+(r?1:0),3),k(t,f,p)):(I(t,4+(r?1:0),3),function(t,e,i,r){var n;for(I(t,e-257,5),I(t,i-1,5),I(t,r-4,4),n=0;n<r;n++)I(t,t.bl_tree[2*d[n]+1],3);N(t,t.dyn_ltree,e-1),N(t,t.dyn_dtree,i-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),k(t,t.dyn_ltree,t.dyn_dtree)),M(t),r&&R(t)},i._tr_tally=function(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(g[i]+s+1)]++,t.dyn_dtree[2*E(e)]++),t.last_lit===t.lit_bufsize-1},i._tr_align=function(t){var e;I(t,2,3),A(t,256,f),16===(e=t).bi_valid?(S(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,i){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,i){(function(t){!function(t){if(!t.setImmediate){var e,i,r,n,s=1,o={},a=!1,h=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,e="[object process]"==={}.toString.call(t.process)?function(t){process.nextTick(function(){u(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?(n="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",d,!1):t.attachEvent("onmessage",d),function(e){t.postMessage(n+e,"*")}):t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){u(t.data)},function(t){r.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,function(t){var e=h.createElement("script");e.onreadystatechange=function(){u(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):function(t){setTimeout(u,0,t)},l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:t,args:i};return o[s]=n,e(s),s++},l.clearImmediate=c}function c(t){delete o[t]}function u(t){if(a)setTimeout(u,0,t);else{var e=o[t];if(e){a=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(undefined,i)}}(e)}finally{c(t),a=!1}}}}function d(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(n)&&u(+e.data.slice(n.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)})}}),Zt={};function Jt(t,e,i,r,n,s,o){try{var a=t[s](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,n)}function $t(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var s=t.apply(e,i);function o(t){Jt(s,r,n,o,a,"next",t)}function a(t){Jt(s,r,n,o,a,"throw",t)}o(void 0)})}}function Qt(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):Qt(t,e)}function te(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function ee(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}function ie(t,e){var i,r,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(h){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,h])}}}E(Zt,{BaseItem:()=>cT,Box2:()=>Kw,EffectsItem:()=>wT,FrameItem:()=>ST,GeneratorItem:()=>bT,GroupItem:()=>yT,ItemOrderAction:()=>ET,SDK:()=>Lk,SDKItemType:()=>kw,SpriteItem:()=>dT,TextItem:()=>pT,Vector2:()=>Lw,VideoItem:()=>gT,createSDKItem:()=>AT,generateGUID:()=>ei,isBaseItem:()=>uT,isEffectsItem:()=>TT,isFrameItem:()=>IT,isGeneratorItem:()=>_T,isGroupItem:()=>xT,isSpriteItem:()=>fT,isTextItem:()=>mT,isVideoItem:()=>vT,spec:()=>en});var re=new Uint8Array(16);function ne(){if(!Yt&&!(Yt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yt(re)}var se,oe=[];for(se=0;se<256;++se)oe.push((se+256).toString(16).slice(1));var ae={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function he(t,e,i){if(ae.randomUUID&&!e&&!t)return ae.randomUUID();var r=(t=t||{}).random||(t.rng||ne)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),oe[t[e+0]]+oe[t[e+1]]+oe[t[e+2]]+oe[t[e+3]]+"-"+oe[t[e+4]]+oe[t[e+5]]+"-"+oe[t[e+6]]+oe[t[e+7]]+"-"+oe[t[e+8]]+oe[t[e+9]]+"-"+oe[t[e+10]]+oe[t[e+11]]+oe[t[e+12]]+oe[t[e+13]]+oe[t[e+14]]+oe[t[e+15]]}(r)}function le(t,e){return t.includes(e)||t.push(e),t}function ce(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ue(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(s);return o.set(t),o}return t}var de=2*Math.PI,fe=Math.PI/180,pe=180/Math.PI,me=1e-6;function ge(t,e){return Math.abs(t-e)<me||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ve=function(t,e,i){return(1-i)*t+i*e};function ye(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,s=Math.min(r,n),o=Math.max(r,n);return Math.min(Math.max(t,s),o)}var xe=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):Qt(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):Qt(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):Qt(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):Qt(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=me,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();xe.ONE=new xe(1,1),xe.ZERO=new xe(0,0);var be=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):Qt(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):Qt(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):Qt(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):Qt(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(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},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(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},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-n*o,this.y=n*s-i*a,this.z=i*o-r*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=me,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new xe(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();be.X=new be(1,0,0),be.Y=new be(0,1,0),be.Z=new be(0,0,1),be.ONE=new be(1,1,1),be.ZERO=new be(0,0,0);var _e=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):Qt(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):Qt(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):Qt(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):Qt(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(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.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(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.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=me,e=this,i=e.x,r=e.y,n=e.z,s=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(s)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new be(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();_e.ONE=new _e(1,1,1,1),_e.ZERO=new _e(0,0,0,0);var we=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,s=t/60,o=n*(1-Math.abs(s%2-1)),a=0,h=0,l=0;s>=0&&s<=1?(a=n,h=o):s>=1&&s<=2?(a=o,h=n):s>=2&&s<=3?(h=n,l=o):s>=3&&s<=4?(h=o,l=n):s>=4&&s<=5?(a=o,l=n):s>=5&&s<=6&&(a=n,l=o);var c=i-n;return this.set(a+c,h+c,l+c,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):Qt(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):Qt(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):Qt(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):Qt(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new _e(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,s=e.a,o=Math.max(i,r,n),a=Math.min(i,r,n),h=o-a,l=0,c=0;return 0!==o&&(c=h/o),o!=a&&(o==i?(l=(r-n)/h,r<n&&(l+=6)):o==r?l=(n-i)/h+2:o==n&&(l=(i-r)/h+4),l*=60),new t(l,c,o,s)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+s:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function Te(t,e){var i=[0,0,0,0];if(Xe(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else Qt(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var s=0;s<4;s++)i[s]/=255;return i}function Ee(t){var e=[];if(Qt(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4];e.push({time:Ie(i),color:new we(r,n,s,o)})}):Object.keys(t).forEach(function(i){var r=t[i],n=(new we).setFromArray(Te(r));e.push({time:Ie(i),color:n})}),(e=e.sort(function(t,e){return t.time-e.time})).length){0!==e[0].time&&e.unshift({time:0,color:e[0].color.clone()});var i=e[e.length-1];1!==i.time&&e.push({time:1,color:i.color.clone()})}return e}function Se(t,e,i,r){var n=[],s=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*s+e[o]*i;else{for(var a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*s+e[a]*e[a]*i));n[3]=Math.round(t[3]*s+e[3]*i)}return n}function Ie(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function Ae(){return"object"==typeof window?Math.min(2,window.devicePixelRatio||1):1}we.BLACK=new we(0,0,0,1),we.BLUE=new we(0,0,1,1),we.CLEAR=new we(0,0,0,0),we.CYAN=new we(0,1,1,1),we.GRAY=new we(.5,.5,.5,1),we.GREEN=new we(0,1,0,1),we.MAGENTA=new we(1,0,1,1),we.RED=new we(1,0,0,1),we.WHITE=new we(1,1,1,1),we.YELLOW=new we(1,.92,.016,1);var Ce,Pe,Me="undefined"!=typeof window;function Re(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function Oe(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function De(){return Oe()||/\bOpenHarmony\b/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function ke(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=Ee(t);if(n.length){r.set(n[0].color.toArray(),0);for(var s=1;s<127;s++){for(var o=s/e,a=void 0,h=void 0,l=0;l<n.length&&(a=n[l],h=n[l+1],!(a.time<=o&&h.time>o));l++);var c=Se(a.color.toArray(),h.color.toArray(),(o-a.time)/(h.time-a.time));r.set(c,4*s)}r.set(n[n.length-1].color.toArray(),508)}return i}function Le(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)Fe(t,r,e);return t}return Ne(t,e)}function Fe(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!==--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!==--e););t[e]=r}function Ne(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,s=t[i],o=i,a=r;o<a;){if(2===e){for(;t[a].priority>s.priority&&a>=o;)a--;for(;t[o].priority<=s.priority&&o<a;)o++}else{for(;t[a].priority<s.priority&&a>=o;)a--;for(;t[o].priority>=s.priority&&o<a;)o++}var h;h=[t[a],t[o]],t[o]=h[0],t[a]=h[1]}return n=[t[o],t[i]],t[i]=n[0],t[o]=n[1],Ne(t,e,i,o-1),Ne(t,e,a+1,r),t}function Be(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function ze(t){return function(t){return/^[^\d.][\w-]*$/.test(t)}(t)||!De()}(Pe=Ce||(Ce={}))[Pe.none=1]="none",Pe[Pe.ascending=2]="ascending",Pe[Pe.descending=3]="descending";var Ue;function Ve(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}var Ge,je,He={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(Ve(t),[i])),null==Ue||Ue("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(Ve(t))),null==Ue||Ue("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(Ve(t))),null==Ue||Ue("warn",t,i)},register:function(t){t&&qe(t)&&(Ue=t)}};function We(){}function Xe(t){return"string"==typeof t}(je=Ge||(Ge={}))[je.destroy=0]="destroy",je[je.keep=1]="keep",je[je.force=0]="force";var Ye=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function qe(t){return"[object Function]"===Object.prototype.toString.call(t)}function Ke(t){return"[object Object]"===Object.prototype.toString.call(t)}function Ze(t){if(null===t||"object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function Je(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function $e(t){return!(t&t-1)&&0!==t}function Qe(t,e){return t+Math.random()*(e-t)}function ti(){throw new Error("Destroyed item cannot be used again.")}function ei(){return he().replace(/-/g,"")}function ii(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=t.split(",")[1]||t,n=atob(r),s=[],o=0;o<n.length;o+=512){for(var a=n.slice(o,o+512),h=new Array(a.length),l=0;l<a.length;l++)h[l]=a.charCodeAt(l);var c=new Uint8Array(h);s.push(c)}var u=new Blob(s,{type:i});return new File([u],e,{type:i})}function ri(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var ni={},si=[];function oi(t,e){ni[t]&&He.error("Duplicate registration for plugin "+t+"."),ni[t]=e;var i=new e;i.name=t,si.push(i),si.sort(function(t,e){return t.order-e.order})}var ai=function(){function t(){}return t.getPlugins=function(){return si},t.initializeComposition=function(t,e){si.forEach(function(i){return i.onCompositionCreated(t,e)})},t.destroyComposition=function(t){si.forEach(function(e){return e.onCompositionDestroy(t)})},t.onAssetsLoadStart=function(t,e){return $t(function(){return ie(this,function(i){return[2,Promise.all(si.map(function(i){return i.onAssetsLoadStart(t,e)}))]})})()},t.onAssetsLoadFinish=function(t,e,i){si.forEach(function(r){return r.onAssetsLoadFinish(t,e,i)})},t}(),hi={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",ffd:"@galacean/effects-plugin-ffd",ktx2:"@galacean/effects-plugin-ktx2",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function li(t){var e=hi[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var ci,ui,di,fi,pi,mi,gi,vi,yi,xi,bi,_i,wi,Ti,Ei,Si,Ii,Ai,Ci,Pi,Mi,Ri,Oi,Di,ki,Li,Fi,Ni,Bi=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return $t(function(){return ie(this,function(t){return[2]})})()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},t}();function zi(t,e){return(zi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ui(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&zi(t,e)}(ui=ci||(ci={}))["1_0"]="1.0",ui["1_1"]="1.1",ui["1_2"]="1.2",ui["1_3"]="1.3",ui["1_5"]="1.5",ui["1_8"]="1.8",ui["2_0"]="2.0",ui["2_1"]="2.1",ui["2_2"]="2.2",ui["2_3"]="2.3",ui["2_4"]="2.4",ui["3_0"]="3.0",ui["3_1"]="3.1",ui["3_2"]="3.2",ui["3_3"]="3.3",ui["3_4"]="3.4",ui["3_5"]="3.5",ui["3_6"]="3.6",ui["3_7"]="3.7",ui.LATEST="3.7",(fi=di||(di={})).S="S",fi.APlus="A+",fi.A="A",fi.BPlus="B+",fi.B="B",(mi=pi||(pi={}))[mi.ALPHA=0]="ALPHA",mi[mi.ADD=1]="ADD",mi[mi.MULTIPLY=2]="MULTIPLY",mi[mi.BRIGHTNESS=3]="BRIGHTNESS",mi[mi.SUBTRACTION=4]="SUBTRACTION",mi[mi.STRONG_LIGHT=5]="STRONG_LIGHT",mi[mi.WEAK_LIGHT=6]="WEAK_LIGHT",mi[mi.SUPERPOSITION=7]="SUPERPOSITION",(vi=gi||(gi={}))[vi.DOUBLE=1032]="DOUBLE",vi[vi.FRONT=1028]="FRONT",vi[vi.BACK=1029]="BACK",(xi=yi||(yi={}))[xi.OBSCURED=2]="OBSCURED",xi[xi.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(_i=bi||(bi={}))[_i.NONE=0]="NONE",_i[_i.SPHERE=1]="SPHERE",_i[_i.CONE=2]="CONE",_i[_i.HEMISPHERE=3]="HEMISPHERE",_i[_i.CIRCLE=4]="CIRCLE",_i[_i.DONUT=5]="DONUT",_i[_i.RECTANGLE=6]="RECTANGLE",_i[_i.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",_i[_i.EDGE=8]="EDGE",_i[_i.TEXTURE=9]="TEXTURE",(Ti=wi||(wi={}))[Ti.GYROSCOPE=0]="GYROSCOPE",Ti[Ti.SPINE=1]="SPINE",(Si=Ei||(Ei={}))[Si.CLICK=0]="CLICK",Si[Si.MESSAGE=1]="MESSAGE",Si[Si.DRAG=2]="DRAG",(Ai=Ii||(Ii={}))[Ai.NONE=0]="NONE",Ai[Ai.NOTIFY=1]="NOTIFY",Ai[Ai.RESUME_PLAYER=2]="RESUME_PLAYER",Ai[Ai.REMOVE=3]="REMOVE",Ai[Ai.PAUSE=4]="PAUSE",(Pi=Ci||(Ci={})).base="0",Pi.sprite="1",Pi.particle="2",Pi.null="3",Pi.interact="4",Pi.plugin="5",Pi.camera="6",Pi.composition="7",Pi.spine="spine",Pi.mesh="mesh",Pi.tree="tree",Pi.text="text",Pi.light="light",Pi.skybox="skybox",Pi.effect="effect",Pi.shape="shape",Pi.postProcessVolume="postProcessVolume",Pi.node="node",Pi.video="video",Pi.audio="audio",Pi.richtext="richtext",(Ri=Mi||(Mi={}))[Ri.BILLBOARD=0]="BILLBOARD",Ri[Ri.MESH=1]="MESH",Ri[Ri.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",Ri[Ri.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(Di=Oi||(Oi={}))[Di.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",Di[Di.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",Di[Di.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",Di[Di.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",Di[Di.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",Di[Di.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",Di[Di.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",Di[Di.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",Di[Di.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(Li=ki||(ki={})).Opaque="Opaque",Li.Transparent="Transparent",(Ni=Fi||(Fi={})).Both="Both",Ni.Back="Back",Ni.Front="Front";var Vi,Gi,ji,Hi,Wi,Xi,Yi,qi,Ki,Zi,Ji,$i,Qi,tr,er,ir,rr,nr,sr,or,ar,hr,lr,cr,ur,dr,fr,pr,mr,gr,vr,yr,xr,br,_r,wr,Tr,Er;(Gi=Vi||(Vi={}))[Gi.portrait=1]="portrait",Gi[Gi.landscape=0]="landscape",(Hi=ji||(ji={}))[Hi.CONSTANT=0]="CONSTANT",Hi[Hi.CONSTANT_VEC2=1]="CONSTANT_VEC2",Hi[Hi.CONSTANT_VEC3=2]="CONSTANT_VEC3",Hi[Hi.CONSTANT_VEC4=3]="CONSTANT_VEC4",Hi[Hi.RANDOM=4]="RANDOM",Hi[Hi.LINE=5]="LINE",Hi[Hi.CURVE=6]="CURVE",Hi[Hi.BEZIER_PATH=7]="BEZIER_PATH",Hi[Hi.RGBA_COLOR=8]="RGBA_COLOR",Hi[Hi.GRADIENT_COLOR=9]="GRADIENT_COLOR",Hi[Hi.SHAPE_POINTS=10]="SHAPE_POINTS",Hi[Hi.SHAPE_SPLITS=11]="SHAPE_SPLITS",Hi[Hi.LINEAR_PATH=12]="LINEAR_PATH",Hi[Hi.COLORS=13]="COLORS",Hi[Hi.BINARY=20]="BINARY",Hi[Hi.BEZIER_CURVE=21]="BEZIER_CURVE",Hi[Hi.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",Hi[Hi.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",Hi[Hi.COLOR_CURVE=24]="COLOR_CURVE",Hi[Hi.VECTOR4_CURVE=25]="VECTOR4_CURVE",Hi[Hi.VECTOR2_CURVE=26]="VECTOR2_CURVE",Hi[Hi.VECTOR3_CURVE=27]="VECTOR3_CURVE",(Xi=Wi||(Wi={}))[Xi.AUTO=0]="AUTO",Xi[Xi.EASE=1]="EASE",Xi[Xi.EASE_IN=2]="EASE_IN",Xi[Xi.EASE_OUT=3]="EASE_OUT",Xi[Xi.LINE=4]="LINE",Xi[Xi.HOLD=5]="HOLD",Xi[Xi.LINE_OUT=6]="LINE_OUT",(qi=Yi||(Yi={}))[qi.destroy=0]="destroy",qi[qi.restart=5]="restart",qi[qi.forward=2]="forward",qi[qi.freeze=4]="freeze",(Zi=Ki||(Ki={}))[Zi.none=0]="none",Zi[Zi.removeParticle=1]="removeParticle",($i=Ji||(Ji={}))[$i.RANDOM=0]="RANDOM",$i[$i.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",$i[$i.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",$i[$i.UNIFORM_BURST=3]="UNIFORM_BURST",(tr=Qi||(Qi={})).point="point",tr.spot="spot",tr.directional="directional",tr.ambient="ambient",(ir=er||(er={}))[ir.box=2]="box",ir[ir.sphere=3]="sphere",(nr=rr||(rr={})).orthographic="orthographic",nr.perspective="perspective",(or=sr||(sr={})).unlit="unlit",or.pbr="pbr",or.hair="hair",(hr=ar||(ar={}))[hr.opaque=100]="opaque",hr[hr.masked=101]="masked",hr[hr.translucent=102]="translucent",hr[hr.additive=103]="additive",(cr=lr||(lr={})).none="none",cr.uv="uv",cr.normal="normal",cr.basecolor="basecolor",cr.alpha="alpha",cr.metallic="metallic",cr.roughness="roughness",cr.ao="ao",cr.emissive="emissive",cr.diffuse="diffuse",(dr=ur||(ur={}))[dr.visible=0]="visible",dr[dr.display=1]="display",dr[dr.clip=2]="clip",dr[dr.ellipsis=3]="ellipsis",(pr=fr||(fr={}))[pr.autoWidth=0]="autoWidth",pr[pr.autoHeight=1]="autoHeight",pr[pr.fixed=2]="fixed",(gr=mr||(mr={}))[gr.top=0]="top",gr[gr.middle=1]="middle",gr[gr.bottom=2]="bottom",(yr=vr||(vr={}))[yr.left=0]="left",yr[yr.middle=1]="middle",yr[yr.right=2]="right",(br=xr||(xr={}))[br.top=0]="top",br[br.middle=1]="middle",br[br.bottom=2]="bottom",(wr=_r||(_r={})).normal="normal",wr.bold="bold",wr.lighter="lighter",(Er=Tr||(Tr={})).normal="normal",Er.italic="italic",Er.oblique="oblique";var Sr,Ir,Ar,Cr,Pr,Mr,Rr,Or,Dr,kr,Lr,Fr,Nr,Br,zr,Ur,Vr,Gr,jr,Hr,Wr,Xr,Yr,qr,Kr,Zr,Jr,$r,Qr={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(Ir=Sr||(Sr={}))[Ir.Solid=0]="Solid",Ir[Ir.GradientLinear=1]="GradientLinear",Ir[Ir.GradientRadial=2]="GradientRadial",Ir[Ir.GradientAngular=3]="GradientAngular",Ir[Ir.Texture=4]="Texture",(Cr=Ar||(Ar={}))[Cr.Fill=0]="Fill",Cr[Cr.Fit=1]="Fit",Cr[Cr.Crop=2]="Crop",Cr[Cr.Tile=3]="Tile",(Mr=Pr||(Pr={}))[Mr.Custom=0]="Custom",Mr[Mr.Rectangle=1]="Rectangle",Mr[Mr.Ellipse=2]="Ellipse",Mr[Mr.Polygon=3]="Polygon",Mr[Mr.Star=4]="Star",(Or=Rr||(Rr={}))[Or.Butt=0]="Butt",Or[Or.Round=1]="Round",Or[Or.Square=2]="Square",(kr=Dr||(Dr={}))[kr.Round=0]="Round",kr[kr.Bevel=1]="Bevel",kr[kr.Miter=2]="Miter",(Fr=Lr||(Lr={})).AnimationClipNodeData="AnimationClipNodeData",Fr.BlendNodeData="BlendNodeData",Fr.ApplyAdditiveNodeData="ApplyAdditiveNodeData",Fr.LayerBlendNodeData="LayerBlendNodeData",Fr.StateMachineNodeData="StateMachineNodeData",Fr.TransitionNodeData="TransitionNodeData",Fr.StateNodeData="StateNodeData",Fr.ConstFloatNodeData="ConstFloatNodeData",Fr.ConstBoolNodeData="ConstBoolNodeData",Fr.ControlParameterBoolNodeData="ControlParameterBoolNodeData",Fr.ControlParameterFloatNodeData="ControlParameterFloatNodeData",Fr.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",Fr.NotNodeData="NotNodeData",Fr.AndNodeData="AndNodeData",Fr.OrNodeData="OrNodeData",Fr.EqualNodeData="EqualNodeData",Fr.GreaterNodeData="GreaterNodeData",Fr.LessNodeData="LessNodeData",(Br=Nr||(Nr={})).video="video",Br.image="image",(Ur=zr||(zr={})).video="video",Ur.audio="audio",(Gr=Vr||(Vr={})).L30="hev1.1.0.L30.B0",Gr.L60="hev1.1.0.L60.B0",Gr.L63="hev1.1.0.L63.B0",Gr.L90="hev1.1.0.L90.B0",Gr.L93="hev1.1.0.L93.B0",Gr.L120="hev1.1.0.L120.B0",Gr.L150="hev1.1.0.L150.B0",Gr.L180="hev1.1.0.L180.B0",(Hr=jr||(jr={})).VFXItemData="VFXItemData",Hr.Material="Material",Hr.Shader="Shader",Hr.Geometry="Geometry",Hr.Texture="Texture",Hr.Image="Image",Hr.AnimationClip="AnimationClip",Hr.BinaryAsset="BinaryAsset",Hr.TrackAsset="TrackAsset",Hr.TimelineAsset="TimelineAsset",Hr.ObjectBindingTrack="ObjectBindingTrack",Hr.TransformTrack="TransformTrack",Hr.SpriteColorTrack="SpriteColorTrack",Hr.ActivationTrack="ActivationTrack",Hr.SubCompositionTrack="SubCompositionTrack",Hr.FloatPropertyTrack="FloatPropertyTrack",Hr.ColorPropertyTrack="ColorPropertyTrack",Hr.Vector2PropertyTrack="Vector2PropertyTrack",Hr.Vector3PropertyTrack="Vector3PropertyTrack",Hr.Vector4PropertyTrack="Vector4PropertyTrack",Hr.TransformPlayableAsset="TransformPlayableAsset",Hr.SpriteColorPlayableAsset="SpriteColorPlayableAsset",Hr.ActivationPlayableAsset="ActivationPlayableAsset",Hr.SubCompositionPlayableAsset="SubCompositionPlayableAsset",Hr.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",Hr.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",Hr.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",Hr.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",Hr.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",Hr.MeshComponent="MeshComponent",Hr.SkyboxComponent="SkyboxComponent",Hr.LightComponent="LightComponent",Hr.CameraComponent="CameraComponent",Hr.ModelPluginComponent="ModelPluginComponent",Hr.TreeComponent="TreeComponent",Hr.AnimationComponent="AnimationComponent",Hr.SpineComponent="SpineComponent",Hr.VideoComponent="VideoComponent",Hr.AudioComponent="AudioComponent",Hr.RichTextComponent="RichTextComponent",Hr.OrientationComponent="OrientationComponent",Hr.ShapeComponent="ShapeComponent",Hr.SpriteComponent="SpriteComponent",Hr.ParticleSystem="ParticleSystem",Hr.InteractComponent="InteractComponent",Hr.CameraController="CameraController",Hr.PostProcessVolume="PostProcessVolume",Hr.EffectComponent="EffectComponent",Hr.TextComponent="TextComponent",Hr.AnimationGraphAsset="AnimationGraphAsset",Hr.CompositionComponent="CompositionComponent",Hr.FFDComponent="FFDComponent",Hr.Animator="Animator",Hr.TimelineClip="TimelineClip",(Xr=Wr||(Wr={}))[Xr.POINTS=0]="POINTS",Xr[Xr.LINES=1]="LINES",Xr[Xr.LINE_LOOP=2]="LINE_LOOP",Xr[Xr.LINE_STRIP=3]="LINE_STRIP",Xr[Xr.TRIANGLES=4]="TRIANGLES",Xr[Xr.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",Xr[Xr.TRIANGLE_FAN=6]="TRIANGLE_FAN",(qr=Yr||(Yr={}))[qr.Float16=0]="Float16",qr[qr.Float32=1]="Float32",qr[qr.Int8=2]="Int8",qr[qr.Int16=3]="Int16",qr[qr.Int32=4]="Int32",qr[qr.UInt8=5]="UInt8",qr[qr.UInt16=6]="UInt16",qr[qr.UInt32=7]="UInt32",(Zr=Kr||(Kr={}))[Zr.None=-1]="None",Zr[Zr.UInt8=0]="UInt8",Zr[Zr.UInt16=1]="UInt16",Zr[Zr.UInt32=2]="UInt32",($r=Jr||(Jr={})).Position="POSITION",$r.Uv="TEXCOORD0",$r.Uv2="TEXCOORD1",$r.Normal="NORMAL",$r.Tangent="TANGENT",$r.Color="COLOR",$r.Joints="JOINTS",$r.Weights="WEIGHTS",$r.PositionBS0="POSITION_BS0",$r.PositionBS1="POSITION_BS1",$r.PositionBS2="POSITION_BS2",$r.PositionBS3="POSITION_BS3",$r.PositionBS4="POSITION_BS4",$r.PositionBS5="POSITION_BS5",$r.PositionBS6="POSITION_BS6",$r.PositionBS7="POSITION_BS7",$r.NormalBS0="NORMAL_BS0",$r.NormalBS1="NORMAL_BS1",$r.NormalBS2="NORMAL_BS2",$r.NormalBS3="NORMAL_BS3",$r.TangentBS0="TANGENT_BS0",$r.TangentBS1="TANGENT_BS1",$r.TangentBS2="TANGENT_BS2",$r.TangentBS3="TANGENT_BS3";var tn=ci.LATEST,en=Object.freeze({__proto__:null,LATEST_VERSION:tn,get RenderLevel(){return di},get BlendingMode(){return pi},get SideMode(){return gi},get ObscuredMode(){return yi},get ParticleEmitterShapeType(){return bi},get PluginType(){return wi},get InteractType(){return Ei},get InteractBehavior(){return Ii},get ItemType(){return Ci},get RenderMode(){return Mi},get ParticleOrigin(){return Oi},get RenderType(){return ki},get RenderFace(){return Fi},get CameraClipMode(){return Vi},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return ji},get BezierKeyframeType(){return Wi},get JSONSceneVersion(){return ci},get EndBehavior(){return Yi},get ParticleInteractionBehavior(){return Ki},get ShapeArcMode(){return Ji},get LightType(){return Qi},get ModelBoundingType(){return er},get CameraType(){return rr},get MaterialType(){return sr},get MaterialBlending(){return ar},get RenderMode3D(){return lr},get TextOverflow(){return ur},get TextSizeMode(){return fr},get TextBaseline(){return mr},get TextAlignment(){return vr},get TextVerticalAlign(){return xr},get TextWeight(){return _r},get FontStyle(){return Tr},BuiltinObjectGUID:Qr,get FillType(){return Sr},get TexturePaintScaleMode(){return Ar},get ShapePrimitiveType(){return Pr},get LineCap(){return Rr},get LineJoin(){return Dr},get NodeDataType(){return Lr},get BackgroundType(){return Nr},get MultimediaType(){return zr},get HevcVideoCodec(){return Vr},get DataType(){return jr},get GeometryType(){return Wr},get VertexFormatType(){return Yr},get IndexFormatType(){return Kr},get VertexBufferSemantic(){return Jr}});function rn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function nn(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return rn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?rn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var sn=new Map,on=new Map,an={};function hn(t){return an[t]}function ln(t){return function(e,i){an[t]&&console.warn("Class "+t+" is already registered."),an[t]=e}}function cn(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;sn.get(e)||sn.set(e,{});return sn.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function un(t){var e=t.constructor;if(on.get(e))return on.get(e);var i={};on.set(e,i);for(var r=t,n=e;n;){var s=sn.get(n);for(var o in s)i[o]=s[o];var a=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(a).constructor)===Object)break;r=a}return i}var dn=function(){function t(t){this.engine=t,this.guid=ei(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){void 0!==t.id&&this.setInstanceId(t.id)},e.dispose=function(){this.engine.removeInstance(this.guid)},t.is=function(e){return Qt(e,t)&&"guid"in e},t}(),fn=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),pn={};function mn(t){return function(e,i){pn[t]&&console.warn("NodeData Class "+t+" is already registered."),pn[t]=e}}var gn,vn,yn=-1,xn=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");0===--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},t}(),bn=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i.asset=this,i},t}(),_n=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}Ui(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(xn),wn=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.setValue=function(t){},e}(xn),Tn=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(wn),En=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(wn),Sn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new fn,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=yn,e}return Ui(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,s=0;s<n;s++)this.parameterLookupMap.set(i.controlParameterIDs[s],s);this.nodeDatas=[];for(var o=0;o<r.length;o++)this.nodeDatas[o]=e.createNodeData(r[o].type),this.nodeDatas[o].load(r[o]);this.graphDataSet=new fn,this.graphDataSet.resources=[];for(var a,h=nn(i.graphDataSet.resources);!(a=h()).done;){var l=a.value,c=this.engine.findObject(l);this.graphDataSet.resources.push(c)}},e.createNodeData=function(t){var e=pn[t];if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(dn);Sn=ee([ln("AnimationGraphAsset")],Sn),(vn=gn||(gn={}))[vn.Active=0]="Active",vn[vn.Inactive=1]="Inactive";var In=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),An=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},t}();function Cn(){return Cn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},Cn.apply(this,arguments)}var Pn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(On,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=Cn({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(bn);Pn=ee([mn(Lr.AnimationClipNodeData)],Pn);var Mn,Rn,On=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}Ui(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=ye(this.currentTime,0,1),this.sampleEvents(t);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.sampleEvents=function(t){if(this.animatable&&0!==this.animatable.events.length)for(var e,i=this.previousTime*this.duration,r=this.currentTime*this.duration,n=nn(this.animatable.events);!(e=n()).done;){var s=e.value,o=s.event.startTime;(this.previousTime<=this.currentTime?i<o&&o<=r:o>i||o<=r)&&(s.currentTime=r,s.deltaTime=t.deltaTime,t.activeEvents.push(s))}},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new Dn(e.skeleton,this.animation))},e}(_n);(Rn=Mn||(Mn={}))[Rn.Position=0]="Position",Rn[Rn.Scale=1]="Scale",Rn[Rn.Rotation=2]="Rotation",Rn[Rn.Euler=3]="Euler";var Dn=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=nn(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var s,o=nn(e.scaleCurves);!(s=o()).done;){var a=s.value;this.addTransformCurveInfo(a,1)}for(var h,l=nn(e.rotationCurves);!(h=l()).done;){var c=h.value;this.addTransformCurveInfo(c,2)}for(var u,d=nn(e.eulerCurves);!(u=d()).done;){var f=u.value;this.addTransformCurveInfo(f,3)}for(var p,m=nn(e.floatCurves);!(p=m()).done;){var g=p.value;this.addFloatCurveInfo(g)}for(var v,y=nn(e.colorCurves);!(v=y()).done;){var x=v.value;this.addColorCurveInfo(x)}for(var b,_=nn(this.animationClip.events);!(b=_()).done;){var w=b.value;this.events.push({event:w,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=ye(t,0,this.animationClip.duration),n=nn(this.transformCurveInfos);!(i=n()).done;){var s=i.value,o=s.curve.keyFrames.getValue(r),a=e.parentSpaceTransforms[s.boneIndex];switch(s.type){case 0:a.position.copyFrom(o);break;case 1:a.scale.copyFrom(o);break;case 2:a.rotation.copyFrom(o);break;case 3:a.euler.copyFrom(o)}}for(var h,l=nn(this.floatCurveInfos);!(h=l()).done;){var c=h.value,u=c.curve.keyFrames.getValue(r);e.floatPropertyValues[c.animatedObjectIndex]=u}for(var d,f=nn(this.colorCurveInfos);!(d=f()).done;){var p=d.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),kn=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=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},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],s=e[1],o=e[5],a=e[9],h=e[2],l=e[6],c=e[10],u=i+o+c;if(u>0){var d=.5/Math.sqrt(u+1);this.w=.25/d,this.x=(l-a)*d,this.y=(n-h)*d,this.z=(s-r)*d}else if(i>o&&i>c){var f=2*Math.sqrt(1+i-o-c);this.w=(l-a)/f,this.x=.25*f,this.y=(r+s)/f,this.z=(n+h)/f,this.negate()}else if(o>c){var p=2*Math.sqrt(1+o-i-c);this.w=(n-h)/p,this.x=(r+s)/p,this.y=.25*p,this.z=(a+l)/p,this.negate()}else{var m=2*Math.sqrt(1+c-i-o);this.w=(s-r)/m,this.x=(n+h)/m,this.y=(a+l)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=i),this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(ye(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.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},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,o=e.x,a=e.y,h=e.z,l=e.w;return this.x=i*l+s*o+r*h-n*a,this.y=r*l+s*a+n*o-i*h,this.z=n*l+s*h+i*a-r*o,this.w=s*l-i*o-r*a-n*h,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,s=i.z,o=i.w,a=o*t.w+r*t.x+n*t.y+s*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=r,this.y=n,this.z=s,this;var h=1-a*a;if(h<=Number.EPSILON){var l=1-e;return this.w=l*o+e*this.w,this.x=l*r+e*this.x,this.y=l*n+e*this.y,this.z=l*s+e*this.z,this.normalize(),this}var c=Math.sqrt(h),u=Math.atan2(c,a),d=Math.sin((1-e)*u)/c,f=Math.sin(e*u)/c;return this.w=o*d+this.w*f,this.x=r*d+this.x*f,this.y=n*d+this.y*f,this.z=s*d+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,s=i.z,o=i.w,a=t.x,h=t.y,l=t.z,c=o*a+n*l-s*h,u=o*h+s*a-r*l,d=o*l+r*h-n*a,f=-r*a-n*h-s*l,p=null!=e?e:t;return p.x=c*o+f*-r+u*-s-d*-n,p.y=u*o+f*-n+d*-r-c*-s,p.z=d*o+f*-s+c*-n-u*-r,p},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(be.ZERO,this,be.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,i){return(new t).setFromAxisAngle(e,i)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return(new t).setFromUnitVectors(e,i)},t}();kn.tempVec0=new be;var Ln=new kn,Fn=function(){},Nn=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(Fn),Bn=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=Ln.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(Fn),zn=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var s=0;s<t.parentSpaceTransforms.length;s++){var o=t.parentSpaceTransforms[s],a=e.parentSpaceTransforms[s],h=r.parentSpaceTransforms[s],l=o.position,c=a.position,u=h.position;n.blendVector3(l,c,i,u);var d=o.rotation,f=a.rotation,p=h.rotation;n.blendQuaternion(d,f,i,p);var m=o.scale,g=a.scale,v=h.scale;n.blendVector3(m,g,i,v);var y=o.euler,x=a.euler,b=h.euler;n.blendEuler(y,x,i,b)}for(var _=0;_<t.floatPropertyValues.length;_++){var w=t.floatPropertyValues[_],T=e.floatPropertyValues[_];r.floatPropertyValues[_]=n.blendFloat(w,T,i)}for(var E=0;E<t.colorPropertyValues.length;E++){var S=t.colorPropertyValues[E],I=e.colorPropertyValues[E],A=r.colorPropertyValues[E];n.blendColor(S,I,i,A)}},t}();zn.normalBlendFunction=new Nn,zn.additiveBlendFunction=new Bn;var Un=function(){function t(t){this.position=new be,this.rotation=new kn,this.scale=new be,this.euler=new be,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),Vn=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=nn(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new Un).copyFrom(r))}for(var n,s=nn(t.defaultFloatPropertyValues);!(n=s()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var a,h=nn(t.defaultColorPropertyValues);!(a=h()).done;){var l=a.value;this.colorPropertyValues.push((new we).copyFrom(l))}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),Gn=function(t){this.pose=new Vn(t)},jn=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Hn,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(bn);jn=ee([mn(Lr.ApplyAdditiveNodeData)],jn);var Hn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}Ui(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Gn(e.skeleton),this.additiveNodeResult=new Gn(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){zn.additiveBlend(t,e,i,r)},e}(_n),Wn=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Xn,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(bn);Wn=ee([mn(Lr.BlendNodeData)],Wn);var Xn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}Ui(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new Gn(e.skeleton),this.source1Result=new Gn(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){zn.localBlend(t,e,i,r)},e}(_n),Yn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(qn,t),r=nn(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(bn);Yn=ee([mn(Lr.AndNodeData)],Yn);var qn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=nn(this.conditionNodes);!(e=i()).done;){if(!e.value.getValue(t)){this.result=!1;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=nn(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=nn(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(En),Kn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Zn,t),r=nn(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(bn);Kn=ee([mn(Lr.OrNodeData)],Kn);var Zn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=nn(this.conditionNodes);!(e=i()).done;){if(e.value.getValue(t)){this.result=!0;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=nn(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=nn(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(En),Jn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=yn,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode($n,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(bn);Jn=ee([mn(Lr.NotNodeData)],Jn);var $n=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(En),Qn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ts,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(bn);Qn=ee([mn(Lr.ConstFloatNodeData)],Qn);var ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return Ui(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Tn),es=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(is,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(bn);es=ee([mn(Lr.ConstBoolNodeData)],es);var is=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return Ui(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(En),rs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ns,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(bn);rs=ee([mn(Lr.ControlParameterFloatNodeData)],rs);var ns=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Tn),ss=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(os,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(bn);ss=ee([mn(Lr.ControlParameterBoolNodeData)],ss);var os=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(En),as=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(hs,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(bn);as=ee([mn(Lr.ControlParameterTriggerNodeData)],as);var hs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Ui(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(En),ls=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=yn,e.layerDatas=[],e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(cs,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=nn(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:yn,e.layerDatas)for(var r,n=nn(e.layerDatas);!(r=n()).done;){var s=r.value;this.layerDatas.push(Cn({inputNodeIndex:yn,weightValueNodeIndex:yn},s))}},e}(bn);ls=ee([mn(Lr.LayerBlendNodeData)],ls);var cs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}Ui(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Gn(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=nn(this.layers);!(r=n()).done;){var s,o,a=r.value;null==(s=a.inputNode)||s.initialize(e),null==(o=a.weightValueNode)||o.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=nn(this.layers);!(r=n()).done;){var s,o,a=r.value;null==(s=a.inputNode)||s.shutdown(e),null==(o=a.weightValueNode)||o.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()?(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e),e):e},i.updateLayers=function(t,e){for(var i,r=nn(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var s=n.weightValueNode.getValue(t);zn.localBlend(e.pose,this.layerNodeResult.pose,s,e.pose)}}return e},e}(_n),us=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=yn,e.comparandValueNodeIndex=yn,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ps,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(bn);us=ee([mn(Lr.EqualNodeData)],us);var ds,fs,ps=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}Ui(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(En),ms=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=yn,e.comparandValueNodeIndex=yn,e}return Ui(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(bn);(fs=ds||(ds={}))[fs.GreaterThan=0]="GreaterThan",fs[fs.LessThan=1]="LessThan";var gs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}Ui(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(En),vs=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.instantiate=function(t){var e=this.createNode(gs,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ms);vs=ee([mn(Lr.GreaterNodeData)],vs);var ys=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.instantiate=function(t){var e=this.createNode(gs,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ms);ys=ee([mn(Lr.LessNodeData)],ys);var xs=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(ws,t),r=nn(this.stateDatas);!(e=r()).done;){var n=e.value,s={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(s);for(var o,a=nn(n.transitionDatas);!(o=a()).done;){var h=o.value,l={transitionNode:t.getNode(h.transitionNodeIndex),conditionNode:t.getNode(h.conditionNodeIndex),targetStateIndex:h.targetStateIndex};s.transitions.push(l)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(bn);xs=ee([mn(Lr.StateMachineNodeData)],xs);var bs,_s,ws=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=yn,e}Ui(e,t);var i=e.prototype;return i.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===gn.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=yn,n=i.transitions.length,s=0;s<n;s++){var o=i.transitions[s];if(o.targetStateIndex===yn)throw new Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var a=!1;if(o.transitionNode.hasExitTime){var h=i.stateNode;h.getElapsedTimeInState()/h.getDuration()>o.transitionNode.exitTime&&(a=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(a=!0);if(a){r=s;break}}}if(r!==yn){var l=i.transitions[r];l.transitionNode.initialize(t),e=null!==this.activeTransition?l.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):l.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=l.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=l.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.getNodeData().defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=yn,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=nn(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=nn(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(_n);(_s=bs||(bs={}))[_s.None=0]="None",_s[_s.TransitioningIn=1]="TransitioningIn",_s[_s.TransitioningOut=2]="TransitioningOut";var Ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=yn,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Is,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},e}(bn);Ts=ee([mn(Lr.StateNodeData)],Ts);var Es,Ss,Is=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}Ui(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(_n);(Ss=Es||(Es={}))[Ss.State=0]="State",Ss[Ss.Transition=1]="Transition",Ss[Ss.CachedPose=2]="CachedPose";var As=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=yn,e}Ui(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ms,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(bn);As=ee([mn(Lr.TransitionNodeData)],As);var Cs,Ps,Ms=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}Ui(e,t);var i=e.prototype;return i.evaluate=function(t,e){Be(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=ye(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=gn.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),s=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,s),this.blendedDuration=ve(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var o=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+o)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),s},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new Gn(e.skeleton),this.targetNodeResult=new Gn(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(bs.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(bs.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=ve(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=ye(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;zn.localBlend(t.pose,e.pose,r,i.pose)},e}(_n);(Ps=Cs||(Cs={}))[Ps.Float=0]="Float",Ps[Ps.Color=1]="Color";var Rs=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=nn(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var s,o=nn(e.rotation);!(s=o()).done;){var a=s.value;this.addReferenceTransform(a)}for(var h,l=nn(e.scale);!(h=l()).done;){var c=h.value;this.addReferenceTransform(c)}for(var u,d=nn(e.euler);!(u=d()).done;){var f=u.value;this.addReferenceTransform(f),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var g=0;g<e.colors.length;g++){var v=e.colors[g];this.addRecordedProperty(v.path,v.className,v.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new Un(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var s=this.findTarget(t);if(s){var o;(o="VFXItem"===e?s:s.getComponent(hn(e)))||console.error("The "+e+" Component was not found.");for(var a=i.split("."),h=a[a.length-1],l=o,c=0;c<a.length-1;c++){var u=l[a[c]];void 0===u&&console.error("The "+a[c]+" property of "+l+" was not found."),l=u}var d={target:o,propertyPath:i,directTarget:l,propertyName:h};switch(r){case 0:this.floatAnimatedObjects.push(d),this.defaultFloatPropertyValues.push(l[h]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(d),this.defaultColorPropertyValues.push((new we).copyFrom(l[h])),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=nn(i);!(e=n()).done;){var s=e.value,o=r.find(s);if(!o)return null;r=o}return r},t}(),Os=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new In;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=nn(t.graphDataSet.resources);!(i=n()).done;){var s=i.value;if(s){for(var o,a=nn(s.positionCurves);!(o=a()).done;){var h=o.value;r.position.push(h.path)}for(var l,c=nn(s.rotationCurves);!(l=c()).done;){var u=l.value;r.rotation.push(u.path)}for(var d,f=nn(s.scaleCurves);!(d=f()).done;){var p=d.value;r.scale.push(p.path)}for(var m,g=nn(s.eulerCurves);!(m=g()).done;){var v=m.value;r.euler.push(v.path)}for(var y,x=nn(s.floatCurves);!(y=x()).done;){var b=y.value;r.floats.push(b)}for(var _,w=nn(s.colorCurves);!(_=w()).done;){var T=_.value;r.colors.push(T)}}}this.skeleton=new Rs(e,r),this.result=new Gn(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var E=new An;E.nodes=this.nodes,E.nodeDatas=t.nodeDatas,E.dataSet=t.graphDataSet;for(var S=0;S<t.nodeDatas.length;S++)E.nodes[S]||t.nodeDatas[S].instantiate(E);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.activeEvents.length=0,this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];Qt(i,hs)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.getStateMachineNode=function(t){for(var e,i=null,r=nn(this.nodes);!(e=r()).done;){var n=e.value;Qt(n,ws)&&n.getNodeData().machineName===t&&(i=n)}return i},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),yn)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);i!==yn&&this.nodes[i].setValue(e)},t}();function Ds(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ks(t,e,i){return e&&Ds(t.prototype,e),i&&Ds(t,i),t}var Ls=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}Ui(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onPreRender=function(){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&ce(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},ks(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(dn);ee([cn()],Ls.prototype,"item",void 0),ee([cn()],Ls.prototype,"_enabled",void 0);var Fs,Ns,Bs,zs,Us=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(Ls),Vs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}Ui(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graphInstance&&this.graphInstance.setBool(t,e)},i.setFloat=function(t,e){this.graphInstance&&this.graphInstance.setFloat(t,e)},i.setTrigger=function(t){this.graphInstance&&this.graphInstance.setTrigger(t)},i.resetTrigger=function(t){this.graphInstance&&this.graphInstance.resetTrigger(t)},i.getStateMachineNode=function(t){var e=null;return this.graphInstance&&(e=this.graphInstance.getStateMachineNode(t)),e},i.onStart=function(){this.graphAsset&&(this.graphInstance=new Os(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graphInstance){for(var e=this.graphInstance.evaluateGraph(t/1e3),i=this.graphInstance.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,s=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,a=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(a.x,a.y,a.z):i[r].setQuaternion(s.x,s.y,s.z,s.w)}for(var h=this.graphInstance.skeleton.floatAnimatedObjects,l=0;l<h.length;l++){var c=h[l],u=c.propertyName;c.directTarget[u]=e.pose.floatPropertyValues[l],Qt(c.target,Ls)&&c.target.onApplyAnimationProperties()}for(var d=this.graphInstance.skeleton.colorAnimatedObjects,f=0;f<d.length;f++){var p=d[f],m=p.propertyName;p.directTarget[m]=e.pose.colorPropertyValues[f],Qt(p.target,Ls)&&p.target.onApplyAnimationProperties()}for(var g,v=nn(this.graphInstance.activeEvents);!(g=v()).done;){var y=g.value,x=y.event;x.event.onEvent(this.item,x.clip,y)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(Ls);Vs=ee([ln("Animator")],Vs),(Ns=Fs||(Fs={}))[Ns.vertex=0]="vertex",Ns[Ns.fragment=1]="fragment",(zs=Bs||(Bs={}))[zs.NONE=0]="NONE",zs[zs.MASK=1]="MASK",zs[zs.OBSCURED=2]="OBSCURED",zs[zs.REVERSE_OBSCURED=3]="REVERSE_OBSCURED";var Gs,js,Hs,Ws,Xs=[],Ys={},qs="iOS16 lockdown mode, WebGL Constants not in global",Ks="WebGL Constants not in global, please check your environment";function Zs(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Js(t){for(var e in t)/^[A-Z_]/.test(e)&&(Ys[e]=t[e])}function $s(t){switch(t){case Yr.Float32:return WebGLRenderingContext.FLOAT;case Yr.Int16:return WebGLRenderingContext.SHORT;case Yr.Int8:return WebGLRenderingContext.BYTE;case Yr.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case Yr.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function Qs(t){switch(t){case pi.ALPHA:case pi.ADD:case pi.SUBTRACTION:case pi.STRONG_LIGHT:case pi.WEAK_LIGHT:return 1;case pi.SUPERPOSITION:return 2;case pi.BRIGHTNESS:return 3;case pi.MULTIPLY:return 0;default:return 1}}function to(t,e){switch(e){case void 0:case pi.ALPHA:t.blendFunction=[Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA];break;case pi.ADD:t.blendFunction=[Ys.ONE,Ys.ONE,Ys.ONE,Ys.ONE];break;case pi.SUBTRACTION:t.blendFunction=[Ys.ONE,Ys.ONE,Ys.ZERO,Ys.ONE],t.blendEquation=[Ys.FUNC_REVERSE_SUBTRACT,Ys.FUNC_REVERSE_SUBTRACT];break;case pi.SUPERPOSITION:t.blendFunction=[Ys.ONE,Ys.ONE,Ys.ONE,Ys.ONE];break;case pi.MULTIPLY:t.blendFunction=[Ys.DST_COLOR,Ys.ONE_MINUS_SRC_ALPHA,Ys.DST_COLOR,Ys.ONE_MINUS_SRC_ALPHA];break;case pi.BRIGHTNESS:t.blendFunction=[Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA];break;case pi.STRONG_LIGHT:t.blendFunction=[Ys.DST_COLOR,Ys.DST_ALPHA,Ys.ZERO,Ys.ONE];break;case pi.WEAK_LIGHT:t.blendFunction=[Ys.DST_COLOR,Ys.ZERO,Ys.ZERO,Ys.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function eo(t,e){e===gi.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Ys.CW,t.cullFace=e===gi.BACK?Ys.BACK:Ys.FRONT)}Xs.length||function(){"function"==typeof WebGL2RenderingContext?Js(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(Js(WebGLRenderingContext),Js(WebGLRenderingContext.prototype)):Me?Xs.push(Re()?qs:Ks):Xs.push(Ks);Xs.length||"HALF_FLOAT"in Ys||(Ys.HALF_FLOAT=5131)}(),(js=Gs||(Gs={}))[js.whatever=0]="whatever",js[js.clear=2]="clear",(Ws=Hs||(Hs={}))[Ws.none=0]="none",Ws[Ws.data=1]="data",Ws[Ws.image=2]="image",Ws[Ws.compressed=3]="compressed",Ws[Ws.video=4]="video",Ws[Ws.canvas=5]="canvas",Ws[Ws.framebuffer=6]="framebuffer",Ws[Ws.mipmaps=7]="mipmaps";var io=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.downloadText=function(t,e,i){this.download(t,"text",e,i)},e.download=function(e,i,r,n){var s=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var o=new XMLHttpRequest,a=function(){s.finish(e,o.status,o.response)};o.responseType=i,o.addEventListener("load",function(){200==o.status||0==o.status&&t.trustXHRStatusZero?s.finish(e,200,o.response):a()}),o.addEventListener("error",a),o.open("GET",e,!0),o.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var s=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],o=s.length-1,a=n.length;o<a;o+=2)n[o].apply(null,s)},t}();io.trustXHRStatusZero=!1;var ro=!1,no=!1;function so(t,e){return oo.apply(this,arguments)}function oo(){return(oo=$t(function(t,e){return ie(this,function(i){switch(i.label){case 0:return!ro&&e?[3,2]:[4,lo(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,lo(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),ro=!0,[4,lo(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}})})).apply(this,arguments)}function ao(t,e){return ho.apply(this,arguments)}function ho(){return(ho=$t(function(t,e){return ie(this,function(i){switch(i.label){case 0:return!no&&e?[3,2]:[4,lo(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,lo(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),no=!0,[4,lo(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}})})).apply(this,arguments)}function lo(t){return co.apply(this,arguments)}function co(){return(co=$t(function(t){var e,i;return ie(this,function(r){if(e="",Qt(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else Qt(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function uo(t){return fo.apply(this,arguments)}function fo(){return(fo=$t(function(t){return ie(this,function(e){return[2,new Promise(function(e,i){(new io).downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function po(t){return mo.apply(this,arguments)}function mo(){return(mo=$t(function(t){var e;return ie(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,e.autoplay=!1,Oe()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=!1,n=function(){r||(r=!0,o(),t(e))},s=function(){r||(r=!0,o(),i("Load video fail."))},o=function(){e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",n),e.removeEventListener("error",s)};e.addEventListener("loadeddata",n),e.addEventListener("canplay",n),e.addEventListener("error",s),e.play().catch(function(t){console.warn("Autoplay blocked:",t)})})]})})).apply(this,arguments)}function go(t,e){return vo.apply(this,arguments)}function vo(){return(vo=$t(function(t,e){return ie(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}})})).apply(this,arguments)}function yo(t,e,i){return xo.apply(this,arguments)}function xo(){return(xo=$t(function(t,e,i,r){var n,s,o,a,h,l,c,u,d;return ie(this,function(f){switch(f.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,s=t.target,o=n.map(function(t){return Promise.all(t.map(function(t){return t.id?i[t.id]:bo(t,e)}))}),[4,Promise.all(o)]);case 1:return a=f.sent(),[2,Cn({keepImageSource:!1},t,{mipmaps:a,sourceFrom:{target:s,type:Hs.mipmaps}})];case 2:return h=t.mipmaps,l=t.target,c=h.map(function(t){return bo(t,e)}),[4,Promise.all(c)];case 3:return u=f.sent(),d=r[h[0][1][0]].url,[2,Cn({keepImageSource:!1},t,{mipmaps:u,sourceType:Hs.mipmaps,sourceFrom:{target:l,bin:d,type:Hs.mipmaps,mipmaps:h.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function bo(t,e){return _o.apply(this,arguments)}function _o(){return(_o=$t(function(t,e){var i,r,n,s,o;return ie(this,function(a){if(i=t[1],r=i[0],n=i[1],s=i[2],!(o=e[r]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,lo(new Blob([new Uint8Array(o,n,s)]))]})})).apply(this,arguments)}var wo=1,To=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+wo++,i}Ui(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Ys.TEXTURE_2D:e,r=t.format,n=void 0===r?Ys.RGBA:r;return t.sourceType||(t.sourceType="image"in t?Hs.image:"data"in t?Hs.data:"video"in t?Hs.video:0),Cn({minFilter:Ys.NEAREST,magFilter:Ys.NEAREST,wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,target:i,format:Ys.RGBA,internalFormat:n,type:Ys.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,r){return $t(function(){var n,s;return ie(this,function(o){switch(o.label){case 0:return[4,lo(t)];case 1:return n=o.sent(),(s=e.create(i,Cn({sourceType:Hs.image,image:n,target:Ys.TEXTURE_2D,id:ei(),flipY:!0},r))).initialize(),[2,s]}})})()},e.fromVideo=function(t,i,r){return $t(function(){var n,s;return ie(this,function(o){switch(o.label){case 0:return[4,po(t)];case 1:return n=o.sent(),(s=e.create(i,Cn({sourceType:Hs.video,video:n,id:ei(),flipY:!0},r))).initialize(),[2,s]}})})()},ks(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(dn);function Eo(t,e,i,r){var n,s,o=e.length/i/r;return s=n=4===o||0===o?Ys.RGBA:3===o?Ys.RGB:2===o?Ys.LUMINANCE_ALPHA:Ys.LUMINANCE,To.createWithData(t,{data:e,width:i,height:r},{type:Ys.HALF_FLOAT,format:n,internalFormat:s,wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE})}var So={type:Ys.UNSIGNED_BYTE,format:Ys.RGBA,internalFormat:Ys.RGBA,wrapS:Ys.MIRRORED_REPEAT,wrapT:Ys.MIRRORED_REPEAT,minFilter:Ys.NEAREST,magFilter:Ys.NEAREST};var Io,Ao,Co,Po=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){this.loaders.has(t)?console.warn('TextureLoader for type "'+t+'" is already registered, skipping.'):this.loaders.set(t,e)},e.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},e.getLoader=function(t){if(this.instances.has(t))return this.instances.get(t);var e=this.loaders.get(t);if(!e)return console.error('TextureLoader for type "'+t+'" is not registered.'),null;var i=e();return this.instances.set(t,i),i},e.has=function(t){return this.loaders.has(t)},e.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},e.dispose=function(){this.instances.forEach(function(t){return t.dispose()}),this.instances.clear(),this.loaders.clear()},t}()),Mo=function(){function t(){this.reloadPending={}}var e=t.prototype;return e.reload=function(t){var e=this;return $t(function(){var i,r;return ie(this,function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}})})()},e.canOffloadTexture=function(t){if(t){var e=t.type;if(e===Hs.compressed||e===Hs.image){var i=t.target,r=t.map,n=t.url;return i===Ys.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:Xe(n)&&n.length>0}if(e===Hs.mipmaps){var s=t.bin,o=t.mipmaps,a=t.target,h=t.maps,l=t.urls;return s?o.length>0:a===Ys.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return Xe(t)&&t.length>0})}}return!1},e.loadSource=function(t,e){var i=this;return $t(function(){var r,n,s,o,a,h,l,c,u,d,f,p,m,g,v,y,x,b,_,w,T,E;return ie(this,function(S){switch(S.label){case 0:return r=t.type,n=t.target,s=t.map,o=t.url,a=t.bin,h=t.mipmaps,l=t.urls,c=t.maps,n!==Ys.TEXTURE_CUBE_MAP||r===Hs.mipmaps?[3,2]:[4,i.loadCubeMap(s)];case 1:return u=S.sent(),[2,Cn({},e,{cube:u,target:Ys.TEXTURE_CUBE_MAP,sourceType:Hs.image,sourceFrom:{type:Hs.image,map:Cn({},s),target:Ys.TEXTURE_CUBE_MAP}})];case 2:return r!==Hs.image?[3,4]:[4,lo(o)];case 3:return d=S.sent(),[2,Cn({},e,{image:d,sourceType:Hs.image,sourceFrom:{type:r,url:o,target:Ys.TEXTURE_2D}})];case 4:return r!==Hs.video?[3,6]:[4,po(o)];case 5:return f=S.sent(),[2,Cn({},e,{video:f,sourceType:Hs.video})];case 6:return r!==Hs.compressed?[3,14]:[4,uo(o)];case 7:if(p=S.sent(),!(m=Po.getLoader("ktx2")))return[3,12];S.label=8;case 8:return S.trys.push([8,10,,11]),[4,m.loadFromBuffer(p)];case 9:return(g=S.sent()).sourceType===Hs.compressed?[2,Cn({sourceType:g.sourceType,type:g.type,target:g.target,internalFormat:g.internalFormat,format:g.format,mipmaps:g.mipmaps,minFilter:Ys.LINEAR,magFilter:Ys.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw v=S.sent(),new Error("Failed to parse KTX2 from "+(null!=(y=null==t?void 0:t.url)?y:"buffer")+": "+(v.message||v));case 11:return[3,13];case 12:throw new Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:return r!==Hs.mipmaps?[3,23]:a?[4,uo(a)]:[3,19];case 15:return x=S.sent(),b=null!=n?n:Ys.TEXTURE_2D,_=b===Ys.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),n!==Ys.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(h.map(function(t){return i.loadMipmapImages(t,x)}))];case 16:return w=S.sent(),[3,18];case 17:w=i.loadMipmapImages(h,x),S.label=18;case 18:return[2,Cn({},e,{mipmaps:w,target:b,sourceType:Hs.mipmaps,sourceFrom:{bin:a,mipmaps:_,target:b,type:Hs.mipmaps}})];case 19:return n!==Ys.TEXTURE_2D&&n?[3,21]:[4,Promise.all(l.map(function(t){return lo(t)}))];case 20:return T=S.sent(),[2,Cn({},e,{mipmaps:T,target:Ys.TEXTURE_2D,sourceType:Hs.mipmaps,sourceFrom:{type:r,urls:l.slice(),target:Ys.TEXTURE_2D}})];case 21:return n!==Ys.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(c.map(function(t){return i.loadCubeMap(t)}))];case 22:return E=S.sent(),[2,Cn({},e,{mipmaps:E,target:Ys.TEXTURE_CUBE_MAP,sourceType:Hs.mipmaps,sourceFrom:{type:r,maps:c.map(function(t){return Cn({},t)}),target:Ys.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+r+".")}})})()},e.loadMipmapImages=function(t,e){return $t(function(){return ie(this,function(i){return[2,Promise.all(t.map(function(t){return lo(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},e.loadCubeMap=function(t){return $t(function(){return ie(this,function(e){return[2,Promise.all(t.map(function(t){return lo(t)}))]})})()},t}();function Ro(){return Io||(Io=new Mo),Io}(Co=Ao||(Ao={}))[Co.normal=0]="normal",Co[Co.transformFeedback=1]="transformFeedback";var Oo,Do,ko=1,Lo=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,s=void 0===n?"Material"+ko++:n,o=i.renderType,a=void 0===o?0:o,h=i.shader;r.name=s,r.renderType=a,r.shaderSource=h,r.props=i}else r.name="Material"+ko++,r.renderType=0;return r}Ui(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},ks(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(dn),Fo=function(){function t(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=Bs.NONE,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:Gs.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.inverted,s=void 0!==n&&n,o=e.reference,a=e.alphaMaskEnabled,h=void 0!==a&&a;if(this.alphaMaskEnabled=h,this.isMask=r,this.inverted=s,this.maskReferences=[],r)this.maskMode=Bs.MASK;else{this.maskMode=s?Bs.REVERSE_OBSCURED:Bs.OBSCURED;var l=t.findObject(o);l&&this.maskReferences.push({maskable:l,inverted:s})}},e.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some(function(e){return e.maskable===t})){if(this.maskReferences.length>=255)return void console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");this.maskReferences.push({maskable:t,inverted:e})}},e.removeMaskReference=function(t){var e=this.maskReferences.findIndex(function(e){return e.maskable===t});-1!==e&&this.maskReferences.splice(e,1)},e.clearMaskReferences=function(){this.maskReferences=[]},e.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=nn(r);!(i=n()).done;){var s=i.value;this.addMaskReference(s,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var o,a=[],h=[],l=nn(this.maskReferences);!(o=l()).done;){var c=o.value;c.inverted?h.push(c):a.push(c)}for(var u=0;u<a.length;u++)a[u].maskable.drawStencilMask(u);for(var d,f=a.length,p=nn(h);!(d=p()).done;){d.value.maskable.drawStencilMask(f)}this.expectedStencilValue=f}for(var m,g=nn(e.materials);!(m=g()).done;){var v=m.value;this.setupMaskedMaterial(v)}for(var y,x=nn(r);!(y=x()).done;){var b=y.value;this.removeMaskReference(b),e.frameClipMasks=[]}},e.drawGeometryMask=function(t,e,i,r,n,s){void 0===s&&(s=0);var o=r.colorMask,a=r.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,r.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpZPass,r.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,r.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,r.stencilMask),this.setupMaskMaterial(r,n),t.drawGeometry(e,i,r,s),r.colorMask=o,r.stencilTest=a,r.stencilFunc=this.prevStencilFunc,r.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},e.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[Ys.EQUAL,Ys.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[Ys.INCR,Ys.INCR],t.colorMask=!1},e.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[Ys.EQUAL,Ys.EQUAL],t.stencilOpZPass=[Ys.KEEP,Ys.KEEP]):t.stencilTest=!1},e.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},ks(t,[{key:"maskable",get:function(){return this.maskReferences.length>0?this.maskReferences[0].maskable:null},set:function(t){this.maskReferences=[],t&&this.maskReferences.push({maskable:t,inverted:this.maskMode===Bs.REVERSE_OBSCURED})}}]),t}(),No=function(){function t(t,e,i,r,n,s,o,a,h,l,c,u,d,f,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===u&&(u=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,s,o,a,h,l,c,u,d,f,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,o,a,h,l,c,u,d,f,p,m){var g=this.elements;return g[0]=t,g[1]=e,g[2]=i,g[3]=r,g[4]=n,g[5]=s,g[6]=o,g[7]=a,g[8]=h,g[9]=l,g[10]=c,g[11]=u,g[12]=d,g[13]=f,g[14]=p,g[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,s,o,a,h,l,c,u,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=r,g[1]=n,g[5]=s,g[9]=o,g[13]=a,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),s=Math.sin(i),o=1-n,a=r.x,h=r.y,l=r.z,c=o*a,u=o*h;return this.set(c*a+n,c*h+s*l,c*l-s*h,0,c*h-s*l,u*h+n,u*l+s*a,0,c*l+s*h,u*l-s*a,o*l*l+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(be.ZERO,t,be.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,s=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),s.crossVectors(o,n);var a=this.elements;return a[0]=n.x,a[1]=s.x,a[2]=o.x,a[3]=0,a[4]=n.y,a[5]=s.y,a[6]=o.y,a[7]=0,a[8]=n.z,a[9]=s.z,a[10]=o.z,a[11]=0,a[12]=-n.dot(e),a[13]=-s.dot(e),a[14]=-o.dot(e),a[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],o=i[4],a=i[8],h=i[12],l=i[1],c=i[5],u=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],_=r[0],w=r[4],T=r[8],E=r[12],S=r[1],I=r[5],A=r[9],C=r[13],P=r[2],M=r[6],R=r[10],O=r[14],D=r[3],k=r[7],L=r[11],F=r[15];return n[0]=s*_+o*S+a*P+h*D,n[4]=s*w+o*I+a*M+h*k,n[8]=s*T+o*A+a*R+h*L,n[12]=s*E+o*C+a*O+h*F,n[1]=l*_+c*S+u*P+d*D,n[5]=l*w+c*I+u*M+d*k,n[9]=l*T+c*A+u*R+d*L,n[13]=l*E+c*C+u*O+d*F,n[2]=f*_+p*S+m*P+g*D,n[6]=f*w+p*I+m*M+g*k,n[10]=f*T+p*A+m*R+g*L,n[14]=f*E+p*C+m*O+g*F,n[3]=v*_+y*S+x*P+b*D,n[7]=v*w+y*I+x*M+b*k,n[11]=v*T+y*A+x*R+b*L,n[15]=v*E+y*C+x*O+b*F,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],s=t[1],o=t[5],a=t[9],h=t[13],l=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+n*a*c-r*h*c-n*o*u+i*h*u+r*o*d-i*a*d)+t[7]*(+e*a*d-e*h*u+n*s*u-r*s*d+r*h*l-n*a*l)+t[11]*(+e*h*c-e*o*d-n*s*c+i*s*d+n*o*l-i*h*l)+t[15]*(-r*o*l-e*a*c+e*o*u+r*s*c-i*s*u+i*a*l)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],v=c*m*h-p*u*h+p*a*d-o*m*d-c*a*g+o*u*g,y=f*u*h-l*m*h-f*a*d+s*m*d+l*a*g-s*u*g,x=l*p*h-f*c*h+f*o*d-s*p*d-l*o*g+s*c*g,b=f*c*a-l*p*a-f*o*u+s*p*u+l*o*m-s*c*m,_=e*v+i*y+r*x+n*b;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/_;return t[0]=v*w,t[1]=(p*u*n-c*m*n-p*r*d+i*m*d+c*r*g-i*u*g)*w,t[2]=(o*m*n-p*a*n+p*r*h-i*m*h-o*r*g+i*a*g)*w,t[3]=(c*a*n-o*u*n-c*r*h+i*u*h+o*r*d-i*a*d)*w,t[4]=y*w,t[5]=(l*m*n-f*u*n+f*r*d-e*m*d-l*r*g+e*u*g)*w,t[6]=(f*a*n-s*m*n-f*r*h+e*m*h+s*r*g-e*a*g)*w,t[7]=(s*u*n-l*a*n+l*r*h-e*u*h-s*r*d+e*a*d)*w,t[8]=x*w,t[9]=(f*c*n-l*p*n-f*i*d+e*p*d+l*i*g-e*c*g)*w,t[10]=(s*p*n-f*o*n+f*i*h-e*p*h-s*i*g+e*o*g)*w,t[11]=(l*o*n-s*c*n-l*i*h+e*c*h+s*i*d-e*o*d)*w,t[12]=b*w,t[13]=(l*p*r-f*c*r+f*i*u-e*p*u-l*i*m+e*c*m)*w,t[14]=(f*o*r-s*p*r-f*i*a+e*p*a+s*i*m-e*o*m)*w,t[15]=(s*c*r-l*o*r+l*i*a-e*c*a-s*i*u+e*o*u)*w,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=be.ZERO);var n=this.elements,s=e.x,o=e.y,a=e.z,h=e.w,l=-r.x,c=-r.y,u=-r.z,d=s+s,f=o+o,p=a+a,m=s*d,g=s*f,v=s*p,y=o*f,x=o*p,b=a*p,_=h*d,w=h*f,T=h*p,E=i.x,S=i.y,I=i.z;return n[0]=(1-(y+b))*E,n[1]=(g+T)*E,n[2]=(v-w)*E,n[3]=0,n[4]=(g-T)*S,n[5]=(1-(m+b))*S,n[6]=(x+_)*S,n[7]=0,n[8]=(v+w)*I,n[9]=(x-_)*I,n[10]=(1-(m+y))*I,n[11]=0,n[12]=l*n[0]+c*n[4]+u*n[8]-l+t.x,n[13]=l*n[1]+c*n[5]+u*n[9]-c+t.y,n[14]=l*n[2]+c*n[6]+u*n[10]-u+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,s=this.elements,o=n.set(s[0],s[1],s[2]).length(),a=n.set(s[4],s[5],s[6]).length(),h=n.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14];var l=t.tempMat0;l.copyFrom(this);var c=1/o,u=1/a,d=1/h;return l.elements[0]*=c,l.elements[1]*=c,l.elements[2]*=c,l.elements[4]*=u,l.elements[5]*=u,l.elements[6]*=u,l.elements[8]*=d,l.elements[9]*=d,l.elements[10]*=d,i.setFromRotationMatrix(l),r.x=o,r.y=a,r.z=h,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new be,e=new kn,i=new be;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,s){var o=1/(e-t),a=1/(i-r),h=1/(s-n),l=-(e+t)*o,c=-(i+r)*a,u=-(s+n)*h;o*=2,a*=2,h*=-2;var d=this.elements;return d[0]=o,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=a,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=h,d[11]=0,d[12]=l,d[13]=c,d[14]=u,d[15]=1,this},e.perspective=function(t,e,i,r,n){var s=1/Math.tan(.5*t),o=1/(i-r),a=this.elements;return a[0]=n?s:s/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=n?s*e:s,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(r+i)*o,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*r*i*o,a[15]=0,null!==r&&r!==1/0||(a[10]=-1,a[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,o=null!=e?e:t;o.x=s[0]*i+s[4]*r+s[8]*n+s[12],o.y=s[1]*i+s[5]*r+s[9]*n+s[13],o.z=s[2]*i+s[6]*r+s[10]*n+s[14];var a=s[3]*i+s[7]*r+s[11]*n+s[15];return o.multiply(1/a)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n+s[12],o.y=s[1]*i+s[5]*r+s[9]*n+s[13],o.z=s[2]*i+s[6]*r+s[10]*n+s[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n,o.y=s[1]*i+s[5]*r+s[9]*n,o.z=s[2]*i+s[6]*r+s[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n+o[12]*s,a.y=o[1]*i+o[5]*r+o[9]*n+o[13]*s,a.z=o[2]*i+o[6]*r+o[10]*n+o[14]*s,a.w=o[3]*i+o[7]*r+o[11]*n+o[15]*s,a},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!ge(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,s){return(new t).perspective(e,i,r,n,s)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,s,o,a,h,l,c,u,d,f,p,m,g){return new t(e,s,l,f,i,o,c,p,r,a,u,m,n,h,d,g)},t}();No.IDENTITY=new No(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),No.ZERO=new No(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),No.tempVec0=new be,No.tempVec1=new be,No.tempVec2=new be,No.tempMat0=new No,(Do=Oo||(Oo={}))[Do.triangle=1]="triangle",Do[Do.box=2]="box",Do[Do.sphere=3]="sphere",Do[Do.custom=4]="custom";var Bo=function(){this.position=new xe,this.delta=new xe,this.pointerCurrentRaycast=new zo},zo=function(){this.point=null,this.item=null},Uo=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new be),this.vectorsWorld.push(new be);for(var n=0;n<3;n++)this.directions.push(new be);this.minimum=new be,this.maximum=new be,this.minimumWorld=new be,this.maximumWorld=new be,this.center=new be,this.centerWorld=new be,this.extendSize=new be,this.extendSizeWorld=new be,this.worldMatrix=i||No.fromIdentity(),this.reConstruct(t,e,i)}var e=t.prototype;return e.reConstruct=function(e,i,r){var n=e.x,s=e.y,o=e.z,a=i.x,h=i.y,l=i.z;this.minimum.set(n,s,o),this.maximum.set(a,h,l),this.vectors[0].set(n,s,o),this.vectors[1].set(a,h,l),this.vectors[2].set(a,s,o),this.vectors[3].set(n,h,o),this.vectors[4].set(n,s,l),this.vectors[5].set(a,h,o),this.vectors[6].set(n,h,l),this.vectors[7].set(a,s,l);var c=t.tempVector0,u=t.tempVector1;c.copyFrom(i).add(e),this.center.copyFrom(c).scale(.5),u.copyFrom(i).subtract(e),this.extendSize.copyFrom(u).scale(.5),this.worldMatrix=r||No.fromIdentity(),this.update(this.worldMatrix)},e.update=function(e){var i=this.minimumWorld,r=this.maximumWorld,n=this.vectorsWorld,s=this.vectors;if(e.isIdentity()){i.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var o=0;o<8;o++)n[o].copyFrom(s[o]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var a=0;a<8;a++){e.transformPoint(s[a],n[a]);var h=n[a];i.x=Math.min(i.x,h.x),i.y=Math.min(i.y,h.y),i.z=Math.min(i.z,h.z),r.x=Math.max(r.x,h.x),r.y=Math.max(r.y,h.y),r.z=Math.max(r.z,h.z)}var l=t.tempVector0,c=t.tempVector1;l.copyFrom(r).subtract(i),this.extendSizeWorld.copyFrom(l).scale(.5),c.copyFrom(r).add(i),this.centerWorld.copyFrom(c).scale(.5)}var u=e.elements;this.directions[0].set(u[0],u[1],u[2]),this.directions[1].set(u[4],u[5],u[6]),this.directions[2].set(u[8],u[9],u[10]),this.worldMatrix=e},e.scale=function(e){var i=t.tempVector0;i.copyFrom(this.maximum).subtract(this.minimum);var r=i.length();i.scale(1/r);var n=r*e;i.scale(.5*n);var s=t.tempVector1,o=t.tempVector2;return s.copyFrom(this.center).subtract(i),o.copyFrom(this.center).add(i),this.reConstruct(s,o,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld,r=-1e-6;return!(i.x-t.x<r||r>t.x-e.x)&&(!(i.y-t.y<r||r>t.y-e.y)&&!(i.z-t.z<r||r>t.z-e.z))},e.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.intersectsMinMax=function(t,e){var i=this.minimumWorld,r=this.maximumWorld;return!(r.x<t.x||i.x>e.x)&&(!(r.y<t.y||i.y>e.y)&&!(r.z<t.z||i.z>e.z))},t.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},t}();Uo.tempVector0=new be,Uo.tempVector1=new be,Uo.tempVector2=new be;var Vo,Go,jo=function(){function t(){this.boundingBox=new Uo(new be,new be),this.triangles=[],this.worldMatrix=new No,this.assemblyTriangles=function(t,e,i,r,n){for(var s=i;s<r;s+=3){var o=3*e[s],a=3*e[s+1],h=3*e[s+2],l={x:t[o],y:t[o+1],z:t[o+2]},c={x:t[a],y:t[a+1],z:t[a+2]},u={x:t[h],y:t[h+1],z:t[h+2]};n.push({p0:l,p1:c,p2:u})}}}var e=t.prototype;return e.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},e.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},e.getBoundingBoxTriangle=function(t){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,s=Number.MAX_VALUE,o=nn(this.boundingBoxTriangle.area);!(e=o()).done;){var a=e.value;i=Math.max(a.p0.x,a.p1.x,a.p2.x,i),r=Math.max(a.p0.y,a.p1.y,a.p2.y,r),n=Math.min(a.p0.x,a.p1.x,a.p2.x,n),s=Math.min(a.p0.y,a.p1.y,a.p2.y,s)}var h=[],l=new be(n,r,0),c=new be(i,r,0),u=new be(i,s,0),d=new be(n,s,0);return h.push({p0:l,p1:c,p2:u}),h.push({p0:l,p1:u,p2:d}),this.applyWorldMatrix(h),{type:Oo.triangle,area:h}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=nn(this.triangles);!(i=n()).done;){var s=i.value;r.push({p0:s.p0,p1:s.p1,p2:s.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:Oo.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,s=nn(t.subMeshes);!(n=s()).done;){var o=n.value;if(void 0!==o.indexCount){var a=e.BYTES_PER_ELEMENT,h=o.offset/a,l=h+o.indexCount;this.assemblyTriangles(i,e,h,l,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new be),t.p1=e.worldMatrix.transformPoint(t.p1,new be),t.p2=e.worldMatrix.transformPoint(t.p2,new be)}),t},t}(),Ho=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e.frameClipMasks=[],e.maskManager=new Fo,e._priority=0,e.boundingBoxInfo=new jo,e}Ui(e,t);var i=e.prototype;return i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},i.getBoundingBoxInfo=function(){return this.boundingBoxInfo},i.render=function(t){},ks(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(Ls);ee([cn()],Ho.prototype,"materials",void 0),ee([cn()],Ho.prototype,"_priority",void 0),(Go=Vo||(Vo={}))[Go.XYZ=0]="XYZ",Go[Go.XZY=1]="XZY",Go[Go.YXZ=2]="YXZ",Go[Go.YZX=3]="YZX",Go[Go.ZXY=4]="ZXY",Go[Go.ZYX=5]="ZYX";var Wo=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],s=i[8],o=i[1],a=i[5],h=i[9],l=i[2],c=i[6],u=i[10];switch(e){case Vo.XYZ:this.y=Math.asin(ye(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-h,u),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(c,a),this.z=0);break;case Vo.YXZ:this.x=Math.asin(-ye(h,-1,1)),Math.abs(h)<.9999999?(this.y=Math.atan2(s,u),this.z=Math.atan2(o,a)):(this.y=Math.atan2(-l,r),this.z=0);break;case Vo.ZXY:this.x=Math.asin(ye(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-l,u),this.z=Math.atan2(-n,a)):(this.y=0,this.z=Math.atan2(o,r));break;case Vo.ZYX:this.y=Math.asin(-ye(l,-1,1)),Math.abs(l)<.9999999?(this.x=Math.atan2(c,u),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,a));break;case Vo.YZX:this.z=Math.asin(ye(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-h,a),this.y=Math.atan2(-l,r)):(this.x=0,this.y=Math.atan2(s,u));break;case Vo.XZY:this.z=Math.asin(-ye(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,a),this.y=Math.atan2(s,r)):(this.x=Math.atan2(-h,u),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=pe,this.y*=pe,this.z*=pe,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,s,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new kn;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this,i=e.x,r=e.y,n=e.z,s=e.order,o=Math.cos(i*fe*.5),a=Math.cos(r*fe*.5),h=Math.cos(n*fe*.5),l=Math.sin(i*fe*.5),c=Math.sin(r*fe*.5),u=Math.sin(n*fe*.5);switch(s){case Vo.XYZ:t.set(l*a*h+o*c*u,o*c*h-l*a*u,o*a*u+l*c*h,o*a*h-l*c*u);break;case Vo.YXZ:t.set(l*a*h+o*c*u,o*c*h-l*a*u,o*a*u-l*c*h,o*a*h+l*c*u);break;case Vo.ZXY:t.set(l*a*h-o*c*u,o*c*h+l*a*u,o*a*u+l*c*h,o*a*h-l*c*u);break;case Vo.ZYX:t.set(l*a*h-o*c*u,o*c*h+l*a*u,o*a*u-l*c*h,o*a*h+l*c*u);break;case Vo.YZX:t.set(l*a*h+o*c*u,o*c*h+l*a*u,o*a*u-l*c*h,o*a*h-l*c*u);break;case Vo.XZY:t.set(l*a*h-o*c*u,o*c*h-l*a*u,o*a*u+l*c*h,o*a*h+l*c*u);break;default:console.error("unknown euler order: "+s)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,s=i.z,o=i.order,a=Math.cos(r*fe),h=Math.sin(r*fe),l=Math.cos(n*fe),c=Math.sin(n*fe),u=Math.cos(s*fe),d=Math.sin(s*fe);if(o===Vo.XYZ){var f=a*u,p=a*d,m=h*u,g=h*d;e[0]=l*u,e[4]=-l*d,e[8]=c,e[1]=p+m*c,e[5]=f-g*c,e[9]=-h*l,e[2]=g-f*c,e[6]=m+p*c,e[10]=a*l}else if(o===Vo.YXZ){var v=l*u,y=l*d,x=c*u,b=c*d;e[0]=v+b*h,e[4]=x*h-y,e[8]=a*c,e[1]=a*d,e[5]=a*u,e[9]=-h,e[2]=y*h-x,e[6]=b+v*h,e[10]=a*l}else if(o===Vo.ZXY){var _=l*u,w=l*d,T=c*u,E=c*d;e[0]=_-E*h,e[4]=-a*d,e[8]=T+w*h,e[1]=w+T*h,e[5]=a*u,e[9]=E-_*h,e[2]=-a*c,e[6]=h,e[10]=a*l}else if(o===Vo.ZYX){var S=a*u,I=a*d,A=h*u,C=h*d;e[0]=l*u,e[4]=A*c-I,e[8]=S*c+C,e[1]=l*d,e[5]=C*c+S,e[9]=I*c-A,e[2]=-c,e[6]=h*l,e[10]=a*l}else if(o===Vo.YZX){var P=a*l,M=a*c,R=h*l,O=h*c;e[0]=l*u,e[4]=O-P*d,e[8]=R*d+M,e[1]=d,e[5]=a*u,e[9]=-h*u,e[2]=-c*u,e[6]=M*d+R,e[10]=P-O*d}else if(o===Vo.XZY){var D=a*l,k=a*c,L=h*l,F=h*c;e[0]=l*u,e[4]=-d,e[8]=c*u,e[1]=D*d+F,e[5]=a*u,e[9]=k*d-L,e[2]=L*d-k,e[6]=h*u,e[10]=F*d+D}else console.error("toMatrix4: Invalid order "+o);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromArray(e,i,r)},t}();Wo.DEFAULT_ORDER=Vo.ZYX,Wo.tempQuat0=new kn,Wo.tempMat0=new No;var Xo="editor",Yo="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",qo="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b",Ko="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Zo="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Jo="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",$o="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",Qo=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var s;null==(s=e.listeners[t])||s.forEach(function(i){var n=i.listener,s=i.options;n.apply(void 0,[].concat(r)),(null==s?void 0:s.once)&&e.off(t,n)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},ta=function(){function t(t,e,i,r,n,s,o,a,h){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=1),this.elements=[t,e,i,r,n,s,o,a,h]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,o,a,h){var l=this.elements;return l[0]=t,l[3]=r,l[6]=o,l[1]=e,l[4]=n,l[7]=a,l[2]=i,l[5]=s,l[8]=h,this},e.setFromRowMajorData=function(t,e,i,r,n,s,o,a,h){var l=this.elements;return l[0]=t,l[3]=e,l[6]=i,l[1]=r,l[4]=n,l[7]=s,l[2]=o,l[5]=a,l[8]=h,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,s=e+e,o=i+i,a=r+r,h=e*s,l=e*o,c=e*a,u=i*o,d=i*a,f=r*a,p=n*s,m=n*o,g=n*a,v=this.elements;return v[0]=1-(u+f),v[1]=l+g,v[2]=c-m,v[3]=l-g,v[4]=1-(h+f),v[5]=d+p,v[6]=c+m,v[7]=d-p,v[8]=1-(h+u),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],s=r[3],o=r[6],a=r[1],h=r[4],l=r[7];return r[0]=e*n+i*a,r[3]=e*s+i*h,r[6]=e*o+i*l,r[1]=-i*n+e*a,r[4]=-i*s+e*h,r[7]=-i*o+e*l,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],o=i[3],a=i[6],h=i[1],l=i[4],c=i[7],u=i[2],d=i[5],f=i[8],p=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],_=r[5],w=r[8];return n[0]=s*p+o*v+a*b,n[3]=s*m+o*y+a*_,n[6]=s*g+o*x+a*w,n[1]=h*p+l*v+c*b,n[4]=h*m+l*y+c*_,n[7]=h*g+l*x+c*w,n[2]=u*p+d*v+f*b,n[5]=u*m+d*y+f*_,n[8]=u*g+d*x+f*w,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],o=t[7],a=t[2],h=t[5],l=t[8];return e*(s*l-h*o)+n*(h*r-i*l)+a*(i*o-s*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],o=t[7],a=t[2],h=t[5],l=t[8],c=l*s-h*o,u=h*r-l*i,d=o*i-s*r,f=e*c+n*u+a*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return t[0]=c*p,t[1]=(a*o-l*n)*p,t[2]=(h*n-a*s)*p,t[3]=u*p,t[4]=(l*e-a*r)*p,t[5]=(a*i-h*e)*p,t[6]=d*p,t[7]=(n*r-o*e)*p,t[8]=(s*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[3]*r+s[6]*n,o.y=s[1]*i+s[4]*r+s[7]*n,o.z=s[2]*i+s[5]*r+s[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!ge(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,s,o,a,h,l){return new t(e,n,a,i,s,h,r,o,l)},t}(),ea=function(){function t(t,e){void 0===t&&(t=be.ZERO),void 0===e&&(e=be.X),this.origin=new be,this.direction=new be,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new be;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,s,o,a,h=this.origin,l=h.x,c=h.y,u=h.z,d=this.direction,f=d.x,p=d.y,m=d.z,g=t.min,v=g.x,y=g.y,x=g.z,b=t.max,_=b.x,w=b.y,T=b.z,E=1/f,S=1/p,I=1/m;if(E>=0?(i=(v-l)*E,r=(_-l)*E):(i=(_-l)*E,r=(v-l)*E),S>=0?(n=(y-c)*S,s=(w-c)*S):(n=(w-c)*S,s=(y-c)*S),!(i>s||n>r||((n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),(n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),I>=0?(o=(x-u)*I,a=(T-u)*I):(o=(T-u)*I,a=(x-u)*I),i>a||o>r||((o>i||i!=i)&&(i=o),(a<r||r!=r)&&(r=a),r<0))))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new be).copyFrom(this.origin):void 0;var s=-(this.origin.dot(i)+r)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),s=n.dot(this.direction),o=n.dot(n)-s*s,a=e.radius*e.radius;if(!(o>a)){var h=Math.sqrt(a-o),l=s-h,c=s+h;if(!(c<0))return l>=0?this.at(l,i):this.at(c,i)}},e.intersectTriangle=function(e,i,r){var n,s=e.p0,o=e.p1,a=e.p2,h=t.tempVec0.subtractVectors(o,s),l=t.tempVec1.subtractVectors(a,s),c=t.tempVec2.subtractVectors(this.origin,s),u=t.tempVec3.crossVectors(h,l),d=this.direction.dot(u);if(d>0){if(r)return;n=1}else{if(!(d<0))return;n=-1,d=-d}l.crossVectors(c,l);var f=n*this.direction.dot(l);if(!(f<0)){h.cross(c);var p=n*this.direction.dot(h);if(!(p<0||f+p>d)){var m=-n*c.dot(u);if(!(m<0))return this.at(m/d,i)}}},t}();ea.tempVec0=new be,ea.tempVec1=new be,ea.tempVec2=new be,ea.tempVec3=new be;var ia,ra,na=function(){function t(t,e){void 0===t&&(t=new be(1/0,1/0,1/0)),void 0===e&&(e=new be(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,s=-1/0,o=-1/0,a=0,h=t.length;a<h;a+=3){var l=t[a],c=t[a+1],u=t[a+2];l<e&&(e=l),c<i&&(i=c),u<r&&(r=u),l>n&&(n=l),c>s&&(s=c),u>o&&(o=u)}return this.min.set(e,i,r),this.max.set(n,s,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new t).copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new be),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new be),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,s=0,o=n.length;s<o;s++)this.expandByObject(n[s]);return this},e.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)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new be),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.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)},e.intersectsSphere=function(t){var e=new be;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new be),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new be),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new be),this.isEmpty())return[];var i=[];return i[0]=new be(this.min.x,this.min.y,this.min.z),i[1]=new be(this.min.x,this.min.y,this.max.z),i[2]=new be(this.min.x,this.max.y,this.min.z),i[3]=new be(this.min.x,this.max.y,this.max.z),i[4]=new be(this.max.x,this.min.y,this.min.z),i[5]=new be(this.max.x,this.min.y,this.max.z),i[6]=new be(this.max.x,this.max.y,this.min.z),i[7]=new be(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new be;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),sa=function(){function t(t,e){void 0===t&&(t=be.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var s=(new na).setFromPoints(t);s.getCenter(i),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new be),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(t=new na),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],s=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*s,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new be).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new be,i=new be;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=(new be).subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),oa=Object.freeze({__proto__:null,get EulerOrder(){return Vo},Euler:Wo,Quaternion:kn,Vector2:xe,Vector3:be,Vector4:_e,Matrix3:ta,Matrix4:No,Ray:ea,PI2:de,DEG2RAD:fe,RAD2DEG:pe,NumberEpsilon:me,isZero:function(t){return isNaN(t)||Math.abs(t)<me},isEqual:ge,damp:function(t,e,i,r){return ve(t,e,1-Math.exp(-i*r))},lerp:ve,degToRad:function(t){return t*fe},radToDeg:function(t){return t*pe},clamp:ye,Color:we,Box3:na,Sphere:sa}),aa=new kn,ha=new be,la=new be,ca=1,ua=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new be(0,0,0),this.quat=new kn(0,0,0,1),this.rotation=new Wo(0,0,0),this.scale=new be(1,1,1),this.anchor=new be(0,0,0),this.size=new xe(1,1),this.children=[],this.worldMatrix=No.fromIdentity(),this.localMatrix=No.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new be(0,0,0),quat:new kn(0,0,0,1),scale:new be(1,1,1)},this.name="transform_"+ca++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,s=t.size,o=t.quat,a=t.name,h=t.anchor;if(a&&(this.name=a),i&&(Qt(i,be)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)Qt(o,kn)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var l=e?-1:1;Qt(r,Wo)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}n&&(Qt(n,be)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),s&&this.setSize(s.x,s.y),h&&(Qt(h,xe)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){le(this.children,t)},e.removeChild=function(t){ce(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Wo)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.setWorldPosition=function(t,e,i){var r=this.getParentMatrix();r?(ha.set(0,0,0),aa.set(0,0,0,1),la.set(1,1,1),r.decompose(ha,aa,la),ha.set(t-ha.x,e-ha.y,i-ha.z),aa.invert(),ha.applyQuaternion(aa),ha.x=0!==la.x?ha.x/la.x:0,ha.y=0!==la.y?ha.y/la.y:0,ha.z=0!==la.z?ha.z/la.z:0,this.setPosition(ha.x,ha.y,ha.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Wo)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new be).copyFrom(t.position),t.quat?e.quat=new kn(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Wo(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new be).copyFrom(t.scale),t.size&&(e.size=(new xe).copyFrom(t.size)),t.anchor&&(e.anchor=(new xe).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=aa.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},ks(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),da=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new ua,r.time=-1,r.duration=0,r.endBehavior=Yi.forward,r.type=Ci.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Qo,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}Ui(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=nn(this.components);!(i=r()).done;){var n=i.value;if(Qt(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=nn(this.components);!(e=r()).done;){var n=e.value;Qt(n,t)&&i.push(n)}return i},i.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},i.setParent=function(t){(t!==this||t)&&(this.parent&&ce(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&(this.awake(),this.beginPlay()))},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=nn(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new ua({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Wo(t,e,i),n=kn.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(t,e,i)},i.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,s=r.y,o=this.composition.engine.canvas.getBoundingClientRect(),a=o.width,h=o.height;this.transform.setPosition((2*t/a-1)*n,(1-2*e/h)*s,i)}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.engine.canvas.getBoundingClientRect(),r=i.width,n=i.height,s=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(s),a=o.x,h=o.y;this.transform.translate(2*t*a/r,-2*e*h/n,0)}},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new be;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,s=i[r];if(r++,s.name===t)return s;(n=i).push.apply(n,[].concat(s.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.refreshGUIDRecursive();var e=this.engine.findObject({id:this.defination.id});return e.refreshGUIDRecursive(),this.refreshGUIDRecursive(t),this.composition&&e.setParent(this.composition.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=nn(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=nn(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=nn(this.children);!(r=n()).done;){r.value.awake()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=nn(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=nn(this.components);!(r=n()).done;){var s=r.value;s.enabled&&!s.isEnableCalled&&s.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=nn(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.setRendererComponentOrder=function(t){for(var e,i=nn(this.components);!(e=i()).done;){var r=e.value;Qt(r,Ho)&&(r.priority=t)}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r,n=i.id,s=i.name,o=i.parentId,a=i.endBehavior,h=i.transform,l=i.duration,c=void 0===l?0:l,u=i.visible,d=void 0===u||u;if(this.type=i.type,this.props=i,this.id=n.toString(),this.parentId=o,this.components.length=0,e.isComposition(this)){var f=this.defination.content.options.refId,p=this.engine.findEffectsObjectData(f);if(!p)throw new Error("Referenced precomposition with Id: "+f+" does not exist.");this.instantiatePreComposition(p)}if(this.name=s,this.duration=c,this.endBehavior=a,h&&this.transform.fromData(h),this.transform.name=this.name,this.transform.engine=this.engine,i.content||(i.content={options:{}}),c<0)throw new Error("Item duration can't be less than 0, see "+Yo+".");if(i.components)for(var m,g=nn(i.components);!(m=g()).done;){var v=m.value,y=this.engine.findObject(v);this.components.push(y),Qt(y,gd)&&(this.components.includes(y.renderer)||this.components.push(y.renderer))}for(var x,b=nn(null!=(r=i.children)?r:[]);!(x=b()).done;){var _=x.value;this.engine.findObject(_).setParent(this)}this.setVisible(d)},i.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=jr.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var i,r=nn(this.components);!(i=r()).done;){var n=i.value;Qt(n,Yh)&&this.defination.components.push(n)}}this.defination.content={}},i.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e,i=nn(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=nn(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&ce(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i,r=this.getInstanceId();this.setInstanceId(t.id);for(var n,s=nn(t.components);!(n=s()).done;){var o=n.value,a=this.engine.findObject(o);a.item=this,this.components.push(a)}for(var h,l=nn(null!=(i=t.children)?i:[]);!(h=l()).done;){var c=h.value;this.engine.findObject(c).setParent(this)}if(e){for(var u,d=nn(this.components);!(u=d()).done;){u.value.setInstanceId(ei())}for(var f,p=nn(this.children);!(f=p()).done;){f.value.refreshGUIDRecursive()}}this.setInstanceId(r)},i.refreshGUIDRecursive=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:ei();this.setInstanceId(i);for(var r,n=nn(this.components);!(r=n()).done;){var s,o=r.value,a=null!=(s=null==t?void 0:t.get(o))?s:ei();o.setInstanceId(a)}for(var h,l=nn(this.children);!(h=l()).done;){h.value.refreshGUIDRecursive(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=nn(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,s=nn(this.children);!(n=s()).done;){n.value.gatherPreviousObjectID(t)}},i.getDescendantsInternal=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var r=0;r<this.children.length;r++){var n=this.children[r];i&&!i(n)||t.push(n),e||n.getDescendantsInternal(t,!1,i)}},e.isComposition=function(t){return t.type===Ci.composition},e.isSprite=function(t){return t.type===Ci.sprite},e.isParticle=function(t){return t.type===Ci.particle},e.isNull=function(t){return t.type===Ci.null},e.isTree=function(t){return t.type===Ci.tree},e.isCamera=function(t){return t.type===Ci.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},ks(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=nn(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){this.listIndex=t,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(t)}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(dn);da=ee([ln(jr.VFXItemData)],da),(ra=ia||(ia={})).is=function(t,e){return t.type===e},ra.isComposition=function(t){return t.type===Ci.composition},ra.isParticle=function(t){return t.type===Ci.particle},ra.isNull=function(t){return t.type===Ci.null};var fa,pa,ma,ga=(fa=new Float32Array(1),pa=new Int32Array(fa.buffer),function(t){fa[0]=t;var e=pa[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),va=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=ga(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=ga(t[i])},t}(),ya=new Wo,xa=new No;function ba(t,e,i,r,n,s,o){var a=t,h=r/n,l=r,c=e.speedOverLifetime;c&&(l=c.getIntegrateValue(0,r,n));var u=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;a.copyFrom(s),a.addScaledVector(o,l),a.addScaledVector(i,u);var d=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var p=new be;f.center&&p.setFromArray(f.center);var m=a.clone().subtract(p),g=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?g?e.getValue(h):e.getIntegrateValue(0,r,n):0});ya.setFromArray(v).negate(),xa.setFromEuler(ya);var y=xa.transformPoint(m);a.addVectors(p,y)}if(d.enabled){var x=d.asMovement,b=d.x,_=d.y,w=d.z;if(b){var T=x?b.getValue(h):b.getIntegrateValue(0,r,n);a.x=a.x+T}if(_){var E=x?_.getValue(h):_.getIntegrateValue(0,r,n);a.y=a.y+E}if(w){var S=x?w.getValue(h):w.getIntegrateValue(0,r,n);a.z=a.z+S}}return a}function _a(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}(ma={})[Oi.PARTICLE_ORIGIN_CENTER]=[0,0],ma[Oi.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ma[Oi.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ma[Oi.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ma[Oi.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ma[Oi.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ma[Oi.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ma[Oi.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ma[Oi.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5];function wa(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function Ta(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function Ea(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function Sa(t,e,i,r,n){void 0===r&&(r=null);var s=new be(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new be(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var a=e,h=e*n;a<e+i;a++,h+=n){var l=t[h],c=t[h+1],u=t[h+2];s.x=Math.min(s.x,l),s.y=Math.min(s.y,c),s.z=Math.min(s.z,u),o.x=Math.max(o.x,l),o.y=Math.max(o.y,c),o.z=Math.max(o.z,u)}return r&&(s.x-=s.x*r.x+r.y,s.y-=s.y*r.x+r.y,s.z-=s.z*r.x+r.y,o.x+=o.x*r.x+r.y,o.y+=o.y*r.x+r.y,o.z+=o.z*r.x+r.y),{minimum:s,maximum:o}}var Ia={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex,s=e[r],o=e[n];return new xe(s,o)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===Wi.LINE||i===Wi.EASE_OUT?0:i===Wi.EASE_IN||i===Wi.EASE||i===Wi.HOLD&&r===Wi.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Wi.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Wi.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[Wi.EASE,Wi.EASE_IN,Wi.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[Wi.EASE,Wi.EASE_OUT,Wi.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Wi.HOLD&&[Wi.HOLD,Wi.LINE_OUT,Wi.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Wi.HOLD&&[Wi.HOLD,Wi.LINE,Wi.EASE_IN].includes(i)}},Aa=function(t,e){this.points=t,this.totalLength=e},Ca={},Pa={},Ma=.1;function Ra(t,e){return 1-3*e+3*t}function Oa(t,e){return 3*e-6*t}function Da(t){return 3*t}function ka(t,e,i){return((Ra(e,i)*t+Oa(e,i))*t+Da(e))*t}function La(t,e,i){return 3*Ra(e,i)*t*t+2*Oa(e,i)*t+Da(e)}var Fa=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=Ea(e.x-t.x,3)+"_"+Ea(e.y-t.y,3)+"_"+Ea(e.z-t.z,3)+"&"+Ea(i.x-t.x,3)+"_"+Ea(i.y-t.y,3)+"_"+Ea(i.z-t.z,3)+"&"+Ea(r.x-t.x,3)+"_"+Ea(r.y-t.y,3)+"_"+Ea(r.z-t.z,3);if(Pa[n])return{data:Pa[n],interval:t};for(var s=[],o=null,a=0,h=0,l=0;l<300;l+=1){var c=new be,u=l/299;h=0,c.x=3*Math.pow(1-u,2)*u*(i.x-t.x)+3*(1-u)*Math.pow(u,2)*(r.x-t.x)+Math.pow(u,3)*(e.x-t.x),c.y=3*Math.pow(1-u,2)*u*(i.y-t.y)+3*(1-u)*Math.pow(u,2)*(r.y-t.y)+Math.pow(u,3)*(e.y-t.y),c.z=3*Math.pow(1-u,2)*u*(i.z-t.z)+3*(1-u)*Math.pow(u,2)*(r.z-t.z)+Math.pow(u,3)*(e.z-t.z),null!==o&&(h+=Math.pow(c.x-o.x,2),h+=Math.pow(c.y-o.y,2),h+=Math.pow(c.z-o.z,2)),o=c,a+=h=Math.sqrt(h),s[l]={partialLength:h,point:c}}var d=new Aa(s,a);return Pa[n]=d,{data:d,interval:new be(t.x,t.y,t.z)}}(t,e,i,r),s=n.data,o=n.interval;this.lengthData=s,this.interval=o,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(Ta(1-t,0))return e.points[299].point.clone().add(this.interval);if(Ta(e.totalLength,0))return this.p1.clone();var i=new be,r=Ea(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(Ta(n,r))return e.points[s].point.clone().add(this.interval);var o=!0,a=1;for(r<n&&(a=-1);o;){if(r>=n){if(299===s){i.x=e.points[s].point.x,i.y=e.points[s].point.y,i.z=e.points[s].point.z;break}if(r<n+e.points[s+1].partialLength){var h=(r-n)/e.points[s+1].partialLength;i.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*h,i.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*h,i.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*h;break}}a>0&&s<299?(s+=a,n+=Ea(e.points[s].partialLength,5)):a<0&&s>0?(n-=Ea(e.points[s].partialLength,5),s+=a):o=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),Na=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new kn,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):Ta(1-t,0)?this.temp.copyFrom(this.p2):(Va.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Ba=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new xe,this.control2=new xe,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),ka(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var s=1-n,o=s*s,a=n*n;return t*(o*s)+e*o*n*3+i*s*a*3+r*(a*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=ka(t*Ma,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=Ma;var n=i+(t-e[--r])/(e[r+1]-e[r])*Ma,s=La(n,this.control1.x,this.control2.x);return s>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var s=La(e,i,r);if(0===s)return e;e-=(ka(e,i,r)-t)/s}return e}(t,n,this.control1.x,this.control2.x):0===s?n:function(t,e,i,r,n){var s,o,a=0;do{(s=ka(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o}while(Math.abs(s)>1e-7&&++a<10);return o}(t,i,i+Ma,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,this.control1.x===this.control1.y&&this.control2.x===this.control2.y||this.calcSampleValues()},t}();function za(t,e){var i=Ua(t,e,!0),r=i.p0,n=i.p1,s=i.p2,o=i.p3;Be(s),Be(o);var a,h,l=o.x-r.x,c=o.y-r.y,u=Ea((n.x-r.x)/l,5),d=Ea((s.x-r.x)/l,5);Ta(c,0)?a=h=NaN:(a=Ea((n.y-r.y)/c,5),h=Ea((s.y-r.y)/c,5)),u<0&&(console.error("Invalid bezier points, x1 < 0",r,n,s,o),u=0),d<0&&(console.error("Invalid bezier points, x2 < 0",r,n,s,o),d=0),u>1&&(console.error("Invalid bezier points, x1 >= 1",r,n,s,o),u=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",r,n,s,o),d=1);var f,p=("bez_"+u+"_"+a+"_"+d+"_"+h).replace(/\./g,"p");return Ca[p]?f=Ca[p]:(f=Ta(c,0)?new Ba:new Ba(u,a,d,h),Ca[p]=f),{points:[r,n,s,o],timeInterval:l,valueInterval:c,curve:f}}function Ua(t,e,i){var r=t[1],n=Ia.isHoldOutKeyframe(t),s=Ia.isHoldInKeyframe(e),o=!s&&Ia.isRightSideEase(t),a=!n&&Ia.isLeftSideEase(e);if(o&&!a&&!s){var h=new xe(r[r.length-4],r[r.length-3]),l=new xe(r[r.length-2],r[r.length-1]),c=Ia.getPointInCurve(e),u=new xe(c.x,c.y);return{type:"ease",p0:h,p1:l,p2:new xe(u.x-(u.x-h.x)/10,u.y),p3:u}}if(!o&&a&&!n){var d=e[1],f=Ia.getPointInCurve(t),p=new xe(f.x,f.y),m=new xe(d[0],d[1]),g=new xe(d[2],d[3]);return{type:"ease",p0:p,p1:new xe(p.x+(g.x-p.x)/10,p.y),p2:m,p3:g}}if(o&&a){var v=e[1];return{type:"ease",p0:new xe(r[r.length-4],r[r.length-3]),p1:new xe(r[r.length-2],r[r.length-1]),p2:new xe(v[0],v[1]),p3:new xe(v[2],v[3])}}var y=Ia.getPointInCurve(t),x=Ia.getPointInCurve(e);return n?x.y=y.y:s&&(y.y=x.y),i?{type:"line",p0:y,p1:new xe((x.x-y.x)/3+y.x,(x.y-y.y)/3+y.y),p2:new xe((x.x-y.x)/3*2+y.x,(x.y-y.y)/3*2+y.y),p3:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}:{type:"line",p0:y,p1:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}var Va=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,s=e.y,o=e.z,a=e.w,h=i.x,l=i.y,c=i.z,u=i.w;if(0===r)return t.x=n,t.y=s,t.z=o,void(t.w=a);if(1===r)return t.x=h,t.y=l,t.z=c,void(t.w=u);if(a!==u||n!==h||s!==l||o!==c){var d=1-r,f=n*h+s*l+o*c+a*u,p=f>=0?1:-1,m=1-f*f;if(m>Number.EPSILON){var g=Math.sqrt(m),v=Math.atan2(g,f*p);d=Math.sin(d*v)/g,r=Math.sin(r*v)/g}var y=r*p;if(n=n*d+h*y,s=s*d+l*y,o=o*d+c*y,a=a*d+u*y,d===1-r){var x=1/Math.sqrt(n*n+s*s+o*o+a*a);n*=x,s*=x,o*=x,a*=x}}t.x=n,t.y=s,t.z=o,t.w=a},t}(),Ga="not_implement",ja=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Ga)},e.getIntegrateValue=function(t,e,i){throw new Error(Ga)},e.getIntegrateByTime=function(t,e){throw new Error(Ga)},e.getValue=function(t){throw new Error(Ga)},e.getMaxTime=function(){throw new Error(Ga)},e.toUniform=function(t){throw new Error(Ga)},e.map=function(t){throw new Error(Ga)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Ga)},t.getAllData=function(t,e){for(var i=new(e?va:Float32Array)(4*t.index),r=0,n=0,s=t.curves;r<s.length;r++){var o=s[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),Ha=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(ja),Wa=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(ja),Xa=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(ja),Ya=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var s=Math.random();r[n]=e[n]*(1-s)+i[n]*s}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(ja),qa=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,s=this.xCoord*i;return((r+e/s*(n-r)+r)*e-(r+t/s*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return eh(e,0,this.xCoord,this.min,this.max)-eh(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(ja),Ka=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=Ee(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1];if(n.time<=t&&s.time>t){var o=(t-n.time)/(s.time-n.time);return Se(n.color.toArray(),s.color.toArray(),o,!0)}}return e[i].color.toArray()},e}(ja),Za=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1],o=n[0],a=s[0];if(t>=o&&t<=a){var h=(t-o)/(a-o),l=n[1];return l+h*(s[1]-l)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,s=e?eh:th,o=0;o<n;o++){var a=i[o],h=i[o+1],l=a[0],c=h[0];if(t>l&&t<=c)return r+s(t,l,c,a[1],h[1]);r+=s(c,l,c,a[1],h[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(ja),Ja=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],s=e[r+1];if(n[0]<=t&&s[0]>=t){var o=s[1]-n[1],a=void 0;if(0===o)a=(t-n[0])/(s[0]-n[0]);else a=(ih(t,n,s)-n[1])/o;return this.calculateVec(r,a)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],s=0;s<i.length;s++)n[s]=i[s]*(1-e)+r[s]*e;return n},e}(ja),$a=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=new be(i[n][0],i[n][1],i[n][2]),h=new be(i[n+1][0],i[n+1][1],i[n+1][2]),l=new be(r[2*n][0],r[2*n][1],r[2*n][2]),c=new be(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),u=za(s,o),d=u.points,f=u.curve,p=u.timeInterval,m=u.valueInterval,g=d[0],v=d[d.length-1],y=new Fa(a,h,l,c);this.curveSegments[g.x+"&"+v.x]={points:d,timeInterval:p,valueInterval:m,easingCurve:f,pathCurve:y,timeStart:Number(g.x),timeEnd:Number(v.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=Ea(t,5),i=0,r=new be,n=this.keyTimeData;if(!n.length)return r;var s=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=s)return r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return r=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<n.length;a++){var h=this.curveSegments[n[a]].timeStart,l=this.curveSegments[n[a]].timeEnd;if(e>=Number(h)&&e<Number(l)){var c=this.curveSegments[n[a]].pathCurve;i=this.getPercValue(n[a],e),r=c.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=Ea((e-r.x)/n,4);return ye(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(ja),Qa=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=kn.fromArray(i[n]),h=kn.fromArray(i[n+1]),l=kn.fromArray(r[2*n]),c=kn.fromArray(r[2*n+1]),u=za(s,o),d=u.points,f=u.curve,p=u.timeInterval,m=u.valueInterval,g=d[0],v=d[d.length-1],y=new Na(a,h,l,c);this.curveSegments[g.x+"&"+v.x]={points:d,timeInterval:p,valueInterval:m,easingCurve:f,pathCurve:y}}},i.getValue=function(t){var e=0,i=Ea(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),s=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=s)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var a=r[o].split("&"),h=a[0],l=a[1];if(i>=Number(h)&&i<Number(l)){var c=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),c.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=Ea((e-r.x)/n,4);return ye(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(ja);function th(t,e,i,r,n){var s=t-e;return(r+r+(n-r)*s/(i-e))*s/2}function eh(t,e,i,r,n){var s=t*t,o=e*e;return(2*(s*t)*(r-n)+3*s*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function ih(t,e,i){var r=i[0]-e[0],n=e[3]*r,s=i[2]*r,o=(t-e[0])/r,a=o*o,h=a*o,l=h-2*a+o,c=h-a,u=-2*h+3*a;return(2*h-3*a+1)*e[1]+l*n+c*s+u*i[1]}function rh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(rh=function(){return!!t})()}function nh(t,e,i){return(nh=rh()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&zi(n,i.prototype),n}).apply(null,arguments)}var sh,oh,ah,hh,lh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new _e,e}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=gh(t[0]),this.yCurve=gh(t[1]),this.zCurve=gh(t[2]),this.wCurve=gh(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(ja),ch=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new be,e}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=gh(t[0]),this.yCurve=gh(t[1]),this.zCurve=gh(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(ja),uh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new xe,e}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=gh(t[0]),this.yCurve=gh(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(ja);(oh=sh||(sh={}))[oh.Cubic=0]="Cubic",oh[oh.Linear=1]="Linear",oh[oh.Constant=2]="Constant",(hh=ah||(ah={}))[hh.None=0]="None",hh[hh.In=1]="In",hh[hh.Out=2]="Out",hh[hh.Both=3]="Both";var dh=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=function(t){for(var e=t,i=[],r=[],n={x:0,y:0},s=0;s<e.length;s++){var o=e[s],a=Ua(o,s+1<e.length?e[s+1]:e[s],!0),h=a.p0,l=a.p1,c=a.p2,u=a.p3,d=a.type;Be(c),Be(u);var f={leftControl:n,value:h,rightControl:l,tangentMode:"line"===d?1:0};o[0]===Wi.HOLD&&(f.tangentMode=2),r.push(f),n=c}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+me)},m=0;m<r.length;m++){var g=r[m].leftControl,v=r[m].value,y=r[m].rightControl,x=0,b=0;m>0&&(x=p(g,v)),m<r.length-1&&(b=p(v,y));var _={time:v.x,value:v.y,inSlope:x,outSlope:b,inWeight:0,outWeight:0,tangentMode:r[m].tangentMode,weightedMode:3};i.push(_),m>0&&(_.inWeight=(v.x-g.x)/((v.x-r[m-1].value.x)/3)),m+1<r.length&&(_.outWeight=(y.x-v.x)/((r[m+1].value.x-v.x)/3))}return i}(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=fh(e[i],e[i+1]),n=r.points,s=r.curve,o=r.timeInterval,a=r.valueInterval,h=n[0],l=n[n.length-1];this.keys.push([].concat(h.toArray(),n[1].toArray())),this.keys.push([].concat(l.toArray(),n[2].toArray()));var c={points:n,timeInterval:o,valueInterval:a,curve:s,timeStart:Number(h.x),timeEnd:Number(l.x)};this.curveMap[h.x+"&"+l.x]=c,this.curveInfos.push(c)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,s=this.keyFrames[r+1].time;if(t>=n&&t<s){var o=this.curveInfos[r],a=o.points[0],h=o.timeInterval,l=o.valueInterval,c=(t-a.x)/h,u=0;u=1===this.keyFrames[r].tangentMode?c:o.curve.getValue(c),e=a.y+l*u;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,s=Object.keys(this.curveMap);if(r<=this.curveMap[s[0]].timeStart)return 0;for(var o=0;o<s.length;o++){var a=this.curveMap[s[o]].timeStart,h=this.curveMap[s[o]].timeEnd;if(r>=Number(h)&&(n+=i*this.getCurveIntegrateValue(s[o],Number(h))),r>=Number(a)&&r<Number(h)){n+=i*this.getCurveIntegrateValue(s[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,o=0,a=(e-r.x)/20,h=0;h<=20;h++){var l=h*a/n,c=r.y+s*i.curve.getValue(l);o+=0===h||20===h?c:h%2==1?4*c:2*c}return o*=a/3},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(ja);function fh(t,e){var i=new xe(t.time,t.value),r=new xe,n=new xe,s=new xe,o=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,a=2===t.tangentMode,h=(o?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+h,r.y=t.value+h*(a?0:t.outSlope);var l=(o?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-l,n.y=e.value-l*(a?0:e.inSlope),s.x=e.time,s.y=a?t.value:e.value,Be(n),Be(s);var c,u,d=s.x-i.x,f=s.y-i.y,p=Ea((r.x-i.x)/d,5),m=Ea((n.x-i.x)/d,5);Ta(f,0)?c=u=NaN:(c=Ea((r.y-i.y)/f,5),u=Ea((n.y-i.y)/f,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,s),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,s),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,s),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,s),m=1);var g,v=("bez_"+p+"_"+c+"_"+m+"_"+u).replace(/\./g,"p");return Ca[v]?g=Ca[v]:(g=Ta(f,0)?new Ba:o?new Ba(p,c,m,u):new Ba(c,u),Ca[v]=g),{points:[i,r,n,s],timeInterval:d,valueInterval:f,curve:g}}var ph,mh=((ph={})[ji.RANDOM]=function(t){return Qt(t[0],Array)?new Ya(t):new Xa(t)},ph[ji.CONSTANT]=function(t){return new Ha(t)},ph[ji.CONSTANT_VEC2]=function(t){return new Ha(t)},ph[ji.CONSTANT_VEC3]=function(t){return new Ha(t)},ph[ji.CONSTANT_VEC4]=function(t){return new Ha(t)},ph[ji.RGBA_COLOR]=function(t){return new Ha(t)},ph[ji.COLORS]=function(t){return new Wa(t.map(function(t){return Te(t,!1)}))},ph[ji.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new qa([t[0][1],t[1][1]]):new Za(t)},ph[ji.GRADIENT_COLOR]=function(t){return new Ka(t)},ph[ji.LINEAR_PATH]=function(t){return new Ja(t)},ph[ji.BEZIER_CURVE]=function(t){return 1===t.length?new Ha(t[0][1][1]):new dh(t)},ph[ji.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Ha(nh(be,[].concat(t[1][0]))):new $a(t)},ph[ji.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Ha(nh(kn,[].concat(t[1][0]))):new Qa(t)},ph[ji.COLOR_CURVE]=function(t){return new vh(t)},ph[ji.VECTOR4_CURVE]=function(t){return new lh(t)},ph[ji.VECTOR2_CURVE]=function(t){return new uh(t)},ph[27]=function(t){return new ch(t)},ph);function gh(t){if(!t||!isNaN(+t))return new Ha(t||0);if(Qt(t,ja))return t;if(qe(mh[t[0]]))return mh[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+qo+".")}var vh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new we,e}Ui(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=gh(t[0]),this.gCurve=gh(t[1]),this.bCurve=gh(t[2]),this.aCurve=gh(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(ja),yh=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},ks(t,null,[{key:"shared",get:function(){return xh.x=0,xh.y=0,xh}}]),t}(),xh=new yh;function bh(t,e,i,r,n,s,o,a){var h,l;o?(h=r,l=-i):(h=-r,l=i);var c=t-i*n+h,u=e-r*n+l,d=t+i*s+h,f=e+r*s+l;return a.push(c,u),a.push(d,f),2}function _h(t,e,i,r,n,s,o,a){var h=i-t,l=r-e,c=Math.atan2(h,l),u=Math.atan2(n-t,s-e);a&&c<u?c+=2*Math.PI:!a&&c>u&&(u+=2*Math.PI);var d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=1+(15*p*Math.sqrt(m)/Math.PI|0),v=f/g;if(d+=v,a){o.push(t,e),o.push(i,r);for(var y=1,x=d;y<g;y++,x+=v)o.push(t,e),o.push(t+Math.sin(x)*m,e+Math.cos(x)*m);o.push(t,e),o.push(n,s)}else{o.push(i,r),o.push(t,e);for(var b=1,_=d;b<g;b++,_+=v)o.push(t+Math.sin(_)*m,e+Math.cos(_)*m),o.push(t,e);o.push(n,s),o.push(t,e)}return 2*g}function wh(t,e,i,r,n,s,o,a,h){var l=1e-4;if(0!==t.length){var c=e,u=c.alignment;if(.5!==e.alignment){var d=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],s=t[e-1];r<e;r+=2){var o=t[r],a=t[r+1];i+=(o-n)*(a+s),n=o,s=a}return i<0?-1:1}(t);i&&(d*=-1),u=(u-.5)*d+.5}var f=new yh(t[0],t[1]),p=new yh(t[t.length-2],t[t.length-1]),m=r,g=Math.abs(f.x-p.x)<l&&Math.abs(f.y-p.y)<l;if(m){t=t.slice(),g&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var v=.5*(f.x+p.x),y=.5*(p.y+f.y);t.unshift(v,y),t.push(v,y)}var x=n,b=t.length/2,_=t.length,w=x.length/2,T=c.width/2,E=T*T,S=c.miterLimit*c.miterLimit,I=t[0],A=t[1],C=t[2],P=t[3],M=0,R=0,O=-(A-P),D=I-C,k=0,L=0,F=Math.sqrt(O*O+D*D)+me;O/=F,D/=F,O*=T,D*=T;var N=2*(1-u),B=2*u;m||(c.cap===Rr.Round?_+=_h(I-O*(N-B)*.5,A-D*(N-B)*.5,I-O*N,A-D*N,I+O*B,A+D*B,x,!0)+2:c.cap===Rr.Square&&(_+=bh(I,A,O,D,N,B,!0,x))),x.push(I-O*N,A-D*N),x.push(I+O*B,A+D*B);for(var z=1;z<b-1;++z){I=t[2*(z-1)],A=t[2*(z-1)+1],C=t[2*z],P=t[2*z+1],M=t[2*(z+1)],R=t[2*(z+1)+1],O=-(A-P),D=I-C,O/=F=Math.sqrt(O*O+D*D)+me,D/=F,O*=T,D*=T,k=-(P-R),L=C-M,k/=F=Math.sqrt(k*k+L*L)+me,L/=F,k*=T,L*=T;var U=C-I,V=A-P,G=C-M,j=R-P,H=U*G+V*j,W=V*G-j*U,X=W<0;if(Math.abs(W)<.001*Math.abs(H))x.push(C-O*N,P-D*N),x.push(C+O*B,P+D*B),H>=0&&(c.join===Dr.Round?_+=_h(C,P,C-O*N,P-D*N,C-k*N,P-L*N,x,!1)+4:_+=2,x.push(C-k*B,P-L*B),x.push(C+k*N,P+L*N));else{var Y=(-O+I)*(-D+P)-(-O+C)*(-D+A),q=(-k+M)*(-L+P)-(-k+C)*(-L+R),K=(U*q-G*Y)/W,Z=(j*Y-V*q)/W,J=(K-C)*(K-C)+(Z-P)*(Z-P),$=C+(K-C)*N,Q=P+(Z-P)*N,tt=C-(K-C)*B,et=P-(Z-P)*B,it=X?N:B;J<=Math.min(U*U+V*V,G*G+j*j)+it*it*E?c.join===Dr.Bevel||J/E>S?(X?(x.push($,Q),x.push(C+O*B,P+D*B),x.push($,Q),x.push(C+k*B,P+L*B)):(x.push(C-O*N,P-D*N),x.push(tt,et),x.push(C-k*N,P-L*N),x.push(tt,et)),_+=2):c.join===Dr.Round?X?(x.push($,Q),x.push(C+O*B,P+D*B),_+=_h(C,P,C+O*B,P+D*B,C+k*B,P+L*B,x,!0)+4,x.push($,Q),x.push(C+k*B,P+L*B)):(x.push(C-O*N,P-D*N),x.push(tt,et),_+=_h(C,P,C-O*N,P-D*N,C-k*N,P-L*N,x,!1)+4,x.push(C-k*N,P-L*N),x.push(tt,et)):(x.push($,Q),x.push(tt,et)):(x.push(C-O*N,P-D*N),x.push(C+O*B,P+D*B),c.join===Dr.Round?_+=X?_h(C,P,C+O*B,P+D*B,C+k*B,P+L*B,x,!0)+2:_h(C,P,C-O*N,P-D*N,C-k*N,P-L*N,x,!1)+2:c.join===Dr.Miter&&J/E<=S&&(X?(x.push(tt,et),x.push(tt,et)):(x.push($,Q),x.push($,Q)),_+=2),x.push(C-k*N,P-L*N),x.push(C+k*B,P+L*B),_+=2)}}I=t[2*(b-2)],A=t[2*(b-2)+1],C=t[2*(b-1)],O=-(A-(P=t[2*(b-1)+1])),D=I-C,O/=F=Math.sqrt(O*O+D*D)+me,D/=F,O*=T,D*=T,x.push(C-O*N,P-D*N),x.push(C+O*B,P+D*B),m||(c.cap===Rr.Round?_+=_h(C-O*(N-B)*.5,P-D*(N-B)*.5,C-O*N,P-D*N,C+O*B,P+D*B,x,!1)+2:c.cap===Rr.Square&&(_+=bh(C,P,O,D,N,B,!1,x)));for(var rt=w;rt<_+w-2;++rt)I=x[2*rt],A=x[2*rt+1],C=x[2*(rt+1)],P=x[2*(rt+1)+1],M=x[2*(rt+2)],R=x[2*(rt+2)+1],Math.abs(I*(P-R)+C*(R-A)+M*(A-P))<1e-8||a.push(rt,rt+1,rt+2)}}var Th=function(){},Eh="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Sh={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function s(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function o(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function h(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function l(t){return r(t.b.a,t.a)}function c(t){return r(t.a,t.b.a)}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function d(t){var e=v(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function f(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,w(e.a,t.a)),e.d!==t.d&&(i=!0,T(e.d,t.d)),y(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,T(t.d,t.b.d)),t.c===t?w(t.a,null):(t.b.d.a=Q(t),t.a.c=t.c,y(t,Q(t)),i||b(t,t.d)),e.c===e?(w(e.a,null),T(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,y(e,Q(e))),_(t)}function m(t){var e=v(t),i=e.b;return y(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,y(t.b,Q(t.b)),y(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function g(t,e){var i=!1,r=v(t),n=r.b;return e.d!==t.d&&(i=!0,T(e.d,t.d)),y(r,t.e),y(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function v(t){var e=new $,i=new $,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function y(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new J(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do{i.d=r,i=i.e}while(i!==t)}function _(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function w(t,e){var i=t.c,r=i;do{r.a=e,r=r.c}while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function T(t,e){var i=t.a,r=i;do{r.d=e,r=r.e}while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function E(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var S=4e150;function I(t,e){t.f+=e.f,t.b.f+=e.b.f}function A(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=s(i.b.a,e.a,i.a):0<=s(e.b.a,i.a,e.a):0>=s(i.b.a,t,i.a):i.b.a===t?0<=s(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function C(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function P(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function M(t){var e=t.a.a;do{t=ft(t)}while(t.a.a===e);return t.c&&(P(t,e=g(dt(t).a.b,t.a.e)),t=ft(t)),t}function R(t,e,i){var r=new ut;return r.a=i,r.e=W(t.f,e.e,r),i.i=r}function O(t,e){switch(t.s){case 100130:return!!(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function D(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,C(t)}function k(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=dt(t),n=r.a;if(n.a!==e.a){if(!r.c){D(t);break}P(r,n=g(e.c.b,n.b))}e.c!==n&&(f(Q(n),n),f(e,n)),D(t),e=r.a,t=r}return e}function L(t,e,i,r,n,s){var o=!0;do{R(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=dt(e).a.b.c);(i=(r=dt(e)).a.b).a===n.a;)i.c!==n&&(f(Q(i),i),f(Q(n),i)),r.f=e.f-i.f,r.d=O(t,r.f),e.b=!0,!o&&z(t,e)&&(I(i,n),C(e),p(n)),o=!1,e=r,n=i;e.b=!0,s&&V(t,e)}function F(t,e,i,r,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,i,r,t.c)||null,null===e.d&&(n?t.n||(Z(t,100156),t.n=!0):e.d=i[0])}function N(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,F(t,e.a,r,[.5,.5,0,0],!1),f(e,i)}function B(t,e,i,r,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),a=n+1;r[n]=.5*o/(s+o),r[a]=.5*s/(s+o),t.g[0]+=r[n]*e.g[0]+r[a]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[a]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[a]*i.g[2]}function z(t,e){var n=dt(e),o=e.a,a=n.a;if(r(o.a,a.a)){if(0<s(a.b.a,o.a,a.a))return!1;if(i(o.a,a.a)){if(o.a!==a.a){n=t.e;var h=o.a.h;if(0<=h){var l=(n=n.b).d,c=n.e,u=n.c,d=u[h];l[d]=l[n.a],u[l[d]]=d,d<=--n.a&&(1>=d||r(c[l[d>>1]],c[l[d]])?lt(n,d):ct(n,d)),c[h]=null,u[h]=n.b,n.b=h}else for(n.c[-(h+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;N(t,Q(a),o)}}else m(a.b),f(o,Q(a)),e.b=n.b=!0}else{if(0>s(o.b.a,a.a,o.a))return!1;ft(e).b=e.b=!0,m(o.b),f(Q(a),o)}return!0}function U(t,e){var l=dt(e),c=e.a,d=l.a,p=c.a,g=d.a,v=c.b.a,y=d.b.a,x=new et;if(s(v,t.a,p),s(y,t.a,g),p===g||Math.min(p.a,v.a)>Math.max(g.a,y.a))return!1;if(r(p,g)){if(0<s(y,p,g))return!1}else if(0>s(v,g,p))return!1;var b,_,w=v,T=p,E=y,S=g;if(r(w,T)||(b=w,w=T,T=b),r(E,S)||(b=E,E=S,S=b),r(w,E)||(b=w,w=E,E=b,b=T,T=S,S=b),r(E,T)?r(T,S)?(0>(b=n(w,E,T))+(_=n(E,T,S))&&(b=-b,_=-_),x.b=u(b,E.b,_,T.b)):(0>(b=s(w,E,T))+(_=-s(w,S,T))&&(b=-b,_=-_),x.b=u(b,E.b,_,S.b)):x.b=(E.b+T.b)/2,o(w,T)||(b=w,w=T,T=b),o(E,S)||(b=E,E=S,S=b),o(w,E)||(b=w,w=E,E=b,b=T,T=S,S=b),o(E,T)?o(T,S)?(0>(b=a(w,E,T))+(_=a(E,T,S))&&(b=-b,_=-_),x.a=u(b,E.a,_,T.a)):(0>(b=h(w,E,T))+(_=-h(w,S,T))&&(b=-b,_=-_),x.a=u(b,E.a,_,S.a)):x.a=(E.a+T.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),w=r(p,g)?p:g,r(w,x)&&(x.b=w.b,x.a=w.a),i(x,p)||i(x,g))return z(t,e),!1;if(!i(v,t.a)&&0<=s(v,t.a,x)||!i(y,t.a)&&0>=s(y,t.a,x)){if(y===t.a)return m(c.b),f(d.b,c),c=dt(e=M(e)).a,k(t,dt(e),l),L(t,e,Q(c),c,c,!0),!0;if(v===t.a){m(d.b),f(c.e,Q(d)),g=(p=l=e).a.b.a;do{p=ft(p)}while(p.a.b.a===g);return p=dt(e=p).a.b.c,l.a=Q(d),L(t,e,(d=k(t,l,null)).c,c.b.c,p,!0),!0}return 0<=s(v,t.a,x)&&(ft(e).b=e.b=!0,m(c.b),c.a.b=t.a.b,c.a.a=t.a.a),0>=s(y,t.a,x)&&(e.b=l.b=!0,m(d.b),d.a.b=t.a.b,d.a.a=t.a.a),!1}return m(c.b),m(d.b),f(Q(d),c),c.a.b=x.b,c.a.a=x.a,c.a.h=rt(t.e,c.a),c=c.a,d=[0,0,0,0],x=[p.d,v.d,g.d,y.d],c.g[0]=c.g[1]=c.g[2]=0,B(c,p,v,d,0),B(c,g,y,d,2),F(t,c,x,d,!0),ft(e).b=e.b=l.b=!0,!1}function V(t,e){for(var i=dt(e);;){for(;i.b;)e=i,i=dt(i);if(!e.b&&(i=e,null===(e=ft(e))||!e.b))break;e.b=!1;var n,o=e.a,a=i.a;if(n=o.b.a!==a.b.a)t:{var h=dt(n=e),l=n.a,c=h.a,u=void 0;if(r(l.b.a,c.b.a)){if(0>s(l.b.a,c.b.a,l.a)){n=!1;break t}ft(n).b=n.b=!0,u=m(l),f(c.b,u),u.d.c=n.d}else{if(0<s(c.b.a,l.b.a,c.a)){n=!1;break t}n.b=h.b=!0,u=m(c),f(l.e,c.b),u.b.d.c=n.d}n=!0}if(n&&(i.c?(C(i),p(a),a=(i=dt(e)).a):e.c&&(C(e),p(o),o=(e=ft(i)).a)),o.a!==a.a)if(o.b.a===a.b.a||e.c||i.c||o.b.a!==t.a&&a.b.a!==t.a)z(t,e);else if(U(t,e))break;o.a===a.a&&o.b.a===a.b.a&&(I(a,o),C(e),p(o),e=ft(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var o=e;(l=new ut).a=o.c.b;var a=(u=n.f).a;do{a=a.a}while(null!==a.b&&!u.c(u.b,l,a.b));var h=dt(u=a.b),l=u.a;a=h.a;if(0===s(l.b.a,o,l.a))i((l=u.a).a,o)||i(l.b.a,o)||(m(l.b),u.c&&(p(l.c),u.c=!1),f(o.c,l),G(n,o));else{var c=r(a.b.a,l.b.a)?u:h;h=void 0;u.d||c.c?(h=c===u?g(o.c.b,l.e):g(a.b.c.b,o.c).b,c.c?P(c,h):(l=n,(u=R(n,u,h)).f=ft(u).f+u.a.f,u.d=O(l,u.f)),G(n,o)):L(n,u,o.c,o.c,null,!0)}return}if(u=(l=dt(n=M(n.i))).a,(l=k(t,l,null)).c===u){l=(u=l).c,a=dt(n),h=n.a,c=a.a;var u,d=!1;h.b.a!==c.b.a&&U(t,n),i(h.a,t.a)&&(f(Q(l),h),l=dt(n=M(n)).a,k(t,dt(n),a),d=!0),i(c.a,t.a)&&(f(u,Q(c)),u=k(t,a,null),d=!0),d?L(t,n,u.c,l,l,!0):(o=r(c.a,h.a)?Q(c):h,L(t,n,o=g(u.c.b,o),o.c,o.c,!1),o.b.i.c=!0,V(t,n))}else L(t,n,l.c,u,u,!0)}function j(t,e){var i=new ut,r=d(t.b);r.a.b=S,r.a.a=e,r.b.a.b=-S,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=W(r=t.f,r.a,i),i.e=r}function H(t){this.a=new X,this.b=t,this.c=A}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new X(i,e.a,e),e.a.c=t,e.a=t}function X(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=q,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var q=0;function K(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case q:Z(t,100151),t.u(null);break;case 1:Z(t,100152),t.t()}else switch(t.d){case 2:Z(t,100154),t.v();break;case 1:Z(t,100153),t.w()}}function Z(t,e){t.p&&t.p(e,t.c)}function J(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function $(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function Q(t){return t.b.e}function tt(){this.c=new et,this.a=new J,this.b=new $,this.d=new $,this.b.b=this.d,this.d.b=this.b}function et(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=ot(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ct(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ht(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(at(t.b),e))return ht(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function st(){this.d=ot([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function ot(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function at(t){return t.e[t.d[1]]}function ht(t){var e=t.d,i=t.e,r=t.c,n=e[1],s=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&<(t,1)),s}function lt(t,e){for(var i=t.d,n=t.e,s=t.c,o=e,a=i[o];;){var h=o<<1;h<t.a&&r(n[i[h+1]],n[i[h]])&&(h+=1);var l=i[h];if(h>t.a||r(n[a],n[l])){i[o]=a,s[a]=o;break}i[o]=l,s[l]=o,o=h}}function ct(t,e){for(var i=t.d,n=t.e,s=t.c,o=e,a=i[o];;){var h=o>>1,l=i[h];if(0===h||r(n[l],n[a])){i[o]=a,s[a]=o;break}i[o]=l,s[l]=o,o=h}}function ut(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function dt(t){return t.e.c.b}function ft(t){return t.e.a.b}(e=Y.prototype).x=function(){K(this,q)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void Z(this,100900)}Z(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Z(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Z(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];K(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,i=!0),1e150<s&&(s=1e150,i=!0),r[n]=s}i&&Z(this,100155),null===(i=this.q)?f(i=d(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){K(this,q),this.d=1,this.b=new tt,this.c=t},e.t=function(){K(this,1),this.d=2,this.q=null},e.v=function(){K(this,2),this.d=1},e.w=function(){K(this,1),this.d=q;var t=!1,e=[u=this.j[0],n=this.j[1],a=this.j[2]];if(0===u&&0===n&&0===a){for(var n=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],a=[],h=[],u=(t=this.b.c).e;u!==t;u=u.e)for(var d=0;3>d;++d){var f=u.g[d];f<o[d]&&(o[d]=f,h[d]=u),f>n[d]&&(n[d]=f,a[d]=u)}if(u=0,n[1]-o[1]>n[0]-o[0]&&(u=1),n[2]-o[2]>n[u]-o[u]&&(u=2),o[u]>=n[u])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,o=h[u],a=a[u],h=[0,0,0],o=[o.g[0]-a.g[0],o.g[1]-a.g[1],o.g[2]-a.g[2]],d=[0,0,0],u=t.e;u!==t;u=u.e)d[0]=u.g[0]-a.g[0],d[1]=u.g[1]-a.g[1],d[2]=u.g[2]-a.g[2],h[0]=o[1]*d[2]-o[2]*d[1],h[1]=o[2]*d[0]-o[0]*d[2],h[2]=o[0]*d[1]-o[1]*d[0],(f=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>n&&(n=f,e[0]=h[0],e[1]=h[1],e[2]=h[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[E(o)]=1)}t=!0}for(h=E(e),u=this.b.c,n=(h+1)%3,a=(h+2)%3,h=0<e[h]?1:-1,e=u.e;e!==u;e=e.e)e.b=e.g[n],e.a=h*e.g[a];if(t){for(e=0,u=(t=this.b.a).b;u!==t;u=u.b)if(!(0>=(n=u.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==u.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,u=(e=this.b.b).h;u!==e;u=t)t=u.h,n=u.e,i(u.a,u.b.a)&&u.e.e!==u&&(N(this,n,u),p(u),n=(u=n).e),n.e===u&&(n!==u&&(n!==t&&n!==t.b||(t=t.h),p(n)),u!==t&&u!==t.b||(t=t.h),p(u));for(this.e=e=new it,u=(t=this.b.c).e;u!==t;u=u.e)u.h=rt(e,u);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)lt(t,e);t.h=!0}(t.b)}(e),this.f=new H(this),j(this,-S),j(this,S);null!==(e=nt(this.e));){for(;;){t:if(u=this.e,0===u.a)t=at(u.b);else if(t=u.c[u.d[u.a-1]],0!==u.b.a&&(u=at(u.b),r(u,t))){t=u;break t}if(null===t||!i(t,e))break;t=nt(this.e),N(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,C(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,u=(e=this.b).a.b;u!==e.a;u=t)t=u.b,(u=u.a).e.e===u&&(I(u.c,u),p(u));if(!this.n){if(e=this.b,this.m)for(u=e.b.h;u!==e.b;u=t)t=u.h,u.b.d.c!==u.d.c?u.f=u.d.c?1:-1:p(u);else for(u=e.a.b;u!==e.a;u=t)if(t=u.b,u.c){for(u=u.a;r(u.b.a,u.a);u=u.c.b);for(;r(u.a,u.b.a);u=u.e);for(n=u.c.b,a=void 0;u.e!==n;)if(r(u.b.a,n.a)){for(;n.e!==u&&(l(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(a=g(n.e,n)).b;n=n.c.b}else{for(;n.e!==u&&(c(u.c.b)||0<=s(u.b.a,u.a,u.c.b.a));)u=(a=g(u,u.c.b)).b;u=u.e}for(;n.e.e!==u;)n=(a=g(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),u=t.a;do{this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,u=!1,n=-1,a=e.a.d;a!==e.a;a=a.d)if(a.c){u||(this.h&&this.h(4,this.c),u=!0),h=a.a;do{t&&(n!==(o=h.b.d.c?0:1)&&(n=o,this.l&&this.l(!!n,this.c))),this.k&&this.k(h.a.d,this.c),h=h.e}while(h!==a.a)}u&&this.i&&this.i(this.c)}if(this.r){for(u=(e=this.b).a.b;u!==e.a;u=t)if(t=u.b,!u.c){a=(n=u.a).e,h=void 0;do{a=(h=a).e,h.d=null,null===h.b.d&&(h.c===h?w(h.a,null):(h.a.c=h.c,y(h,Q(h))),(o=h.b).c===o?w(o.a,null):(o.a.c=o.c,y(o,Q(o))),_(h))}while(h!==n);n=u.d,(u=u.b).d=n,n.b=u}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Eh.libtess={GluTesselator:Y,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=Eh.libtess}(Sh);var Ih,Ah=((Ih=new Sh.exports.GluTesselator).gluTessCallback(Sh.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),Ih.gluTessCallback(Sh.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==Sh.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),Ih.gluTessCallback(Sh.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),Ih.gluTessCallback(Sh.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),Ih.gluTessCallback(Sh.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),Ih);function Ch(t){Ah.gluTessNormal(0,0,1);var e=[];Ah.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){Ah.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var s=[r[n],r[n+1],0];Ah.gluTessVertex(s,s)}Ah.gluTessEndContour()}return Ah.gluTessEndPolygon(),e}var Ph=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var s=Array.isArray(i[0])?i[0]:i;if("number"!=typeof s[0]){for(var o=[],a=0,h=s.length;a<h;a++)o.push(s[a].x,s[a].y);s=o}return n.points=s,n.closePath=!0,n}Ui(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var o=this.points[2*n],a=this.points[2*n+1],h=this.points[2*s],l=this.points[2*s+1];a>e!=l>e&&t<(e-a)/(l-a)*(h-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var s=Ch([t]),o=e.length/2;0===s.length&&this.getLineEndPointsTriangle(t,s);for(var a=0;a<s.length;a++)e[2*i+a]=s[a];for(var h=s.length/2,l=0;l<h;l++)r[n+l]=o+l},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var i=t[2]-t[0],r=t[3]-t[1],n=t[0],s=t[1],o=t[0],a=t[1];if(Math.abs(i)>=Math.abs(r))for(var h=0;h<t.length;h+=2){var l=t[h],c=t[h+1];l<n&&(n=l,s=c),l>o&&(o=l,a=c)}else for(var u=0;u<t.length;u+=2){var d=t[u],f=t[u+1];f<s&&(n=d,s=f),f>a&&(o=d,a=f)}e.push(n,s,o,a,o,a)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},ks(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Th),Mh=1.1920929e-7;function Rh(t,e,i,r,n,s,o,a,h,l){var c=(1-Math.min(.99,Math.max(0,null!=l?l:.5)))/5;return function(t,e,i,r,n,s,o,a,h,l){Oh(t,e,i,r,n,s,o,a,h,l,0),h.push(o,a)}(e,i,r,n,s,o,a,h,t,c*=c),t}function Oh(t,e,i,r,n,s,o,a,h,l,c){if(!(c>8)){var u=(t+i)/2,d=(e+r)/2,f=(i+n)/2,p=(r+s)/2,m=(n+o)/2,g=(s+a)/2,v=(u+f)/2,y=(d+p)/2,x=(f+m)/2,b=(p+g)/2,_=(v+x)/2,w=(y+b)/2;if(c>0){var T=o-t,E=a-e,S=Math.abs((i-o)*E-(r-a)*T),I=Math.abs((n-o)*E-(s-a)*T);if(S>Mh&&I>Mh){if((S+I)*(S+I)<=l*(T*T+E*E))return void h.push(_,w)}else if(S>Mh){if(S*S<=l*(T*T+E*E))return void h.push(_,w)}else if(I>Mh){if(I*I<=l*(T*T+E*E))return void h.push(_,w)}else if((T=_-(t+o)/2)*T+(E=w-(e+a)/2)*E<=l)return void h.push(_,w)}Oh(t,e,u,d,v,y,_,w,h,l,c+1),Oh(_,w,x,b,m,g,o,a,h,l,c+1)}}var Dh,kh,Lh=function(t){function e(e,i,r,n){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=i,s.halfWidth=r,s.halfHeight=n,s}Ui(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return(i*=i)+(r*=r)<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var s=i/2,o=r-s,a=n-s,h=r+s,l=n+s,c=t-this.x,u=e-this.y;return c*c/(o*o)+u*u/(a*a)>1&&c*c/(h*h)+u*u/(l*l)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(r+n)),o=8*s+0+0;if(0===o)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var a=0,h=4*s+0+2,l=h,c=o,u=0+r,d=0,f=e+u,p=e-u,m=i+d;t[a++]=f,t[a++]=m,t[--h]=m,t[--h]=p;for(var g=1;g<s;g++){var v=Math.PI/2*(g/s),y=0+Math.cos(v)*r,x=0+Math.sin(v)*n,b=e+y,_=e-y,w=i+x,T=i-x;t[a++]=b,t[a++]=w,t[--h]=w,t[--h]=_,t[l++]=_,t[l++]=T,t[--c]=T,t[--c]=b}f=e+(u=0),p=e-u,m=i+(d=0+n);var E=i-d;return t[a++]=f,t[a++]=m,t[--c]=E,t[--c]=f,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var h=i;e[2*h]=s,e[2*h+1]=o;for(var l=h++,c=0;c<t.length;c+=2)e[2*h]=t[c],e[2*h+1]=t[c+1],c>0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},e}(Th);(kh=Dh||(Dh={}))[kh.Star=0]="Star",kh[kh.Polygon=1]="Polygon";var Fh,Nh,Bh=function(t){function e(e,i,r,n,s,o){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),(a=t.call(this)||this).pointCount=e,a.outerRadius=i,a.innerRadius=r,a.outerRoundness=n,a.innerRoundness=s,a.starType=o,a.v=[],a.in=[],a.out=[],a}Ui(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)Rh(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;Rh(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var s=Ch([t]),o=e.length/2,a=0;a<s.length;a++)e[2*i+a]=s[a];for(var h=s.length/2,l=0;l<h;l++)r[n+l]=o+l},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,o=!0,a=this.outerRadius,h=this.innerRadius,l=this.outerRoundness/100,c=this.innerRoundness/100,u=2*Math.PI*a/(2*n),d=2*Math.PI*h/(2*n),f=-Math.PI/2;for(t=0;t<n;t++){i=o?l:c,r=o?u:d;var p=(e=o?a:h)*Math.cos(f),m=e*Math.sin(f),g=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),v=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),y=2*t;this.v[y]=p,this.v[y+1]=m,this.in[y]=p+g*r*i*1,this.in[y+1]=m+v*r*i*1,this.out[y]=p-g*r*i*1,this.out[y+1]=m-v*r*i*1,o=!o,f+=1*s}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*r/(4*e),o=.5*-Math.PI;for(t=0;t<e;t++){var a=r*Math.cos(o),h=r*Math.sin(o),l=0===a&&0===h?0:h/Math.sqrt(a*a+h*h),c=0===a&&0===h?0:-a/Math.sqrt(a*a+h*h),u=2*t;this.v[u]=a,this.v[u+1]=h,this.in[u]=a+l*s*n*1,this.in[u+1]=h+c*s*n*1,this.out[u]=a-l*s*n*1,this.out[u+1]=h-c*s*n*1,o+=1*i}},e}(Th),zh=function(t){function e(e,i,r,n,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=s,o}Ui(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,s=this.y+r,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),a=i-o,h=r-e;if(o>=0&&e>=0&&a>=0&&h>=0){var l=5*Math.ceil(2.3*Math.sqrt(o+e)),c=8*l+(a?4:0)+(h?4:0);if(0!==c){if(0===l)return t[0]=t[6]=n+a,t[1]=t[3]=s+h,t[2]=t[4]=n-a,void(t[5]=t[7]=s-h);var u=0,d=4*l+(a?2:0)+2,f=d,p=c,m=a+o,g=h,v=n+m,y=n-m,x=s+g;if(t[u++]=v,t[u++]=x,t[--d]=x,t[--d]=y,h){var b=s-g;t[f++]=y,t[f++]=b,t[--p]=b,t[--p]=v}for(var _=1;_<l;_++){var w=Math.PI/2*(_/l),T=a+Math.cos(w)*o,E=h+Math.sin(w)*e,S=n+T,I=n-T,A=s+E,C=s-E;t[u++]=S,t[u++]=A,t[--d]=A,t[--d]=I,t[f++]=I,t[f++]=C,t[--p]=C,t[--p]=S}v=n+(m=a),y=n-m,x=s+(g=h+e);var P=s-g;t[u++]=v,t[u++]=x,t[--p]=P,t[--p]=v,a&&(t[u++]=y,t[u++]=x,t[--p]=P,t[--p]=y)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var h=i;e[2*h]=s,e[2*h+1]=o;for(var l=h++,c=0;c<t.length;c+=2)e[2*h]=t[c],e[2*h+1]=t[c+1],c>0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},e}(Th),Uh=function(t){function e(e,i,r,n,s,o){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),(a=t.call(this)||this).x=e,a.y=i,a.x2=r,a.y2=n,a.x3=s,a.y3=o,a}Ui(e,t);var i=e.prototype;return i.contains=function(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),r=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=r<0&&0!==i&&0!==r)return!1;var n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===n||n<0==i+r<=0},i.clone=function(){return new e(this.x,this.y,this.x2,this.y2,this.x3,this.y3)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getBounds=function(t){t=t||new zh;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),r=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=r,t.width=i-e,t.height=n-r,t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){t[0]=this.x,t[1]=this.y,t[2]=this.x2,t[3]=this.y2,t[4]=this.x3,t[5]=this.y3},i.triangulate=function(t,e,i,r,n){var s=0;e[(i*=2)+s]=t[0],e[i+s+1]=t[1],e[i+(s+=2)]=t[2],e[i+s+1]=t[3],e[i+(s+=2)]=t[4],e[i+s+1]=t[5];var o=i/2;r[n++]=o,r[n++]=o+1,r[n++]=o+2},e}(Th),Vh=function(t){function e(e,i,r){var n;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),(n=t.call(this)||this).x=e,n.y=i,n.radius=r,n}Ui(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.radius)},i.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},i.strokeContains=function(t,e,i,r){if(void 0===r&&(r=.5),0===this.radius)return!1;var n=this.x-t,s=this.y-e,o=this.radius,a=(1-r)*i,h=Math.sqrt(n*n+s*s);return h<=o+a&&h>o-(i-a)},i.getBounds=function(t){return t||(t=new zh),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e=this.x,i=this.y,r=this.radius,n=this.radius;if(!(r<=0)){var s=Math.ceil(2.3*Math.sqrt(r+n)),o=8*s+0+0;if(0!==o){if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,void(t[5]=t[7]=i-0);var a=0,h=4*s+0+2,l=h,c=o,u=0+r,d=0,f=e+u,p=e-u,m=i+d;t[a++]=f,t[a++]=m,t[--h]=m,t[--h]=p;for(var g=1;g<s;g++){var v=Math.PI/2*(g/s),y=0+Math.cos(v)*r,x=0+Math.sin(v)*n,b=e+y,_=e-y,w=i+x,T=i-x;t[a++]=b,t[a++]=w,t[--h]=w,t[--h]=_,t[l++]=_,t[l++]=T,t[--c]=T,t[--c]=b}f=e+(u=0),p=e-u,m=i+(d=0+n);var E=i-d;t[a++]=f,t[a++]=m,t[--c]=E,t[--c]=f}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var h=i;e[2*h]=s,e[2*h+1]=o;for(var l=h++,c=0;c<t.length;c+=2)e[2*h]=t[c],e[2*h+1]=t[c+1],c>0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},e}(Th),Gh=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=nn(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"lineTo":this.lineTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"circle":this.circle(n[0],n[1],n[2],n[3]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"triangle":this.triangle(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,s,o){this.ensurePoly();var a=this.currentPoly;return Rh(a.points,a.lastX,a.lastY,t,e,i,r,n,s,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.lineTo=function(t,e){this.ensurePoly();var i=this.currentPoly.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new Lh(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new Vh(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,s,o){return this.drawShape(new Bh(t,e,i,r,n,s),o),this},e.rect=function(t,e,i,r,n,s){return this.drawShape(new zh(t,e,i,r,n),s),this},e.triangle=function(t,e,i,r,n,s,o){return this.drawShape(new Uh(t,e,i,r,n,s),o),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new Ph).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new Ph,this.currentPoly.points.push(0,0))},t}(),jh=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,s,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,s,o]}),this.dirty=!0,this},e.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.circle=function(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,s){return this.instructions.push({action:"rect",data:[t,e,i,r,n,s]}),this.dirty=!0,this},e.triangle=function(t,e,i,r,n,s,o){return this.instructions.push({action:"triangle",data:[t,e,i,r,n,s,o]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,s,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,s,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},ks(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new Gh(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();(Nh=Fh||(Fh={}))[Nh.EveryUpdate=0]="EveryUpdate",Nh[Nh.Manual=1]="Manual";var Hh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).items=[],e.state=pc.Stopped,e.updateMode=0,e.playOnStart=!1,e.endBehavior=Yi.forward,e.time=0,e.lastTime=0,e.sceneBindings=[],e.timelineAsset=null,e._timelineInstance=null,e.nestedCompositions=[],e}Ui(e,t);var i=e.prototype;return i.onStart=function(){this.playOnStart&&this.play()},i.pause=function(){this.state=pc.Paused;for(var t,e=nn(this.nestedCompositions);!(t=e()).done;){t.value.pause()}},i.play=function(){this.state=pc.Playing;for(var t,e=nn(this.nestedCompositions);!(t=e()).done;){t.value.play()}},i.stop=function(){this.state=pc.Stopped,this.time=0,this.lastTime=0;for(var t,e=nn(this.nestedCompositions);!(t=e()).done;){t.value.stop()}},i.getTime=function(){return this.time},i.setTime=function(t){this.time=t},i.onUpdate=function(t){this.state===pc.Playing&&0===this.updateMode&&this.tick(t/1e3)},i.tick=function(t){if(this.timelineInstance){var e=this.time;if(Ta(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case Yi.forward:break;case Yi.freeze:e=this.item.duration;break;case Yi.restart:e%=this.item.duration;break;case Yi.destroy:return void this.item.dispose()}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},i.onEnable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!0),!1})},i.onDisable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!1),!1})},i.onDestroy=function(){this.item.getDescendants().forEach(function(t){return t.dispose()})},i.hitTest=function(t,e,i,r,n,s){var o,a=Wh(this.item,t,e,i,r,n,s);if(a&&this.item!==(null==(o=this.item.composition)?void 0:o.rootItem)){var h=this.item,l=r[r.length-1].hitPositions,c={id:h.getInstanceId(),name:h.name,position:l[l.length-1],parentId:h.parentId,hitPositions:l,behavior:Ii.NONE,item:h,composition:h.composition};r.push(c)}return a},i.setChildrenRenderOrder=function(t){if(!this.timelineInstance)return t;var i=[];this.collectChildren(this.item,i);for(var r,n=new Set,s=nn(this.timelineInstance.masterTrackInstances);!(r=s()).done;){var o=r.value;Qt(o.boundObject,da)&&n.add(o.boundObject)}for(var a=[],h=0;h<i.length;h++)n.has(i[h])&&a.push(h);for(var l,c=[],u=nn(this.timelineInstance.masterTrackInstances);!(l=u()).done;){var d=l.value;Qt(d.boundObject,da)&&c.push(d.boundObject)}for(var f=0;f<a.length&&f<c.length;f++)i[a[f]]=c[f];for(var p,m=nn(i);!(p=m()).done;){var g=p.value,v=t++;g.isManuallySetRenderOrder||g.setRendererComponentOrder(v);var y=g.getComponent(e);y&&(t=y.setChildrenRenderOrder(t))}return t},i.collectChildren=function(t,e){for(var i,r=nn(t.children);!(i=r()).done;){var n=i.value;e.push(n),da.isComposition(n)||this.collectChildren(n,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this._timelineInstance=null},ks(e,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new Bd(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var t,i=nn(this._timelineInstance.masterTrackInstances);!(t=i()).done;){var r=t.value.boundObject;if(Qt(r,da)&&da.isComposition(r)){var n=r.getComponent(e);n.updateMode=1,this.nestedCompositions.push(n)}}}return this._timelineInstance}}]),e}(Ls);function Wh(t,e,i,r,n,s,o){var a=function(){var t=d.value;if(t.isActive&&t.transform.getValid()&&!c(t)){var a=t.getHitTestParams(s);if(a){var u=!1,p=new be;if(a.type===Oo.triangle)for(var m=a.triangles,g=a.backfaceCulling,v=0;v<m.length;v++){var y=m[v];if(e.intersectTriangle(y,p,g)){u=!0,h.push(p);break}}else if(a.type===Oo.box){var x=a.center,b=a.size,_=x.clone().addScaledVector(b,.5),w=x.clone().addScaledVector(b,-.5);e.intersectBox({min:_,max:w},p)&&(u=!0,h.push(p))}else if(a.type===Oo.sphere){var T=a.center,E=a.radius;e.intersectSphere({center:T,radius:E},p)&&(u=!0,h.push(p))}else if(a.type===Oo.custom){var S=a.collect(e,new xe(i,r));S&&S.length>0&&(S.forEach(function(t){h.push(t)}),u=!0)}if(u){var I={id:t.getInstanceId(),name:t.name,position:h[h.length-1],parentId:t.parentId,hitPositions:h,behavior:a.behavior,item:t,composition:t.composition};if(n.push(I),f=!0,l(I))return{v:!0}}}}da.isComposition(t)?t.getComponent(Hh).hitTest(e,i,r,n,s,o)&&(f=!0):Wh(t,e,i,r,n,s,o)&&(f=!0)},h=[],l=(null==o?void 0:o.stop)||We,c=(null==o?void 0:o.skip)||We,u=null==o?void 0:o.maxCount;if(void 0!==u&&n.length>=u)return!1;for(var d,f=!1,p=nn(t.children);!(d=p()).done;){var m=a();if("object"===te(m))return m.v}return f}ee([cn()],Hh.prototype,"items",void 0),ee([cn()],Hh.prototype,"sceneBindings",void 0),ee([cn()],Hh.prototype,"timelineAsset",void 0),Hh=ee([ln("CompositionComponent")],Hh);var Xh=function(t){function e(e){var i;return(i=t.call(this,e)||this).getHitTestParams=function(t){var e=i.transform.getWorldMatrix();i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area}},i}Ui(e,t);var i=e.prototype;return i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++){var i=this.materials[e];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),i,t,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Sa(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.mask;i&&this.maskManager.setMaskOptions(this.engine,i)},e}(Ho);ee([cn()],Xh.prototype,"geometry",void 0);var Yh=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}Ui(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new _e;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(Xh);Yh=ee([ln(jr.EffectComponent)],Yh);var qh=new be(0,0,0),Kh=new be(0,0,0),Zh=function(){this.target=null,this.weight=1},Jh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).positionAtRest=new be(0,0,0),e.positionOffset=new be(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}Ui(e,t);var i=e.prototype;return i.onStart=function(){var t=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(t)},i.onUpdate=function(t){if(0!==this.targets.length){qh.set(0,0,0);for(var e,i=0,r=nn(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var s=n.target.transform.getWorldPosition(),o=n.weight;qh.x+=s.x*o,qh.y+=s.y*o,qh.z+=s.z*o,i+=o}}i>0&&(qh.x/=i,qh.y/=i,qh.z/=i),qh.x+=this.positionOffset.x,qh.y+=this.positionOffset.y,qh.z+=this.positionOffset.z,Kh.set(this.lerp(this.positionAtRest.x,qh.x,this.weight),this.lerp(this.positionAtRest.y,qh.y,this.weight),this.lerp(this.positionAtRest.z,qh.z,this.weight)),qh.copyFrom(this.item.transform.getWorldPosition());var a=this.constrainX?Kh.x:qh.x,h=this.constrainY?Kh.y:qh.y,l=this.constrainZ?Kh.z:qh.z;this.item.transform.setWorldPosition(a,h,l)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new Zh;i.target=t,i.weight=Math.max(0,Math.min(1,e)),this.targets.push(i)},i.removeTarget=function(t){var e=this.targets.findIndex(function(e){return e.target===t});-1!==e&&this.targets.splice(e,1)},i.clearTargets=function(){this.targets=[]},i.setPositionOffset=function(t,e,i){this.positionOffset.set(t,e,i)},i.setWeight=function(t){this.weight=Math.max(0,Math.min(1,t))},i.lerp=function(t,e,i){return t+(e-t)*i},i.fromData=function(e){t.prototype.fromData.call(this,e),this.positionAtRest.copyFrom(e.positionAtRest),this.positionOffset.copyFrom(e.positionOffset),this.weight=e.weight,this.constrainX=e.constrainX,this.constrainY=e.constrainY,this.constrainZ=e.constrainZ,this.targets=[];for(var i,r=nn(e.targets);!(i=r()).done;){var n=i.value,s=new Zh;s.target=this.engine.findObject(n.target),s.weight=n.weight,this.targets.push(s)}},e}(Ls);Jh=ee([ln("PositionConstraint")],Jh);var $h,Qh,tl,el,il=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return Ui(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(Ls);ee([cn()],il.prototype,"bloom",void 0),ee([cn()],il.prototype,"vignette",void 0),ee([cn()],il.prototype,"tonemapping",void 0),ee([cn()],il.prototype,"colorAdjustments",void 0),il=ee([ln(jr.PostProcessVolume)],il),(Qh=$h||($h={}))[Qh.Nearest=0]="Nearest",Qh[Qh.Linear=1]="Linear",(el=tl||(tl={}))[el.RGBA32=0]="RGBA32",el[el.RGBAHalf=1]="RGBAHalf";var rl,nl,sl,ol,al=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},ks(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}();(nl=rl||(rl={}))[nl.none=0]="none",nl[nl.color=1]="color",nl[nl.stencil_8_opaque=2]="stencil_8_opaque",nl[nl.depth_16_opaque=3]="depth_16_opaque",nl[nl.depth_stencil_opaque=4]="depth_stencil_opaque",nl[nl.depth_16_texture=5]="depth_16_texture",nl[nl.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",(ol=sl||(sl={}))[ol.store=0]="store",ol[ol.clear=2]="clear";var hl,ll,cl=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(Qt(i,To))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,s=i.wrapS,o=i.minFilter,a=i.magFilter,h=i.internalFormat,l=i.format,c=void 0===l?Ys.RGBA:l,u=i.type,d=void 0===u?Ys.UNSIGNED_BYTE:u;this.externalTexture=!1,this.textureOptions={size:r,format:c,type:d,internalFormat:h||c,wrapT:n,wrapS:s,minFilter:o,magFilter:a,name:e.name},this.texture=To.create(t,Cn({},this.textureOptions,{sourceType:Hs.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},ks(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),t}();(ll=hl||(hl={}))[ll.force=0]="force",ll[ll.keep=1]="keep",ll[ll.keepExternal=2]="keepExternal",ll[ll.destroy=0]="destroy";var ul,dl,fl,pl,ml=1,gl=function(){function t(t){this.priority=0,this.name="RenderPass"+ml++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var e=t.prototype;return e.addMesh=function(t){var e,i,r;e=this.meshes,i=t,void 0===r&&(r=2),e.includes(i)||(e.push(i),1===e.length||1!==r&&Fe(e,e.length-1,r))},e.removeMesh=function(t){ce(this.meshes,t)},e.configure=function(t){},e.execute=function(t){},e.onCameraCleanup=function(t){},e.getViewport=function(){var t,e=null==(t=this.framebuffer)?void 0:t.viewport;if(e)return e;var i=this.renderer;return i?[0,0,i.getWidth(),i.getHeight()]:[0,0,0,0]},e.dispose=function(t){if(!this.disposed){var e=(null==t?void 0:t.meshes)||void 0;e!==Ge.keep&&this.meshes.forEach(function(t){t.dispose(e)}),this.meshes.length=0,this.disposed=!0}},ks(t,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),t}(),vl=function(t){function e(e){var i;return(i=t.call(this,e)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}Ui(e,t);var i=e.prototype;return i.setup=function(t){this.useRenderTarget=t},i.configure=function(t){this.useRenderTarget&&(this.framebuffer=t.getTemporaryRT("DrawObjectPass",t.getWidth(),t.getHeight(),16,$h.Linear,tl.RGBAHalf),t.setFramebuffer(this.framebuffer))},i.execute=function(t){this.useRenderTarget&&t.clear({colorAction:Gs.clear,depthAction:Gs.clear,stencilAction:Gs.clear}),this.meshes.sort(function(t,e){return t.priority-e.priority}),t.renderMeshes(this.meshes)},i.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},e}(gl);(dl=ul||(ul={}))[dl.noShader=0]="noShader",dl[dl.success=1]="success",dl[dl.fail=2]="fail",dl[dl.compiling=3]="compiling",(pl=fl||(fl={})).GLSL1="100",pl.GLSL3="300 es";var yl,xl=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return Ui(e,t),e}(dn),bl=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=nn(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var s=this.engine.getShaderLibrary().createShader(this.shaderData,e);return s.shader=this,s},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(dn);bl=ee([ln(jr.Shader)],bl);var _l=((yl={})[Ys.FLOAT]=Float32Array.BYTES_PER_ELEMENT,yl[Ys.INT]=Int32Array.BYTES_PER_ELEMENT,yl[Ys.SHORT]=Int16Array.BYTES_PER_ELEMENT,yl[Ys.BYTE]=Int8Array.BYTES_PER_ELEMENT,yl),wl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}Ui(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(dn);var Tl=1,El=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,s=i.geometry,o=i.name,a=void 0===o?"<unnamed>":o,h=i.priority,l=void 0===h?0:h,c=i.worldMatrix,u=void 0===c?No.fromIdentity():c;r.id="Mesh"+Tl++,r.name=a,r.geometry=s,r.material=n,r.priority=l,r.worldMatrix=u}else r.id="Mesh"+Tl++,r.name="<unnamed>",r.worldMatrix=No.fromIdentity(),r._priority=0;return r}Ui(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==Ge.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==Ge.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==Ge.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},ks(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Ho),Sl="#version 100\nprecision mediump float;\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",Il="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Al={},Cl=function(){function t(){}return t.registerInclude=function(t,e){Al[t]&&He.warn('The "'+t+'" shader include already exist.'),Al[t]=e},t.unRegisterInclude=function(t){delete Al[t]},t.unRegisterAllIncludes=function(){Object.keys(Al).forEach(function(e){t.unRegisterInclude(e)})},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,s=e.macros,o=e.removeVersion,a=t.genMacroString(i,s),h=t.genShaderVersion(i),l=t.parseIncludes(n),c=t.isVersion300(l);return l=t.removeWebGLVersion(l),2!==i||c||(l=t.convertTo300(l,r===Fs.fragment)),o?a+l:h+a+l},t.convertTo300=function(e,i){if(e=(e=(e=e.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=Al[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length?r.join("\n")+"\n":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&i.add(s[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Pl=function(t){function e(e,i){var r;void 0===i&&(i=4),(r=t.call(this,e)||this).tempRTs=[],r.iterationCount=i;var n=r.renderer.engine;return r.thresholdMaterial=Lo.create(n,{shader:{vertex:Il,fragment:"precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",glslVersion:fl.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=Lo.create(n,{shader:{vertex:Il,fragment:"precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",glslVersion:fl.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=Lo.create(n,{shader:{vertex:Il,fragment:"precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",glslVersion:fl.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=Lo.create(n,{shader:{vertex:Il,fragment:"precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",glslVersion:fl.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}Ui(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},i.execute=function(t){var e,i,r,n=t.getWidth(),s=t.getHeight(),o=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.thresholdRT=t.getTemporaryRT("_BloomThreshold",n,s,0,$h.Linear,tl.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",o),t.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var a=this.thresholdRT.getColorTextures()[0],h=0;h<this.iterationCount;h++){var l=Math.floor(n/Math.pow(2,h+1)),c=Math.floor(s/Math.pow(2,h+1)),u=t.getTemporaryRT("_BloomDownH"+h,l,c,0,$h.Linear,tl.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",Dl(a)),t.blit(a,u,this.downSampleHMaterial);var d=t.getTemporaryRT("_BloomDownV"+h,l,c,0,$h.Linear,tl.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",Dl(u.getColorTextures()[0])),t.blit(u.getColorTextures()[0],d,this.downSampleVMaterial),t.releaseTemporaryRT(u),this.tempRTs.push(d),a=d.getColorTextures()[0]}t.releaseTemporaryRT(this.thresholdRT);for(var f=this.iterationCount-1;f>0;f--){var p=Math.floor(n/Math.pow(2,f-1)),m=Math.floor(s/Math.pow(2,f-1)),g=t.getTemporaryRT("_BloomUp"+f,p,m,0,$h.Linear,tl.RGBAHalf),v=this.tempRTs[f-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",v),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",Dl(v)),t.blit(a,g,this.upSampleMaterial),a=g.getColorTextures()[0],this.tempRTs.push(g)}t.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},i.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},i.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),t.prototype.dispose.call(this,e)},e}(gl),Ml=function(t){function e(e,i){var r,n="PostProcess",s=(r=t.call(this,e)||this).renderer.engine;r.sceneTextureHandle=i||new cl(s);var o=wl.create(s,{name:n,mode:Ys.TRIANGLE_STRIP,attributes:{aPos:{type:Ys.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Lo.create(s,{name:n,shader:{vertex:Il,fragment:"precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",glslVersion:fl.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,r.screenMesh=El.create(s,{name:n,geometry:o,material:a,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}Ui(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:Gs.clear,depthAction:Gs.clear,stencilAction:Gs.clear});var e=t.renderingData.currentFrame.globalVolume,i=Cn({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=Cn({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Cn({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),s=Cn({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new xe(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new be(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(s.active)),t.renderMeshes([this.screenMesh])},e}(gl),Rl=1,Ol=function(){function t(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=void 0===r?[1,1,0,0]:r,s=t.globalVolume,o=t.postProcessingEnabled,a=void 0!==o&&o,h=i.engine;if(s&&(this.globalVolume=s),this.postProcessingEnabled=a,this.globalUniforms=new Fl,this.renderer=i,a&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new vl(i);var l=[this.drawObjectPass];if(this.setRenderPasses(l),a){var c=new cl(h),u=new Pl(i,7);u.sceneTextureHandle=c,this.addRenderPass(u);var d=new Ml(i,c);this.addRenderPass(d)}this.name="RenderFrame"+Rl++,this.camera=e,this.editorTransform=_e.fromArray(n)}var e=t.prototype;return e.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){var e=(null==t?void 0:t.passes)?t.passes:void 0;e!==Ge.keep&&this.renderPasses.forEach(function(t){t.dispose(e)}),this.renderPasses.length=0,this.disposed=!0},e.setRenderPasses=function(t){this.renderPasses=t.slice()},e.addRenderPass=function(t){this.renderPasses.push(t)},e.removeRenderPass=function(t){ce(this.renderPasses,t)},ks(t,[{key:"isDisposed",get:function(){return this.disposed}}]),t}();function Dl(t){return t?new xe(t.getWidth(),t.getHeight()):new xe}var kl,Ll,Fl=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Nl=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return ks(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Bl=function(){function t(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var e=t.prototype;return e.flush=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=-1),this.currentFrame++;for(var i=e>=0?e:this.maxUnusedFrames,r=0;r<this.temporaryRTs.length;r++){var n=this.temporaryRTs[r];!n.isOccupied&&(t||this.currentFrame-n.lastFrameReleased>i)&&(n.RT.dispose(),this.temporaryRTs.splice(r--,1))}},e.get=function(t,e,i,r,n,s){void 0===r&&(r=0),void 0===n&&(n=$h.Linear),void 0===s&&(s=tl.RGBA32);for(var o,a,h,l=e+"_"+i+"_"+r+"_"+n+"_"+s,c=nn(this.temporaryRTs);!(o=c()).done;){var u=o.value;if(!u.isOccupied&&u.descriptionHash===l)return u.isOccupied=!0,u.RT.name=t,u.RT}var d=rl.none;n===$h.Linear?a=Ys.LINEAR:n===$h.Nearest&&(a=Ys.NEAREST),s===tl.RGBA32?h=Ys.UNSIGNED_BYTE:s===tl.RGBAHalf&&(h=Ys.HALF_FLOAT),0===r?d=rl.none:16===r?d=rl.depth_stencil_opaque:24===r&&(d=rl.depth_24_stencil_8_texture);var f=To.create(this.engine,{sourceType:Hs.framebuffer,minFilter:a,magFilter:a,internalFormat:Ys.RGBA,format:Ys.RGBA,type:h}),p={RT:al.create({name:t,storeAction:{},viewport:[0,0,e,i],attachments:[f],depthStencilAttachment:{storageType:d}},this.engine.renderer),lastFrameReleased:0,descriptionHash:l,isOccupied:!0};return this.temporaryRTs.push(p),p.RT},e.release=function(t){for(var e,i=nn(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},e.dispose=function(){for(var t,e=nn(this.temporaryRTs);!(t=e()).done;){t.value.RT.dispose()}},t}(),zl="function"==typeof WebGL2RenderingContext,Ul=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},e.setupCapability=function(t){var e,i=zl&&Qt(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),s=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),a=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),s&&(this.UNSIGNED_INT_24_8=s.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=Vl(t,t.HALF_FLOAT)),r&&!a&&(a=Vl(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0;this.compressTextureCapabilityList=new Map([["WEBGL_compressed_texture_astc",!!t.getExtension("WEBGL_compressed_texture_astc")],["WEBKIT_WEBGL_compressed_texture_astc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_astc")],["WEBGL_compressed_texture_etc",!!t.getExtension("WEBGL_compressed_texture_etc")],["WEBKIT_WEBGL_compressed_texture_etc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_etc")],["WEBGL_compressed_texture_etc1",!!t.getExtension("WEBGL_compressed_texture_etc1")],["WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["WEBKIT_WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var c,u,d={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:o,floatLinear:a,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:(c=this.compressTextureCapabilityList,u=c.get("WEBGL_compressed_texture_astc")||c.get("WEBKIT_WEBGL_compressed_texture_astc"),!!u),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!s,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=d,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&i>0)throw new Error("Draw multiple color buffers not available.");var o=s?s["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)}else if(e.length>1)throw new Error("Draw buffers not available.")},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},ks(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function Vl(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}(Ll=kl||(kl={})).astc="WEBGL_compressed_texture_astc",Ll.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",Ll.etc="WEBGL_compressed_texture_etc",Ll.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",Ll.etc1="WEBGL_compressed_texture_etc1",Ll.pvrtc="WEBGL_compressed_texture_pvrtc",Ll.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",Ll.sRGB="EXT_sRGB";var Gl,jl=function(){function t(t){this.engine=t,this.currentFramebuffer=null,this.renderTargetPool=new Bl(t)}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return this.currentFramebuffer},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i,r){},e.getTemporaryRT=function(t,e,i,r,n,s){return this.renderTargetPool.get(t,e,i,r,n,s)},e.releaseTemporaryRT=function(t){this.renderTargetPool.release(t)},e.blit=function(t,e,i){},e.dispose=function(){},t}(),Hl=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i._color=new we(1,1,1,1),i.getHitTestParams=function(t){var e=No.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.boundingBoxInfo.setGeometry(i.geometry,e);var n,s=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(s)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:s.type,triangles:s.area,backfaceCulling:i.renderer.side===gi.FRONT}}},i.renderer={renderMode:Mi.MESH,blending:pi.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:gi.DOUBLE,mask:0},i.defaultGeometry=wl.create(i.engine,{attributes:{aPos:{type:Ys.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ys.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ys.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=Lo.create(i.engine,{shader:{fragment:"precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",vertex:"precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}}",shared:!0}});return i.material=r,i.material.setColor("_Color",new we(1,1,1,1)),i.configureMaterial(i.renderer),i}Ui(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){Qt(t,we)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return $t(function(){var i;return ie(this,function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,To.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},i.onUpdate=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),this.renderer.renderMode!==Mi.BILLBOARD&&this.renderer.renderMode!==Mi.VERTICAL_BILLBOARD&&this.renderer.renderMode!==Mi.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale)}},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t,this),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[e],t,e)},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size)},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Sa(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.texture,s=this.maskManager.maskMode,o=this.material;o.blending=!0,o.depthTest=!0,o.depthMask=i,to(o,r),eo(o,e),o.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',o.setVector4("_TexOffset",new _e(0,0,1,1)),o.setTexture("_MainTex",n);var a=Qs(r),h=new _e;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=a,h.z=t.renderMode,h.w=s,o.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?o.enableMacro("ALPHA_CLIP"):o.disableMacro("ALPHA_CLIP"),o},i.draw=function(t){for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[e],e)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,s,o=e,a=null!=(i=o.renderer)?i:{},h=o.mask;h&&this.maskManager.setMaskOptions(this.engine,h),this.renderer={renderMode:null!=(r=a.renderMode)?r:Mi.MESH,blending:null!=(n=a.blending)?n:pi.ALPHA,texture:a.texture?this.engine.findObject(a.texture):this.engine.whiteTexture,occlusion:!!a.occlusion,transparentOcclusion:!!a.transparentOcclusion||this.maskManager.maskMode===Bs.MASK,side:null!=(s=a.side)?s:gi.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},ks(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Ho);!function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(Gl||(Gl={}));var Wl=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new jh,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:Rr.Butt,join:Dr.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=Rr.Butt,i.strokeJoin=Dr.Miter,i.strokes=[],i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=No.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===gi.FRONT}}},i.rendererOptions={renderMode:Mi.MESH,blending:pi.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:gi.DOUBLE,mask:0};var r={type:Sr.Solid,color:new we(1,1,1,1)};i.strokes.push(r);var n={type:Sr.Solid,color:new we(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:Pr.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=wl.create(i.engine,{attributes:{aPos:{type:Ys.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ys.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ys.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}Ui(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.shapeDirty&&(this.buildPath(this.shapeAttributes),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1),this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=0;e<this.fillMaterials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],t,0);for(var i=0;i<this.strokeMaterials.length;i++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],t,1)}},i.draw=function(t){for(var e=0;e<this.fillMaterials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],0);for(var i=0;i<this.strokeMaterials.length;i++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],1)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Sa(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.fills.length>0)for(var n,s=nn(e);!(n=s()).done;){var o=n.value.shape,a=[],h=r.length,l=i.length/2;o.build(a),o.triangulate(a,i,l,r,h)}var c=r.length;if(this.strokes.length>0)for(var u,d=nn(e);!(u=d()).done;){var f=u.value.shape,p=[],m=this.strokeAttributes;m.cap=this.strokeCap,m.join=this.strokeJoin,m.width=this.strokeWidth;var g=!0;this.shapeAttributes.type===Pr.Custom&&(g=f.closePath),f.build(p),wh(p,m,!1,g,i,0,0,r)}var v=r.length-c,y=i.length/2,x=this.geometry.getAttributeData("aPos"),b=this.geometry.getAttributeData("aUV"),_=this.geometry.getIndexData();(!x||x.length<3*y)&&(x=new Float32Array(3*y)),(!b||b.length<2*y)&&(b=new Float32Array(2*y)),(!_||_.length<r.length)&&(_=new Uint16Array(r.length));for(var w=Number.MAX_VALUE,T=Number.MAX_VALUE,E=Number.MIN_VALUE,S=Number.MIN_VALUE,I=0;I<y;I++){var A=3*I,C=2*I,P=i[C],M=i[C+1];x[A]=P,x[A+1]=M,x[A+2]=0,w=Math.min(w,P),T=Math.min(T,M),E=Math.max(E,P),S=Math.max(S,M)}for(var R=E-w,O=S-T,D=0;D<y;D++){var k=3*D,L=2*D;b[L]=(x[k]-w)/R,b[L+1]=(x[k+1]-T)/O}_.set(r),this.geometry.setAttributeData("aPos",x),this.geometry.setAttributeData("aUV",b),this.geometry.setIndexData(_),this.geometry.setDrawCount(r.length);var F=this.geometry.subMeshes[0],N=this.geometry.subMeshes[1];F.indexCount=c,N.offset=2*c,N.indexCount=v},i.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case Pr.Custom:for(var e,i=this.shapeAttributes,r=i.points,n=i.easingIns,s=i.easingOuts,o=nn(i.shapes);!(e=o()).done;){var a=e.value,h=a.indexes,l=r[h[0].point];this.graphicsPath.moveTo(l.x,l.y);for(var c=1;c<h.length;c++){var u=h[c],d=h[c-1],f=r[u.point],p=r[d.point],m=s[d.easingOut],g=n[u.easingIn];this.graphicsPath.bezierCurveTo(m.x+p.x,m.y+p.y,g.x+f.x,g.y+f.y,f.x,f.y,1)}if(a.close){var v=h[0],y=h[h.length-1],x=r[v.point],b=r[y.point],_=s[y.easingOut],w=n[v.easingIn];this.graphicsPath.bezierCurveTo(_.x+b.x,_.y+b.y,w.x+x.x,w.y+x.y,x.x,x.y,1),this.graphicsPath.closePath()}}break;case Pr.Ellipse:var T=t;this.graphicsPath.ellipse(0,0,T.xRadius,T.yRadius);break;case Pr.Rectangle:var E=t;this.graphicsPath.rect(-E.width/2,-E.height/2,E.width,E.height,E.roundness);break;case Pr.Star:var S=t;this.graphicsPath.polyStar(S.pointCount,S.outerRadius,S.innerRadius,S.outerRoundness,S.innerRoundness,Dh.Star);break;case Pr.Polygon:var I=t;this.graphicsPath.polyStar(I.pointCount,I.radius,I.radius,I.roundness,I.roundness,Dh.Polygon)}},i.updateMaterials=function(){for(var t=0;t<this.fills.length;t++)this.updatePaintMaterial(this.fillMaterials[t],this.fills[t]);for(var e=0;e<this.strokes.length;e++)this.updatePaintMaterial(this.strokeMaterials[e],this.strokes[e])},i.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===Sr.Solid)t.color=e.color;else if(e.type===Sr.GradientLinear||e.type===Sr.GradientAngular||e.type===Sr.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===Sr.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new xe(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new xe(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var s=e.textureTransform;t.setMatrix3("_TextureTransform",(new ta).scale(s.scale.x,s.scale.y).rotate(s.rotation).translate(s.offset.x,s.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,s=[],o=[],a=nn(e.stops);!(n=a()).done;){var h=n.value,l=h.color;s.push(new _e(l.r,l.g,l.b,l.a)),o.push(h.time)}t.setVector4Array("_Colors",s),t.setFloats("_Stops",o),t.setInt("_StopsCount",o.length),t.setVector2("_StartPoint",i),t.setVector2("_EndPoint",r)},i.createMaterialFromRendererOptions=function(t){var e={shader:{vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}",fragment:"precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;vec4 smoothMix(vec4 a,vec4 b,float t){return mix(a,b,smoothstep(0.0,1.0,t));}float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float prevStop=_Stops[i-1];float currStop=_Stops[i];if(t>=prevStop&&t<=currStop){float localT=(t-prevStop)/max(currStop-prevStop,1e-6);finalColor=smoothMix(_Colors[i-1],_Colors[i],localT);break;}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}",glslVersion:fl.GLSL1}},i=Lo.create(this.engine,e),r=t,n=r.side,s=r.occlusion,o=r.blending,a=r.texture,h=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=s,to(i,o),eo(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new _e(0,0,1,1)),i.setTexture("_ImageTex",a);var l=Qs(o),c=new _e;return c.x=r.occlusion?+r.transparentOcclusion:1,c.y=l,c.z=r.renderMode,c.w=h,i.setVector4("_TexParams",c),0===c.x||this.maskManager.alphaMaskEnabled?i.enableMacro("ALPHA_CLIP"):i.disableMacro("ALPHA_CLIP"),i},i.fromData=function(e){var i;t.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(this.engine,e.mask);var r,n,s,o,a,h=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:Mi.MESH,blending:null!=(r=h.blending)?r:pi.ALPHA,texture:h.texture?this.engine.findObject(h.texture):this.engine.whiteTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||this.maskManager.maskMode===Bs.MASK,side:null!=(n=h.side)?n:gi.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(s=e.strokeCap)?s:Rr.Butt,this.strokeWidth=null!=(o=e.strokeWidth)?o:1,this.strokeJoin=null!=(a=e.strokeJoin)?a:Dr.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var l,c=nn(e.fills);!(l=c()).done;){var u=l.value;this.fills.push(this.createPaint(u)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var d,f=nn(e.strokes);!(d=f()).done;){var p=d.value;this.strokes.push(this.createPaint(p)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case Pr.Custom:for(var m,g=e,v={type:Pr.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},y=nn(g.points);!(m=y()).done;){var x=m.value;v.points.push(new xe(x.x,x.y))}for(var b,_=nn(g.easingIns);!(b=_()).done;){var w=b.value;v.easingIns.push(new xe(w.x,w.y))}for(var T,E=nn(g.easingOuts);!(T=E()).done;){var S=T.value;v.easingOuts.push(new xe(S.x,S.y))}v.shapes=g.shapes,this.shapeAttributes=v;break;case Pr.Ellipse:var I=e,A={type:Pr.Ellipse,xRadius:I.xRadius,yRadius:I.yRadius};this.shapeAttributes=A;break;case Pr.Rectangle:var C=e,P={type:Pr.Rectangle,width:C.width,height:C.height,roundness:C.roundness};this.shapeAttributes=P;break;case Pr.Star:var M=e,R={type:Pr.Star,pointCount:M.pointCount,innerRadius:M.innerRadius,outerRadius:M.outerRadius,innerRoundness:M.innerRoundness,outerRoundness:M.outerRoundness};this.shapeAttributes=R;break;case Pr.Polygon:var O=e,D={type:Pr.Polygon,pointCount:O.pointCount,radius:O.radius,roundness:O.roundness};this.shapeAttributes=D}},i.createPaint=function(t){var e;switch(t.type){case Sr.Solid:e={type:t.type,color:(new we).copyFrom(t.color)};break;case Sr.GradientLinear:case Sr.GradientAngular:case Sr.GradientRadial:e={type:t.type,gradientStops:gh(t.gradientStops),startPoint:(new xe).copyFrom(t.startPoint),endPoint:(new xe).copyFrom(t.endPoint)};break;case Sr.Texture:var i,r,n,s=Cn({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},null!=(i=t.textureTransform)?i:{});e={type:t.type,texture:this.engine.findObject(t.texture),scaleMode:t.scaleMode,scalingFactor:null!=(r=t.scalingFactor)?r:1,opacity:null!=(n=t.opacity)?n:1,textureTransform:{offset:(new xe).copyFrom(s.offset),rotation:s.rotation,scale:(new xe).copyFrom(s.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},ks(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Ho);Wl=ee([ln("ShapeComponent")],Wl);var Xl,Yl,ql=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}Ui(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(Yh)},i.onUpdate=function(t){this.updateFake3D()},i.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,i=this.startPositionY*(1-s)+s*this.endPositionY,r=this.startPositionZ*(1-s)+s*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},e}(Ls);ee([cn()],ql.prototype,"loop",void 0),ee([cn()],ql.prototype,"amountOfMotion",void 0),ee([cn()],ql.prototype,"animationLength",void 0),ee([cn()],ql.prototype,"mode",void 0),ee([cn()],ql.prototype,"startPositionX",void 0),ee([cn()],ql.prototype,"startPositionY",void 0),ee([cn()],ql.prototype,"startPositionZ",void 0),ee([cn()],ql.prototype,"endPositionX",void 0),ee([cn()],ql.prototype,"endPositionY",void 0),ee([cn()],ql.prototype,"endPositionZ",void 0),ee([cn()],ql.prototype,"amplitudeX",void 0),ee([cn()],ql.prototype,"amplitudeY",void 0),ee([cn()],ql.prototype,"amplitudeZ",void 0),ee([cn()],ql.prototype,"phaseX",void 0),ee([cn()],ql.prototype,"phaseY",void 0),ee([cn()],ql.prototype,"phaseZ",void 0),ql=ee([ln("Fake3DComponent")],ql),(Yl=Xl||(Xl={}))[Yl.Circular=0]="Circular",Yl[Yl.Linear=1]="Linear";var Kl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).color=new we(1,1,1,1),e.worldMatrix=new No,e.getHitTestParams=function(t){var i=No.fromScale(e.transform.size.x,e.transform.size.y,1).premultiply(e.transform.getWorldMatrix());if(t){e.boundingBoxInfo.setGeometry(e.clipGeometry,i);var r=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area}}},e}Ui(e,t);var i=e.prototype;return i.onAwake=function(){this.clipGeometry=wl.create(this.engine,{attributes:{aPos:{type:Ys.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ys.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ys.TRIANGLES,drawCount:6});var t=Lo.create(this.engine,{shader:{fragment:"\n precision mediump float;\n\n uniform vec4 _Color;\n\n void main() {\n gl_FragColor = _Color;\n }\n ",vertex:"\n precision highp float;\n attribute vec3 aPos;\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n void main() {\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * vec4(aPos, 1.0);\n }\n ",shared:!0}});t.depthTest=!0,t.depthMask=!1,t.setColor("_Color",this.color),this.material=t},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Zl(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},i.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},i.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Zl(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},i.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},i.setClipRectangleRecursive=function(t){for(var e,i=nn(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(Ho);n&&n.frameClipMasks.push(this),this.setClipRectangleRecursive(r)}},e}(Ho);function Zl(t,e,i){var r=t.elements;r[0]*=e,r[1]*=e,r[2]*=e,r[3]*=e,r[4]*=i,r[5]*=i,r[6]*=i,r[7]*=i}Kl=ee([ln("FrameComponent")],Kl);var Jl=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}Ui(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(Ls);function $l(t){return($l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ql(t){var e="function"==typeof Map?new Map:void 0;return Ql=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return nh(t,arguments,$l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),zi(r,t)},Ql(t)}Jl=ee([ln(jr.CameraController)],Jl);var tc,ec,ic=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(Ql(Bi)),rc="click",nc="touchstart",sc="touchmove",oc="touchend";(ec=tc||(tc={}))[ec.PointerDown=0]="PointerDown",ec[ec.PointerUp=1]="PointerUp",ec[ec.PointerMove=2]="PointerMove";var ac=function(){function t(t,e){void 0===e&&(e=!1),this.engine=t,this.allowPropagation=e,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var e=t.prototype;return e.bindListeners=function(t){var e,i,r,n,s,o=this;this.target=t,s=function(t){return t};var a,h="mousedown",l="mousemove",c="mouseup",u="mouseleave",d=function(t,e,i,r,s){void 0===r&&(r=0),void 0===s&&(s=0);var a=0,h=0,l=performance.now();if(!o.target)return He.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:h,dx:r,dy:s,ts:l,width:0,height:0,origin:t};var c=o.target,u=c.width,d=c.height;if(n){var f=l-n.ts;a=(r-n.dx)/f||0,h=(s-n.dy)/f||0,n={dx:r,dy:s,ts:l}}return{x:e,y:i,vx:a,vy:h,dx:r,dy:s,ts:l,width:u,height:d,origin:t}};De()&&(s=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},h="touchstart",l="touchmove",c="touchend",u="touchcancel"),this.nativeHandlers=((a={})[h]=function(t){if(o.enabled){var a=s(t),h=hc(a);e=h.x,i=h.y,n=r={clientX:a.clientX,clientY:a.clientY,ts:performance.now(),x:e,y:i},o.dispatchEvent(nc,d(t,e,i))}},a[l]=function(t){if(r&&o.enabled){var n=hc(s(t));e=n.x,i=n.y,o.dispatchEvent(sc,d(t,e,i,e-r.x,i-r.y))}},a[c]=function(t){if(r&&o.enabled){!o.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=s(t),a=hc(n),h=Math.abs(r.clientX-n.clientX)+Math.abs(r.clientY-n.clientY);e=a.x,i=a.y,h<4&&o.dispatchEvent(rc,d(t,e,i)),o.dispatchEvent(oc,d(t,e,i,e-r.x,i-r.y))}r=0},a),this.nativeHandlers[u]=this.nativeHandlers[c],Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])}),this.addEventListener(rc,this.onClick.bind(this)),this.addEventListener(nc,this.onPointerDown.bind(this)),this.addEventListener(oc,this.onPointerUp.bind(this)),this.addEventListener(sc,this.onPointerMove.bind(this))},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),le(i,e),function(){ce(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&ce(i,e)},e.onClick=function(t){for(var e,i=t.x,r=t.y,n=[],s=nn(this.engine.compositions);!(e=s()).done;){var o,a=e.value;(o=n).push.apply(o,[].concat(a.hitTest(i,r)))}for(var h,l=nn(n);!(h=l()).done;){var c=h.value,u=c.item.composition;if(u){var d=Cn({},c,{compositionId:u.id,compositionName:u.name});c.item.emit("click",c),u.emit("click",d),this.engine.emit("click",d)}}},e.onPointerDown=function(t){this.handlePointerEvent(t,0)},e.onPointerUp=function(t){this.handlePointerEvent(t,1)},e.onPointerMove=function(t){this.handlePointerEvent(t,2)},e.handlePointerEvent=function(t,e){var i=null,r=t.x,n=t.y,s=t.width,o=t.height;if(2!==e||!this.skipPointerMovePicking)for(var a,h=nn(this.engine.compositions);!(a=h()).done;){var l=a.value.hitTest(r,n);l.length>0&&(i=l[l.length-1])}var c=new Bo;c.position.x=(r+1)/2*s,c.position.y=(n+1)/2*o,c.delta.x=t.vx*s,c.delta.y=t.vy*o;var u=c.pointerCurrentRaycast;i&&(u.point=i.position,u.item=i.item);var d="pointerdown";switch(e){case 0:d="pointerdown";break;case 1:d="pointerup";break;case 2:d="pointermove"}if(i){var f=i.item,p=f.composition;f.emit(d,c),p.emit(d,c),this.engine.emit(d,c)}},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={})},t}();function hc(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),s=n.left,o=n.top;return{x:(i-s)/n.width*2-1,y:1-(r-o)/n.height*2}}var lc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(Ql(Bi)),cc=1,uc=function(){function t(t,e,i){this.transform=e,this.engine=i,this.color=t.options.previewColor;var r=this.createMaterial(),n=this.createGeometry();this.mesh=this.createMesh(n,r),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new be,n=new kn,s=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,s),e.x=s.x,e.y=s.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===Xo]],e=gh(this.color).getValue(0),i={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:fl.GLSL1,macros:t}},r=Lo.create(this.engine,i);return r.blending=!0,r.depthTest=!1,r.setVector4("uPos",new _e(0,0,0,0)),r.setVector2("uSize",new xe(1,1)),r.setVector4("uColor",new _e(e[0]/255,e[1]/255,e[2]/255,e[3])),r.setQuaternion("uQuat",new kn(0,0,0,0)),r},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return wl.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:Ys.LINES,maxVertex:4})},e.createMesh=function(t,e){return El.create(this.engine,{name:"Interact_preview"+cc++,priority:0,worldMatrix:No.fromIdentity(),geometry:t,material:e})},t}(),dc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i}:void 0}},e}Ui(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===Ei.CLICK&&(this.clickable=!0,r&&t===Xo&&(this.previewContent=new uc(this.item.props.content,this.transform,this.engine))),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.env;if(e===Ei.CLICK)this.clickable=!0;else if(e===Ei.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==Xo||n){var s,o=(null!=(s=this.item.composition)?s:{}).event;o&&this.beginDragTarget(r,o)}}},i.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,s=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,s.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,fc(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,s=n.position,o=n.fov,a=e.dy,h=e.dx*e.width/e.height,l=s[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(l),u=a*c,d=h*c,f=this.dragRange,p=f.dxRange,m=f.dyRange,g=s[0]-this.dragRatio[0]*d,v=s[1]-this.dragRatio[1]*u,y=p[0],x=p[1],b=m[0],_=m[1];if(g=ye(g,y,x),v=ye(v,b,_),g!==y&&g!==x&&y!==x)null==(i=e.origin)||i.preventDefault();if(v!==b&&v!==_&&b!==_)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new be(g,v,l)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,s={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){r.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!fc(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=Cn({},n)),n=null}}};Object.keys(s).forEach(function(t){i.addEventListener(t,s[t])}),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(s).forEach(function(t){i.removeEventListener(t,s[t])})}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=function(t,e,i){var r=t.x,n=t.y,s=t.z,o=new be(r-e,n+i,s),a=new be(r-e,n-i,s),h=new be(r+e,n-i,s),l=new be(r+e,n+i,s);return[{p0:o,p1:a,p2:h},{p0:o.clone(),p1:h.clone(),p2:l}]}(be.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach(function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)}),{type:Oo.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Ei.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,s=0;if("number"==typeof e)i=e,r=e,n=e,s=e;else if(Ye(e)){var o,a,h,l,c;i=void 0===(a=(o=e)[0])?0:a,r=void 0===(h=o[1])?0:h,n=void 0===(l=o[2])?0:l,s=void 0===(c=o[3])?0:c}if(t.x<s-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},ks(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Ho);function fc(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}dc=ee([ln(jr.InteractComponent)],dc);var pc,mc,gc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return Ui(e,t),e}(Ql(Bi)),vc=function(){function t(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){if(0===this.playState)this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),yc=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),xc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(dn);(mc=pc||(pc={}))[mc.Playing=0]="Playing",mc[mc.Paused=1]="Paused",mc[mc.Stopped=2]="Stopped";var bc=[1,1,1,1],_c=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}Ui(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(Qt(e,da)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var n=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");n&&(this.startColor=n.toArray())}var s,o,a,h=function(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}(bc,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,u=this.colorOverLifetime;if(u&&(h=function(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var s=t[n-1],o=t[n];if(s.time<=e&&e<=o.time){r=Se(s.color.toArray(),o.color.toArray(),(e-s.time)/(o.time-s.time));break}}return r||(r=t[t.length-1].color.toArray()),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}(u,l,!0),s=!0),c&&(h[3]*=c.getValue(l),s=!0),s)!function(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o]}(this.renderColor,h,this.startColor),null==(a=this.activeMaterial)||null==(o=a.getColor("_Color"))||o.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=gh(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===ji.GRADIENT_COLOR&&(this.colorOverLifetime=Ee(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(Hl)},e}(vc),wc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.onEvent=function(t,e,i){t.emit("animationevent",i)},e}(Ql(function(){function t(){}return t.prototype.onEvent=function(t,e,i){},t}())),Tc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e.events=[],e}Ui(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=ye(e,0,this.duration),n=nn(this.positionCurves);!(i=n()).done;){var s=i.value,o=s.keyFrames.getValue(r),a=this.findTarget(t,s.path);null==a||a.transform.setPosition(o.x,o.y,o.z)}for(var h,l=nn(this.rotationCurves);!(h=l()).done;){var c=h.value,u=c.keyFrames.getValue(r),d=this.findTarget(t,c.path);null==d||d.transform.setQuaternion(u.x,u.y,u.z,u.w)}for(var f,p=nn(this.eulerCurves);!(f=p()).done;){var m=f.value,g=m.keyFrames.getValue(r),v=this.findTarget(t,m.path);null==v||v.transform.setRotation(g.x,g.y,g.z)}for(var y,x=nn(this.scaleCurves);!(y=x()).done;){var b=y.value,_=b.keyFrames.getValue(r),w=this.findTarget(t,b.path);null==w||w.transform.setScale(_.x,_.y,_.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=nn(t.positionCurves);!(i=r()).done;){var n=i.value,s={path:n.path,keyFrames:gh(n.keyFrames)};e=Math.max(e,s.keyFrames.getMaxTime()),this.positionCurves.push(s)}if(t.rotationCurves)for(var o,a=nn(t.rotationCurves);!(o=a()).done;){var h=o.value,l={path:h.path,keyFrames:gh(h.keyFrames)};e=Math.max(e,l.keyFrames.getMaxTime()),this.rotationCurves.push(l)}if(t.eulerCurves)for(var c,u=nn(t.eulerCurves);!(c=u()).done;){var d=c.value,f={path:d.path,keyFrames:gh(d.keyFrames)};e=Math.max(e,f.keyFrames.getMaxTime()),this.eulerCurves.push(f)}if(t.scaleCurves)for(var p,m=nn(t.scaleCurves);!(p=m()).done;){var g=p.value,v={path:g.path,keyFrames:gh(g.keyFrames)};e=Math.max(e,v.keyFrames.getMaxTime()),this.scaleCurves.push(v)}if(t.floatCurves)for(var y,x=nn(t.floatCurves);!(y=x()).done;){var b=y.value,_={path:b.path,keyFrames:gh(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,_.keyFrames.getMaxTime()),this.floatCurves.push(_)}if(t.colorCurves)for(var w,T=nn(t.colorCurves);!(w=T()).done;){var E=w.value,S={path:E.path,keyFrames:gh(E.keyFrames),property:E.property,className:E.className};e=Math.max(e,S.keyFrames.getMaxTime()),this.colorCurves.push(S)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var I,A=nn(t.events);!(I=A()).done;){var C,P=I.value,M={name:P.name,startTime:P.startTime,duration:null!=(C=P.duration)?C:0,event:new wc,clip:this};this.events.push(M)}},i.findTarget=function(t,e){for(var i,r=t,n=nn(e.split("."));!(i=n()).done;){for(var s,o=i.value,a=!1,h=nn(r.children);!(s=h()).done;){var l=s.value;if(l.name===o){r=l,a=!0;break}}if(!a)return}return r},e}(dn);Tc=ee([ln(jr.AnimationClip)],Tc);var Ec=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}Ui(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=nn(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(Qt(t,vc)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(vc),Sc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(Qt(e,da)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(Ec),Ic=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();Qt(e,da)&&(e.time=this.time)},e}(vc),Ac=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(vc),Cc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}Ui(e,t);var i=e.prototype;return i.evaluate=function(t){var e=t.output.getUserData();if(e){this.directTarget||this.preparePath(e);var i=!1;if(this.propertyValue=this.directTarget[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var s=this.getClipPlayable(r);if(!Qt(s,Ac)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=s.value;this.addWeightedValue(o,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,Qt(e,Ls)&&e.onApplyAnimationProperties())}}},i.preparePath=function(t){for(var e=this.propertyPath.split("."),i=t,r=0;r<e.length-1;r++){var n=i[e[r]];void 0===n&&console.error("The "+e[r]+" property of "+t+" was not found"),i=n}e.length>0&&(this.propertyName=e[e.length-1]),this.directTarget=i},e}(Ec),Pc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(Cc),Mc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(Cc),Rc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.evaluate=function(t){},e}(Ec),Oc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.evaluate=function(t){},e}(Ec),Dc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();Qt(e,Hh)&&e.tick(this.getTime()-e.getTime())},e}(vc),kc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(Qt(e,Hh)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(Ec),Lc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.evaluate=function(t){},e}(Ec),Fc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(Cc),Nc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e},e}(Cc),Bc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(Cc),zc=new Wo,Uc=new be(1,1,1),Vc=new be,Gc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new be(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=gh(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&gh(r.linearX),y:r.linearY&&gh(r.linearY),z:r.linearZ&&gh(r.linearZ),asMovement:r.asMovement,enabled:!!o});var a=r.orbitalX||r.orbitalY||r.orbitalZ;a&&(this.orbitalVelOverLifetime={x:r.orbitalX&&gh(r.orbitalX),y:r.orbitalY&&gh(r.orbitalY),z:r.orbitalZ&&gh(r.orbitalZ),center:_a(r.orbCenter),asRotation:r.asRotation,enabled:!!a}),this.speedOverLifetime=r.speedOverLifetime&&gh(r.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=gh(s.x||1),this.sizeYOverLifetime=gh(s.y||1),this.sizeZOverLifetime=gh(s.z||1)):this.sizeXOverLifetime=gh(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:gh(n.z||0)},n.separateAxes)){var h=this.rotationOverLifetime;h.x=gh(n.x||0),h.y=gh(n.y||0)}this.gravity=be.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=gh(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?be.fromArray(r.direction).normalize():new be,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();Qt(e,da)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=this.getDuration(),r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){Uc.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Uc.y=this.sizeYOverLifetime.getValue(r),Uc.z=this.sizeZOverLifetime.getValue(r)):Uc.z=Uc.y=Uc.x;var n=this.originalTransform.scale;e.transform.setScale(Uc.x*n.x,Uc.y*n.y,Uc.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=s(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;zc.x=a?s(this.rotationOverLifetime.x):0,zc.y=a?s(this.rotationOverLifetime.y):0,zc.z=o;var h=zc.addEulers(this.originalTransform.rotation,zc);e.transform.setRotation(h.x,h.y,h.z)}if(this.positionOverLifetime){var l=Vc;ba(l,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&l.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(l.x,l.y,l.z)}},e}(vc),jc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Gc;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(xc);jc=ee([ln(jr.TransformPlayableAsset)],jc);var Hc,Wc,Xc=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===Yi.restart?e%=i:this.endBehavior===Yi.freeze&&(e=Math.min(i,e))),e},t}(),Yc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}Ui(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new Ec},i.createOutput=function(){return new yc},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=nn(this.clips);!(e=r()).done;){var n=e.value;i.push(n)}return this.compileClips(i,t)},i.compileClips=function(t,e){for(var i,r=this.createTrackMixer(),n=nn(t);!(i=n()).done;){var s=i.value,o=this.createClipPlayable(s);o.setDuration(s.duration);var a=new qc(s,o,r);e.push(a),r.clipPlayables.push(o),r.setClipWeight(o,0)}return r},i.createPlayable=function(){return new vc},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new Xc;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=nn(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t){return t.asset.createPlayable()},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=nn(this.children);!(i=r()).done;){i.value.parent=this}},e}(xc);ee([cn(Xc)],Yc.prototype,"clips",void 0),ee([cn()],Yc.prototype,"children",void 0),Yc=ee([ln(jr.TrackAsset)],Yc),(Wc=Hc||(Hc={}))[Wc.MasterTrack=0]="MasterTrack",Wc[Wc.ObjectTrack=1]="ObjectTrack";var qc=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1;t>=e.start+e.duration&&e.endBehavior===Yi.destroy?(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==pc.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var s=e.toLocalTime(t);this.playable.setTime(s),r&&this.playable.getPlayState()===pc.Playing&&this.playable.pause()},ks(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}(),Kc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){return new Sc},e}(Yc);Kc=ee([ln(jr.ActivationTrack)],Kc);var Zc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return Ui(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(Yc);ee([cn()],Zc.prototype,"path",void 0);var Jc=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){var t=new Mc;return t.propertyPath=this.path,t},e}(Zc);Jc=ee([ln(jr.FloatPropertyTrack)],Jc);var $c=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){return new Oc},e}(Yc);$c=ee([ln(jr.SpriteColorTrack)],$c);var Qc=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!Qt(t,da))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(Hh)},i.createTrackMixer=function(){return new kc},e}(Yc);Qc=ee([ln(jr.SubCompositionTrack)],Qc);var tu=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){return new Lc},e}(Yc);tu=ee([ln(jr.TransformTrack)],tu);var eu=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.updateAnimatedObject=function(t){if(!Qt(t,Ho))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(Yc);ee([cn()],eu.prototype,"index",void 0),eu=ee([ln("MaterialTrack")],eu);var iu=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){return new Rc},e}(Yc),ru=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){var t=new Fc;return t.propertyPath=this.path,t},e}(Zc);ru=ee([ln(jr.Vector4PropertyTrack)],ru);var nu=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){var t=new Nc;return t.propertyPath=this.path,t},e}(Zc);nu=ee([ln(jr.Vector3PropertyTrack)],nu);var su=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){var t=new Bc;return t.propertyPath=this.path,t},e}(Zc);su=ee([ln(jr.Vector2PropertyTrack)],su);var ou=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){var t=new Pc;return t.propertyPath=this.path,t},e}(Zc);ou=ee([ln(jr.ColorPropertyTrack)],ou);var au=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=hu(this.arc,this.arcMode,t)*fe,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new be(i,r,0),s=Math.tan(this.angle*fe),o=n.clone().multiply(s);return o.z+=1,{position:n.multiply(Qe(0,1)),direction:o.normalize()}},t}();function hu(t,e,i){if(e===Ji.RANDOM)t=Qe(0,t);else if(e===Ji.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===Ji.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===Ji.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var lu,cu=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=hu(this.arc,this.arcMode,t)*fe,i=new be(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),uu=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Qe(-this._d,this._d),i=Qe(-this._h,this._h);return{direction:new be(0,0,1),position:new be(e,i,0)}},t}(),du=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=hu(this.arc,this.arcMode,t)*fe,i=new be(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,s=Math.atan2(n,r),o=Math.tan(e),a=new be;return e<s?a.set(r,r*o,0):e>=s&&e<Math.PI-s?a.set(n/o,n,0):e<Math.PI+s?a.set(-r,-r*o,0):e<2*Math.PI-s?a.set(-n/o,-n,0):a.set(r,r*o,0),{direction:i,position:a}},t}(),fu=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Ji.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Qe(0,1);return{direction:new be(0,1,0),position:new be(this._d*(e-.5),0,0)}},t}(),pu=new No,mu=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=Qe(0,2*Math.PI),n=hu(this.arc,this.arcMode,t)*fe,s=pu.setFromRotationZ(n),o=new be(Math.cos(r),Math.sin(r),0),a=new be(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:s.transformNormal(o),position:s.transformPoint(a)}},t}(),gu=new No,vu=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return Qe(-90,90)},e.generate=function(t){var e=hu(this.arc,this.arcMode,t)*fe,i=this.getHorizontalAngle()*fe,r=this.radius,n=new be(Math.cos(i),0,Math.sin(i)),s=gu.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(r),direction:s}},t}(),yu=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.getHorizontalAngle=function(){return Qe(0,90)},e}(vu),xu=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=ye(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(hu(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,s=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new be(n,s,0);return{position:new be(n*this.width,s*this.height,0),direction:o.normalize()}},t}(),bu=function(){function t(){}return t.prototype.generate=function(){return{position:new be,direction:new be}},t}(),_u=((lu={})[bi.NONE]=bu,lu[bi.CONE]=au,lu[bi.SPHERE]=vu,lu[bi.HEMISPHERE]=yu,lu[bi.CIRCLE]=cu,lu[bi.DONUT]=mu,lu[bi.RECTANGLE]=uu,lu[bi.EDGE]=fu,lu[bi.RECTANGLE_EDGE]=du,lu[bi.TEXTURE]=xu,lu);function wu(t,e,i,r,n){var s,o;if(n===function(t,e,i,r){for(var n=0,s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,e,i,r)>0)for(s=e;s<i;s+=r)o=Uu(s,t[s],t[s+1],o);else for(s=i-r;s>=e;s-=r)o=Uu(s,t[s],t[s+1],o);return o&&ku(o,o.next)&&(Vu(o),o=o.next),o}function Tu(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!ku(r,r.next)&&0!==Du(r.prev,r,r.next))r=r.next;else{if(Vu(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Eu(t){var e=t.prev,i=t,r=t.next;if(Du(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Ru(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&Du(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Su(t,e,i,r){var n=t.prev,s=t,o=t.next;if(Du(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,h=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,l=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,c=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,u=Pu(a,h,e,i,r),d=Pu(l,c,e,i,r),f=t.prevZ,p=t.nextZ;f&&f.z>=u&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&Ru(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Du(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&Ru(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Du(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=u;){if(f!==t.prev&&f!==t.next&&Ru(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Du(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&Ru(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Du(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Iu(t,e){return t.x-e.x}function Au(t,e){if(e=function(t,e){var i,r=e,n=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===o)return i;var h,l=i,c=i.x,u=i.y,d=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&Ru(s<u?n:o,s,c,u,s<u?o:n,s,r.x,r.y)&&(h=Math.abs(s-r.y)/(n-r.x),Bu(r,t)&&(h<d||h===d&&(r.x>i.x||r.x===i.x&&Cu(i,r)))&&(i=r,d=h)),r=r.next}while(r!==l);return i}(t,e),e){var i=zu(e,t);Tu(e,e.next),Tu(i,i.next)}}function Cu(t,e){return Du(t.prev,t,e.prev)<0&&Du(e.next,t,t.next)<0}function Pu(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Mu(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Ru(t,e,i,r,n,s,o,a){return(n-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(r-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function Ou(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Lu(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Bu(t,e)&&Bu(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Du(t.prev,t,e.prev)||Du(t,e.prev,e))||ku(t,e)&&Du(t.prev,t,t.next)>0&&Du(e.prev,e,e.next)>0)}function Du(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ku(t,e){return t.x===e.x&&t.y===e.y}function Lu(t,e,i,r){var n=Nu(Du(t,e,i)),s=Nu(Du(t,e,r)),o=Nu(Du(i,r,t)),a=Nu(Du(i,r,e));return n!==s&&o!==a||(!(0!==n||!Fu(t,i,e))||(!(0!==s||!Fu(t,r,e))||(!(0!==o||!Fu(i,t,r))||!(0!==a||!Fu(i,e,r)))))}function Fu(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Nu(t){return t>0?1:t<0?-1:0}function Bu(t,e){return Du(t.prev,t,t.next)<0?Du(t,e,t.next)>=0&&Du(t,t.prev,e)>=0:Du(t,e,t.prev)<0||Du(t,t.next,e)<0}function zu(t,e){var i=new Gu(t.i,t.x,t.y),r=new Gu(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function Uu(t,e,i,r){var n=new Gu(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Vu(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 Gu(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ju=0;function Hu(t,e,i,r){i=i||2,ju=r||0;var n,s,o,a,h,l,c,u=e&&e.length,d=u?e[0]*i:t.length,f=wu(t,0,d,i,!0),p=[];if(!f||f.next===f.prev)return p;if(u&&(f=function(t,e,i,r){var n,s,o,a=[];for(n=0,s=e.length;n<s;n++)(o=wu(t,e[n]*r,n<s-1?e[n+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(Mu(o));for(a.sort(Iu),n=0;n<a.length;n++)Au(a[n],i),i=Tu(i,i.next);return i}(t,e,f,i)),t.length>80*i){n=o=t[0],s=a=t[1];for(var m=i;m<d;m+=i)(h=t[m])<n&&(n=h),(l=t[m+1])<s&&(s=l),h>o&&(o=h),l>a&&(a=l);c=0!==(c=Math.max(o-n,a-s))?1/c:0}return Wu(f,p,i,n,s,c),p}function Wu(t,e,i,r,n,s,o){if(t){!o&&s&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=Pu(n.x,n.y,e,i,r)),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,i,r,n,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,r=i,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(h=l;a>0||h>0&&r;)0!==a&&(0===h||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,h--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,l*=2}while(o>1)}(n)}(t,r,n,s);for(var a,h,l=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?Su(t,r,n,s):Eu(t))e.push(a.i/i+ju),e.push(t.i/i+ju),e.push(h.i/i+ju),Vu(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?Wu(t=Xu(Tu(t),e,i),e,i,r,n,s,2):2===o&&Yu(t,e,i,r,n,s):Wu(Tu(t),e,i,r,n,s,1);break}}}function Xu(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!ku(n,s)&&Lu(n,r,r.next,s)&&Bu(n,s)&&Bu(s,n)&&(e.push(n.i/i+ju),e.push(r.i/i+ju),e.push(s.i/i+ju),Vu(r),Vu(r.next),r=t=s),r=r.next}while(r!==t);return Tu(r)}function Yu(t,e,i,r,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ou(o,a)){var h=zu(o,a);return o=Tu(o,o.next),h=Tu(h,h.next),Wu(o,e,i,r,n,s),void Wu(h,e,i,r,n,s)}a=a.next}o=o.next}while(o!==t)}function qu(t,e){for(var i=t.s,r=t.p,n=i[1],s=r[1],o=0,a=0;a<n.length;a++){o+=n[a].length-1}var h,l=new Float32Array(6*o),c=e.indexBase,u=void 0===c?0:c,d=e.uvTransform,f=0,p=0,m=0,g=1,v=1;d&&(p=d[0],m=d[1],h=d[4],g=h?d[3]:d[2],v=h?d[2]:d[3]);for(var y=[0,0],x=0===h?0:-Math.PI/2,b=0;b<n.length;b++)for(var _=n[b],w=s[b],T=s[b+1]||s[0],E=_,S=[0,0],I=0;I<E.length-1;I++){Ju(S,E[I],w,T,w[4],w[5],T[2],T[3]),C(S[0],S[1])}var A=Hu(Array.from(l),null,6,u);return{aPoint:l,index:new Uint16Array(A)};function C(t,e){l[f++]=t/2,l[f++]=e/2,d?(y[0]=t,y[1]=e,Zu(y,y,x),l[f++]=p+(y[0]+1)/2*g,l[f++]=m+(y[1]+1)/2*v):(l[f++]=(t+1)/2,l[f++]=(e+1)/2),f+=2}}function Ku(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach(function(t){e.push({p:[ji.SHAPE_POINTS,t.p],s:[ji.SHAPE_SPLITS,t.s]})}):"g"in t?e.push({p:[ji.SHAPE_POINTS,t.g.p],s:[ji.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,s=0,o=0,a=0;a<r.length;a++){var h=qu(r[a],{indexBase:n,uvTransform:e});n+=h.aPoint.length/5,i.push(h),s+=h.aPoint.length,o+=h.index.length}if(1===i.length)return i[0];for(var l=new Float32Array(s),c=new Uint16Array(o),u=0,d=0,f=0;u<i[u];u++){var p=i[u];l.set(p.aPoint,d),d+=p.aPoint.length,c.set(p.index,f),f+=p.index.length}return{aPoint:l,index:c}}function Zu(t,e,i){var r=Math.cos(i),n=Math.sin(i),s=e[0],o=e[1];return t[0]=r*s+n*o,t[1]=-n*s+r*o,t}function Ju(t,e,i,r,n,s,o,a){var h=1-e,l=h*h*h,c=3*e*h*h,u=3*e*e*h,d=e*e*e;return t[0]=l*i[0]+c*n+u*o+d*r[0],t[1]=l*i[1]+c*s+u*a+d*r[1],t}var $u=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,s=t.probability;this.time=+e||0,this.interval=+i||1,this.count=Qt(r,ja)?r:gh(r),this.cycles=+n||1/0,this.probability=isNaN(s)?1:+s,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),Qu=function(t){this.content=t},td=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new Qu(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new Qu(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),ed={};var id=new be,rd=new be,nd=function(){function t(t,e){this.pointStart=[];var i=e.colorOverLifetime,r=e.colorOverTrail,n=e.maxTrailCount,s=e.opacityOverLifetime,o=void 0===s?gh(1):s,a=e.widthOverTrail,h=e.name,l=e.occlusion,c=e.blending,u=e.textureMap,d=void 0===u?[0,0,1,1]:u,f=e.texture,p=e.transparentOcclusion,m=e.minimumVertexDistance,g=e.lifetime,v=e.matrix,y=t.gpuCapability,x=y.detail,b=y.level,_=Math.max(e.pointCountPerTrail,2),w={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},T=x.maxVertexTextures>0,E=(null!=t?t:{}).env,S={},I=[["ENABLE_VERTEX_TEXTURE",T],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",E===Xo]],A=n>64,C=0;i&&(I.push(["COLOR_OVER_LIFETIME",!0]),C|=1,S.uColorOverLifetime=To.createWithData(t,ke(i))),r&&(I.push(["COLOR_OVER_TRAIL",!0]),C|=4,S.uColorOverTrail=To.createWithData(t,ke(r))),A?(I.push(["ATTR_TRAIL_START",1]),C|=8):S.uTrailStart=new Float32Array(n),S.uOpacityOverLifetimeValue=o.toUniform(w);var P=a.toUniform(w);I.push(["VERT_CURVE_VALUE_COUNT",w.index],["VERT_MAX_KEY_FRAME_COUNT",w.max]),S.uVCurveValues=ja.getAllData(w);var M={shader:{vertex:"#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;void main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;}",fragment:Sl,macros:I,glslVersion:1===b?fl.GLSL1:fl.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+C+"+"+w.index+"+"+w.max}},R=_*n*2,O=(_-1)*n,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,L={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*R)},aSeed:{size:1,stride:k,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(R)},aDir:{size:3,data:new Float32Array(3*R)}},indices:{data:new Uint16Array(6*R)},drawCount:6*O,name:"trail#"+h,bufferUsage:Ys.DYNAMIC_DRAW};if(A)L.attributes.aTrailStart={size:1,data:new Float32Array(R)};else{var F=new Float32Array(R);L.attributes.aTrailStartIndex={size:1,data:F};for(var N=0;N<n;N++)for(var B=2*_,z=N*B,U=0;U<B;U++)F[z+U]=N}var V=Qs(c),G=Lo.create(t,M);G.blending=!0,G.depthMask=l,G.depthTest=!0,to(G,c);var j=this.mesh=El.create(t,{name:"MTrail_"+h,material:G,geometry:wl.create(t,L)}),H=null!=f?f:To.createWithData(t);Object.keys(S).map(function(t){var e=S[t];if(Qt(e,To))G.setTexture(t,e);else if("uTrailStart"===t)G.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new _e(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}G.setVector4Array(t,i)}else G.setVector4(t,_e.fromArray(e))}),G.setFloat("uTime",0),G.setVector4("uWidthOverTrail",_e.fromArray(P)),G.setVector2("uTexOffset",new xe(0,0)),G.setVector4("uTextureMap",_e.fromArray(d)),G.setVector4("uParams",new _e(0,_-1,0,0)),G.setTexture("uMaskTex",H),G.setVector4("uColorParams",new _e(f?1:0,+V,0,+(l&&!p))),this.maxTrailCount=n,this.pointCountPerTrail=_,this.checkVertexDistance=m>0,this.minimumVertexDistance=Math.pow(m||.001,2),this.useAttributeTrailStart=A,this.lifetime=g,v&&(this.mesh.worldMatrix=v),this.geometry=j.firstGeometry(),this.trailCursors=new Uint16Array(n)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,o=n-1,a=r%n,h=(r-1)%n,l=(r-2)%n,c=this.getTrailPosition(t,h,id);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var u=t*n+a,d=hd(c,e),f=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,g=6*u,v=new Float32Array(6);v.set(d,0),v.set(d,3),s.setAttributeSubData("aDir",g,v),s.setAttributeSubData("aTime",2*u,new Float32Array([f,f]));var y=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(y,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(y,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,s.setAttributeSubData("aColor",24*u,x),h>=0){var _=this.getTrailPosition(t,l,rd),w=new Float32Array(hd(_,c,e)),T=6*(t*n+h);s.setAttributeSubData("aDir",T,w),s.setAttributeSubData("aDir",T+3,w);var E=t*n*2,S=new Uint16Array([2*h+E,2*h+1+E,2*a+E,2*a+E,2*h+1+E,2*a+1+E]),I=6*(t*o+(r-1)%o);s.setIndexSubData(I,S)}r=++this.trailCursors[t];var A=this.mesh.material,C=A.getVector4("uParams"),P=p[2];if(this.useAttributeTrailStart){for(var M=2*n,R=new Float32Array(M),O=0;O<M;O++)R[O]=P;s.setAttributeSubData("aTrailStart",t*R.length,R)}else{var D=A.getFloats("uTrailStart");null!=D&&(D[t]=P,A.setFloats("uTrailStart",D))}C&&(C.y=Math.max(C.y,r-1)-Math.max(0,r-n),A.setVector4("uParams",C))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,s=this.geometry.getAttributeData("aColor");return Be(s),i.x=s[n],i.y=s[1+n],i.z=s[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();Be(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");Be(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();Be(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},ks(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),sd=new be,od=new be,ad=new be;function hd(t,e,i){var r=sd;return t||i?(t?i?(od.subtractVectors(e,t).normalize(),od.subtractVectors(i,e),ad.copyFrom(od).normalize(),r.addVectors(od,ad)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var ld=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).particleSystem=null,e}Ui(e,t);var i=e.prototype;return i.getParticleSystem=function(t){if(this.particleSystem)return this.particleSystem;var e=t.output.getUserData();return Qt(e,da)?(this.particleSystem=e.getComponent(gd),this.particleSystem):null},i.processFrame=function(t){var e=this.getParticleSystem(t);if(e){this.time>=0&&this.time<e.time&&e.reset();for(;e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},e}(vc),cd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){return new ld},e}(xc),ud={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"},dd=function(){function t(t,e){this.particleCount=0,this.cachedRotationVector3=new be,this.cachedRotationMatrix=new ta,this.cachedLinearMove=new be,this.tempMatrix3=new ta,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,r,n=(null!=t?t:{}).env,s=e.speedOverLifetime,o=e.colorOverLifetime,a=e.linearVelOverLifetime,h=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,c=e.rotationOverLifetime,u=e.sprite,d=e.gravityModifier,f=e.maxCount,p=e.textureFlip,m=e.useSprite,g=e.name,v=e.gravity,y=e.forceTarget,x=e.side,b=e.occlusion,_=e.anchor,w=e.blending,T=e.transparentOcclusion,E=e.meshSlots,S=e.renderMode,I=void 0===S?0:S,A=e.diffuse,C=void 0===A?To.createWithData(t):A,P=t.gpuCapability.detail,M=P.halfFloatTexture,R=P.maxVertexUniforms,O=[["RENDER_MODE",+I],["ENV_EDITOR",n===Xo]],D=t.gpuCapability.level,k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},L={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},F=R>0,N={},B=0,z=0;(this.useSprite=m,F&&O.push(["ENABLE_VERTEX_TEXTURE",!0]),s&&(O.push(["SPEED_OVER_LIFETIME",!0]),z|=2,N.uSpeedLifetimeValue=s.toUniform(k)),(null==u?void 0:u.animate)&&(O.push(["USE_SPRITE",!0]),z|=4,N.uFSprite=N.uSprite=new Float32Array([u.col,u.row,u.total,u.blend?1:0]),this.useSprite=!0),(null==o?void 0:o.color)&&(O.push(["COLOR_OVER_LIFETIME",!0]),z|=16,N.uColorOverLifetime=Qt(o.color,To)?o.color:To.createWithData(t,ke(o.color))),(null==o?void 0:o.opacity)?N.uOpacityOverLifetimeValue=o.opacity.toUniform(k):N.uOpacityOverLifetimeValue=gh(1).toUniform(k),["x","y","z"].forEach(function(t,e){var r=0,n=0;(null==a?void 0:a[t])&&(N["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=a[t].toUniform(k),r=1,z|=1<<7+e,a.enabled=!0),O.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==h?void 0:h[t])&&(N["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(k),n=1,z|=1<<10+e,i=!0,h.enabled=!0),O.push(["ORB_VEL_"+t.toUpperCase(),n])}),(null==a?void 0:a.asMovement)&&(O.push(["AS_LINEAR_MOVEMENT",!0]),z|=32),i&&((null==h?void 0:h.asRotation)&&(O.push(["AS_ORBITAL_MOVEMENT",!0]),z|=64),N.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),N.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(k),null==l?void 0:l.separateAxes)&&(O.push(["SIZE_Y_BY_LIFE",1]),z|=16384,N.uSizeYByLifetimeValue=null==l||null==(r=l.y)?void 0:r.toUniform(k));(null==c?void 0:c.z)&&(N.uRZByLifeTimeValue=c.z.toUniform(k),z|=32768,O.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(N.uRXByLifeTimeValue=c.x.toUniform(k),z|=65536,O.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(N.uRYByLifeTimeValue=c.y.toUniform(k),z|=1<<17,O.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(O.push(["ROT_LIFETIME_AS_MOVEMENT",1]),z|=1<<18),N.uGravityModifierValue=d.toUniform(k),y&&(O.push(["FINAL_TARGET",!0]),z|=1<<19,N.uFinalTarget=new Float32Array(y.target||[0,0,0]),N.uForceCurve=y.curve.toUniform(k)),M&&L.max?(z|=1<<20,N.uFCurveValueTexture=Eo(t,ja.getAllData(L,!0),L.index,1)):N.uFCurveValues=ja.getAllData(L);var U=k.max+k.curves.length-32>R;if(2===D&&(k.max=-1,k.index=E?E[0]:pd(k.index),L.index>0&&(L.max=-1,L.index=E?E[1]:pd(L.index))),U&&M&&F){var V=Eo(t,ja.getAllData(k,!0),k.index,1);N.uVCurveValueTexture=V,B=1}else N.uVCurveValues=ja.getAllData(k);var G=["-p:",I,z,k.index,k.max,L.index,L.max].join("+");O.push(["VERT_CURVE_VALUE_COUNT",k.index],["FRAG_CURVE_VALUE_COUNT",L.index],["VERT_MAX_KEY_FRAME_COUNT",k.max],["FRAG_MAX_KEY_FRAME_COUNT",L.max]),this.VERT_MAX_KEY_FRAME_COUNT=k.max;var j={shader:{fragment:Sl,vertex:"#define LOOKUP_TEXTURE_CURVE "+B+"\n#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;vec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;}}",glslVersion:1===D?fl.GLSL1:fl.GLSL3,shared:!0,cacheId:G,macros:O,name:"particle#"+g}},H=Qs(w);N.uTexOffset=new Float32Array(C?[1/C.getWidth(),1/C.getHeight()]:[0,0]),N.uMaskTex=C,N.uColorParams=new Float32Array([C?1:0,+H,0,+(!!b&&!T)]),N.uParams=[0,0,0,0],N.uAcceleration=[(null==v?void 0:v[0])||0,(null==v?void 0:v[1])||0,(null==v?void 0:v[2])||0,0];var W=Lo.create(t,j);W.blending=!0,W.depthTest=!0,W.depthMask=!!b,to(W,w),eo(W,x),Object.keys(N).map(function(t){var e=N[t];if(Qt(e,To))W.setTexture(t,e);else{var i=[];switch(ud[t]){case"vec4":W.setVector4(t,_e.fromArray(e));break;case"vec3":W.setVector3(t,be.fromArray(e));break;case"vec2":W.setVector2(t,xe.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new _e(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}}),W.setVector3("emissionColor",new be(0,0,0)),W.setFloat("emissionIntensity",0);var X=wl.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,s={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(s.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:s,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*f,this.useSprite,"particle#"+g)),Y=El.create(t,{name:"MParticle_"+g,material:W,geometry:X});this.anchor=_,this.mesh=Y,this.geometry=Y.firstGeometry(),this.forceTarget=y,this.sizeOverLifetime=l,this.speedOverLifetime=s,this.linearVelOverLifetime=a,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=d,this.rotationOverLifetime=c,this.maxCount=f,this.textureOffsets=p?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return Be(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,s=this.geometry,o=r>this.maxParticleBufferCount,a=1;this.particleCount>300?a=(this.particleCount+100)/this.particleCount:this.particleCount>100?a=1.4:this.particleCount>0&&(a=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},l=this.useSprite;l&&(h.aSprite=new Float32Array(12));var c=new be,u=new kn,d=new be(1,1,1);e.transform.assignWorldTRS(c,u,d);var f,p=ua.getRotation(u,new Wo),m=c.toArray(),g=p.toArray(),v=this.textureOffsets,y=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,_=e.color,w=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],T=Math.random();l&&(f=e.sprite);for(var E=0;E<4;E++){var S=2*E,I=3*E,A=4*E,C=12*E,P=8*E;h.aPos.set(m,C),b.fill(h.aPos,C+3),h.aRot.set(g,P),h.aRot[P+3]=T,h.aRot.set(_,P+4),l&&h.aSprite.set(f,I);var M=e.uv||x;if(M){var R=l?1-v[S+1]:v[S+1];y[0]=M[0]+v[S]*M[2],y[1]=M[1]+R*M[3]}h.aOffset.set(y,A);for(var O=E+E,D=(w[O]-this.anchor.x)*d.x,k=(w[O+1]-this.anchor.y)*d.y,L=0;L<3;L++)h.aPos[C+6+L]=e.dirX.getElement(L)*D,h.aPos[C+9+L]=e.dirY.getElement(L)*k}var F=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(o){var N=ue(s.getIndexData(),6*r,6*i,a);N.set(F,6*t),s.setIndexData(N),this.maxParticleBufferCount=N.length/6}else s.setIndexSubData(6*t,F);Object.keys(h).forEach(function(e){var r=h[e],l=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var c=s.getAttributeData(e);Be(c);var u=ue(c,n*l,4*i*l,a);u.set(r,r.length*t),s.setAttributeData(e,u)}else s.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(r,this.particleCount),s.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,a=0,h=0,l=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),u=0;u<t;u+=4){var d=12*u+3;o=n[d],a=n[d+1],h=n[d+2];var f=i-s[4*u+2],p=s[4*u+3];if(l&&c){var m=this.gravityModifier.getIntegrateValue(0,f,p),g=l.x*m,v=l.y*m,y=l.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(f/p);o=o*x+g,a=a*x+v,h=h*x+y}else o+=g,a+=v,h+=y}var b=3*u;if(s[4*u+2]<i){var _=o*(e/1e3),w=a*(e/1e3),T=h*(e/1e3);r[b]+=_,r[b+1]+=w,r[b+2]+=T,r[b+3]+=_,r[b+4]+=w,r[b+5]+=T,r[b+6]+=_,r[b+7]+=w,r[b+8]+=T,r[b+9]+=_,r[b+10]+=w,r[b+11]+=T}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),s=this.geometry.getAttributeData("aSeed"),o=this.time,a=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=ye((o-r[4*h+2])/r[4*h+3],0,1),c=8*h,u=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),d=s[8*h+3],f=u;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(Qt(this.rotationOverLifetime.x,Xa)?f.x+=this.rotationOverLifetime.x.getValue(l,d):f.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(Qt(this.rotationOverLifetime.y,Xa)?f.y+=this.rotationOverLifetime.y.getValue(l,d):f.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(Qt(this.rotationOverLifetime.z,Xa)?f.z+=this.rotationOverLifetime.z.getValue(l,d):f.z+=this.rotationOverLifetime.z.getValue(l))):a.setZero(),0===f.dot(f)&&a.identity();var p=Math.PI/180,m=f.x*p,g=f.y*p,v=f.z*p,y=Math.sin(m),x=Math.sin(g),b=Math.sin(v),_=Math.cos(m),w=Math.cos(g),T=Math.cos(v);a.set(T,-b,0,b,T,0,0,0,1),a.multiply(this.tempMatrix3.set(w,0,x,0,1,0,-x,0,w)),a.multiply(this.tempMatrix3.set(1,0,0,0,_,-y,0,y,_));var E=9*h,S=a.elements;i.set(S,E),h+4<=t&&(i.set(S,E+9),i.set(S,E+18),i.set(S,E+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),s=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var a=0;a<t;a+=4){var h=s-r[4*a+2],l=r[4*a+3],c=h/l,u=n[8*a+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(Qt(this.linearVelOverLifetime.x,Xa)?o.x=this.linearVelOverLifetime.x.getValue(c,u):o.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(Qt(this.linearVelOverLifetime.y,Xa)?o.y=this.linearVelOverLifetime.y.getValue(c,u):o.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(Qt(this.linearVelOverLifetime.z,Xa)?o.z=this.linearVelOverLifetime.z.getValue(c,u):o.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(Qt(this.linearVelOverLifetime.x,Xa)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,u):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(Qt(this.linearVelOverLifetime.y,Xa)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,u):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(Qt(this.linearVelOverLifetime.z,Xa)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,u):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*a;i[d]=o.x,i[d+1]=o.y,i[d+2]=o.z,i[d+3]=o.x,i[d+4]=o.y,i[d+5]=o.z,i[d+6]=o.x,i[d+7]=o.y,i[d+8]=o.z,i[d+9]=o.x,i[d+10]=o.y,i[d+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}(),fd=[10,32,64,160];function pd(t){for(var e=0;e<fd.length;e++){var i=fd[e];if(i>t)return i}return t||fd[0]}var md=function(t){function e(e,i,r){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new dd(e,i)),r&&(n.trailMesh=new nd(e,r));var s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}Ui(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder;for(var t,e=nn(this.meshes);!(t=e()).done;){t.value.onStart()}},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new _e;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e,i=nn(this.meshes);!(e=i()).done;){e.value.render(t)}},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(Ho),gd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).destroyed=!1,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:Oo.custom,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ki.removeParticle,ray:t})}}},r.maskManager=new Fo,i&&r.fromData(i),r}Ui(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===ji.CONSTANT_VEC3?e.add(r[1]):t=gh(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},i.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},i.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var s=r.first;r.removeNode(s),i=n[1]=s.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new td(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1,this.destroyed=!1},i.onStart=function(){var t=this;this.startEmit(),this.initEmitterTransform(),this.item.on("click",function(){var e;if((null==(e=t.interaction)?void 0:e.behavior)===Ki.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}})},i.onUpdate=function(t){this.frozen||this.update(t)},i.simulate=function(t){this.update(1e3*t),this.frozen=!0},i.update=function(t){var e=this;if(this.started){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,s=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,a=(i-n)/this.item.duration,h=this.timePassed,l=!1,c=function(){e.trails&&!l&&(l=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3];i<h?e.clearPointTrail(r):h>n&&e.updatePointTrail(r,a,s,n)}))};if(this.ended){if(this.item.endBehavior!==Yi.restart&&Yi.destroy===this.item.endBehavior){var u=o.last;u&&u.content[0]<this.time&&(this.destroyed=!0)}}else{var d=this.item.duration,f=this.lifetime;if(h<d){var p=1/s.rateOverTime.getValue(f),m=Math.floor((h-this.lastEmitTime)/p),g=m,v=p/m,y=i,x=r.maxCount;this.updateEmitterTransform(h);for(var b=function(){var t=o.first;return e.emissionStopped||o.length===x&&t&&t.content[0]-n>h},_=0;_<g&&_<x&&!b();_++){var w=this.createPoint(f);w.delay+=y+_*v,this.addParticle(w,x),this.lastEmitTime=h}for(var T=s.bursts,E=(null==T?void 0:T.length)-1,S=0;E>=0&&S<x&&!b();E--){var I=T[E],A=!I.disabled&&I.getGeneratorOptions(h,f);if(A){var C=s.burstOffsets[E],P=C&&C[A.cycleIndex]||[0,0,0];I.once&&this.removeBurst(E);for(var M=0;M<A.count&&S<x;M++){var R;if(b())break;var O=this.initPoint(this.shape.generate({total:A.total,index:A.index,burstIndex:M,burstCount:A.count}));O.delay+=y,S++,(R=O.transform).translate.apply(R,[].concat(P)),this.addParticle(O,x)}}}}else if(this.item.endBehavior===Yi.restart)c(),this.loopStartTime=i-d,this.lastEmitTime-=d,this.time-=d,s.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=d,t[2]-=d,t[3]&&(t[3].delay-=d)}),this.renderer.minusTimeForLoop(d);else{this.ended=!0,this.item.endBehavior===Yi.freeze&&(this.frozen=!0)}}c()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=nn(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(t){return t.dispose()})},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!t||!e)return i;for(var s=t.last,o=!1;!o;){var a=s.content[0],h=s.content[3];if(a>this.timePassed){var l=this.getPointPosition(h);i.push({center:l,size:h.transform.scale}),s.pre?s=s.pre:o=!0}++n>r&&(o=!0)}return i},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],s=new be,o=!1;if(r&&r.content)do{var a=r.content,h=a[0];a[2];var l=a[3];if(h>this.timePassed){var c=this.getPointPosition(l),u=t.ray,d=!1;u&&(d=!!u.intersectSphere({center:c,radius:t.radius},s)),d&&(this.clickedPoint=r,n.push(c),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var s=this.trails,o=this.getPointPosition(i),a=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],h=i.transform.getWorldScale().toArray(),l=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(l*=h[0]),s.sizeAffectsLifetime&&(c*=h[0]),s.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var u=n.getTrailStartPosition(t);u&&o.subtract(u)}n.addTrailPoint(t,o,{color:a,lifetime:c,size:l,time:r})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,s=t.gravity,o=void 0===s?[]:s,a=this.options.forceTarget,h=this.time-n,l=new be,c=be.fromArray(o);e.assignWorldTRS(l);var u=ba(new be,this.options,c,h,r,l,i);if(a){var d=a.target||[0,0,0],f=a.curve.getValue(h/r),p=1-f;u.x=u.x*p+d[0]*f,u.y=u.y*p+d[1]*f,u.z=u.z*p+d[2]*f}return u},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),s=e.particleFollowParent?No.IDENTITY:this.transform.getWorldMatrix(),o=t.position,a=s.transformPoint(o,new be),h=new ua({position:a,valid:!0}),l=t.direction;if(l=s.transformNormal(l,vd).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)wd.setElement(c,e.turbulence[c].getValue(i));Td.setFromVector3(wd.negate()),Sd.setFromEuler(Td).transformNormal(l).normalize()}var u,d=bd,f=_d;r.alignSpeedDirection?(f.copyFrom(l),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=be.Z.clone(),s.transformNormal(this.upDirectionWorld)),d.crossVectors(f,this.upDirectionWorld).normalize(),d.isZero()&&d.set(1,0,0)):(d.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((u=Ed)[0]=p.animationDelay.getValue(i),u[1]=p.animationDuration.getValue(i),u[2]=p.cycles.getValue(i));var m=xd;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),h.setRotation(m.x,m.y,m.z);var g=e.startColor.getValue(i);3===g.length&&(g[3]=1);var v=yd;if(e.start3DSize)v.x=e.startSizeX.getValue(i),v.y=e.startSizeY.getValue(i);else{var y=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);v.x=y,v.y=0===x?0:y/x}var b=l.clone();if(b.multiply(n),!e.particleFollowParent){var _=new be;this.transform.assignWorldTRS(void 0,void 0,_),v.x*=_.x,v.y*=_.y}return h.setScale(v.x,v.y,1),{size:v,vel:b,color:g,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:Ad(this.uvs,!0),gravity:e.gravity,sprite:u,dirY:f,dirX:d,transform:h}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&Qt(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:Oo.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i,this.destroyed=!1;var r,n,s,o,a,h=i.options,l=i.positionOverLifetime,c=void 0===l?{}:l,u=i.shape,d=null==c?void 0:c.gravityOverLifetime,f=_a(null==c?void 0:c.gravity),p=i.textureSheetAnimation,m=p?{animationDelay:gh(p.animationDelay||0),animationDuration:gh(p.animationDuration||1),cycles:gh(p.cycles||1),animate:p.animate,col:p.col,row:p.row,total:p.total||p.col*p.row}:void 0,g=!!(u&&u.turbulenceX||(null==u?void 0:u.turbulenceY)||(null==u?void 0:u.turbulenceZ));g&&(r=[gh(null!=(n=u.turbulenceX)?n:0),gh(null!=(s=u.turbulenceY)?s:0),gh(null!=(o=u.turbulenceZ)?o:0)]);this.name="ParticleSystem",this.shape=function(t){if(!t)return new bu;var e=Cn({radius:1,arc:360,angle:0,arcMode:Ji.RANDOM},t),i=t.type,r=_u[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==bi.NONE){var s=t.alignSpeedDirection,o=t.upDirection,a=void 0===o?[0,0,1]:o;n.alignSpeedDirection=s,n.upDirection=be.fromArray(a).normalize()}return n}(u),this.emission={rateOverTime:gh(i.emission.rateOverTime),burstOffsets:Id(null!=(a=i.emission.burstOffsets)?a:[]),bursts:(i.emission.bursts||[]).map(function(t){return new $u(t)})},this.textureSheetAnimation=m;var v,y,x=i.renderer||{},b=i.rotationOverLifetime;b&&((v={}).asRotation=!!b.asRotation,v.z=b.z?gh(b.z):gh(0),b.separateAxes&&(v.x=b.x&&gh(b.x),v.y=b.y&&gh(b.y))),(null==c?void 0:c.forceTarget)&&(y={target:c.target||[0,0,0],curve:gh(c.forceCurve||[ji.LINE,[[0,0],[1,1]]])});var _={x:c.linearX&&gh(c.linearX||0),y:c.linearY&&gh(c.linearY||0),z:c.linearZ&&gh(c.linearZ||0),asMovement:c.asMovement},w={x:c.orbitalX&&gh(c.orbitalX),y:c.orbitalY&&gh(c.orbitalY),z:c.orbitalZ&&gh(c.orbitalZ),center:c.orbCenter,asRotation:c.asRotation},T=i.sizeOverLifetime||{},E=i.colorOverLifetime,S=(null==T?void 0:T.separateAxes)?{separateAxes:!0,x:gh(T.x),y:gh(T.y)}:{separateAxes:!1,x:gh(("size"in T?T.size:T.x)||1)};x.anchor=x.anchor||[0,0];var I,A=xe.fromArray(x.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:gh(h.startLifetime),startDelay:gh(h.startDelay||0),startSpeed:gh(c.startSpeed||0),startColor:gh(h.startColor),looping:!1,maxCount:null!=(I=h.maxCount)?I:0,gravityModifier:gh(d||0),gravity:f,start3DSize:!!h.start3DSize,startTurbulence:g,turbulence:r,speedOverLifetime:c.speedOverLifetime&&gh(c.speedOverLifetime),linearVelOverLifetime:_,orbitalVelOverLifetime:w,forceTarget:y},h.startRotationZ&&(this.options.startRotation=gh(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=gh(h.startRotationX||0),this.options.startRotationY=gh(h.startRotationY||0),this.options.startRotationZ=gh(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=gh(h.startSizeX),this.options.startSizeY=gh(h.startSizeY)):(this.options.startSize=gh(h.startSize),this.options.sizeAspect=gh(h.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(this.engine,i.mask);var C={meshSlots:h.meshSlots,name:this.name,matrix:No.IDENTITY,shaderCachePrefix:"",renderMode:x.renderMode||Mi.BILLBOARD,side:x.side||gi.DOUBLE,gravity:f,blending:x.blending||pi.ALPHA,rotationOverLifetime:v,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:m,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:h.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:y,diffuse:x.texture?this.engine.findObject(x.texture):void 0,sizeOverLifetime:S,anchor:A};if(E){var P=E.color,M=E.opacity;C.colorOverLifetime={},M&&(C.colorOverLifetime.opacity=gh(E.opacity)),P&&(P[0]===ji.GRADIENT_COLOR?C.colorOverLifetime.color=E.color[1]:P[0]===ji.RGBA_COLOR?C.colorOverLifetime.color=To.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):Qt(P,To)&&(C.colorOverLifetime.color=P))}var R,O=[],D=[0,0,1,1];if(i.splits){var k=i.splits[0];D=(R=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(m&&!m.animate)for(var L=R?m.row:m.col,F=R?m.col:m.row,N=m.total||L*F,B=0,z=0;z<L;z++)for(var U=0;U<F&&B<N;U++,B++)O.push([z*D[2]/L+D[0],U*D[3]/F+D[1],D[2]/L,D[3]/F]);else O.push(D);this.uvs=O,C.textureFlip=R;var V,G=i.trails;G&&(this.trails={lifetime:gh(G.lifetime),dieWithParticles:!1!==G.dieWithParticles,sizeAffectsWidth:!!G.sizeAffectsWidth,sizeAffectsLifetime:!!G.sizeAffectsLifetime,inheritParticleColor:!!G.inheritParticleColor,parentAffectsPosition:!!G.parentAffectsPosition},G.mask&&this.maskManager.setMaskOptions(this.engine,G.mask),V={name:"Trail",matrix:No.IDENTITY,minimumVertexDistance:G.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(G.maxPointPerTrail)||32,blending:G.blending,texture:G.texture?this.engine.findObject(G.texture):void 0,opacityOverLifetime:gh(G.opacityOverLifetime||1),widthOverTrail:gh(G.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!G.occlusion,transparentOcclusion:!!G.transparentOcclusion,textureMap:G.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},G.colorOverLifetime&&G.colorOverLifetime[0]===ji.GRADIENT_COLOR&&(V.colorOverLifetime=G.colorOverLifetime[1]),G.colorOverTrail&&G.colorOverTrail[0]===ji.GRADIENT_COLOR&&(V.colorOverTrail=G.colorOverTrail[1])),this.renderer=new md(this.engine,C,V),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var j,H=i.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(j=H.radius)?j:.4,behavior:H.behavior});this.item.getHitTestParams=this.getHitTestParams},ks(e,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),e}(Ls);gd=ee([ln(jr.ParticleSystem)],gd);var vd=new be,yd=new xe,xd=new Wo,bd=new be,_d=new be,wd=new be,Td=new Wo,Ed=[0,0,0],Sd=new No;function Id(t){var e={};return Array.isArray(t)&&t.forEach(function(t){var i=Qt(t,Array),r=i?t[0]:t.index,n=e[r];n||(n=e[r]=[]),i?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),e}function Ad(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var Cd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(Qt(i,da))for(var r,n=nn(this.getChildTracks());!(r=n()).done;){var s=r.value;if(Qt(s,Kc)){if(i.getComponent(gd))for(var o,a=t.createTrack(iu,this,"ParticleTrack"),h=nn(s.getClips());!(o=h()).done;){var l=o.value,c=a.createClip(cd);c.start=l.start,c.duration=l.duration,c.endBehavior=l.endBehavior}if(i.getComponent(Yd))for(var u,d=t.createTrack(jd,this,"SpriteComponentTimeTrack"),f=nn(s.getClips());!(u=f()).done;){var p=u.value,m=d.createClip(Wd);m.start=p.start,m.duration=p.duration,m.endBehavior=p.endBehavior}if(i.getComponent(Yh))for(var g,v=t.createTrack(Hd,this,"EffectComponentTimeTrack"),y=nn(s.getClips());!(g=y()).done;){var x=g.value,b=v.createClip(Wd);b.start=x.start,b.duration=x.duration,b.endBehavior=x.endBehavior}break}}},e}(Yc);Cd=ee([ln(jr.ObjectBindingTrack)],Cd);var Pd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){return new Ic},e}(xc);Pd=ee([ln(jr.ActivationPlayableAsset)],Pd);var Md=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){var t=new Ac;return t.curve=gh(this.curveData),t.value=t.curve.getValue(0),t},e}(xc);ee([cn()],Md.prototype,"curveData",void 0),Md=ee([ln(jr.ColorPropertyPlayableAsset)],Md);var Rd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){var t=new Ac;return t.curve=gh(this.curveData),t.value=t.curve.getValue(0),t},e}(xc);ee([cn()],Rd.prototype,"curveData",void 0),Rd=ee([ln(jr.FloatPropertyPlayableAsset)],Rd);var Od=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){return new Dc},e}(xc);Od=ee([ln(jr.SubCompositionPlayableAsset)],Od);var Dd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){var t=new Ac;return t.curve=gh(this.curveData),t.value=t.curve.getValue(0),t},e}(xc);ee([cn()],Dd.prototype,"curveData",void 0),Dd=ee([ln(jr.Vector4PropertyPlayableAsset)],Dd);var kd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){var t=new Ac;return t.curve=gh(this.curveData),t.value=t.curve.getValue(0),t},e}(xc);ee([cn()],kd.prototype,"curveData",void 0),kd=ee([ln(jr.Vector3PropertyPlayableAsset)],kd);var Ld=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){var t=new Ac;return t.curve=gh(this.curveData),t.value=t.curve.getValue(0),t},e}(xc);ee([cn()],Ld.prototype,"curveData",void 0),Ld=ee([ln(jr.Vector2PropertyPlayableAsset)],Ld);var Fd=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i,this.mixer.trackInstance=this}return t.prototype.addChild=function(t){this.children.push(t)},t}(),Nd=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}Ui(e,t);var i=e.prototype;return i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=nn(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,o=nn(t.getChildTracks());!(s=o()).done;){var a=s.value;this.addSubTracksRecursive(a,e)}},ks(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=nn(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(dn);ee([cn()],Nd.prototype,"tracks",void 0),Nd=ee([ln(jr.TimelineAsset)],Nd);var Bd=function(){function t(t,e){this.masterTrackInstances=[],this.clips=[];for(var i,r={},n=nn(e);!(i=n()).done;){var s=i.value;r[s.key.getInstanceId()]=s.value}for(var o,a=nn(t.tracks);!(o=a()).done;){var h=o.value;Qt(h,Cd)&&h.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.evaluate=function(t,e){for(var i,r=nn(this.clips);!(i=r()).done;){i.value.evaluateAt(t)}for(var n,s=nn(this.masterTrackInstances);!(n=s()).done;){var o=n.value;this.tickTrack(o,e)}},e.compileTracks=function(t,e){for(var i,r=t,n={},s=nn(r);!(i=s()).done;){var o=i.value,a=o.createPlayableGraph(this.clips),h=o.createOutput(),l=new Fd(o,a,h);n[o.getInstanceId()]=l,o.parent||this.masterTrackInstances.push(l)}for(var c,u=nn(r);!(c=u()).done;)for(var d,f=c.value,p=n[f.getInstanceId()],m=nn(f.getChildTracks());!(d=m()).done;){var g=n[d.value.getInstanceId()];p.addChild(g)}for(var v,y=nn(e);!(v=y()).done;){var x=v.value;n[x.key.getInstanceId()].boundObject=x.value}for(var b,_=nn(this.masterTrackInstances);!(b=_()).done;){var w=b.value;this.updateTrackAnimatedObject(w)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=nn(t.mixer.clipPlayables);!(r=n()).done;){var s=r.value;s.getPlayState()===pc.Playing&&s.processFrame(i)}t.mixer.evaluate(i);for(var o,a=nn(t.children);!(o=a()).done;){var h=o.value;this.tickTrack(h,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=nn(t.children);!(e=i()).done;){var r=e.value;if(!r.boundObject){var n=r.trackAsset.updateAnimatedObject(t.boundObject);r.boundObject=n}this.updateTrackAnimatedObject(r)}},t}(),zd=[[0,0,1,1,0]],Ud=0,Vd=function(t){function e(){return t.apply(this,arguments)}Ui(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new _c;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(xc);Vd=ee([ln(jr.SpriteColorPlayableAsset)],Vd);var Gd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createTrackMixer=function(){return new Ec},e}(Yc),jd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(Yd)},e}(Gd),Hd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(Yh)},e}(Gd),Wd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.createPlayable=function(){return new Xd},e}(xc),Xd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(vc),Yd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=1,r.splits=zd,r.name="MSprite"+Ud++,i&&r.fromData(i),r}Ui(e,t);var i=e.prototype;return i.onUpdate=function(e){var i=this;t.prototype.onUpdate.call(this,e);var r,n=this.time,s=this.duration,o=this.textureSheetAnimation,a=null==(r=null==o?void 0:o.loop)||r;n>s&&a&&(n%=s);var h=Math.min(Math.max(n/s,0),1),l=this.renderer.texture.source.video;if(l&&(0===n?l.pause():l.play().catch(function(t){i.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),o){var c,u,d,f,p,m=o.total||o.row*o.col,g=0,v=0,y=1,x=1;if(this.splits){var b=this.splits[0];u=b[4],g=b[0],v=b[1],u?(y=b[3],x=b[2]):(y=b[2],x=b[3])}if(u?(d=1/o.row*y,f=1/o.col*x):(d=1/o.col*y,f=1/o.row*x),o.animate){var _=Math.round(h*(m-1)),w=Math.floor(_/o.col),T=_-w*o.col;p=u?[d*w,f*(o.col-T)]:[d*T,f*(1+w)]}else p=[0,f];null==(c=this.material.getVector4("_TexOffset"))||c.setFromArray([g+p[0],x+v-p[1],d,f])}this.time=n+e/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===Hs.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.updateGeometry=function(t){var e=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],i=e[0],r=e[1],n=Boolean(e[4]),s=n?e[3]:e[2],o=n?e[2]:e[3],a=n?-Math.PI/2:0,h=t.getAttributeData("aUV"),l=t.getAttributeData("aPos"),c=t.getIndexData(),u=[0,0];if(h&&l&&c){for(var d=h.length/2,f=0;f<d;f++){var p=3*f,m=2*f,g=l[p],v=l[p+1];u[0]=g,u[1]=v,Zu(u,u,a),h[m]=(u[0]+.5)*s+i,h[m+1]=(u[1]+.5)*o+r}this.geometry.setAttributeData("aPos",l.slice()),this.geometry.setAttributeData("aUV",h.slice()),this.geometry.setIndexData(c.slice()),this.geometry.setDrawCount(c.length)}this.geometry.subMeshes.length=0;for(var y,x=nn(t.subMeshes);!(y=x()).done;){var b=y.value;this.geometry.subMeshes.push({offset:b.offset,indexCount:b.indexCount,vertexCount:b.vertexCount})}},i.updateGeometryFromMultiSplit=function(){for(var t=this.splits,e=this.textureSheetAnimation,i=this.defaultGeometry,r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],n=[],s=[],o=[],a=0;a<2;a++)for(var h=0;h<2;h++){var l=4*(2*h+a),c=e?[0,0,1,1,t[0][4]]:t[2*h+a],u=c[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],d=((a+a+1)/2-1)/2,f=((h+h+1)/2-1)/2,p=c[0],m=c[1],g=c[4]?c[3]:c[2],v=c[4]?c[2]:c[3],y=[r[0]/2+d,r[1]/2+f,r[2]/2+d,r[3]/2+f,r[4]/2+d,r[5]/2+f,r[6]/2+d,r[7]/2+f];n.push(u[0]*g+p,u[1]*v+m,u[2]*g+p,u[3]*v+m,u[4]*g+p,u[5]*v+m,u[6]*g+p,u[7]*v+m),o.push(1*y[0],1*y[1],0,1*y[2],1*y[3],0,1*y[4],1*y[5],0,1*y[6],1*y[7],0),s.push(l,1+l,2+l,2+l,1+l,3+l)}i.setAttributeData("aPos",new Float32Array(o)),i.setIndexData(new Uint16Array(s)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(s.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:zd,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var s=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(s):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var o,a=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new we).setFromArray(a)),this.duration=null!=(o=e.duration)?o:this.item.duration},e}(Hl);Yd=ee([ln(jr.SpriteComponent)],Yd);var qd=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(Ql(Bi)),Kd=function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return Be(t),t}if(function(t){return ed[t]}("offscreen_canvas"))return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?le(this.elements,t):t.remove()},t}(),Zd=new Kd,Jd=function(){function t(t){this.width=0,this.height=0,this.autoResize=fr.fixed,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,s=t.textOverflow,o=void 0===s?ur.clip:s,a=t.textVerticalAlign,h=void 0===a?xr.top:a,l=t.textAlign,c=void 0===l?vr.left:l,u=t.letterSpace,d=void 0===u?0:u,f=t.fontSize,p=t.lineHeight,m=void 0===p?f:p;this.letterSpace=d,this.overflow=o,this.textVerticalAlign=h,this.textAlign=c,this.width=n,this.height=i,this.lineHeight=m},e.getOffsetY=function(t,e,i,r,n){var s=t.fontScale,o=(i-r)/3,a=r,h=void 0!==n?n:i*(e-1),l=0;switch(this.textVerticalAlign){case xr.top:l=a+o;break;case xr.middle:l=(this.height*s-h+a)/2;break;case xr.bottom:l=this.height*s-h-o}return l},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case vr.left:i=0;break;case vr.middle:i=(this.width*t.fontScale-e)/2;break;case vr.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),$d=function(){function t(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0,this.update(t)}return t.prototype.update=function(t){var e,i,r,n,s,o,a,h=t.textColor,l=void 0===h?[1,1,1,1]:h,c=t.fontSize,u=void 0===c?40:c,d=t.outline,f=t.shadow,p=t.fontWeight,m=void 0===p?"normal":p,g=t.fontStyle,v=void 0===g?"normal":g,y=t.fontFamily,x=void 0===y?"sans-serif":y;(this.textColor=[].concat(l),this.textWeight=m,this.fontStyle=v,this.fontFamily=x,this.fontSize=u,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,d&&(null!=(e=d.outlineWidth)?e:0)>0)&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=d.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=d.outlineWidth)?r:0);(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,f)&&(this.hasShadow=!0,this.shadowBlur=null!=(n=f.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(s=f.shadowColor)?s:[0,0,0,1]),this.shadowOffsetX=null!=(o=f.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=f.shadowOffsetY)?a:0);this.fontOffset=0,this.fontStyle!==Tr.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),Qd=function(){function t(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var e=t.prototype;return e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){ze(t)?this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("Risky font family, ignored:",t)},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,s=e.textWeight,o=e.fontStyle,a=(t||i*r).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(n)?a+=n:a+='"'+n+'"',s!==_r.normal&&(a=s+" "+a),o!==Tr.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],s=i[1],o=i[2],a=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*o+", "+a+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.shadowColor,r=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,o=i[0],a=i[1],h=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*a+", "+255*h+", "+l+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-s)},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var s=this.context;s.save(),this.canvas.width=t,this.canvas.height=e,s.setTransform(1,0,0,1,0,0),i||(s.translate(0,e),s.scale(1,-1)),s.clearRect(0,0,t,e),s.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(s),s.restore();var o=s.getImageData(0,0,t,e),a=To.createWithData(this.engine,{data:new Uint8Array(o.data),width:o.width,height:o.height},{flipY:i,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=a,this.material.setTexture("_MainTex",a)}},e.initTextBase=function(t){this.engine=t,this.canvas=Zd.getCanvas(),Zd.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},t}(),tf=0,ef=function(t){function e(e){var i;(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+tf++,i.canvas=Zd.getCanvas(),Zd.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0});var r=i.getDefaultProps().options;return i.updateWithOptions(r),i}Ui(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=nn(this.materials);!(i=r()).done;){var n=i.value,s=this.transform.size.x,o=this.transform.size.y,a=this.getTextureExpandScale();s*=a[0],o*=a[1],n.setVector2("_Size",new xe(s,o))}},i.render=function(t){this.maskManager.drawStencilMask(t,this),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.resetState(),this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new we(1,1,1,1))},i.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},i.updateWithOptions=function(t){this.textStyle?this.textStyle.update(t):this.textStyle=new $d(t),this.textLayout?this.textLayout.update(t):this.textLayout=new Jd(t),this.text=t.text.toString()},i.getLineCount=function(t){var e=this.context,i=this.textLayout,r=i.letterSpace,n=i.overflow;this.maxLineWidth=0;var s=this.textLayout.width+this.textStyle.fontOffset,o=1,a=0,h=0;e&&(e.font=this.getFontDesc(this.textStyle.fontSize));for(var l=0;l<t.length;l++){var c,u,d=t[l],f=null!=(u=null==e||null==(c=e.measureText(d))?void 0:c.width)?u:0;h>0&&(a+=r),n===ur.display?"\n"===d?(o++,a=0,h=0):(a+=f,h++,this.maxLineWidth=Math.max(this.maxLineWidth,a)):((a+f>s&&l>0||"\n"===d)&&(o++,this.maxLineWidth=Math.max(this.maxLineWidth,a),a=0,h=0),"\n"!==d&&(a+=f,h++))}return o},i.setLineHeight=function(t){var e=this.textStyle.fontSize,i=Math.max(e,t);this.textLayout.lineHeight!==i&&(this.textLayout.lineHeight=i,this.isDirty=!0)},i.updateTexture=function(t){var e=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var i=this.textStyle,r=this.textLayout,n=i.fontScale;r.autoResize===fr.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var s=(r.width+i.fontOffset)*n,o=r.height*n,a=i.fontSize*n,h=r.lineHeight*n;i.fontDesc=this.getFontDesc(a);var l=Array.from(this.text||""),c=this.getEffectPadding(),u=c.padL,d=c.padR,f=c.padT,p=c.padB,m=0!==(u|d|f|p),g=m?Math.ceil(s+u+d):s,v=m?Math.ceil(o+f+p):o,y=m?u:0,x=m?t?f:p:0;this.effectScaleX=s>0?g/s:1,this.effectScaleY=o>0?v/o:1;var b=.0123044998279225;this.transform.setSize(s*b/n,o*b/n),this.renderToTexture(g,v,t,function(t){e.maxLineWidth>s&&r.overflow===ur.display?t.font=e.getFontDesc(a*s/e.maxLineWidth):t.font=i.fontDesc;var o=i.textColor,c=o[0],u=o[1],d=o[2],f=o[3];t.fillStyle="rgba("+255*c+", "+255*u+", "+255*d+", "+f+")";for(var p=[],m=0,g=r.getOffsetY(i,e.lineCount,h,a),v=[],b=[],_=0;_<l.length;_++){var w=l[_],T=t.measureText(w);v.length>0&&(m+=r.letterSpace*n),(m+T.width>s&&_>0||"\n"===w)&&(p.push({y:g,width:m,chars:v,charOffsetX:b}),m=0,g+=h,v=[],b=[]),"\n"!==w&&(v.push(w),b.push(m),m+=T.width)}p.push({y:g,width:m,chars:v,charOffsetX:b});var E=i.isOutlined&&i.outlineWidth>0;E&&(i.hasShadow&&e.setupShadow(),e.setupOutline(),p.forEach(function(e){for(var n=r.getOffsetX(i,e.width),s=0;s<e.chars.length;s++){var o=e.chars[s],a=y+n+e.charOffsetX[s],h=x+e.y;t.strokeText(o,a,h)}}),i.hasShadow&&(t.shadowColor="transparent")),!E&&i.hasShadow&&e.setupShadow(),p.forEach(function(e){for(var n=r.getOffsetX(i,e.width),s=0;s<e.chars.length;s++){var o=e.chars[s],a=y+n+e.charOffsetX[s],h=x+e.y;t.fillText(o,a,h)}}),i.hasShadow&&(t.shadowColor="transparent")}),this.isDirty=!1}},i.renderText=function(t){this.updateTexture()},i.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},i.getEffectPadding=function(){var t=this.textStyle,e=(t.isOutlined&&t.outlineWidth>0?Math.ceil(2*t.outlineWidth*t.fontScale):0)+(t.hasShadow&&(t.shadowBlur>0||0!==t.shadowOffsetX||0!==t.shadowOffsetY)?Math.ceil((Math.abs(t.shadowOffsetX)+Math.abs(t.shadowOffsetY)+t.shadowBlur)*t.fontScale):0);return{padL:e,padR:e,padT:e,padB:e}},i.setAutoResize=function(t){this.textLayout.autoResize!==t&&(this.textLayout.autoResize=t,this.isDirty=!0)},i.setTextWidth=function(t){var e=Math.max(0,Number(t)||0),i=this.textLayout;i.width===e&&i.autoResize===fr.autoWidth||(i.autoResize=fr.autoHeight,i.width=e,this.isDirty=!0)},i.setTextHeight=function(t){var e=Math.max(0,Number(t)||0);if(0!==e){var i=this.textLayout;i.height!==e&&(i.height=e,this.isDirty=!0)}},i.setFontSize=function(t){var e=Math.max(1,Number(t)||1);this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.isDirty=!0)},i.setOutlineWidth=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},i.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},i.setShadowBlur=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},i.setShadowColor=function(t){var e=null!=t?t:[0,0,0,1];this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},i.setShadowOffsetX=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},i.setShadowOffsetY=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},i.getTextWidth=function(){var t,e,i,r=this.context;if(!r)return null!=(e=null==(t=this.textLayout)?void 0:t.width)?e:0;var n=(null!=(i=this.text)?i:"").toString(),s=this.textLayout,o=this.textStyle,a=o.fontScale||1,h=o.fontSize*a;r.font=this.getFontDesc(h);for(var l=0,c=0,u=0;u<n.length;u++){var d=n[u];"\n"!==d?(c+=(s.letterSpace||0)*a,c+=r.measureText(d).width):(l=Math.max(l,c),c=0)}var f=(l=Math.max(l,c))/a,p=Math.ceil(f-(o.fontOffset||0)-1e-4)+2;return Math.max(0,p)},i.getDefaultProps=function(){return{id:"default-id-"+Math.random().toString(36).substr(2,9),item:{id:"default-item-"+Math.random().toString(36).substr(2,9)},dataType:jr.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:_r.normal,letterSpace:0,textAlign:vr.middle,fontStyle:Tr.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(Hl);ri(ef=ee([ln(jr.TextComponent)],ef),[Qd]);var rf=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(Ql(Bi)),nf=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(dn),sf=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e}(dn);ee([cn()],sf.prototype,"buffer",void 0),sf=ee([ln(jr.BinaryAsset)],sf);var of=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=un(e);if(r)for(var n,s=nn(Object.keys(r));!(n=s()).done;){var o=n.value,a=e[o];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(a)?i[o]=a:Ye(a)?(i[o]||(i[o]=[]),t.serializeArrayProperty(a,i[o],0)):dn.is(a)?i[o]={id:a.getInstanceId()}:Ke(a)&&(i[o]||(i[o]={}),t.serializeObjectProperty(a,i[o],0))}for(var h,l=nn(Object.keys(e.defination));!(h=l()).done;){var c=h.value,u=e.defination[c];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?i[c]=u:Ye(u)?(i[c]||(i[c]=[]),t.serializeArrayProperty(u,i[c],0)):dn.is(u)?i[c]={id:u.getInstanceId()}:Ke(u)&&(i[c]||(i[c]={}),t.serializeObjectProperty(u,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=un(i),n=i.engine;if(r)for(var s,o=nn(Object.keys(r));!(s=o()).done;){var a=s.value,h=e[a];if(void 0!==h){var l=r[a].type;i[a]=t.deserializeProperty(h,n,0,l)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return Qt(t,Int8Array)||Qt(t,Uint8Array)||Qt(t,Uint8ClampedArray)||Qt(t,Int16Array)||Qt(t,Uint16Array)||Qt(t,Int32Array)||Qt(t,Uint32Array)||Qt(t,Float32Array)||Qt(t,Float64Array)||Qt(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(Ke(t)&&1===Object.keys(t).length&&"id"in t&&Xe(t.id))},t.checkGLTFNode=function(t){return Ke(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return Je(t)||Qt(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,s){if(void 0===s&&(s=!0),!(r>14)){if(Ye(e)){for(var o,a=[],h=nn(e);!(o=h()).done;){var l=o.value;a.push(t.deserializeProperty(l,i,r+1,n,s))}return a}if(t.checkDataPath(e)){var c=i.findObject(e);return s?c:e}if(Ze(e)){var u;u=n?new n:{};for(var d,f=nn(Object.keys(e));!(d=f()).done;){var p=d.value;u[p]=t.deserializeProperty(e[p],i,r+1,void 0,s)}return u}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,s=nn(Object.keys(e));!(n=s()).done;){var o=n.value,a=e[o];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[o]=a:Ye(a)?(i[o]||(i[o]=[]),t.serializeArrayProperty(a,i[o],r+1)):dn.is(a)?i[o]={id:a.getInstanceId()}:Ke(a)&&(i[o]||(i[o]={}),t.serializeObjectProperty(a,i[o],r+1))}}},t.serializeArrayProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[n]=s:Ye(s)?(i[n]||(i[n]=[]),t.serializeArrayProperty(s,i[n],r+1)):dn.is(s)?i[n]={id:s.getInstanceId()}:Ke(s)&&(i[n]||(i[n]={}),t.serializeObjectProperty(s,i[n],r+1))}}},t}(),af=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case jr.Material:e=Lo.create(this.engine);break;case jr.Geometry:e=wl.create(this.engine);break;case jr.Texture:e=To.create(this.engine);break;default:var n=hn(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),of.deserialize(r,e),e;console.error("Constructor for DataType: "+r.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}();function hf(t,e){if(!t.includes(e))return t.push(e),!0}function lf(t){if(Number.isFinite(t))return[ji.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===ji.CONSTANT)return[ji.CONSTANT,t[1]];if("lines"===e)return[ji.LINE,t[1]];if(e===ji.LINE){var r=i.map(function(t){return[Wi.LINE,t]});return[ji.BEZIER_CURVE,r]}return"curve"===e||e===ji.CURVE?[ji.BEZIER_CURVE,Pf(i)]:t}}function cf(t,e){return Array.isArray(t)&&"random"===t[0]?[ji.CONSTANT,t[1][e]]:lf(t)}function uf(t){return t&&"color"===t[0]?mf(t[1],!0):[1,1,1,1]}function df(t,e){if(t)return"colors"===t[0]?[ji.COLORS,t[1].map(function(t){return mf(t,e)})]:"gradient"===t[0]?pf(t[1],e):"color"===t[0]?[ji.RGBA_COLOR,mf(t[1],e)]:t}function ff(t){return t&&"random"===t[0]?[ji.RANDOM,t[1]]:lf(t)}function pf(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),s=mf(t[r],e);i.push([n,s[0],s[1],s[2],s[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[ji.GRADIENT_COLOR,i]}}function mf(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else Qt(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=function(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}(i)),i}function gf(t,e){return Array.isArray(t)?t[0]===ji.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&pf(t[1],e):pf(t,e)}function vf(t){if(t){if(3===t.length)return[ji.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===ji.BEZIER_PATH||e===ji.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],s=i[2],o=Pf(r);if(!s){s=[];for(var a=0;a<n.length;a++){var h=n[a].slice();0===a?s.push(h):a<n.length-1?(s.push(h),s.push(h)):s.push(h)}}return[ji.BEZIER_CURVE_PATH,[o,n,s]]}return t}}function yf(t){for(var e,i=nn(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function xf(t){for(var e,i=nn(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var bf,_f=Math.cos,wf=Math.sin,Tf=Math.PI/180,Ef=180/Math.PI;function Sf(t,e){return t?[t[0]-.5,.5-t[1]]:e?Af[e]:[0,0]}var If,Af=((bf={})[Oi.PARTICLE_ORIGIN_CENTER]=[0,0],bf[Oi.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],bf[Oi.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],bf[Oi.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],bf[Oi.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],bf[Oi.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],bf[Oi.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],bf[Oi.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],bf[Oi.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],bf);function Cf(t,e,i,r){var n=i[0],s=i[1],o=r[0],a=o-n;return[[n+(o-n)/3,s+(t*=a)/3],[o-(o-n)/3,r[1]-(e*=a)/3]]}function Pf(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var o=t[s][3]*(e-i),a=t[s+1][2]*(e-i),h=[t[s][0],t[s][1]],l=[t[s+1][0],t[s+1][1]];if(h[0]!=l[0]){var c=Cf(o,a,h,l),u=c[0],d=c[1];n[n.length-1].push(u[0]),n[n.length-1].push(u[1]),n.push([d[0],d[1],l[0],l[1]])}else n[n.length-1].push(l[0]),n[n.length-1].push(l[1])}return n.map(function(t,e){return 0===e?[Wi.EASE_OUT,t]:e===n.length-1?[Wi.EASE_IN,t]:[Wi.EASE,t]})}var Mf=new Map,Rf=new Map;function Of(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===Ci.null&&t.endBehavior===Yi.destroy&&(t.endBehavior=Yi.freeze)})}),t.version=ci["2_1"],t}function Df(t){for(var e,i,r,n=function(){var t=h.value;3!==t.endBehavior&&1!==t.endBehavior||(t.endBehavior=Yi.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===Ci.particle&&(t.content.filter&&delete t.content.filter)});for(var e,i=nn(t.items);!(e=i()).done;){var r=e.value;l[r.id]=ei(),r.oldId=r.id,r.id=l[r.id],c[r.id]=r}t.items.forEach(function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=l[r]+"^"+n}else e.parentId=l[e.parentId];s.items.push(e),t.items[i]={id:e.id}});var n=Cn({},t,{timelineAsset:{id:""},sceneBindings:[]});s.compositions.push(n),function(t,e,i){for(var r,n=[],s=[],o=[],a={tracks:[],id:ei(),dataType:"TimelineAsset"},h=nn(t.items);!(r=h()).done;){var l=e[r.value.id],c=[],u={id:ei(),dataType:"ActivationPlayableAsset"};o.push(u);var d={id:ei(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:u.id}}]};if(c.push({id:d.id}),s.push(d),l.type!==Ci.particle){var f={id:ei(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};o.push(f);var p={id:ei(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:f.id}}]};c.push({id:p.id}),s.push(p)}if(l.type===Ci.sprite||l.type===Ci.text){var m={id:ei(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime};o.push(m);var g={id:ei(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:m.id}}]};c.push({id:g.id}),s.push(g)}if(l.type===Ci.composition){var v={id:ei(),dataType:"SubCompositionPlayableAsset"};o.push(v);var y={id:ei(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:v.id}}]};c.push({id:y.id}),s.push(y)}var x={id:ei(),dataType:"ObjectBindingTrack",children:c,clips:[]};s.push(x),a.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:l.id}})}for(var b,_=[],w=nn(s);!(b=w()).done;){var T=b.value;_.push({id:T.id})}t.timelineAsset={id:a.id},t.sceneBindings=n,i.miscs.push(a);for(var E,S=nn(s);!(E=S()).done;){var I=E.value;i.miscs.push(I)}for(var A,C=nn(o);!(A=C()).done;){var P=A.value;i.miscs.push(P)}}(n,c,s)},s=Cn({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),o=nn(s.images);!(i=o()).done;){i.value.id=ei()}if(null!=(e=s).textures||(e.textures=[]),s.textures.forEach(function(t){var e;t.id=ei(),t.dataType=jr.Texture,t.source={id:null==(e=s.images[t.source])?void 0:e.id}}),s.textures.length<s.images.length)for(var a=s.textures.length;a<s.images.length;a++)s.textures.push({id:ei(),dataType:jr.Texture,source:{id:s.images[a].id},flipY:!0});t.bins&&(r=t.bins,s.bins=r.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:ei()}}));for(var h,l={},c={},u=nn(t.compositions);!(h=u()).done;)n();for(var d,f=nn(s.items);!(d=f()).done;){var p=d.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:s.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var g=p.content.trails.texture;p.content.trails.texture={id:s.textures[g].id}}}if(p.transform){var v,y,x,b=[].concat(null!=(v=p.transform.position)?v:[0,0,0]),_=[].concat(null!=(y=p.transform.rotation)?y:[0,0,0]),w=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:_[0],y:_[1],z:_[2]},scale:{x:w[0],y:w[1],z:w[0]}}}),p.type===Ci.sprite&&(p.transform.size={x:w[0],y:w[1]},p.transform.scale={x:1,y:1,z:1}),p.type===Ci.sprite){var T=p.content;T.renderer||(T.renderer={});var E,S,I,A,C=T.renderer,P=Sf(C.anchor,C.particleOrigin),M=p.transform.size;if(!C.anchor&&void 0!==C.particleOrigin)p.transform.position.x+=-P[0]*(null!=(E=null==M?void 0:M.x)?E:1),p.transform.position.y+=-P[1]*(null!=(S=null==M?void 0:M.y)?S:1);p.transform.anchor={x:P[0]*(null!=(I=null==M?void 0:M.x)?I:1),y:P[1]*(null!=(A=null==M?void 0:M.y)?A:1)}}}if(p.type===Ci.particle){var R=p.content;R.renderer||(R.renderer={});var O=R.renderer;R.renderer.anchor=Sf(O.anchor,O.particleOrigin)}if(p.type===Ci.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var D=p.pn,k=t.plugins,L=void 0===k?[]:k;void 0!==D&&Number.isInteger(D)&&(p.pluginName=L[D])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=l[p.content.options.target]),p.type===Ci.spine&&t.spines&&0!==t.spines.length&&Xf(t.spines[p.content.options.spine],p.content,s),p.type!==Ci.sprite&&p.type!==Ci.particle&&p.type!==Ci.mesh&&p.type!==Ci.skybox&&p.type!==Ci.light&&"camera"!==p.type&&p.type!==Ci.tree&&p.type!==Ci.interact&&p.type!==Ci.camera&&p.type!==Ci.text&&p.type!==Ci.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],s.components.push(p.content),p.content.id=ei(),p.content.item={id:p.id},p.dataType=jr.VFXItemData,p.components.push({id:p.content.id})),p.type!==Ci.null&&p.type!==Ci.composition||(p.components=[],p.dataType=jr.VFXItemData),p.type){case Ci.sprite:p.content.dataType=jr.SpriteComponent;break;case Ci.particle:p.content.dataType=jr.ParticleSystem;break;case Ci.mesh:p.content.dataType=jr.MeshComponent;break;case Ci.skybox:p.content.dataType=jr.SkyboxComponent;break;case Ci.light:p.content.dataType=jr.LightComponent;break;case"camera":p.content.dataType=jr.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case Ci.tree:p.content.dataType=jr.TreeComponent;break;case Ci.interact:p.content.dataType=jr.InteractComponent;break;case Ci.camera:p.content.dataType=jr.CameraController;break;case Ci.text:p.content.dataType=jr.TextComponent;break;case Ci.spine:p.content.dataType=jr.SpineComponent}}return s.version=ci["3_0"],s}function kf(t){for(var e,i=nn(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===jr.ShapeComponent){var n=r;if(n.type===Pr.Custom){var s,o=n;(null==(s=o.shapes)?void 0:s.length)>0&&o.shapes[0].fill&&(o.fill=o.shapes[0].fill);for(var a,h=new Array(o.easingIns.length),l=new Array(o.easingOuts.length).fill(!1),c=nn(o.shapes);!(a=c()).done;)for(var u,d=nn(a.value.indexes);!(u=d()).done;){var f=u.value,p=o.points[f.point],m=o.easingIns[f.easingIn],g=o.easingOuts[f.easingOut];h[f.easingIn]||(m.x-=p.x,m.y-=p.y,h[f.easingIn]=!0),l[f.easingOut]||(g.x-=p.x,g.y-=p.y,l[f.easingOut]=!0)}}}}return t.version=ci["3_2"],t}function Lf(t){Mf.clear(),Rf.clear();for(var e,i=t.compositions,r=t.items,n=nn(t.components);!(e=n()).done;){var s=e.value;Mf.set(s.id,s)}for(var o,a=nn(r);!(o=a()).done;){var h=o.value;Rf.set(h.id,h)}for(var l,c=nn(i);!(l=c()).done;){jf(l.value)}return t.version=ci["3_3"],t}function Ff(t){var e;null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var i,r=nn(t.items);!(i=r()).done;){var n=i.value;if(n.type===Ci.sprite){var s=Mf.get(n.components[0].id);if(s){var o,a=s.renderer.shape,h=void 0;if(Number.isInteger(a))h=null==(o=t.shapes)?void 0:o[a];else h=a;s.renderer.shape=h}}}for(var l,c=t.compositionId,u={},d=nn(t.compositions);!(l=d()).done;){var f=l.value,p=ei();u[f.id]=p,f.id===c&&(t.compositionId=p),f.id=p;var m={id:ei(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings,item:{id:f.id}};f.timelineAsset=void 0,f.sceneBindings=void 0,f.components=[{id:m.id}],t.components.push(m)}for(var g,v=nn(t.items);!(g=v()).done;){var y=g.value;if(y.content){var x=y.content.options;x&&void 0!==x.refId&&(x.refId=u[x.refId])}}return t.version=ci["3_4"],t}function Nf(t){for(var e,i={},r=nn(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var s,o=nn(t.compositions);!(s=o()).done;)for(var a,h=s.value,l=nn(h.components);!(a=l()).done;){i[a.value.id].item.id=h.id}for(var c,u=nn(t.components);!(c=u()).done;){var d=c.value;if(d.dataType===jr.SpriteComponent){var f=d,p=f.renderer.shape;if(!(null==p||"aPoint"in p&&"index"in p)){var m=Gf(p);f.geometry={id:m.id},t.geometries.push(m)}}if(d.dataType===jr.ShapeComponent){var g=d;if(g.fills=[],g.fill){var v={type:Sr.Solid,color:g.fill.color};g.fills.push(v)}if(delete g.fill,g.strokes=[],g.stroke){var y={type:Sr.Solid,color:g.stroke.color};g.strokes.push(y),g.strokeWidth=g.stroke.width,g.strokeCap=g.stroke.cap,g.strokeJoin=g.stroke.join,delete g.stroke}}}return t.version=ci["3_5"],t}function Bf(t){if(t.components)for(var e,i=nn(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===jr.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}(r.dataType===jr.TextComponent||r.dataType===jr.RichTextComponent&&r.options)&&Uf(r.options),r.dataType===jr.TextComponent&&Vf(r.options)}return t.version=ci["3_6"],t}function zf(t){for(var e,i=function(){var i=e.value;if(i.type===Ci.text&&i.transform){for(var r,n,s,o=t.components.find(function(t){return i.components[0].id===t.id}),a=i.transform.scale.x/(null!=(n=null==(r=o.options)?void 0:r.textWidth)?n:1)/.0123,h=nn(t.items);!(s=h()).done;){var l=s.value;l.parentId===i.id&&l.transform&&(l.transform.scale.x*=i.transform.scale.x/a,l.transform.scale.y*=i.transform.scale.y/a,l.transform.scale.z*=i.transform.scale.z/a)}i.transform.scale.x=a,i.transform.scale.y=a,i.transform.scale.z=a}},r=nn(t.items);!(e=r()).done;)i();for(var n,s=new Map,o=new Map,a=new Map,h=nn(t.components);!(n=h()).done;){var l=n.value;a.set(l.id,l)}for(var c,u=nn(t.items);!(c=u()).done;){var d=c.value;d.children=[],s.set(d.id,d)}for(var f,p=nn(t.compositions);!(f=p()).done;){var m=f.value;m.children=[];for(var g,v=nn(m.components);!(g=v()).done;){var y=g.value,x=a.get(y.id);if(x.dataType===jr.CompositionComponent){for(var b,_=x,w=nn(_.items);!(b=w()).done;){var T=b.value,E=s.get(T.id);void 0===E.parentId&&m.children.push({id:E.id})}delete _.items}}o.set(m.id,m)}for(var S,I=nn(t.items);!(S=I()).done;){var A=S.value;if(A.parentId){var C=s.get(A.parentId);C&&C.children.push({id:A.id})}}return t.version=ci["3_7"],t}function Uf(t){t&&void 0===t.TextVerticalAlign&&void 0===t.TextVerticalAlign&&(t.TextVerticalAlign=t.textBaseline)}function Vf(t){if(t&&t.textColor){var e,i=t.textColor;t.textColor=[i[0]/255,i[1]/255,i[2]/255,null!=(e=i[3])?e:1]}}function Gf(t,e){void 0===e&&(e="形状");for(var i=Ku(t),r=i.index,n=void 0===r?[]:r,s=i.aPoint,o=void 0===s?[]:s,a=new Float32Array(o),h=[],l=[],c=0;c<a.length;c+=6)l.push(o[c+2],o[c+3]),h.push(a[c],a[c+1],0);var u=h.length/3,d=n.length,f=4*h.length,p=f+4*l.length,m=2*n.length,g={mode:Wr.TRIANGLES,vertexData:{vertexCount:u,channels:[]},name:e,indexFormat:Kr.UInt16,indexOffset:p,buffer:"",id:ei(),dataType:jr.Geometry,subMeshes:[]};g.vertexData.channels.push({semantic:Jr.Position,offset:0,format:Yr.Float32,dimension:3}),g.vertexData.channels.push({semantic:Jr.Uv,offset:f,format:Yr.Float32,dimension:2}),g.subMeshes.push({offset:0,indexCount:d,vertexCount:u});var v=new ArrayBuffer(p+m+(m%4==0?0:2)),y=new Float32Array(v);y.set(h,0),y.set(l,h.length),new Uint16Array(v,p).set(n,0);var x=new Uint8Array(v).slice(0,p+m);return g.binaryData=x,g}function jf(t){for(var e,i=nn(t.items);!(e=i()).done;){var r=e.value,n=Rf.get(r.id);if(!n)return;if(n.type===Ci.sprite||n.type===Ci.particle||n.type===Ci.spine||n.type===Ci.text||n.type===Ci.richtext||n.type===Ci.video||n.type===Ci.shape){var s=Mf.get(n.components[0].id);s&&Hf(s)}}}function Hf(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==Bs.NONE&&(i===Bs.MASK?(t.mask={isMask:!0},If=t.id):i!==yi.OBSCURED&&i!==yi.REVERSE_OBSCURED||(t.mask={inverted:i===yi.REVERSE_OBSCURED,reference:{id:If}}))}function Wf(t){if(t)for(var e,i=nn(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],s=Array.isArray(n);s&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?vf(n):lf(n):s||"object"!=typeof n||Wf(n)}}function Xf(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}function Yf(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},s={path:vf(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:lf(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:lf(n.linearX),linearY:lf(n.linearY),linearZ:lf(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:lf(n.orbitalX),orbitalY:lf(n.orbitalY),orbitalZ:lf(n.orbitalZ),speedOverLifetime:lf(n.speedOverLifetime)};xf(s);var o={options:{startColor:uf(r.startColor)},positionOverLifetime:s};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var a=t.rotationOverLifetime;if(a){var h=o.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};h.separateAxes?(h.x=lf(a.x),h.y=lf(a.y),h.z=lf(a.z)):h.z=lf(a.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=o.colorOverLifetime={opacity:lf(l.opacity)};l.color&&(c.color=gf(l.color))}var u=t.sizeOverLifetime;return u&&(o.sizeOverLifetime={separateAxes:u.separateAxes,size:lf(u.size),x:lf(u.x),y:lf(u.y),z:lf(u.z)}),o}var qf="2.9.0-alpha.1",Kf=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Zf=/^(\d+)\.(\d+)$/,Jf=!1;function $f(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,s,o=null!=(n=Kf.exec(r))?n:[],a=null!=(s=Kf.exec(qf))?s:[],h=o[1],l=o[2],c=a[1],u=a[2];return Number(c)<Number(h)||Number(c)===Number(h)&&Number(u)<Number(l)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+qf+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach(function(t){t.items.forEach(function(t){t.type!==Ci.mesh&&t.type!==Ci.light||(t.endBehavior=1===t.endBehavior?Yi.destroy:t.endBehavior)})})}(t),Kf.test(t.version))return Jf="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),zf(Bf(Nf(Ff(Lf(kf(Df(Of(function(t){var e;Qf=ci["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(Qf=ci["1_3"]);var r,n=(t.requires||[]).slice(),s=t.images.map(function(e,i){return function(t,e,i){var r=i[e];if("string"==typeof t)return{id:ei(),renderLevel:r,url:t};if(t.template)return{id:ei(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ei(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ei(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}(e,i,t.imageTags||[])}),o=t.textures||s.map(function(t,e){return{source:e,flipY:!0}}),a={plugins:i,shapes:t.shapes||[],type:"ge",version:Qf,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map(function(t){return function(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:Cn({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return function(t,e){void 0===e&&(e={});var i,r,n,s,o,a,h,l=Ci.base,c=t.endBehavior,u=NaN;t.content?(l=t.type||Ci.plugin,h=t.pn,a=t.pluginName,s=t.content,n=t.content,isNaN(h)&&!a&&(a=s.options.type),t.duration&&(u=t.duration),r=t.transform||v(n.transform)):t.particle?(l=Ci.particle,r=v((n=t.particle).transform,Jf,!0),s=function(t){var e=t.options,i=t.transform,r={type:bi.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=Cn({},t.shape,{type:bi[s]}),t.shape.upDirection){var o=t.shape.upDirection,a=o[0],h=o[1],l=o[2];0===a&&0===h&&0===l&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=ff(e.turbulenceX),r.turbulenceY=ff(e.turbulenceY),r.turbulenceZ=ff(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return yf(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return yf(t)})),c.rateOverTime&&(c.rateOverTime=ff(c.rateOverTime));var u={renderer:t.renderer,shape:r,splits:t.splits,emission:c,options:{startLifetime:ff(e.startLifetime),start3DSize:!!e.start3DSize,startSize:ff(e.startSize),startSizeX:ff(e.startSizeX),startSizeY:ff(e.startSizeY),sizeAspect:ff(e.sizeAspect),maxCount:e.maxCount,startDelay:ff(e.startDelay),startColor:df(e.startColor,!0),startRotationZ:ff(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(u.options.startRotationX=ff(e.startRotationX),u.options.startRotationY=ff(e.startRotationY)),i&&i.path&&(u.emitterTransform={path:vf(i.path)});var d=t.sizeOverLifetime;d&&(d.separateAxes?u.sizeOverLifetime={separateAxes:!0,x:ff(d.x),y:ff(d.y)}:u.sizeOverLifetime={size:ff(d.size)});var f=t.velocityOverLifetime||{},p=f.speedOverLifetime;p=p?lf(p):void 0,u.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:lf(e.gravityModifier),startSpeed:ff(e.startSpeed),speedOverLifetime:p,asMovement:f.asMovement,linearX:ff(f.linearX),linearY:ff(f.linearY),linearZ:ff(f.linearZ),asRotation:f.asRotation,orbCenter:f.orbCenter,orbitalX:ff(f.orbitalX),orbitalY:ff(f.orbitalY),orbitalZ:ff(f.orbitalZ),forceTarget:f.forceTarget,target:f.target,forceCurve:lf(f.forceCurve)},xf(u.positionOverLifetime);var m=t.rotationOverLifetime;m&&(u.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:ff(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(u.rotationOverLifetime.y=lf(m.y),u.rotationOverLifetime.x=lf(m.x)));var g=t.colorOverLifetime;if(g){var v=u.colorOverLifetime={opacity:lf(g.opacity)};g.color&&(v.color=gf(g.color))}var y=t.textureSheetAnimation;y&&(u.textureSheetAnimation={row:y.row,col:y.col,total:y.total,animate:y.animate,cycles:lf(y.cycles),animationDelay:cf(y.animationDelay,0),animationDuration:cf(y.animationDuration,0)});var x=t.trails;x&&(u.trails={lifetime:ff(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:lf(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&gf(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&gf(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:ff(x.opacityOverLifetime)}),u.trails&&xf(u.trails);var b=t.interaction;return b&&(u.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),u}(n)):t.sprite?(l=Ci.sprite,s=function(t,e){var i=Yf(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=v(n.transform,!1,!0))):t.cal?(l=Ci.null,s=Yf(n=t.cal,r=v(n.transform,!1,!0))):t.ui?(l=Ci.interact,r=v((n=t.ui).transform),s=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Ei.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&uf(i.previewColor),behavior:i.behavior||Ii.NOTIFY};break;case"drag":e={type:Ei.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Ei.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(l=Ci.camera,r=v(n.transform),s=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var s,o={path:vf(null==(s=t.transform)?void 0:s.path),linearX:lf(null==n?void 0:n.translateX),linearY:lf(null==n?void 0:n.translateY),linearZ:lf(null==n?void 0:n.translateZ)};xf(o),r.positionOverLifetime=o}var a=t.rotationOverLifetime;if(a){var h={separateAxes:a.separateAxes,x:lf(null==a?void 0:a.rotateX),y:lf(null==a?void 0:a.rotateY),z:a.separateAxes?lf(null==a?void 0:a.rotateZ):lf(a.rotation)};xf(h),r.rotationOverLifetime=h}return r}(n)));if(null==(i=s.renderer)?void 0:i.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==ip&&d[1]==ip?delete s.renderer.anchor:e.requires&&hf(e.requires,"anchor")}if(n){var f,p,m=null==(f=n.options)?void 0:f.looping;if(m)c=Array.isArray(m)?m[1]?Yi.restart:Yi.destroy:Yi.restart;else c=c||(null==n||null==(p=n.options)?void 0:p.endBehavior)||Yi.destroy;n.options.renderLevel&&(o=n.options.renderLevel),isNaN(u)&&(u=n.options.duration)}var g={type:l,name:t.name,delay:t.delay,duration:u,id:t.id+"",transform:r,endBehavior:c,renderLevel:o,content:s};a?e.plugins?(hf(e.plugins,a),g.pn=e.plugins.indexOf(a)):g.pluginName=a:Number.isInteger(h)&&(g.pn=h);t.parentId&&(g.parentId=t.parentId+"");return g;function v(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var s=function(t,e,i,r){var n=_f(e*Tf/2),s=_f(i*Tf/2),o=_f(r*Tf/2),a=wf(e*Tf/2),h=wf(i*Tf/2),l=wf(r*Tf/2);return t[0]=a*s*o+n*h*l,t[1]=n*h*o-a*s*l,t[2]=n*s*l+a*h*o,t[3]=n*s*o-a*h*l,t}(ep,r.rotation[0],r.rotation[1],r.rotation[2]);r.rotation=function(t,e){var i,r,n,s=e[0],o=e[1],a=e[2],h=e[3],l=s+s,c=o+o,u=a+a,d=s*l,f=o*l,p=o*c,m=a*u,g=h*u,v=1-p-m,y=f-g,x=f+g,b=1-d-m,_=a*l-h*c,w=a*c+h*l,T=1-d-p;return t[1]=Math.asin((r=-1,(i=-_)>(n=1)?n:i<r?r:i))*Ef,Math.abs(_)<.9999999?(t[0]=Math.atan2(w,T)*Ef,t[2]=Math.atan2(x,v)*Ef):(t[0]=0,t[2]=Math.atan2(-y,b)*Ef),t}([],s)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var s=null==(i=t.meta)?void 0:i.previewSize;s&&s[0]===s[1]&&0===s[0]&&(s=void 0);s&&(r.previewSize=s);return r}(t,{plugins:i,requires:n})}),images:s,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:o,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t)))))))));Jf=!1;var r=Zf.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]);if(n)return(n<2||2===n&&s<4)&&(t=function(t){return t.compositions.map(function(t){for(var e,i=nn(t.items);!(e=i()).done;)Wf(e.value.content)}),t}(t)),n<3&&(t=Df(Of(t))),r=Zf.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]),n<4&&(s<2&&(t=kf(t)),s<3&&(t=Lf(t)),s<4&&(t=Ff(t)),s<5&&(t=Nf(t)),s<6&&(t=Bf(t)),s<7&&(t=zf(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var Qf=ci["1_0"];var tp,ep=[0,0,0,1],ip=.5;var rp,np,sp=((tp={})[di.S]=[di.S,di.BPlus,di.APlus],tp[di.A]=[di.A,di.BPlus,di.APlus],tp[di.B]=[di.B,di.BPlus],tp);function op(t,e){if(!t||!e)return!0;var i=sp[e];return!!i&&i.includes(t)}function ap(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},s=n.name,o=n.url;return s&&(e&&e[s]?i=e[s]:o&&(i=o)),i}function hp(t,e,i){return lp.apply(this,arguments)}function lp(){return(lp=$t(function(t,e,i){var r,n;return ie(this,function(s){switch(s.label){case 0:return"string"!=typeof t?[3,2]:[4,lo(t)];case 1:return r=s.sent(),[3,3];case 2:r=t,s.label=3;case 3:if(!r)throw new Error("Image not provided.");if(!e)return[2,r];if(n=ap(e,i)){if(Xe(n)&&n!==r.src)return[2,lo(n)];if(Qt(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}(np=rp||(rp={})).isJSONObject=function(t){return Ke(t)&&"jsonScene"in t},np.isURL=function(t){return Ke(t)&&"url"in t},np.isWithOptions=function(t){return Ke(t)&&"options"in t};var cp=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},up=1,dp=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new io),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=up++,this.timers=[],this.updateOptions(t)}var e=t.prototype;return e.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},e.loadScene=function(t,e){var i=this;return $t(function(){var r,n,s,o,a,h,l,c,u,d,f,p,m;return ie(this,function(g){return n=Xe(t)?t:i.id,s=performance.now(),o=[],a=null==e?void 0:e.engine.gpuCapability,l=null!=(h=null==a?void 0:a.detail.ktx2Support)&&h,c={},d=!1,f=new Promise(function(t,e){u=window.setTimeout(function(){d=!0,i.removeTimer(u);var t=performance.now()-s;e(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+o.join(" ")+", url: "+n+"."))},1e3*i.timeout),i.timers.push(u)}),p=$t(function(t,e){var i,r,n,s;return ie(this,function(a){switch(a.label){case 0:if(d)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,o.push("["+t+": "+n.toFixed(2)+"]"),c[t]=n,[2,r];case 3:throw s=a.sent(),new Error("Load error in "+t+", "+s+".");case 4:throw new Error("Load canceled.")}})}),m=$t(function(){var e,a,h,d,f,m,g,v,y,x,b,_,w,T,E;return ie(this,function(S){switch(S.label){case 0:return Xe(t)?(a=new URL(t,location.href).href,i.baseUrl=a,[4,p("loadJSON",function(){return i.loadJSON(a)})]):[3,2];case 1:return Xe(r=S.sent())&&(r=JSON.parse(r)),[3,3];case 2:r=t,i.baseUrl=location.href,S.label=3;case 3:return rp.isJSONObject(r)?(e=Cn({},r),[3,9]):[3,4];case 4:return[4,p("processJSON",function(){return i.processJSON(r)})];case 5:return m=S.sent().jsonScene,e={timeInfos:c,url:t,storage:{},jsonScene:m,bins:[],textureOptions:[],images:[],assets:i.assets},[4,p("plugin:onAssetsLoadStart",function(){return i.onPluginSceneLoadStart(e)})];case 6:return S.sent(),g=m.bins,v=void 0===g?[]:g,y=m.images,x=m.fonts,[4,Promise.all([p("processBins",function(){return i.processBins(v)}),p("processImages",function(){return i.processImages(y,l)}),p("processFontURL",function(){return i.processFontURL(x)})])];case 7:return b=S.sent(),_=b[0],w=b[1],[4,p("processTextures",function(){return i.processTextures(w,_,m)})];case 8:T=S.sent(),(h=e.bins).push.apply(h,[].concat(_)),(d=e.textureOptions).push.apply(d,[].concat(T)),(f=e.images).push.apply(f,[].concat(w)),e.renderLevel=i.options.renderLevel,S.label=9;case 9:return E=performance.now()-s,He.info("Load asset: totalTime: "+E.toFixed(4)+"ms "+o.join(" ")+", url: "+n+"."),window.clearTimeout(u),i.removeTimer(u),e.totalTime=E,e.startTime=s,e.timeInfos=c,[2,e]}})}),[2,Promise.race([f,m()])]})})()},e.getAssets=function(){return this.assets},e.processJSON=function(t){return $t(function(){var e,i,r,n,s;return ie(this,function(o){for(e=$f(t),i=e.plugins,r=nn(void 0===i?[]:i);!(n=r()).done;)if(s=n.value,!ni[s])throw new Error("The plugin '"+s+"' not found."+li(s));return[2,{jsonScene:e}]})})()},e.processBins=function(t){var e=this;return $t(function(){var i,r,n;return ie(this,function(s){return i=e.options.renderLevel,r=e.baseUrl,n=t.map(function(n){if(Qt(n,ArrayBuffer))return n;if(op(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")}),[2,Promise.all(n)]})})()},e.processFontURL=function(e){var i=this;return $t(function(){return ie(this,function(r){return[2,t.loadFontFamily(e,i.baseUrl)]})})()},e.processImages=function(t,e){void 0===e&&(e=!1);var i=this;return $t(function(){var r,n,s,o,a,h,l,c;return ie(this,function(u){switch(u.label){case 0:return r=i.options,n=r.useCompressedTexture,s=r.variables,o=r.disableWebP,a=r.disableAVIF,h=i.baseUrl,l=t.map($t(function(t,r){var l,c,u,d,f,p,m,g,v,y,x,b,_,w,T,E,S,I,A,C;return ie(this,function(r){switch(r.label){case 0:if(l=t.url,c=t.webp,u=t.avif,d=t.ktx2,f=new URL(l,h).href,p=!o&&c?new URL(c,h).href:void 0,m=!a&&u?new URL(u,h).href:void 0,g=d&&n&&e?new URL(d,h).href:void 0,v=t.id,!("template"in t))return[3,8];if(y=t.template,!(x=y.background))return[3,7];b=ap(y,s),_=x.type===Nr.video,w=x&&_?po:lo,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,go(b,w)];case 2:return Qt(T=r.sent(),HTMLVideoElement)?(i.sourceFrom[v]={url:T.src,type:Hs.video},[2,T]):[3,3];case 3:return x&&Array.isArray(b)&&s&&(s[x.name]=T.src),i.sourceFrom[v]={url:T.src,type:Hs.image},[4,hp(T,y,s)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw E=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(_?"video":"image")+" type, URL: "+b+", Error: "+(E.message||E)+".");case 7:return[3,9];case 8:if("ktx2"in t&&g)return i.sourceFrom[v]={url:g,type:Hs.compressed},[2,i.loadBins(g)];if(Qt(t,HTMLImageElement)||Qt(t,HTMLCanvasElement)||Qt(t,HTMLVideoElement)||Qt(t,To))return[2,t];r.label=9;case 9:return m?[4,ao(f,m)]:[3,11];case 10:return C=r.sent(),[3,13];case 11:return[4,so(f,p)];case 12:C=r.sent(),r.label=13;case 13:return I=(S=C).url,A=S.image,i.sourceFrom[v]={url:I,type:Hs.image},[2,A]}})})),[4,Promise.all(l)];case 1:return c=u.sent(),i.assignImagesToAssets(t,c),[2,c]}})})()},e.onPluginSceneLoadStart=function(t){var e=this;return $t(function(){return ie(this,function(i){switch(i.label){case 0:return[4,ai.onAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}})})()},e.processTextures=function(t,e,i){var r=this;return $t(function(){var n,s,o;return ie(this,function(a){return s=null!=(n=i.textures)?n:t.map(function(t,e){return{source:e}}),o=s.map($t(function(t,n){var s,o,a,h,l,c;return ie(this,function(u){switch(u.label){case 0:if(Qt(t,To))return[2,t];if(!("mipmaps"in t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,yo(t,e,r.assets,i.bins)];case 2:return[2,u.sent()];case 3:throw s=u.sent(),new Error("Load texture "+n+" fails, error message: "+s+".");case 4:return o=t.source,a=t.id,l="",Ke(o)?(h=r.assets[o.id],l=o.id,[3,7]):[3,5];case 5:return"string"!=typeof o?[3,7]:[4,lo(ii(o))];case 6:h=u.sent(),u.label=7;case 7:return h?[4,fp(h,r.sourceFrom[l],a)]:[3,9];case 8:return[2,(c=u.sent()).sourceType===Hs.compressed?c:Cn({},c,t)];case 9:throw new Error("Invalid texture source: "+o+".")}})})),[2,Promise.all(o)]})})()},e.loadJSON=function(t){var e=this;return $t(function(){return ie(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},e.loadBins=function(t){var e=this;return $t(function(){return ie(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},e.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},e.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(e,i){return void 0===i&&(i=location.href),$t(function(){var r;return ie(this,function(n){return e?(r=e.map($t(function(e){var r,n,s;return ie(this,function(o){switch(o.label){case 0:if(!e.fontURL||t.fontCache.has(e.fontFamily))return[3,4];ze(e.fontFamily)||console.warn("Risky font family: "+e.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(e.fontURL,i).href,[4,(s=new FontFace(null!=(n=e.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(s),t.fontCache.add(e.fontFamily),[3,4];case 3:return o.sent(),He.warn("Invalid font family or font source: "+JSON.stringify(e.fontURL)+"."),[3,4];case 4:return[2]}})})),[2,Promise.all(r)]):[2]})})()},t.loadPrecomposition=function(e,i){return $t(function(){var r;return ie(this,function(n){switch(n.label){case 0:return[4,new t(i).loadScene(e)];case 1:return r=n.sent(),[2,new cp(r,i)]}})})()},t}();function fp(t,e,i){return pp.apply(this,arguments)}function pp(){return(pp=$t(function(t,e,i){var r,n,s,o,a;return ie(this,function(h){switch(h.label){case 0:return r={id:i,dataType:jr.Texture},Qt(t,To)?[2,Cn({},t.source,r)]:[3,1];case 1:return Qt(t,HTMLImageElement)||Je(t)?[2,Cn({image:t,sourceType:Hs.image,sourceFrom:e,keepImageSource:!0,minFilter:Ys.LINEAR,magFilter:Ys.LINEAR},r)]:[3,2];case 2:return Qt(t,HTMLVideoElement)?[2,Cn({sourceType:Hs.video,video:t,minFilter:Ys.LINEAR,magFilter:Ys.LINEAR},r)]:[3,3];case 3:if(!Qt(t,ArrayBuffer))return[3,10];if(!(n=Po.getLoader("ktx2")))return[3,8];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,n.loadFromBuffer(t)];case 5:return[2,Cn({sourceType:(s=h.sent()).sourceType,type:s.type,target:s.target,internalFormat:s.internalFormat,format:s.format,mipmaps:s.mipmaps,minFilter:Ys.LINEAR,magFilter:Ys.LINEAR,sourceFrom:e},r)];case 6:throw o=h.sent(),new Error("Failed to parse KTX2 from "+(null!=(a=null==e?void 0:e.url)?a:"buffer")+": "+(o.message||o));case 7:return[3,9];case 8:throw new Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in t&&"height"in t&&"data"in t)return[2,Cn({sourceType:Hs.data,data:t,wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,minFilter:Ys.NEAREST,magFilter:Ys.NEAREST},r)];h.label=11;case 11:throw new Error("Invalid texture options.")}})})).apply(this,arguments)}dp.fontCache=new Set;var mp=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return rp.isURL(t)&&(rp.isJSONObject(t)||(i=t.url),rp.isWithOptions(t)&&(e=Cn({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===Ci.text||t.type===Ci.richtext){var r=e[t.name];if(null==r)return;t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==jr.TextComponent&&(null==n?void 0:n.dataType)!==jr.RichTextComponent||(n.options.text=r)})}})},e.prepareAssets=function(t,e){for(var i,r=nn(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],o=new nf(this.engine);o.data=s,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var a,h=nn(this.builtinObjects);!(a=h()).done;){var l=a.value;this.engine.addInstance(l)}},e.createShaderVariant=function(){for(var t,e=nn(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];Qt(r,Lo)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=nn(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),gp=new be(1,1,1),vp=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new ua,this.viewportMatrix=No.fromIdentity(),this.viewMatrix=No.fromIdentity(),this.projectionMatrix=No.fromIdentity(),this.viewProjectionMatrix=No.fromIdentity(),this.inverseViewMatrix=No.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,s=void 0===n?20:n,o=e.fov,a=void 0===o?60:o,h=e.aspect,l=void 0===h?1:h,c=e.clipMode,u=void 0===c?Vi.portrait:c,d=e.position,f=void 0===d?[0,0,8]:d,p=e.rotation,m=void 0===p?[0,0,0]:p,g=new Wo(m[0],m[1],m[2]),v=(new kn).setFromEuler(g);this.options={near:r,far:s,fov:a,aspect:l,clipMode:u},this.transform.setPosition(f[0],f[1],f[2]),this.transform.setQuaternion(v.x,v.y,v.z,v.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new be(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var s=i.projectPoint(e).z,o=r.projectPoint(new be(1,1,s)),a=o.x,h=o.y,l=r.projectPoint(new be(-1,-1,s)),c=l.x,u=l.y;return new be((a-c)/2,(h-u)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return Cn({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,s=t.aspect,o=t.position,a=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=s,this.position=o,this.rotation=a,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,s=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*fe,r,n,s,o===Vi.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),gp),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:No.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.worldToScreenPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new be,r=this.getViewProjectionMatrix();i.set(t.x,t.y,t.z),r.projectPoint(i,i);var n=this.engine.canvas.getBoundingClientRect(),s=n.width,o=n.height;return i.x=.5*(i.x+1)*s,i.y=.5*(i.y+1)*o,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new be,r=this.getInverseViewProjectionMatrix(),n=this.engine.canvas.getBoundingClientRect(),s=n.width,o=n.height,a=t.x/s*2-1,h=t.y/o*2-1,l=2*t.z-1;return i.set(a,h,l),r.projectPoint(i,i),i},ks(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}();function yp(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var xp,bp,_p=function(){function t(){this.update=new Tp,this.lateUpdate=new Ep,this.preRender=new Sp}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==Ls.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==Ls.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==Ls.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==Ls.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==Ls.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==Ls.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),wp=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),Tp=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=nn(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(wp),Ep=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=nn(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(wp),Sp=function(t){function e(){return t.apply(this,arguments)}return Ui(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=nn(t);!(i=r()).done;){i.value.onPreRender()}},e}(wp),Ip=function(t){function e(e,i){var r,n;(r=t.call(this)||this).sceneTicking=new _p,r.speed=1,r.isEnded=!1,r.loaderData={},r.startTime=0,r.videos=[],r.postProcessingEnabled=!1,r.destroyed=!1,r.paused=!0,r.isEndCalled=!1,r._textures=[];var s,o=e.reusable,a=void 0!==o&&o,h=e.speed,l=void 0===h?1:h,c=e.baseRenderOrder,u=void 0===c?0:c,d=e.renderer,f=e.event,p=e.width,m=e.height,g=e.onItemMessage;r.renderer=d,r.renderer.engine.addComposition(yp(r)),r.createTexturesFromData(i.textureOptions);for(var v,y=nn(Object.keys(i.assets));!(v=y()).done;){var x=v.value,b=i.assets[x];Qt(b,HTMLVideoElement)&&r.videos.push(b)}r.postProcessingEnabled=null!=(s=null==(n=i.jsonScene.renderSettings)?void 0:n.postProcessingEnabled)&&s,r.engine.renderLevel=i.renderLevel,a&&(i.consumed=!0);for(var _,w,T,E,S=i.jsonScene.compositions[0],I=nn(i.jsonScene.compositions);!(_=I()).done;){var A=_.value;A.id===i.jsonScene.compositionId&&(S=A)}return Be(S),r.rootItem=new da(r.engine),r.rootItem.setInstanceId(S.id),r.rootItem.instantiatePreComposition(S,!1),r.rootItem.composition=yp(r),r.rootItem.name="rootItem",r.rootComposition=r.rootItem.getComponent(Hh),r.rootComposition.updateMode=Fh.Manual,r.rootComposition.play(),r.rootItem.on("animationevent",function(t){r.emit("animationevent",t)}),r.width=p,r.height=m,r.renderOrder=u,r.id=S.id,r.startTime=null!=(w=S.startTime)?w:0,r.renderer=d,r.event=f,r.statistic={loadStart:null!=(T=i.startTime)?T:0,loadTime:null!=(E=i.totalTime)?E:0,compileTime:0,firstFrameTime:0},r.reusable=a,r.speed=l,r.name=S.name,r.camera=new vp(r.name,Cn({},null==S?void 0:S.camera,{aspect:p/m})),r.camera.engine=r.engine,r.url=i.url,r.interactive=!0,g&&(r.onItemMessage=g),r.createRenderFrame(),ai.initializeComposition(yp(r),i),r}Ui(e,t);var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.rootItem.setVisible(t)},i.getSpeed=function(){return this.speed},i.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},i.pause=function(){this.paused=!0,this.emit("pause")},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},i.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},i.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},i.createRenderFrame=function(){this.renderFrame=new Ol({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},i.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0)},i.addItem=function(t){t.setParent(this.rootItem)},i.getComponent=function(t){return this.rootItem.getComponent(t)},i.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},i.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},i.prepareRender=function(){},i.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},i.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Yi.destroy&&!this.reusable},i.updateCamera=function(){this.camera.updateMatrix()},i.updateCompositionTime=function(t){if(this.rootComposition.state===pc.Playing&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e>=i)switch(n=!0,r){case Yi.restart:e%=i,this.restart();break;case Yi.freeze:e=Math.min(i,e);case Yi.forward:case Yi.destroy:}this.rootComposition.tick(e+this.startTime-this.rootComposition.getTime()),this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},i.createTexturesFromData=function(t){for(var e,i=nn(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return function(t,e,i){var r=i.position,n=new be(t,e,0),s=new be;return i.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(r),new ea(r,s)}((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],s=this.getHitTestRay(t,e);return this.rootComposition.hitTest(s,t,e,n,i,r),n},i.addInteractiveItem=function(t,e){if(e===Ei.MESSAGE)return null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},i.removeInteractiveItem=function(t,e){e===Ei.MESSAGE&&(null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},i.destroyItem=function(t){},i.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},i.dispose=function(){var t=this;if(!this.destroyed){this.destroyed=!0;for(var e,i=nn(this.textures);!(e=i()).done;){e.value.dispose()}this._textures=[];for(var r,n=nn(this.videos);!(r=n()).done;){var s=r.value;s.pause(),s.removeAttribute("src"),s.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),ai.destroyComposition(this),this.update=function(){He.error("Update disposed composition: "+t.name+".")},this.dispose=We,this.renderer.engine.removeComposition(this),this.engine.env!==Xo&&this.renderer.clear({stencilAction:Gs.clear,clearStencil:0,depthAction:Gs.clear,clearDepth:1,colorAction:Gs.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},i.reloadTexture=function(){var t=this;return $t(function(){return ie(this,function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},ks(e,[{key:"engine",get:function(){return this.getEngine()}},{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootItem.getDescendants()}},{key:"time",get:function(){return this.rootComposition.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(Qo),Ap=new Int32Array(2),Cp=new Float32Array(Ap.buffer),Pp=new Float64Array(Ap.buffer),Mp=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(bp=xp||(xp={}))[bp.UTF8_BYTES=1]="UTF8_BYTES",bp[bp.UTF16_STRING=2]="UTF16_STRING";var Rp=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return Ap[0]=this.readInt32(t),Cp[0]},e.readFloat64=function(t){return Ap[Mp?0:1]=this.readInt32(t),Ap[Mp?1:0]=this.readInt32(t+4),Pp[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){Cp[0]=e,this.writeInt32(t,Ap[0])},e.writeFloat64=function(t,e){Pp[0]=e,this.writeInt32(t,Ap[Mp?0:1]),this.writeInt32(t+4,Ap[Mp?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===xp.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Op=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=Rp.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=1+~(this.bb.capacity()-this.space+i)&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=2*(i+2);this.addInt16(r);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var a=2;a<r;a+=2)if(this.bb.readInt16(s+a)!=this.bb.readInt16(o+a))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var s=3;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){return null==t?0:(e=Qt(t,Uint8Array)?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector());var e},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null===r)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=Rp.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),Dp=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new kp(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),kp=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=Dp.createDataVector(t,this.data);return Dp.createFBEffectsObjectData(t,e,i)},t}(),Lp=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new Dp).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new Fp(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),Fp=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Lp.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Lp.createFBEffectsPackageData(t,e)},t}(),Np=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new Bp(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Bp=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return Np.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),zp=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new Up(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,s,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),Up=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return zp.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Vp=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new zp).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new Gp(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),Gp=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=Vp.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Vp.createFBVertexData(t,this.vertexCount,e)},t}(),jp=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new Vp).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new Np).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Hp(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Hp=function(){function t(t,e,i,r,n,s,o,a,h,l,c,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===o&&(o=0),void 0===a&&(a=null),void 0===h&&(h=[]),void 0===l&&(l=[]),void 0===c&&(c=null),void 0===u&&(u=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=s,this.mode=o,this.buffer=a,this.binaryData=h,this.boneNames=l,this.rootBoneName=c,this.inverseBindMatrices=u}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=jp.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,o=jp.createBinaryDataVector(t,this.binaryData),a=jp.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),h=null!==this.rootBoneName?t.createString(this.rootBoneName):0,l=jp.createInverseBindMatricesVector(t,this.inverseBindMatrices);return jp.startFBGeometryData(t),jp.addId(t,e),jp.addName(t,i),jp.addVertexData(t,r),jp.addIndexFormat(t,this.indexFormat),jp.addIndexOffset(t,this.indexOffset),jp.addSubMeshes(t,n),jp.addMode(t,this.mode),jp.addBuffer(t,s),jp.addBinaryData(t,o),jp.addBoneNames(t,a),jp.addRootBoneName(t,h),jp.addInverseBindMatrices(t,l),jp.endFBGeometryData(t)},t}(),Wp=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new Op(1),i=new Fp,r=[],n=nn(this.exportObjectDatas);!(t=n()).done;){var s=t.value,o=void 0;s.dataType===jr.Geometry&&(o=new kp("Geometry",this.geometryDataToBinary(s))),o&&r.push(o)}return i.exportObjects=r,Lp.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new Rp(t),i=Lp.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var s=n.dataArray(),o=n.dataType();if(s){var a=void 0;o===jr.Geometry&&(a=this.binaryToGeometryData(s)),a&&this.exportObjectDatas.push(a)}}}},e.geometryDataToBinary=function(t){var e=new Op(1),i=new Hp,r=t.indexFormat,n=t.indexOffset,s=t.mode,o=t.id,a=t.vertexData,h=t.boneNames,l=void 0===h?[]:h,c=t.rootBoneName,u=void 0===c?"":c,d=t.inverseBindMatrices,f=void 0===d?[]:d,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=s,i.id=o,i.boneNames=l,i.rootBoneName=u,i.inverseBindMatrices=f,i.binaryData=m;var g=new Gp;g.vertexCount=a.vertexCount,g.channels=[];for(var v,y=nn(a.channels);!(v=y()).done;){var x=v.value,b=x.semantic,_=x.offset,w=x.format,T=x.dimension,E=x.normalize,S=new Up(b,_,w,T,E);g.channels.push(S)}i.vertexData=g;for(var I,A=[],C=nn(t.subMeshes);!(I=C()).done;){var P=I.value,M=P.offset,R=P.indexCount,O=P.vertexCount,D=new Bp(M,R,O);A.push(D)}return i.subMeshes=A,Lp.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new Rp(t),i=jp.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var s=0;s<n.channelsLength();s++){var o=n.channels(s);if(o){var a,h={semantic:null!=(a=o.semantic())?a:"",offset:o.offset(),format:o.format(),dimension:o.dimension(),normalize:o.normalize()};r.channels.push(h)}}}for(var l=[],c=0;c<i.subMeshesLength();c++){var u=i.subMeshes(c);if(u){var d={offset:u.offset(),vertexCount:u.vertexCount(),indexCount:u.indexCount()};l.push(d)}}for(var f=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);f.push(m)}var g,v,y,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:l,mode:i.mode(),buffer:null!=(g=i.buffer())?g:"",boneNames:f,rootBoneName:null!=(v=i.rootBoneName())?v:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(y=i.binaryDataArray())?y:void 0,id:null!=(x=i.id())?x:"",dataType:jr.Geometry}},t}(),Xp=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=ye(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e,i=nn(this.tickers);!(e=i()).done;){(0,e.value)(this.dt)}}}},e.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},ks(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),Yp=function(t){function e(e,i){var r,n,s,o,a,h,l;return(r=t.call(this)||this).name="NewEngine",r.speed=1,r.displayScale=1,r.offscreenMode=!1,r.renderErrors=new Set,r.compositions=[],r.assetManagers=[],r.env="",r.ticker=null,r._disposed=!1,r.textures=[],r.materials=[],r.geometries=[],r.meshes=[],r.renderPasses=[],r.clearAction={stencilAction:Gs.clear,clearStencil:0,depthAction:Gs.clear,clearDepth:1,colorAction:Gs.clear,clearColor:[0,0,0,0]},r.canvas=e,r.env=null!=(n=null==i?void 0:i.env)?n:"",r.name=null!=(s=null==i?void 0:i.name)?s:r.name,r.pixelRatio=null!=(o=null==i?void 0:i.pixelRatio)?o:Ae(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=(a=yp(r),To.create(a,Cn({id:Qr.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:Hs.data},So))),r.transparentTexture=function(t){return To.create(t,Cn({id:Qr.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:Hs.data},So))}(yp(r)),(null==i?void 0:i.manualRender)||(r.ticker=new Xp(null==i?void 0:i.fps),r.runRenderLoop(r.mainLoop.bind(yp(r)))),r.eventSystem=new ac(yp(r),null!=(h=null==i?void 0:i.notifyTouch)&&h),r.eventSystem.enabled=null!=(l=null==i?void 0:i.interactive)&&l,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new af(yp(r)),r.assetService=new mp(yp(r)),r}Ui(e,t);var i=e.prototype;return i.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},i.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},i.findEffectsObjectData=function(t){return this.jsonSceneData[t]},i.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},i.findObject=function(t){return Ze(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},i.removeInstance=function(t){delete this.objectInstance[t]},i.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,s=i.items,o=void 0===s?[]:s,a=i.materials,h=void 0===a?[]:a,l=i.shaders,c=void 0===l?[]:l,u=i.geometries,d=void 0===u?[]:u,f=i.components,p=void 0===f?[]:f,m=i.animations,g=void 0===m?[]:m,v=i.bins,y=void 0===v?[]:v,x=i.miscs,b=void 0===x?[]:x,_=nn(i.compositions);!(e=_()).done;){var w=e.value;this.addEffectsObjectData(w)}for(var T,E=nn(o);!(T=E()).done;){var S=T.value;op(S.renderLevel,t.renderLevel)||(S.components=[],S.type=Ci.null),this.addEffectsObjectData(S)}for(var I,A=nn(h);!(I=A()).done;){var C=I.value;this.addEffectsObjectData(C)}for(var P,M=nn(c);!(P=M()).done;){var R=P.value;this.addEffectsObjectData(R)}for(var O,D=nn(d);!(O=D()).done;){var k=O.value;this.addEffectsObjectData(k)}for(var L,F=nn(p);!(L=F()).done;){var N=L.value;this.addEffectsObjectData(N)}for(var B,z=nn(g);!(B=z()).done;){var U=B.value;this.addEffectsObjectData(U)}for(var V,G=nn(b);!(V=G()).done;){var j=V.value;this.addEffectsObjectData(j)}for(var H=0;H<y.length;H++){var W=y[H],X=t.bins[H];if(W.dataType===jr.BinaryAsset)W.buffer=X,W.id&&this.addEffectsObjectData(W);else{var Y=new Wp;Y.deserializeFromBinary(new Uint8Array(X));for(var q,K=nn(Y.exportObjectDatas);!(q=K()).done;){var Z=q.value;this.addEffectsObjectData(Z)}}}for(var J,$=nn(n);!(J=$()).done;){var Q=J.value;this.addEffectsObjectData(Q)}},i.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},i.mainLoop=function(t){var e,i=this.renderErrors;if(i.size>0)return this.emit("rendererror",i.values().next().value),void(null==(e=this.ticker)||e.pause());t=Math.min(t,33)*this.speed;var r=this.compositions;r.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var n,s,o=!1,a=nn(r);!(n=a()).done;){var h=n.value;h.textureOffloaded?(o=!0,He.error("Composition "+h.name+" texture offloaded, skip render.")):h.update(t)}if(o)return this.emit("rendererror",new Error("Play when texture offloaded.")),void(null==(s=this.ticker)||s.pause());for(var l,c=nn(r);!(l=c()).done;){l.value.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var u,d=nn(r);!(u=d()).done;){var f=u.value;this.renderer.renderRenderFrame(f.renderFrame)}this.renderer.renderTargetPool.flush()},i.resize=function(){var t,e,i,r,n=this.canvas.parentElement;if(n){var s=this.getTargetSize(n);t=s[0],e=s[1],i=s[2],r=s[3]}else t=i=this.canvas.width,e=r=this.canvas.height;var o=t/e;if(t&&e){var a=document.documentElement.clientWidth;i>2*a&&He.error("DPI overflowed, width "+i+" is more than 2x document width "+a+", see "+$o+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>h||r>h)&&(He.error("Container size overflowed "+i+"x"+r+", see "+Ko+"."),o>1?(i=Math.round(h),r=Math.round(h/o)):(r=Math.round(h),i=Math.round(h*o))),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",He.info("Resize engine "+this.name+" ["+i+","+r+","+t+","+e+"]."),this.setSize(i,r)}},i.setSize=function(t,e){var i;this.renderer.resize(t,e),null==(i=this.compositions)||i.forEach(function(i){i.camera.aspect=t/e}),this.emit("resize",this)},i.getTargetSize=function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Zo+".");var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),s=0,o=0;(n?(s=parseInt(n.width,10),o=parseInt(n.height,10)):(s=t.clientWidth,o=t.clientHeight),r)?s/o>r?e=(i=o*this.displayScale)*r:i=(e=s*this.displayScale)/r:(e=s,i=o);var a=this.pixelRatio,h=e,l=i;if(e=Math.round(e*a),i=Math.round(i*a),e<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+e+"x"+i+", see "+Jo+".");e=i=h=l=1}return[h,l,e,i]},i.addTexture=function(t){this.disposed||le(this.textures,t)},i.removeTexture=function(t){this.disposed||ce(this.textures,t)},i.addMaterial=function(t){this.disposed||le(this.materials,t)},i.removeMaterial=function(t){this.disposed||ce(this.materials,t)},i.addGeometry=function(t){this.disposed||le(this.geometries,t)},i.removeGeometry=function(t){this.disposed||ce(this.geometries,t)},i.addMesh=function(t){this.disposed||le(this.meshes,t)},i.removeMesh=function(t){this.disposed||ce(this.meshes,t)},i.addRenderPass=function(t){this.disposed||le(this.renderPasses,t)},i.removeRenderPass=function(t){this.disposed||ce(this.renderPasses,t)},i.addComposition=function(t){this.disposed||le(this.compositions,t)},i.removeComposition=function(t){this.disposed||ce(this.compositions,t)},i.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},i.dispose=function(){var t,e,i;if(!this.disposed){this._disposed=!0;var r=[];this.renderPasses.length>0&&r.push("Pass "+this.renderPasses.length),this.meshes.length>0&&r.push("Mesh "+this.meshes.length),this.geometries.length>0&&r.push("Geom "+this.geometries.length),this.textures.length>0&&r.push("Tex "+this.textures.length),r.length>0&&He.warn("Release GPU memory: "+r.join(", ")+"."),null==(t=this.ticker)||t.stop(),null==(e=this.eventSystem)||e.dispose(),null==(i=this.assetService)||i.dispose(),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},ks(e,[{key:"disposed",get:function(){return this._disposed}}]),e}(Qo),qp=(Ys.RGBA,Ys.UNSIGNED_BYTE,Ys.LINEAR,Ys.LINEAR,Ys.CLAMP_TO_EDGE,Ys.CLAMP_TO_EDGE,Symbol("dispose"),function(){function t(){}return t.load=function(t,e,i){void 0===i&&(i={});var r=this;return $t(function(){var n,s,o,a,h,l,c,u,d,f,p,m,g;return ie(this,function(v){switch(v.label){case 0:return a=performance.now(),h=null==(s=e.gpuCapability)||null==(n=s.detail)?void 0:n.asyncShaderCompile,l=e.compositions.length,c=new dp(i),e.assetManagers.push(c),[4,c.loadScene(t,e.renderer)];case 1:return u=v.sent(),e.clearResources(),ai.onAssetsLoadFinish(u,c.options,e),e.assetService.prepareAssets(u,u.assets),e.assetService.updateTextVariables(u,i.variables),(d=r.createComposition(u,e,i)).setIndex(l),f=performance.now(),[4,new Promise(function(t){var i;null==(i=e.renderer.getShaderLibrary())||i.compileAllShaders(function(){return t(null)})})];case 2:return v.sent(),p=performance.now()-f,null==(o=e.ticker)||o.start(),m=d.name,g=performance.now()-a,d.statistic.compileTime=p,d.statistic.firstFrameTime=g,He.info("First frame ["+m+"]: "+g.toFixed(4)+"ms."),He.info("Shader "+(h?"async":"sync")+" compile ["+m+"]: "+p.toFixed(4)+"ms."),[2,d]}})})()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=e.renderer,n=new Ip(Cn({},i,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:e.eventSystem}),t);return e.ticker&&i.renderLevel===di.B&&e.ticker.setFPS(Math.min(e.ticker.getFPS(),30)),e.env!==Xo&&e.assetService.createShaderVariant(),n},t}()),Kp=function(){function t(){}return t.instantiate=function(t,e){var i=t.scene,r=t.scene.jsonScene,n=t.options,s=e.engine;s.clearResources(),ai.onAssetsLoadFinish(i,n,s),s.assetService.prepareAssets(i,i.assets),s.assetService.updateTextVariables(i,n.variables),e.createTexturesFromData(i.textureOptions);for(var o,a=nn(Object.keys(i.assets));!(o=a()).done;){var h=o.value,l=i.assets[h];Qt(l,HTMLVideoElement)&&e.videos.push(l)}var c=r.compositionId,u=r.compositions.find(function(t){return t.id===c});if(!u)throw new Error('Composition with id "'+c+'" not found in JSONScene.');var d,f=new da(s);return f.instantiatePreComposition(u),f.getComponent(Hh).playOnStart=null==(d=n.autoplay)||d,f.getComponent(Hh).endBehavior=0,e.addItem(f),f},t}();oi("camera",ic),oi("text",rf),oi("sprite",gc),oi("particle",qd),oi("interact",lc);function Zp(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}He.info("Core version: 2.9.0-alpha.1.");var Jp,$p,Qp=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,s=e.target,o=void 0===s?Ys.ARRAY_BUFFER:s,a=e.type,h=void 0===a?Ys.FLOAT:a,l=e.usage,c=void 0===l?Ys.STATIC_DRAW:l,u=function(t){var e,i;return null!=(i=null==(e=tm[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(h);this.target=o,this.type=h,this.usage=c,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=u,r?this.bufferData(r):n&&this.bufferData(u*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return Zp(e,t),e},e.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.engine){this.byteLength=e;var i=this.engine.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.engine){var i=this.engine.gl,r=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;i.bindBuffer(r,this.glBuffer),s>this.byteLength&&(this.byteLength=s,i.bufferData(r,s,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Zs(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},ks(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),tm=((Jp={})[Ys.INT]=Int32Array,Jp[Ys.FLOAT]=Float32Array,Jp[Ys.SHORT]=Int16Array,Jp[Ys.BYTE]=Int8Array,Jp[Ys.UNSIGNED_BYTE]=Uint8Array,Jp[Ys.UNSIGNED_INT]=Uint32Array,Jp[Ys.UNSIGNED_SHORT]=Uint16Array,Jp);var em=(($p={})[Uint8Array.BYTES_PER_ELEMENT]=Ys.UNSIGNED_BYTE,$p[Uint16Array.BYTES_PER_ELEMENT]=Ys.UNSIGNED_SHORT,$p[Uint32Array.BYTES_PER_ELEMENT]=Ys.UNSIGNED_INT,$p),im=1,rm=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}Ui(e,t);var i=e.prototype;return i.getOptions=function(){return Cn({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;Be(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new Qp(t.engine,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,s=i.target;this.bufferProps[r]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,s=e+i.length;if(r.data.length<s){var o=new i.constructor(s);o.set(r.data),r.data=o,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,n)),void 0!==a.end&&(a.end=Math.max(a.end,s-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(Qt(t,Uint8Array)||Qt(t,Uint16Array)||Qt(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var s=new e.constructor(n);s.set(this.indices),this.indices=s,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var o=this.dirtyFlags.index;void 0!==o.start&&(o.start=Math.min(o.start,r)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*_l[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t){var e=em[t.BYTES_PER_ELEMENT],i={data:t,target:Ys.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new Qp(this.engine,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var s,o,a=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,o=r;else{var h=e[n].dataSource;s=t.buffers[h],o=i[h].data}if((a.dirty||a.discard)&&s&&o){if(a.discard)s.bufferData(o);else if(void 0!==a.start&&void 0!==a.end){var l=a.start*o.BYTES_PER_ELEMENT+o.byteOffset,c=a.end-a.start+1,u=new o.constructor(o.buffer,l,c);s.bufferSubData(a.start,u)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],s=e[r].dataSource;i[s]&&n&&(i[s].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,s=e.mode,o=e.indices,a=e.name,h=void 0===a?"effectsGeometry:"+im++:a,l=e.bufferUsage,c=void 0===l?Ys.STATIC_DRAW:l;this.name=h;var u={},d=[],f={},p={},m={},g=c;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(s)?Ys.TRIANGLES:s,Object.keys(e.attributes).forEach(function(t){var i=e.attributes[t],r=i.size,n=i.stride,s=i.offset,o=i.normalize,a=i.type,h=void 0===a?Ys.FLOAT:a,l=i.releasable,c=i.data;if(!h||"dataSource"in i||c||(c=function(t){return t===Ys.INT?new Int32Array(0):t===Ys.SHORT?new Int16Array(0):new Float32Array(0)}(h)),c){var v=Qt(c,Float32Array)?Ys.FLOAT:Ys.INT;u[t]={data:c,usage:g,target:Ys.ARRAY_BUFFER,name:t},f[t]={size:r,stride:n,offset:s,type:null!=h?h:v,normalize:!!o,dataSource:t},m[t]=null!=l&&l,p[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var y=i.dataSource;y&&(f[t]={size:r,stride:n,offset:s,type:h,dataSource:y,normalize:!!o})}d.push(t)}),p.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==o?void 0:o.data,this.indicesReleasable=!0===(null==o?void 0:o.releasable),this.bufferProps=u,this.attributes=f,this.attributesName=d,this.attributesReleasable=m,this.dirtyFlags=p,this.options=e,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);var n=i.buffer;return n}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:Ys.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,o=null!=(e=nm[t.semantic])?e:t.semantic,a=r.createVertexTypedArray(t,i,n);s.attributes[o]={type:$s(t.format),size:t.dimension,data:a,normalize:t.normalize}}),e.indexFormat!==Kr.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:o},s.drawCount=o.length}else s.drawCount=n;this.processProps(s)}else{var a=e.vertexData.channels[0],h=e.vertexData.channels[1],l=e.vertexData.channels[2],c=this.createVertexTypedArray(a,i,n),u=this.createVertexTypedArray(h,i,n),d=this.createVertexTypedArray(l,i,n),f=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),p={mode:Ys.TRIANGLES,attributes:{aPos:{type:$s(a.format),size:3,data:c,normalize:a.normalize},aUV:{type:$s(h.format),size:2,data:u,normalize:h.normalize},aNormal:{type:$s(l.format),size:3,data:d,normalize:l.normalize}}};p.indices={data:f},p.drawCount=f.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var e,i=this;(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized)&&(Object.keys(this.buffers).forEach(function(t){i.buffers[t].dispose()}),this.buffers={},null==(e=this.indicesBuffer)||e.dispose(),Object.keys(this.vaos).forEach(function(t){var e;null==(e=i.vaos[t])||e.dispose(),i.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&this.engine.removeGeometry(this));this.destroyed=!0,t.prototype.dispose.call(this)},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case Yr.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case Yr.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case Yr.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case Yr.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case Yr.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,s=e.byteLength-i;switch(t){case Kr.UInt16:return new Uint16Array(r,n,s/Uint16Array.BYTES_PER_ELEMENT);case Kr.UInt32:return new Uint32Array(r,n,s/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,n,s/Uint32Array.BYTES_PER_ELEMENT)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},ks(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(wl),nm={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var sm=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return Zs(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),Zp(e,t),e},e.bindVertexArray=function(t){var e;Zs(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Zs(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),om=function(){function t(t,e,i){this.engine=t,this.program=e,this.id=i,this.engine.useProgram(e),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var e=t.prototype;return e.bind=function(){this.engine.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,s=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new sm(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var o=t.buffers[n.dataSource];if(!o)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");o.bind(),s.enableVertexAttribArray(i.loc),s.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.engine.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=t.getActiveAttrib(e,n);if(s){var o=s.name,a=s.type,h=s.size,l=t.getAttribLocation(e,o);i[o]={type:a,name:o,size:h,loc:l}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),am=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}Ui(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.engine.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.engine.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.engine.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.engine.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.engine.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.engine.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.engine.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.engine.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.engine.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.engine.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.engine.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.engine.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.engine.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.engine.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var o=i[r];this.samplerChannels[o]=r}},i.toData=function(){var t=this.defination;t.dataType=jr.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var e;this.compileResult&&this.compileResult.shared||(null==(e=this.program)||e.dispose(),t.prototype.dispose.call(this))},e}(xl),hm=0,lm=function(){function t(t){this.engine=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var e=t.prototype;return e.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=nn(Object.keys(this.cachedShaders));!(i=n()).done;){var s=i.value;this.cachedShaders[s].initialized||r.push(s)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},e.addShader=function(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var s=Cn({},t,{vertex:Cl.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Fs.vertex,shader:t.vertex,macros:n}),fragment:Cl.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Fs.fragment,shader:t.fragment,macros:n})}),o=this.computeShaderCacheId(s);if(this.cachedShaders[o])return o;this.shaderAllDone=!1;var a=!1;return(s.shared||s.cacheId)&&(a=!0),this.cachedShaders[o]=new am(this.engine,Cn({},s,{vertex:s.vertex,fragment:s.fragment,name:s.name||o,shared:a})),this.cachedShaders[o].id=o,o},e.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},e.compileShader=function(t,e){var i=this,r=t.source,n=r.shared,s=r.vertex,o=r.fragment,a=r.name,h=t.source.cacheId,l=!1;(n||h)&&(l=!0);var c=this.engine.gl,u={shared:l,status:ul.compiling},d=this.createProgram(c,s,o,u),f=this.glAsyncCompileExt,p=performance.now(),m=function(e){u.status=ul.success,u.compileTime=performance.now()-p,t.program=e,t.initialized=!0,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=e},g=function(){if(i.engine.disposed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==e?void 0:e(u);if(t.initialized)return null==e?void 0:e(u);var r=(!e||!f||f&&1==c.getProgramParameter(u.program,f.COMPLETION_STATUS_KHR))&&d();if(r){if(u.status!==ul.fail){Zp(r,a);var n=new om(i.engine,r,t.id);if(c.validateProgram(r),c.getProgramParameter(r,c.VALIDATE_STATUS))m(n);else{var h=c.getProgramInfoLog(r);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?m(n):(u.status=ul.fail,u.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",s,"\nfragment:\n",o),c.deleteProgram(r))}}null==e||e(u)}else e&&requestAnimationFrame(g)};t.compileResult=u,g()},e.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,s=t.shared,o=t.cacheId;return s||o?o||"shared_"+um(i,n):"instanced_"+hm++},e.createProgram=function(t,e,i,r){var n=t.createProgram(),s=this.createGLShader(t,t.VERTEX_SHADER,e),o=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&s&&o?(t.attachShader(n,s),t.attachShader(n,o),t.linkProgram(n),r.program=n,r.status=ul.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var a=t.getProgramInfoLog(n);console.error("Failed to link program: "+a+".");var h=cm(t,s,"vertex",e),l=cm(t,o,"fragment",i);return r.status=ul.fail,h&&(r.error=h.error,r.status=h.status),l&&(r.error=l.error,r.status=l.status),n}return n}):(r.status=ul.fail,function(){return null})},e.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=um(null!=i?i:""),s=r.get(n);if(s)return s;var o=t.createShader(e);return o&&(t.shaderSource(o,i),t.compileShader(o),r.set(n,o)),o},e.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.restore=function(){},e.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.engine){var e=this.engine.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function cm(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:n,status:ul.fail}}}function um(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var s=e[n],o=0;o<s.length;o++)r=Math.imul(31,r)+s.charCodeAt(o)|0;return r}var dm,fm,pm=1,mm=function(t){function e(e){var i;return(i=t.call(this,e)||this).temporaryRTs={},i.disposed=!1,i.blitGeometry=null,i.blitMaterial=null,i.name="GLRenderer#"+pm++,Be(i.context.gl),i.renderingData={currentFrame:{}},i}Ui(e,t);var i=e.prototype;return i.renderRenderFrame=function(t){var e,i=t,r=i.renderPasses;if(this.isDisposed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders(),i.setup(),this.setFramebuffer(null);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),Le(r);for(var s,o=nn(r);!(s=o()).done;){var a=s.value;this.renderRenderPass(a)}for(var h,l=nn(r);!(h=l()).done;){h.value.onCameraCleanup(this)}}},i.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},i.renderMeshes=function(t){for(var e,i=nn(t);!(e=i()).done;){e.value.render(this)}},i.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},i.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},i.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},i.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},i.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},i.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},i.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush();var n=this.renderingData;i.setMatrix("effects_ObjectToWorld",e);try{i.use(this,n.currentFrame.globalUniforms)}catch(t){return console.error(t),void this.engine.renderErrors.add(t)}var s=this.engine.gl;if(s){var o=t,a=i.shaderVariant.program;if(a){var h=a.setupAttributes(o),l=o.indicesBuffer,c=o.drawStart,u=o.drawCount,d=o.mode,f=o.subMeshes;if(f&&f.length){var p,m=f[r];if(u<0)return;if(c=m.offset,l)u=null!=(p=m.indexCount)?p:0;else u=m.vertexCount}l?s.drawElements(d,u,l.type,null!=c?c:0):s.drawArrays(d,c,u),null==h||h.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")}},i.setFramebuffer=function(t){t?(this.currentFramebuffer=t,this.currentFramebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.currentFramebuffer=null,this.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},i.setViewport=function(t,e,i,r){this.engine.viewport(t,e,i,r)},i.clear=function(t){var e=this.engine,i=0;if(t.colorAction===Gs.clear){var r=t.clearColor;r&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),i=Ys.COLOR_BUFFER_BIT}if(t.stencilAction===Gs.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),i|=Ys.STENCIL_BUFFER_BIT),t.depthAction===Gs.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),i|=Ys.DEPTH_BUFFER_BIT}i&&e.clear(i)},i.getShaderLibrary=function(){return this.engine.shaderLibrary},i.getWidth=function(){return this.width},i.getHeight=function(){return this.height},i.dispose=function(){var t,e;this.disposed||(this.deleteResource(),this.renderTargetPool.dispose(),null==(t=this.blitGeometry)||t.dispose(),this.blitGeometry=null,null==(e=this.blitMaterial)||e.dispose(),this.blitMaterial=null,this.disposed=!0)},i.lost=function(t){t.preventDefault(),He.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");var e=this.engine;e.reset(),e.shaderLibrary=new lm(e),e.gpuCapability=new Ul(t)},i.resize=function(t,e){if(this.width!==t||this.height!==e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e))}},i.blit=function(t,e,i){this.blitGeometry||(this.blitGeometry=wl.create(this.engine,{mode:Ys.TRIANGLE_STRIP,attributes:{aPos:{type:Ys.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=Lo.create(this.engine,{shader:{vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos, 0.0, 1.0);\n vTex = (aPos + vec2(1.0)) / 2.0;\n}",fragment:"\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}"}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var r=i||this.blitMaterial;r.setTexture("_MainTex",t);var n=this.currentFramebuffer;if(e){var s=e.viewport,o=s[0],a=s[1],h=s[2],l=s[3];this.setFramebuffer(e),this.setViewport(o,a,h,l)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,No.IDENTITY,r),this.setFramebuffer(n)},i.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.engine;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.createGLRenderbuffer=function(t){return this.gl.createRenderbuffer()},i.createGLFramebuffer=function(t){var e=this.gl.createFramebuffer();if(!e)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return Zp(e,t,t),e},i.createVAO=function(t){return new sm(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(t.textureBuffer),t.textureBuffer=null)},i.deleteGPUBuffer=function(t){t&&!this.disposed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.disposed&&(this.gl.deleteFramebuffer(t.fbo),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.disposed&&(this.gl.deleteRenderbuffer(t.buffer),t.buffer=null)},i.deleteResource=function(){var t=this.gl;t&&(t.deleteFramebuffer(this.sourceFbo),t.deleteFramebuffer(this.targetFbo))},ks(e,[{key:"gl",get:function(){return this.engine.gl}},{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDisposed",get:function(){return this.disposed}},{key:"context",get:function(){return this.engine.context}}]),e}(jl),gm=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===i&&this.blendColor[2]===r&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===r&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Ys.FUNC_ADD,Ys.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Ys.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[Ys.ALWAYS,Ys.ALWAYS],this.stencilOpFail=[Ys.KEEP,Ys.KEEP],this.stencilOpZFail=[Ys.KEEP,Ys.KEEP],this.stencilOpZPass=[Ys.KEEP,Ys.KEEP],this.culling=!1,this.frontFace=Ys.CCW,this.cullFace=Ys.FRONT},e.apply=function(t){if(t.toggle(Ys.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(Ys.BLEND,this.blending),t.toggle(Ys.DEPTH_TEST,this.depthTest),t.toggle(Ys.STENCIL_TEST,this.stencilTest),t.toggle(Ys.CULL_FACE,this.culling),t.toggle(Ys.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Ys.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Ys.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Ys.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Ys.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Ys.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Ys.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),vm=_e,ym=No,xm=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.glMaterialState=new gm,i&&(r.shader=new bl(e),r.shader.shaderData=Cn({},i.shader,{id:ei(),dataType:jr.Shader})),r}Ui(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];qe(i.initialize)?i.initialize():He.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")}),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.glMaterialState.apply(t)},i.use=function(t,e){var i=t.engine,r=this.shaderVariant;if(r.program){var n;if(r.program.bind(),this.setupStates(i),e){for(var s,o=nn(e.uniforms);!(s=o()).done;)n=s.value,this.checkUniform(n);for(var a,h=nn(e.samplers);!(a=h()).done;)n=a.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])}else{var l;null==(l=this.engine)||l.renderErrors.add(new Error("Shader program is not initialized."))}},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=nn(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=nn(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;Be(r);var n=new e(r,i);return n.glMaterialState=Object.assign(new gm,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=Cn({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===ki.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,s=e.stringTags.RenderFace;for(r in s===Fi.Front?(this.culling=!0,this.cullFace=Ys.BACK):s===Fi.Back?(this.culling=!0,this.cullFace=Ys.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var o=i.vector4s[r];this.setVector4(r,new _e(o.x,o.y,o.z,o.w))}for(r in i.colors){var a=i.colors[r];this.setColor(r,new we(a.r,a.g,a.b,a.a))}for(r in i.textures){var h=i.textures[r],l=this.engine.findObject(h.texture);this.setTexture(r,l);var c=h.offset,u=h.scale;c&&u&&this.setVector4(r+"_ST",new vm(u.x,u.y,c.x,c.y))}if(e.shader){var d=this.engine.findObject(e.shader);d&&(this.shader=d,this.shaderSource=d.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=jr.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var o=t.textures[s],a=this.getVector4(s+"_ST");a&&(o.scale={x:a.x,y:a.y},o.offset={x:a.z,y:a.w},delete t.vector4s[s+"_ST"])}return t},i.cloneUniforms=function(t){var e,i=t;for(e in i.floats)this.setFloat(e,i.floats[e]);for(e in i.ints)this.setInt(e,i.ints[e]);for(e in i.floatArrays)this.setFloats(e,i.floatArrays[e]);for(e in i.textures)this.setTexture(e,i.textures[e]);for(e in i.vector2s)this.setVector2(e,i.vector2s[e]);for(e in i.vector3s)this.setVector3(e,i.vector3s[e]);for(e in i.vector4s)this.setVector4(e,i.vector4s[e]);for(e in i.colors)this.setColor(e,i.colors[e]);for(e in i.quaternions)this.setQuaternion(e,i.quaternions[e]);for(e in i.matrices)this.setMatrix(e,i.matrices[e]);for(e in i.vector4Arrays){for(var r=[],n=0;n<i.vector4Arrays[e].length;n+=4)r.push(new vm(i.vector4Arrays[e][n],i.vector4Arrays[e][n+1],i.vector4Arrays[e][n+2],i.vector4Arrays[e][n+3]));this.setVector4Array(e,r)}for(e in i.matrixArrays){for(var s=[],o=0;o<i.matrixArrays[e].length;o+=16){for(var a=ym.fromIdentity(),h=0;h<16;h++)a.elements[h]=i.matrixArrays[e][o+h];s.push(a)}this.setMatrixArray(e,s)}},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(){var e;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),this.textures={},this.shaderSource=null,this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=ti,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},ks(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Lo),bm=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}Ui(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.engine.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):He.error("Invalid render buffer size: "+t+"x"+e+".")}}else He.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=ti},e}(Nl),_m=((dm={})[Ys.RGBA]=34842,dm[Ys.RGB]=34843,dm[Ys.ALPHA]=33325,dm[Ys.RED]=33325,dm[Ys.LUMINANCE_ALPHA]=33327,dm[Ys.LUMINANCE]=33325,dm),wm=((fm={})[Ys.RGBA]=34836,fm[Ys.RGB]=34837,fm[Ys.ALPHA]=33326,fm[Ys.RED]=33326,fm[Ys.LUMINANCE_ALPHA]=33328,fm[Ys.LUMINANCE]=33326,fm),Tm=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}Ui(e,t);var i=e.prototype;return i.bind=function(t){this.engine.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){this.engine.addTexture(this);var t=this.engine.gl,e=this.source,i=e.target,r=void 0===i?t.TEXTURE_2D:i,n=e.name;this.textureBuffer=t.createTexture(),Zp(this.textureBuffer,n),this.target=r,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case Hs.image:delete this.source.image,delete this.source.cube;break;case Hs.data:delete this.source.data;break;case Hs.compressed:case Hs.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.engine||!this.textureBuffer)return this.width=0,void(this.height=0);var i=this.target,r=this.source,n=this.engine.gl,s=this.engine.gpuCapability.detail,o=r.sourceType,a=r.data,h=r.cube,l=r.image,c=r.video,u=r.mipmaps,d=r.mipmaps,f=t.data,p=t.cube,m=t.generateMipmap,g=void 0!==m&&m,v=t.mipmaps,y=r.format,x=r.type,b=r.internalFormat,_=0,w=0;this.bind(o===Hs.video),x===Ys.HALF_FLOAT?((x=s.halfFloatTexture)||He.error("Half float texture is not support."),Zs(n)&&b===y&&(y===Ys.LUMINANCE&&(y=Ys.RED),b=_m[y]),s.halfFloatLinear||(r.minFilter=r.magFilter=n.NEAREST,He.warn("Half float linear not support, change to NEAREST."))):x===n.FLOAT&&((x=s.floatTexture)||He.error("Float texture is not support."),Zs(n)&&b===y&&(y===Ys.LUMINANCE&&(y=Ys.RED),b=wm[y]),s.floatLinear||(r.minFilter=n.NEAREST,r.magFilter=n.NEAREST,He.warn("Float linear not support, change to NEAREST."))),void 0===r.premultiplyAlpha&&(r.premultiplyAlpha=!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),void 0===r.flipY&&(r.flipY=!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,r.flipY);var T,E,S=function(t,e){$e(t)&&$e(e)||Zs(n)?n.generateMipmap(i):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(o===Hs.framebuffer)f&&(_=null!=(T=f.width)?T:0,w=null!=(E=f.height)?E:0,_&&w&&(this.width!==_||this.height!==w)&&n.texImage2D(i,0,b,_,w,0,y,x,null));else if(o===Hs.data){var I;if(i===n.TEXTURE_CUBE_MAP)p.forEach(function(t,i){var r=e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,y,x,t),s=r[0],o=r[1];_=Math.max(s,_),w=Math.max(o,w)});else I=this.texImage2DData(n,i,0,b,y,x,a),_=I[0],w=I[1],g&&S(_,w)}else if(o===Hs.image||o===Hs.video){if(i===n.TEXTURE_CUBE_MAP)h.forEach(function(t,i){var r=e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,y,x,t),s=r[0],o=r[1];_=Math.max(s,_),w=Math.max(o,w)});else if(i===n.TEXTURE_2D){var A,C=null!=l?l:c;A=this.texImage2D(n,i,0,b,y,x,C),_=A[0],w=A[1]}g&&S(_,w)}else if(o===Hs.mipmaps){var P;i===n.TEXTURE_2D?u.forEach(function(t,r){var s;(P="data"in t?e.texImage2DData(n,i,r,b,y,x,t):e.texImage2D(n,i,r,b,y,x,t),0===r)&&(_=(s=P)[0],w=s[1])}):i===n.TEXTURE_CUBE_MAP&&d.forEach(function(t,i){t.forEach(function(t,r){var s;(P="data"in t?e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,y,x,t):e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,y,x,t),0===i)&&(_=(s=P)[0],w=s[1])})})}else o===Hs.compressed&&v&&0!==v.length&&(_=v[0].width,w=v[0].height,v.forEach(function(t,e){n.compressedTexImage2D(i,e,b,t.width,t.height,0,t.data)}));this.width=_,this.height=w,this.setTextureFilters(n,i,r)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,s=i.wrapS,o=void 0===s?t.CLAMP_TO_EDGE:s,a=i.wrapT,h=void 0===a?t.CLAMP_TO_EDGE:a,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=Zs(t)||$e(this.width)&&$e(this.height),u=i.magFilter?i.magFilter:t.NEAREST,d=i.minFilter?i.minFilter:t.NEAREST;c||d!==t.LINEAR_MIPMAP_LINEAR&&d!==t.LINEAR_MIPMAP_NEAREST&&d!==t.NEAREST_MIPMAP_LINEAR&&d!==t.NEAREST_MIPMAP_NEAREST||(d=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,d),t.texParameteri(e,t.TEXTURE_MAG_FILTER,u),t.texParameteri(e,t.TEXTURE_WRAP_S,c?o:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?h:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,s=r.sourceFrom,o=r.name,a=void 0===o?"":o;this.source=r,this.sourceType=n,this.sourceFrom=s,this.name=a},i.texImage2D=function(t,e,i,r,n,s,o){var a,h=this,l=this.source,c=l.sourceType,u=l.minFilter,d=l.magFilter,f=l.wrapS,p=l.wrapT,m=null!=(a=this.engine.gpuCapability.detail.maxTextureSize)?a:2048,g=o;if(c!==Hs.video){var v=u!==t.NEAREST||d!==t.NEAREST||f!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(v=v||o.width>m||o.height>m)&&setTimeout(function(){g=h.resizeImage(o)})}t.texImage2D(e,i,r,n,s,g);var y=[g.width,g.height];return c===Hs.video?[o.videoWidth,o.videoHeight]:y},i.texImage2DData=function(t,e,i,r,n,s,o){var a=o.data,h=o.width,l=o.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,i,r,h,l,0,n,s,c),[h,l]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Zs(this.engine.gl)&&t.width<n&&t.height<n)return t;var s=function(t,e,i,r){var n=t.width,s=t.height,o=Math.min(e,i||wa(n)),a=Math.min(e,r||wa(s));if(a!==s||o!==n){var h=Zd.getCanvas(),l=h.getContext("2d");return h.width=o,h.height=a,null==l||l.drawImage(t,0,0,n,s,0,0,o,a),He.warn("Image resize from "+n+"x"+s+" to "+o+"x"+a+"."),h}}(t,n,e,i);return s||t},i.reloadData=function(){var t=this;return $t(function(){return ie(this,function(e){switch(e.label){case 0:return t.offloaded?[4,Ro().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},i.offloadData=function(){if(this.initialized&&Ro().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.engine.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},i.uploadCurrentVideoFrame=function(){var t=this;return $t(function(){return ie(this,function(e){return t.source.sourceType===Hs.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]})})()},i.updateSource=function(t){this.source=this.assembleOptions(Cn({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.engine&&this.textureBuffer&&this.engine.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){He.error("This texture has been destroyed.")},this.initialize=ti,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(To);var Em=1,Sm=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,s=e.depthStencilAttachment,o=e.viewport,a=e.storeAction,h=e.name,l=void 0===h?"GLFramebuffer"+Em++:h;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==s?void 0:s.storageType)?n:rl.none,r.viewport=o,r.name=l,r.storeAction=a,r.updateProps(e),r}Ui(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.updateAttachmentTextures=function(){var t=this,e=this.viewport[2],i=this.viewport[3];this.attachmentTextures.length=0,this.colorTextures.forEach(function(r){var n={width:e,height:i,data:new Uint8Array(0)};r.initialize(),r.update({data:n}),le(t.attachmentTextures,r.textureBuffer)}),this.stencilTexture&&le(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:e,height:i,data:new Uint16Array(0)}}),le(this.attachmentTextures,this.depthTexture.textureBuffer))},i.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,s=null!=(i=t.depthStencilAttachment)?i:{storageType:rl.none},o=t.attachments.length>0,a=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,l=n.detail.readableDepthStencilTextures,c=s.storageType,u=s.storage;if(this.colorTextures=t.attachments.slice(),!o&&c!==rl.none)throw new Error("Use depth stencil attachment without color attachments.");switch(o&&(this.fbo=r.createGLFramebuffer(this.name)),c){case rl.depth_stencil_opaque:if(u){if(!Qt(u,bm))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=u,this.externalStorage=!0}else this.depthStencilRenderbuffer=new bm({format:Ys.DEPTH_STENCIL,attachment:Ys.DEPTH_STENCIL_ATTACHMENT,storageType:c},r);a=!1;break;case rl.depth_16_opaque:if(u){if(!Qt(u,bm))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=u,this.externalStorage=!0}else this.depthStencilRenderbuffer=new bm({attachment:Ys.DEPTH_ATTACHMENT,format:Ys.DEPTH_COMPONENT16,storageType:c},r);break;case rl.stencil_8_opaque:if(u){if(!Qt(u,bm))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=u,this.externalStorage=!0}else this.depthStencilRenderbuffer=new bm({attachment:Ys.STENCIL_ATTACHMENT,format:Ys.STENCIL_INDEX8,storageType:c},r);break;case rl.depth_16_texture:if(!l)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Tm(this.engine,{sourceType:Hs.framebuffer,format:Ys.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Ys.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case rl.depth_24_stencil_8_texture:if(!l)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Tm(this.engine,{sourceType:Hs.framebuffer,format:Ys.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),a=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,a),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.renderer.gl,r=this.colorTextures.length;if(t&&Zs(i)&&r>0){var n=[];if(t.depthAction===sl.clear&&this.depthStorage&&le(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===sl.clear&&this.stencilStorage&&le(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===sl.clear)for(var s=0;s<r;s++)le(n,i["COLOR_ATTACHMENT"+s]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.gl;Zs(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.renderer.gl,i=this.renderer.engine,r=this.viewport,n=r[0],s=r[1],o=r[2],a=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,s,o,a);var h=this.renderer.engine.whiteTexture,l=h.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==l&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),h.bind())});for(var c=0;c<4;c++)i.activeTexture(e.TEXTURE0+c),h.bind();if(!this.ready){var u=this,d=u.depthStencilRenderbuffer,f=u.depthTexture,p=u.stencilTexture;if(i.activeTexture(e.TEXTURE0),d)d.setSize(o,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,d.attachment,e.RENDERBUFFER,d.buffer);else if(f){f.source.data={width:o,height:a},f.update({data:{width:o,height:a,data:new Uint16Array(0)}});var m=f&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,m,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var g=e.checkFramebufferStatus(e.FRAMEBUFFER);if(g!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+g+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+". width="+o+", height="+a+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.renderer.gl,r=this.engine.gpuCapability,n=this.viewport,s=[];if(e){for(var o,a=nn(e);!(o=a()).done;){o.value.initialize()}this.colorTextures=e.slice()}this.renderer.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach(function(t,e){var o={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:o}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),s.push(!0)}),r.drawBuffers(i,s),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,s=n[0],o=n[1],a=n[2],h=n[3];s===t&&o===e&&a===i&&h===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){var e;this.renderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:hl.force;if(n===hl.force||n===hl.keepExternal&&!this.externalStorage)null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose();for(var s,o=nn(this.colorTextures);!(s=o()).done;){s.value.dispose()}null==(e=this.stencilTexture)||e.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},ks(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==rl.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==rl.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(al),Im=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],Be(t),this.gl=function(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"===e&&((r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}(t,e,i),this.contextLostListener=function(t){for(var e,i,n=nn(r.lostHandlers);!(i=n()).done;){i.value.lost(t)}null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=nn(r.restoreHandlers);!(i=n()).done;){i.value.restore()}null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){var t;(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl)&&(null==(t=this.gl.getExtension("WEBGL_lose_context"))||t.loseContext());this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Am=function(t){function e(e,i){var r;(r=t.call(this,e,i)||this).restoreCompositionsCache=[],i=Cn({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},i),r.context=new Im(e,i.glType,i),r.context.addLostHandler({lost:function(t){var e;null==(e=r.ticker)||e.pause(),r.restoreCompositionsCache=r.compositions.slice(),r.compositions.forEach(function(e){return e.lost(t)}),r.renderer.lost(t),r.emit("contextlost",{engine:yp(r),e:t})}});var n=yp(r);r.context.addRestoreHandler({restore:$t(function(){var t;return ie(this,function(e){switch(e.label){case 0:return n.renderer.restore(),[4,Promise.all(n.restoreCompositionsCache.map($t(function(t){var e,i,r,s,o,a,h,l,c,u,d;return ie(this,function(f){switch(f.label){case 0:return e=t.time,i=t.url,r=t.speed,s=t.reusable,o=t.renderOrder,a=t.transform,h=t.videoState,[4,qp.load(i,n)];case 1:(l=f.sent()).speed=r,l.reusable=s,l.renderOrder=o,l.transform.setPosition(a.position.x,a.position.y,a.position.z),l.transform.setRotation(a.rotation.x,a.rotation.y,a.rotation.z),l.transform.setScale(a.scale.x,a.scale.y,a.scale.z),l.onItemMessage=t.onItemMessage,c=0,f.label=2;case 2:return c<h.length?h[c]?((u=l.textures[c].source.video).currentTime=null!=(d=h[c])?d:0,[4,u.play()]):[3,4]:[3,5];case 3:f.sent(),f.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}})})))];case 1:return e.sent(),n.restoreCompositionsCache=[],null==(t=n.ticker)||t.resume(),Re()&&n.canvas&&(n.canvas.style.display="none",window.setTimeout(function(){n.canvas.style.display=""},0)),n.emit("contextrestored",n),[2]}})})});var s=r.context.gl;return Be(s),r.gl=s,r.reset(),r.gpuCapability=new Ul(s),r.shaderLibrary=new lm(yp(r)),r.renderer=new mm(yp(r)),r.maxTextureCount=r.gl.TEXTURE0+r.gl.getParameter(r.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,r.resize(),r}Ui(e,t);var i=e.prototype;return i.dispose=function(){var e;this.disposed||(t.prototype.dispose.call(this),this.renderer.dispose(),null==(e=this.shaderLibrary)||e.dispose(),this.context.dispose(),this.reset())},i.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Ys.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},i.toggle=function(t,e){e?this.enable(t):this.disable(t)},i.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},i.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},i.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},i.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},i.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},i.useProgram=function(t){this.set1("useProgram",t)},i.clear=function(t){this.gl.clear(t)},i.clearDepth=function(t){this.set1("clearDepth",t)},i.depthFunc=function(t){this.set1("depthFunc",t)},i.depthMask=function(t){this.set1("depthMask",t)},i.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},i.depthRange=function(t,e){this.set2("depthRange",t,e)},i.clearStencil=function(t){this.set1("clearStencil",t)},i.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},i.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},i.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},i.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},i.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},i.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},i.cullFace=function(t){this.set1("cullFace",t)},i.frontFace=function(t){this.set1("frontFace",t)},i.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},i.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},i.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},i.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},i.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},i.blendEquation=function(t){this.set1("blendEquation",t)},i.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},i.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},i.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},i.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},i.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},i.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},i.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),r.x===e&&r.y===i||this.gl[t](r.x=e,r.y=i)},i.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===i&&n.z===r||this.gl[t](n.x=e,n.y=i,n.z=r)},i.set4=function(t,e,i,r,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),s.x===e&&s.y===i&&s.z===r&&s.w===n||this.gl[t](s.x=e,s.y=i,s.z=r,s.w=n)},i.get=function(t){return this.glCapabilityCache[t]},i.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},i.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},i.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},i.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},i.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},i.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},i.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},i.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},i.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},i.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},i.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},i.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},i.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},i.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},i.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},e}(Yp);var Cm="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Pm="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Mm="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",Rm="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Om=new Map;var Dm=1,km=function(t){function e(e){var i;(i=t.call(this)||this).resumePending=!1,i.disposed=!1,i.lost=function(t){i.handleEmitEvent("webglcontextlost",t)};var r=yp(i);i.restore=$t(function(){return ie(this,function(t){return r.emit("webglcontextrestored"),[2]})});var n,s,o=e.container,a=e.canvas,h=e.fps,l=e.name,c=e.pixelRatio,u=e.manualRender,d=e.renderFramework,f=e.notifyTouch,p=e.onError,m=e.interactive,g=void 0!==m&&m,v=e.renderOptions,y=void 0===v?{}:v,x=e.env,b=void 0===x?"":x,_=y.willCaptureImage,w=y.premultipliedAlpha;if(i.onError=p,"debug-disable"===d)return n=i,!s||"object"!==te(s)&&"function"!=typeof s?yp(n):s;var T,E=(T=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===T[1]||"16"===T[1]&&"5"===T[2])?"webgl":"webgl2";d&&(E="webgl"===d?"webgl":"webgl2"),i.env=b,i.name=l||""+Dm++;var S=!1;try{if(Xs.length)throw new Error("Errors before player create: "+Xs.map(function(t,e){return"\n "+(e+1)+": "+t})+".",{cause:"webgliniterror"});a?(i.canvas=a,S=!0):(!function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Cm+".")}(o),i.canvas=document.createElement("canvas"),o.appendChild(i.canvas)),i.container=i.canvas.parentElement,i.engine=Yp.create(i.canvas,{name:l,glType:E,fps:h,env:b,preserveDrawingBuffer:_,premultipliedAlpha:w,manualRender:u,notifyTouch:f,interactive:g,pixelRatio:Number.isFinite(c)?c:Ae()}),i.engine.offscreenMode=!0,i.engine.on("rendererror",function(t){i.handleEmitEvent("rendererror",t)}),i.engine.on("contextlost",function(t){i.lost(t.e)});var I=yp(i);i.engine.on("contextrestored",$t(function(){return ie(this,function(t){switch(t.label){case 0:return[4,I.restore()];case 1:return t.sent(),[2]}})})),i.engine.on("click",function(t){var e=t.behavior||Ii.NOTIFY;i.emit("click",Cn({},t,{player:yp(i),compositionId:t.composition.id,compositionName:t.composition.name})),e===Ii.RESUME_PLAYER&&i.resume()}),i.engine.on("pointerdown",function(t){i.emit("pointerdown",t)}),i.engine.on("pointerup",function(t){i.emit("pointerup",t)}),i.engine.on("pointermove",function(t){i.emit("pointermove",t)}),i.engine.runRenderLoop(function(t){i.autoPlaying&&i.emit("update",{player:yp(i),playing:!0})}),Om.forEach(function(t){t.gpuCapability.type!==i.gpuCapability.type&&He.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+i.gpuCapability.type+".\nsee "+Rm+".")}),Om.set(i.canvas,yp(i)),function(){for(var t,e=[],i=nn(Om.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&He.error("Current running player count: "+e.length+", see "+Mm+".",e)}()}catch(t){var A;i.canvas&&!S&&i.canvas.remove(),null==(A=i.engine)||A.dispose(),i.disposed=!0,i.handleThrowError(t)}return i}Ui(e,t);var i=e.prototype;return i.setSpeed=function(t){isNaN(t)||(this.engine.speed=t)},i.getSpeed=function(){return this.engine.speed},i.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},i.getCompositions=function(){return this.compositions.sort(function(t,e){return t.getIndex()-e.getIndex()})},i.getAssetManager=function(){return this.assetManagers},i.loadScene=function(t,e){var i=this;return $t(function(){var r,n,s,o,a,h,l,c,u,d;return ie(this,function(f){switch(f.label){case 0:for(Be(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),(n=null==(r=null==e?void 0:e.autoplay)||r)&&(i.autoPlaying=!0),s=[],o=[],Ye(t)?(a=s).push.apply(a,[].concat(t)):s.push(t),h=nn(i.assetManagers);!(l=h()).done;)l.value.dispose();return i.engine.assetManagers=[],c=i.engine.compositions.length,[4,Promise.all(s.map($t(function(t,r){var s,a,h,l,u,d,f;return ie(this,function(p){switch(p.label){case 0:return s=c+r,a=i.assetService.assembleSceneLoadOptions(t,Cn({autoplay:n},e)),h=a.source,l=a.options,d=null==(u=null==l?void 0:l.autoplay)||u,[4,qp.load(h,i.engine,l)];case 1:return(f=p.sent()).setIndex(s),f.onItemMessage=function(t){i.emit("message",t)},o[r]=d,[2,f]}})})))];case 1:for(u=f.sent(),d=0;d<u.length;d++)o[d]?u[d].play():u[d].pause();return u.some(function(t){return!t.getPaused()})&&i.emit("play",{time:0}),[2,Ye(t)?u:u[0]]}})})()},i.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},i.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.tick(0),this.emit("play",{time:t})},i.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.tick(0),this.emit("pause")},i.playSequence=function(t){for(var e,i=function(e){t[e].on("end",function(){t[e+1].play()})},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},i.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map(function(t){t.pause()}),t&&t.offloadTexture&&this.offloadTexture())},i.resume=function(){var t=this;return $t(function(){var e;return ie(this,function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return t.compositions.map(function(t){t.resume()}),null==(e=t.ticker)||e.resume(),[2]}})})()},i.tick=function(t){this.engine.mainLoop(t)},i.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},i.resize=function(){this.engine.resize()},i.clearCanvas=function(){this.renderer.clear({stencilAction:Gs.clear,clearStencil:0,depthAction:Gs.clear,clearDepth:1,colorAction:Gs.clear,clearColor:[0,0,0,0]})},i.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()})},i.dispose=function(){if(He.info("Call player destroyed: "+this.name+"."),!this.disposed){Om.delete(this.canvas),this.pause(),this.engine.dispose(),Qt(this.canvas,HTMLCanvasElement)&&(Zd.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var t=function(t){return"Never use destroyed player: "+t+" again, see "+Pm+"."}(this.name),e=function(){return function(t){throw new Error(t)}(t)},i=function(){return e=t,Promise.reject(e);var e};this.tick=e,this.resize=e,this.loadScene=i,this.play=i,this.gotoAndPlay=i,this.gotoAndStop=i,this.playSequence=e,this.destroyCurrentCompositions=e,this.resume=i,this.disposed=!0}},i.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},i.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},i.handleEmitEvent=function(t,e){this.onError?Qt(e,Event)?this.onError(new Error(e.type,{cause:t}),e):Qt(e,Error)?this.onError(new Error(e.message,{cause:t}),e):this.onError(new Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},ks(e,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(t){this.engine.eventSystem.skipPointerMovePicking=t}},{key:"ticker",get:function(){return this.engine.ticker}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"gpuCapability",get:function(){return this.engine.gpuCapability}},{key:"compositions",get:function(){return this.engine.compositions}},{key:"assetManagers",get:function(){return this.engine.assetManagers}},{key:"assetService",get:function(){return this.engine.assetService}},{key:"event",get:function(){return this.engine.eventSystem}},{key:"displayAspect",get:function(){return this.engine.displayAspect},set:function(t){this.engine.displayAspect=t}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(t){this.engine.displayScale=t}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(t){this.engine.offscreenMode=t}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(t){this.engine.pixelRatio=t}},{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),e}(Qo);ee([function(t,e,i){var r=i.value;return i.value=$t(function(){var e,i,n,s,o=arguments;return ie(this,function(a){switch(a.label){case 0:for(e=o.length,i=new Array(e),n=0;n<e;n++)i[n]=o[n];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.apply(this,i)];case 2:return[2,a.sent()];case 3:return s=a.sent(),t.handleThrowError.call(this,s),[3,4];case 4:return[2]}})}),i}],km.prototype,"loadScene",null),To.create=function(t,e){return new Tm(t,e)},To.createWithData=function(t,e,i){void 0===e&&(e=function(t){Xe(t)&&(t=Te(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Ys.UNSIGNED_BYTE:r,s=i.format,o=void 0===s?Ys.RGBA:s,a=i.internalFormat,h=i.wrapS,l=void 0===h?Ys.MIRRORED_REPEAT:h,c=i.wrapT,u=void 0===c?Ys.MIRRORED_REPEAT:c,d=i.minFilter,f=void 0===d?Ys.NEAREST:d,p=i.magFilter,m=void 0===p?Ys.NEAREST:p,g=i.flipY,v=void 0!==g&&g,y=i.generateMipmap,x=void 0!==y&&y;return new Tm(t,{data:e,type:n,sourceType:Hs.data,format:o,internalFormat:a||o,wrapS:l,wrapT:u,minFilter:f,magFilter:m,flipY:v,generateMipmap:x})},Lo.create=function(t,e){return new xm(t,e)},wl.create=function(t,e){return new rm(t,e)},El.create=function(t,e){return new El(t,e)},Nl.create=function(t){return new bm(t)},al.create=function(t,e){return new Sm(t,e)},jl.create=function(t){return new mm(t)},Yp.create=function(t,e){return new Am(t,e)};var Lm="2.9.0-alpha.1";function Fm(t,e){return(Fm=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Nm(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Fm(t,e)}function Bm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bm=function(){return!!t})()}function zm(t,e,i){return(zm=Bm()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Fm(n,i.prototype),n}).apply(null,arguments)}function Um(t){return(Um=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Vm(t){var e="function"==typeof Map?new Map:void 0;return Vm=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return zm(t,arguments,Um(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Fm(r,t)},Vm(t)}He.info("Player version: "+Lm+".");var Gm,jm,Hm=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="rich-text",e}return Nm(e,t),e}(Vm(Bi));function Wm(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function Xm(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Wm(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wm(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(jm=Gm||(Gm={})).ContextStart="ContextStart",jm.Text="Text",jm.ContextEnd="ContextEnd",jm.EscapedChar="EscapedChar";var Ym=/^<([a-z]+)(=([^>]+))?>$/,qm=/^<\/([a-z]+)>$/,Km=[["EscapedChar",/^\\([=<>\\/])/],["ContextStart",/^<[a-z]+(=[^>]+)?>/],["ContextEnd",/^<\/[a-z]+>/],["Text",/^[^</>=\\]+/]],Zm=function(t,e,i){if(void 0===e&&(e=[]),void 0===i&&(i=0),!t)return e;var r=/^\\([=<>\\/])/.exec(t);if(r){var n=r[1];return Zm(t.slice(2),e.concat({tokenType:"Text",value:n}),i+2)}for(var s,o=Xm(Km);!(s=o()).done;){var a=s.value,h=a[0],l=a[1];if("EscapedChar"!==h){var c=l.exec(t);if(c){var u=c[0],d=u.length;return Zm(t.slice(d),e.concat({tokenType:h,value:u}),i+d)}}}if(t.length>0)return Zm(t.slice(1),e.concat({tokenType:"Text",value:t[0]}),i+1);throw new Error('Unexpected token: "'+t[0]+'" at position '+i+' while reading "'+t+'"')};function Jm(t){return function(e){for(var i,r=Xm(function(t){var e=function(){for(var t,e="",i=!1;n.length>0&&"Text"===(null==(t=n[0])?void 0:t.tokenType);){var r=o();r&&(e+=r.value,i=!0)}return i?e:void 0},i=function(){var t=a();if("ContextStart"===(null==t?void 0:t.tokenType)){o();var e,i=t.value.match(Ym);if(i)return{attributeName:i[1],attributeParam:null!=(e=i[3])?e:""};throw new Error("Expected a start tag marker at position "+s)}return{}},r=function(){var t=a();if("ContextEnd"===(null==t?void 0:t.tokenType)){o();var e=t.value.match(qm);if(e)return{attributeName:e[1]};throw new Error("Expect an end tag marker at position "+s)}return{}},n=Zm(t),s=0,o=function(){var t,e=n.shift();return s+=null!=(t=null==e?void 0:e.value.length)?t:0,e},a=function(){return n[0]},h=[];return function t(n,o){for(void 0===n&&(n=[]),void 0===o&&(o="");;){var a=e();if(a)h.push({attributes:n,text:a});else{var l=i(),c=l.attributeName,u=l.attributeParam;if(!c){if(o){var d=r().attributeName;if(!d)throw new Error('Expect an end tag marker "'+o+'" at position '+s+" but found no tag!");if(d!==o)throw new Error('Expect an end tag marker "'+o+'" at position '+s+' but found tag "'+d+'"');return}break}t(n.concat({attributeName:c,attributeParam:null!=u?u:""}),c)}}}(),h}(e));!(i=r()).done;){var n=i.value,s=n.text,o=n.attributes.reduce(function(t,e){var i=e.attributeName,r=e.attributeParam;return i&&(t[i]=r),t},{});t(s,o)}}}var $m=function(){function t(t){this.width=0,this.height=0;var e=t.textOverflow,i=void 0===e?en.TextOverflow.clip:e,r=t.textVerticalAlign,n=void 0===r?en.TextVerticalAlign.middle:r,s=t.textAlign,o=void 0===s?en.TextAlignment.left:s,a=t.letterSpace,h=void 0===a?0:a,l=t.lineHeight,c=void 0===l?.571:l,u=t.wrapEnabled,d=void 0!==u&&u,f=t.maxTextWidth,p=void 0===f?350:f,m=t.maxTextHeight,g=void 0===m?1e3:m,v=t.autoResize,y=void 0===v?en.TextSizeMode.autoWidth:v,x=t.useLegacyRichText,b=void 0!==x&&x;this.letterSpace=h,this.lineHeight=c,this.useLegacyRichText=b,this.overflow=i,this.textVerticalAlign=n,this.textAlign=o,this.width=100,this.height=100,this.wrapEnabled=d,this.maxTextWidth=p,this.maxTextHeight=g,this.autoResize=y}var e=t.prototype;return e.getOffsetY=function(t,e,i,r,n){var s=t.outlineWidth,o=t.fontScale,a=(i-r)/3,h=r+s*o,l=void 0!==n?n:i*(e-1),c=0;switch(this.textVerticalAlign){case en.TextVerticalAlign.top:c=h+a;break;case en.TextVerticalAlign.middle:c=(this.height*o-l+h)/2;break;case en.TextVerticalAlign.bottom:c=this.height*o-l-a}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case en.TextAlignment.left:i=t.outlineWidth*t.fontScale;break;case en.TextAlignment.middle:i=(this.width*t.fontScale-e)/2;break;case en.TextAlignment.right:i=this.width*t.fontScale-e}return i},e.getOffsetYRich=function(t,e,i){if(0===e.length)return 0;var r=t.outlineWidth,n=t.fontScale,s=e.reduce(function(t,e){return t+e},0),o=(e[0]-i)/3,a=i+r*n,h=s-e[0],l=0;switch(this.textVerticalAlign){case en.TextVerticalAlign.top:l=a+o;break;case en.TextVerticalAlign.middle:l=(this.height*n-s)/2+a;break;case en.TextVerticalAlign.bottom:l=this.height*n-h-o}return l},e.getOffsetXRich=function(t,e,i){switch(this.textAlign){case en.TextAlignment.left:return t.outlineWidth;case en.TextAlignment.middle:return(e-i)/2;case en.TextAlignment.right:return e-i;default:return 0}},e.setSize=function(t,e){this.width=t,this.height=e},t}();function Qm(t,e){if(void 0===e&&(e=1),3!==(t=t.replace(/^#/,"")).length&&4!==t.length||(t=t.split("").map(function(t){return t+t}).join("")),8===t.length){var i=parseInt(t.slice(6,8),16)/255;t=t.slice(0,6),e=i}var r=parseInt(t,16);return[r>>16&255,r>>8&255,255&r,e]}function tg(t,e){if(void 0===e&&(e=1),"string"!=typeof t||!t)throw new Error("Invalid color string");return t.startsWith("#")?Qm(t,e):Qm(function(t){if("string"!=typeof t||!t)throw new Error("Invalid color name provided");if("undefined"==typeof document)throw new Error("This method requires a browser environment");var e=document.createElement("canvas"),i=e.getContext("2d");if(i)try{return i.fillStyle=t,i.fillStyle}finally{null==e.remove||e.remove.call(e)}throw new Error("Failed to get 2D context for color conversion!")}(t))}var eg=function(){function t(){}var e=t.prototype;return e.computeLines=function(t,e,i,r,n){var s=this,o=[],a=[],h=r.lineHeight||0,l=this.createNewLine(),c=0,u=0,d=function(){if(0!==l.chars.length){l.lineHeight=h;var t=0===o.length?0:a[a.length-1]+h;a.push(t),u+=l.lineHeight,o.push(l),c=Math.max(c,l.width),l=s.createNewLine()}};t.forEach(function(t){var r=t.text,s=t.isNewLine,o=t.fontSize;s&&d();var a=t.fontStyle||i.fontStyle||"normal";e.font=a+" "+(t.fontWeight||i.textWeight)+" 10px "+(t.fontFamily||i.fontFamily),l.offsetX.push(l.width);for(var h=.1*o,c=e.measureText("x"),u=c.fontBoundingBoxAscent*h,f=c.fontBoundingBoxDescent*h,p=0,m=[],g=0;g<r.length;g++){var v=r[g],y=e.measureText(v).width,x=(y<=0?0:y)*h;g>0&&(p+=n),m.push({char:v,x:p}),p+=x}l.chars.push(m),l.width+=p,l.richOptions.push(t),l.lineAscent=Math.max(l.lineAscent||0,u),l.lineDescent=Math.max(l.lineDescent||0,f)}),d();var f=1/0,p=-1/0;if(0===o.length)return{lines:o,maxLineWidth:c,totalHeight:u,bboxTop:0,bboxBottom:0,bboxHeight:0};for(var m=0;m<o.length;m++){var g=o[m].lineAscent||0,v=o[m].lineDescent||0,y=(h-(g+v))/2;f=Math.min(f,a[m]-g-y),p=Math.max(p,a[m]+v+y)}return{lines:o,maxLineWidth:c,totalHeight:u,bboxTop:f,bboxBottom:p,bboxHeight:p-f}},e.createNewLine=function(){return{richOptions:[],offsetX:[],width:0,lineHeight:0,offsetY:0,chars:[],lineAscent:0,lineDescent:0}},t}(),ig=function(){function t(){}var e=t.prototype;return e.computeLines=function(t,e,i,r,n){var s=this,o=[],a=[],h=r.lineHeight||0,l=r.maxTextWidth||1/0,c=this.createNewLine(),u=0,d=0,f=null,p=0,m=[],g=null,v=function(){if(y(),0!==c.chars.length){c.lineHeight=h;var t=0===o.length?0:a[a.length-1]+h;a.push(t),d+=c.lineHeight,o.push(c),u=Math.max(u,c.width),c=s.createNewLine(),f=null,p=0,m=[],g=null}},y=function(){0!==m.length&&(null===f&&(f=c.width),c.offsetX.push(f),c.chars.push(m),g&&c.richOptions.push(g),f=null,p=0,m=[],g=null)};t.forEach(function(t){var r=t.text,s=t.isNewLine,o=t.fontSize,a=t.fontStyle||i.fontStyle||"normal";e.font=a+" "+(t.fontWeight||i.textWeight)+" 10px "+(t.fontFamily||i.fontFamily),s&&(y(),v());for(var h=.1*o,u=e.measureText("x"),d=u.fontBoundingBoxAscent*h,x=u.fontBoundingBoxDescent*h,b=0;b<r.length;b++){var _=r[b],w=e.measureText(_).width,T=(w<=0?0:w)*h,E=m.length>0?n:0;c.width+E+T>l&&(y(),v()),null===f&&(f=c.width,g=t),m.length>0&&(p+=n,c.width+=n),m.push({char:_,x:p}),c.lineAscent=Math.max(c.lineAscent||0,d),c.lineDescent=Math.max(c.lineDescent||0,x),p+=T,c.width+=T}y()}),v();var x=1/0,b=-1/0;if(0===o.length)return{lines:o,maxLineWidth:u,totalHeight:d,bboxTop:0,bboxBottom:0,bboxHeight:0};for(var _=0;_<o.length;_++){var w=o[_].lineAscent||0,T=o[_].lineDescent||0,E=(h-(w+T))/2;x=Math.min(x,a[_]-w-E),b=Math.max(b,a[_]+T+E)}return{lines:o,maxLineWidth:u,totalHeight:d,bboxTop:x,bboxBottom:b,bboxHeight:b-x}},e.createNewLine=function(){return{richOptions:[],offsetX:[],width:0,lineHeight:0,offsetY:0,chars:[],lineAscent:0,lineDescent:0}},t}(),rg=function(){function t(){}return t.prototype.resolveCanvas=function(t,e,i,r,n){return{canvasWidth:Math.max(1,Math.ceil(e)),canvasHeight:Math.max(1,Math.ceil(i)),renderOffsetX:0,renderOffsetY:0}},t}(),ng=function(){function t(){}return t.prototype.resolveCanvas=function(t,e,i,r,n){if(0===t.length)return{canvasWidth:Math.max(1,e),canvasHeight:Math.max(1,i),renderOffsetX:0,renderOffsetY:0};for(var s=1/0,o=-1/0,a=n.baselineY,h=0;h<t.length;h++){var l,c,u=null!=(l=t[h].lineAscent)?l:0,d=null!=(c=t[h].lineDescent)?c:0,f=u+d,p=Math.max(0,(t[h].lineHeight-f)/2);s=Math.min(s,a-u-p),o=Math.max(o,a+d+p),h<t.length-1&&(a+=t[h+1].lineHeight)}for(var m=Math.max(0,-s),g=Math.max(0,o-i),v=Math.max(m,g),y=1/0,x=-1/0,b=0;b<t.length;b++){var _,w,T=null!=(_=r.lineOffsets[b])?_:0,E=null!=(w=t[b].width)?w:0;y=Math.min(y,T),x=Math.max(x,T+E)}isFinite(y)||(y=0),isFinite(x)||(x=0);var S=Math.max(0,-y),I=Math.max(0,x-e),A=Math.max(S,I),C=Math.ceil(e+2*A),P=Math.ceil(i+2*v);return{canvasWidth:Math.max(1,C),canvasHeight:Math.max(1,P),renderOffsetX:A,renderOffsetY:v}},t}(),sg=function(){function t(){}return t.prototype.getHorizontalOffsets=function(t,e,i,r){return{lineOffsets:t.map(function(t){return i.getOffsetXRich(r,e,t.width)})}},t}(),og=function(){function t(){}return t.prototype.getVerticalOffsets=function(t,e,i){if(0===t.length)return{baselineY:0,lineYOffsets:[]};for(var r=[0],n=1;n<t.length;n++)r[n]=r[n-1]+t[n].lineHeight;for(var s=1/0,o=-1/0,a=0;a<t.length;a++){var h,l,c=null!=(h=t[a].lineAscent)?h:0,u=null!=(l=t[a].lineDescent)?l:0,d=c+u,f=(t[a].lineHeight-d)/2;s=Math.min(s,r[a]-c-f),o=Math.max(o,r[a]+u+f)}var p=o-s,m=0;switch(i.textVerticalAlign){case en.TextVerticalAlign.top:m=-s;break;case en.TextVerticalAlign.middle:m=(e-p)/2-s;break;case en.TextVerticalAlign.bottom:m=e-p-s}var g=r.map(function(t){return m+t});return{baselineY:m,lineYOffsets:g}},t}(),ag=function(){function t(){}return t.createWrapStrategy=function(t){return t?new ig:new eg},t.createOverflowStrategy=function(t){switch(t){case en.TextOverflow.clip:return new rg;case en.TextOverflow.display:case en.TextOverflow.visible:default:return new ng}},t.createHorizontalAlignStrategy=function(){return new sg},t.createVerticalAlignStrategy=function(){return new og},t}();function hg(){return hg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},hg.apply(this,arguments)}var lg=0,cg=function(t){function e(e){var i;return(i=t.call(this,e)||this).isDirty=!0,i.text="",i.processedTextOptions=[],i.singleLineHeight=1.571,i.size=null,i.initialized=!1,i.canvasSize=null,i.SCALE_FACTOR=.11092565,i.ALPHA_FIX_VALUE=1/255,i.name="MRichText"+lg++,i.initTextBase(e),i.richWrapStrategy=ag.createWrapStrategy(),i.richOverflowStrategy=ag.createOverflowStrategy(en.TextOverflow.display),i.richHorizontalAlignStrategy=ag.createHorizontalAlignStrategy(),i.richVerticalAlignStrategy=ag.createVerticalAlignStrategy(),i}Nm(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.textStyle=new $d(r),this.textLayout=new $m(r),this.text=r.text?r.text.toString():" ",this.textLayout.useLegacyRichText&&(this.textLayout.textVerticalAlign=en.TextVerticalAlign.middle),this.updateStrategies(),this.updateTexture(),this.material.setColor("_Color",new oa.Color(1,1,1,1))},i.updateStrategies=function(){var t=this.textLayout;t&&(this.richWrapStrategy=ag.createWrapStrategy(t.wrapEnabled),this.richOverflowStrategy=ag.createOverflowStrategy(t.overflow))},i.generateTextProgram=function(t){var e=this;this.processedTextOptions=[],Jm(function(t,i){/^\n+$/.test(t)&&(t=t.replace(/\n/g,"\n ")),t.split("\n").forEach(function(t,r){var n={text:t,fontSize:e.textStyle.fontSize,isNewLine:!1};r>0&&(n.isNewLine=!0),"b"in i&&(n.fontWeight=en.TextWeight.bold),"i"in i&&(n.fontStyle=en.FontStyle.italic),"size"in i&&i.size&&(n.fontSize=parseInt(i.size,10)),"color"in i&&i.color&&(n.fontColor=tg(i.color)),e.processedTextOptions.push(n)})})(t)},i.updateWithOptions=function(t){this.textStyle=new $d(t),this.textLayout=new $m(t),this.text=t.text?t.text.toString():" ",this.textLayout.useLegacyRichText&&(this.textLayout.textVerticalAlign=en.TextVerticalAlign.middle),this.updateStrategies(),this.isDirty=!0},i.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas&&this.textStyle&&this.textLayout){var e=!0===this.textLayout.useLegacyRichText;this.singleLineHeight=e?1.571:1,e?this.updateTextureLegacy(t):this.updateTextureWithStrategies(t)}},i.updateTextureLegacy=function(t){var e=this;if(this.isDirty&&this.context&&this.canvas&&this.textStyle){var i=.1;this.generateTextProgram(this.text);var r=0,n=0,s=this.textLayout,o=this.textStyle,a=s.overflow,h=s.letterSpace,l=void 0===h?0:h,c=this.context,u=[],d=o.fontSize*o.fontScale,f={richOptions:[],offsetX:[],width:0,lineHeight:d*this.singleLineHeight,offsetY:d*(this.singleLineHeight-1)/2};if(this.processedTextOptions.forEach(function(t){var s=t.text,a=t.isNewLine,h=t.fontSize;a&&(u.push(f),r=Math.max(r,f.width),f={richOptions:[],offsetX:[],width:0,lineHeight:d*e.singleLineHeight,offsetY:d*(e.singleLineHeight-1)/2},n+=f.lineHeight),c.font=(t.fontWeight||o.textWeight)+" 10px "+(t.fontFamily||o.fontFamily);var p=c.measureText(s),m=p.width;if(void 0!==p.actualBoundingBoxLeft&&void 0!==p.actualBoundingBoxRight){var g=p.actualBoundingBoxLeft+p.actualBoundingBoxRight;g>0&&(m=Math.max(m,g))}var v=h*e.singleLineHeight*o.fontScale;v>f.lineHeight&&(n+=v-f.lineHeight,f.lineHeight=v,f.offsetY=h*o.fontScale*(e.singleLineHeight-1)/2),f.offsetX.push(f.width),f.width+=(m<=0?0:m)*h*i*o.fontScale+s.length*l,f.richOptions.push(t)}),u.push(f),r=Math.max(r,f.width),n+=f.lineHeight,0!==r&&0!==n){void 0!==this.size&&null!==this.size||(this.size=this.item.transform.size.clone());var p=this.size,m=p.x,g=void 0===m?1:m,v=p.y,y=void 0===v?1:v;if(!this.initialized){this.canvasSize=this.canvasSize?this.canvasSize:new oa.Vector2(r,n);var x=this.canvasSize,b=x.x,_=x.y;this.item.transform.size.set(g*b*i*i,y*_*i*i),this.size=this.item.transform.size.clone(),this.initialized=!0}Be(this.canvasSize);var w=this.canvasSize,T=w.x,E=w.y;s.width=T/o.fontScale,s.height=E/o.fontScale,this.renderToTexture(T,E,t,function(t){if(0!==u.length){var i=s.getOffsetY(o,u.length,d*e.singleLineHeight,o.fontSize);u.forEach(function(e,r){var n=e.richOptions,h=e.offsetX,l=e.width,c=l,u=h;if(a===en.TextOverflow.display&&l>T){var d=T/l;c*=d,u=h.map(function(t){return t*d})}var f=s.getOffsetX(o,c);r>0&&(i+=e.lineHeight-e.offsetY),n.forEach(function(e,r){var n=o.fontScale,s=o.textColor,h=o.fontFamily,c=o.textWeight,d=o.fontStyle,p=e.text,m=e.fontSize,g=e.fontColor,v=void 0===g?s:g,y=e.fontFamily,x=void 0===y?h:y,b=e.fontWeight,_=void 0===b?c:b,w=e.fontStyle,E=void 0===w?d:w,S=m;a===en.TextOverflow.display&&l>T&&(S/=l/T);var I=u[r]+f;t.font=E+" "+_+" "+S*n+"px "+x;var A=v[0],C=v[1],P=v[2],M=v[3];t.fillStyle="rgba("+A+", "+C+", "+P+", "+M+")",t.fillText(p,I,i)})})}},{disposeOld:!1}),this.isDirty=!1}else this.isDirty=!1}},i.updateTextureWithStrategies=function(t){var e=this;if(this.isDirty&&this.context&&this.canvas){this.generateTextProgram(this.text);var i=this.textLayout,r=i.letterSpace,n=void 0===r?0:r,s=this.context;if(s){var o=this.textStyle.fontScale;i.autoResize===en.TextSizeMode.autoWidth&&(i.maxTextWidth=Number.MAX_SAFE_INTEGER);var a,h,l=this.richWrapStrategy.computeLines(this.processedTextOptions,s,this.textStyle,i,n);switch(i.autoResize){case en.TextSizeMode.autoWidth:a=Math.max(1,l.maxLineWidth||0),h=Math.max(1,l.totalHeight||0);break;case en.TextSizeMode.autoHeight:a=i.maxTextWidth,h=Math.max(1,l.totalHeight||0);break;case en.TextSizeMode.fixed:default:a=i.maxTextWidth,h=i.maxTextHeight}if(i.overflow===en.TextOverflow.display){var c=Math.max(1,l.maxLineWidth||0),u=Math.max(1,l.totalHeight||0);!function(t,e,i,r,n){var s=function(t,e){return Math.abs(e)>1e-5?t/e:1},o=Math.max(1,e),a=Math.max(1,i),h=Math.min(1,s(r,o),s(n,a));if(!(h>.9999))for(var l,c=Xm(t);!(l=c()).done;){var u=l.value;if(u.width*=h,u.lineHeight*=h,u.offsetX)for(var d=0;d<u.offsetX.length;d++)u.offsetX[d]*=h;for(var f,p=Xm(u.chars||[]);!(f=p()).done;)for(var m,g=Xm(f.value);!(m=g()).done;)m.value.x*=h;for(var v=u.richOptions||[],y=[],x=0;x<v.length;x++)y.push(hg({},v[x],{fontSize:v[x].fontSize*h}));u.richOptions=y,null!=u.lineAscent&&(u.lineAscent*=h),null!=u.lineDescent&&(u.lineDescent*=h)}}(l.lines,c,u,a,h)}var d=this.richHorizontalAlignStrategy.getHorizontalOffsets(l.lines,a,i,this.textStyle),f=this.richVerticalAlignStrategy.getVerticalOffsets(l.lines,h,i),p=this.richOverflowStrategy.resolveCanvas(l.lines,a,h,d,f),m=Math.max(1,Math.ceil(p.canvasWidth*o)),g=Math.max(1,Math.ceil(p.canvasHeight*o));this.item.transform.size.set(p.canvasWidth*this.SCALE_FACTOR*this.SCALE_FACTOR,p.canvasHeight*this.SCALE_FACTOR*this.SCALE_FACTOR),i.maxTextWidth=a,i.maxTextHeight=h,i.width=p.canvasWidth,i.height=p.canvasHeight,this.renderToTexture(m,g,t,function(t){t.scale(o,o),e.drawTextWithStrategies(t,l.lines,d,f,p,e.textStyle)},{disposeOld:!1}),this.isDirty=!1}}},i.drawTextWithStrategies=function(t,e,i,r,n,s){var o=n.renderOffsetX,a=n.renderOffsetY,h=r.baselineY+a,l=i.lineOffsets;e.forEach(function(i,r){var n=i.richOptions,a=i.chars,c=l[r]+o,u=h;n.forEach(function(e,r){var n=s.textColor,o=s.fontFamily,h=s.textWeight,l=s.fontStyle,d=e.fontSize,f=e.fontColor,p=void 0===f?n:f,m=e.fontFamily,g=void 0===m?o:m,v=e.fontWeight,y=void 0===v?h:v,x=e.fontStyle,b=void 0===x?l:x,_=d;t.font=b+" "+y+" "+_+"px "+g;var w=p[0],T=p[1],E=p[2],S=p[3];t.fillStyle="rgba("+w+", "+T+", "+E+", "+S+")";var I=i.offsetX&&i.offsetX[r]?i.offsetX[r]:0;a[r].forEach(function(e){t.fillText(e.char,c+I+e.x,u)})}),r<e.length-1&&(h+=e[r+1].lineHeight)})},i.unsupported=function(t){throw new Error("RichTextComponent does not support "+t+" at runtime.")},i.setShadowOffsetY=function(t){this.unsupported("setShadowOffsetY")},i.setShadowBlur=function(t){this.unsupported("setShadowBlur")},i.setShadowOffsetX=function(t){this.unsupported("setShadowOffsetX")},i.setShadowColor=function(t){this.unsupported("setShadowColor")},i.setOutlineWidth=function(t){this.unsupported("setOutlineWidth")},i.setAutoWidth=function(t){this.unsupported("setAutoWidth")},i.setFontSize=function(t){this.unsupported("setFontSize")},i.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e}(Hl);cg=function(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}([ln(en.DataType.RichTextComponent)],cg),ri(cg,[Qd]);var ug="2.9.0-alpha.1";oi("rich-text",Hm),He.info("Plugin rich text version: "+ug+".");var dg="PluginModel";function fg(t,e,i,r,n,s,o){try{var a=t[s](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,n)}function pg(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var s=t.apply(e,i);function o(t){fg(s,r,n,o,a,"next",t)}function a(t){fg(s,r,n,o,a,"throw",t)}o(void 0)})}}function mg(t,e){return(mg=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function gg(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mg(t,e)}function vg(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):vg(t,e)}function yg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yg=function(){return!!t})()}function xg(t,e,i){return(xg=yg()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&mg(n,i.prototype),n}).apply(null,arguments)}function bg(t){return(bg=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _g(t){var e="function"==typeof Map?new Map:void 0;return _g=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return xg(t,arguments,bg(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),mg(r,t)},_g(t)}function wg(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}function Tg(t,e){var i,r,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(h){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,h])}}}function Eg(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function Sg(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Eg(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Eg(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Ig,Ag,Cg,Pg,Mg,Rg,Og,Dg,kg,Lg,Fg,Ng,Bg,zg,Ug=oa.Vector2,Vg=oa.Vector3,Gg=oa.Vector4,jg=oa.Matrix3,Hg=oa.Matrix4,Wg=oa.Color,Xg=oa.Euler,Yg=oa.EulerOrder,qg=oa.Quaternion,Kg=oa.Box3,Zg=(oa.Sphere,oa.Ray,oa.DEG2RAD);function Jg(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $g(t,e,i){return e&&Jg(t.prototype,e),i&&Jg(t,i),t}function Qg(){return Qg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},Qg.apply(this,arguments)}(Ag=Ig||(Ig={}))[Ag.none=0]="none",Ag[Ag.mesh=1]="mesh",Ag[Ag.texture=2]="texture",Ag[Ag.material=3]="material",Ag[Ag.light=4]="light",Ag[Ag.camera=5]="camera",Ag[Ag.skybox=6]="skybox",Ag[Ag.skin=7]="skin",Ag[Ag.morph=8]="morph",Ag[Ag.skeleton=9]="skeleton",Ag[Ag.animation=10]="animation",Ag[Ag.animationManager=11]="animationManager",Ag[Ag.reference=12]="reference",(Pg=Cg||(Cg={}))[Pg.directional=0]="directional",Pg[Pg.point=1]="point",Pg[Pg.spot=2]="spot",Pg[Pg.ambient=3]="ambient",(Rg=Mg||(Mg={}))[Rg.none=0]="none",Rg[Rg.t2d=1]="t2d",Rg[Rg.t3d=2]="t3d",Rg[Rg.cube=3]="cube",(Dg=Og||(Og={}))[Dg.none=0]="none",Dg[Dg.unlit=1]="unlit",Dg[Dg.pbr=2]="pbr",Dg[Dg.normalVis=3]="normalVis",Dg[Dg.simpleFilter=4]="simpleFilter",Dg[Dg.shadowBase=5]="shadowBase",Dg[Dg.shadowFilter=6]="shadowFilter",Dg[Dg.skyboxFilter=7]="skyboxFilter",(Lg=kg||(kg={}))[Lg.opaque=0]="opaque",Lg[Lg.masked=1]="masked",Lg[Lg.translucent=2]="translucent",Lg[Lg.additive=3]="additive",(Ng=Fg||(Fg={}))[Ng.both=0]="both",Ng[Ng.front=1]="front",Ng[Ng.back=2]="back",(zg=Bg||(Bg={}))[zg.none=0]="none",zg[zg.standard=1]="standard",zg[zg.variance=2]="variance",zg[zg.expVariance=3]="expVariance";var tv=en.BuiltinObjectGUID.PBRShader,ev=en.BuiltinObjectGUID.UnlitShader,iv=function(){function t(){this.translation=new Vg(0,0,0),this.rotation=new qg(0,0,0,1),this.scale=new Vg(1,1,1)}var e=t.prototype;return e.fromMatrix4=function(t){return this.setMatrix(t),this},e.fromEffectsTransform=function(t){if(vg(t,ua))this.setMatrix(t.getWorldMatrix());else{var e=new ua(Qg({},t,{valid:!0}));e.setValid(!0),this.setMatrix(e.getWorldMatrix())}return this},e.toEffectsTransform=function(t){var e=this.getMatrix();return t.cloneFromMatrix(e),t},e.fromBaseTransform=function(t){return t.position?this.setTranslation(t.position):this.translation.set(0,0,0),t.rotation?this.setRotation(t.rotation):this.rotation.set(0,0,0,1),t.scale?this.setScale(t.scale):this.scale.set(1,1,1),this},e.getTranslation=function(){return this.translation},e.setTranslation=function(t){vg(t,Vg)?this.translation.set(t.x,t.y,t.z):this.translation.set(t[0],t[1],t[2])},e.getPosition=function(){return this.translation},e.setPosition=function(t){vg(t,Vg)?this.translation.set(t.x,t.y,t.z):this.translation.set(t[0],t[1],t[2])},e.getRotation=function(){return this.rotation},e.setRotation=function(t){vg(t,qg)?this.rotation.set(t.x,t.y,t.z,t.w):vg(t,Xg)?this.rotation.setFromEuler(t):vg(t,Vg)?this.rotation.setFromEuler(new Xg(t.x,t.y,t.z,Yg.ZYX)):4===t.length?this.rotation.set(t[0],t[1],t[2],t[3]):this.rotation.setFromEuler(new Xg(t[0],t[1],t[2],Yg.ZYX))},e.getScale=function(){return this.scale},e.setScale=function(t){vg(t,Vg)?this.scale.set(t.x,t.y,t.z):this.scale.set(t[0],t[1],t[2])},e.getMatrix=function(){return(new Hg).compose(this.getTranslation(),this.getRotation(),this.getScale())},e.setMatrix=function(t){if(vg(t,Hg)){var e=t.getTransform();this.setTranslation(e.translation),this.setRotation(e.rotation),this.setScale(e.scale)}else{var i=Hg.fromArray(t).getTransform();this.setTranslation(i.translation),this.setRotation(i.rotation),this.setScale(i.scale)}},t}(),rv=function(){function t(){this.origin=new Vg(0,0,0),this.xAxis=new Vg(1,0,0),this.yAxis=new Vg(0,1,0),this.zAxis=new Vg(0,0,1)}var e=t.prototype;return e.fromPTransform=function(t,e){void 0===e&&(e=!1),this.origin.copyFrom(t.getPosition());var i=t.getRotation().toMatrix4(new Hg);return e&&i.invert(),this.fromRotationMatrix(i),this},e.fromRotationMatrix=function(t){var e=t.elements;this.xAxis.set(e[0],e[1],e[2]),this.yAxis.set(e[4],e[5],e[6]),this.zAxis.set(e[8],e[9],e[10])},t}(),nv=function(){function t(){this.isWebGL2=!1,this.shaderShared=!0,this.runtimeEnv=Xo,this.compatibleMode="gltf",this.visBoundingBox=!1,this.renderMode3D=en.RenderMode3D.none,this.renderMode3DUVGridSize=1/16}var e=t.prototype;return e.reset=function(){this.isWebGL2=!1,this.shaderShared=!0,this.runtimeEnv=Xo,this.compatibleMode="gltf",this.visBoundingBox=!1,this.renderMode3D=en.RenderMode3D.none,this.renderMode3DUVGridSize=1/16},e.hasRenderMode3D=function(){return this.renderMode3D!==en.RenderMode3D.none},t.getInstance=function(){return this.instance||(this.instance=new this)},$g(t,[{key:"isEditorEnv",get:function(){return this.runtimeEnv===Xo}},{key:"isDeviceEnv",get:function(){return!this.isEditorEnv}},{key:"isTiny3dMode",get:function(){return"tiny3d"===this.compatibleMode}},{key:"isGLTFMode",get:function(){return!this.isTiny3dMode}}]),t}(),sv=1,ov=function(){function t(){this.name="Unnamed Object",this.type=Ig.none}var e=t.prototype;return e.dispose=function(){},e.isNone=function(){return this.type===Ig.none},e.isValid=function(){return this.type!==Ig.none},e.genName=function(t){return t+"_@"+sv++},t}(),av=function(t){function e(){var e;return(e=t.apply(this,arguments)||this)._visible=!1,e._transform=new iv,e.deleted=!1,e}gg(e,t);var i=e.prototype;return i.update=function(){},i.render=function(t,e){},i.onVisibleChanged=function(t){this.visible=t},i.dispose=function(){t.prototype.dispose.call(this),this.visible=!1,this.deleted=!0},$g(e,[{key:"visible",get:function(){return this._visible&&this.isValid()},set:function(t){this._visible=t}},{key:"transform",get:function(){return this._transform},set:function(t){vg(t,iv)?this._transform=t:(void 0!==t.position&&this._transform.setTranslation(t.position),void 0!==t.rotation&&this._transform.setRotation(t.rotation),void 0!==t.scale&&this._transform.setScale(t.scale))}},{key:"translation",get:function(){return this._transform.getTranslation()},set:function(t){this._transform.setTranslation(t)}},{key:"position",get:function(){return this._transform.getTranslation()},set:function(t){this._transform.setTranslation(t)}},{key:"rotation",get:function(){return this._transform.getRotation()},set:function(t){this._transform.setRotation(t)}},{key:"scale",get:function(){return this._transform.getScale()},set:function(t){this._transform.setScale(t)}},{key:"matrix",get:function(){return this._transform.getMatrix()},set:function(t){this._transform.setMatrix(t)}},{key:"coordinate",get:function(){var t=new rv;return t.fromPTransform(this._transform),t}}]),e}(ov);var hv={i8:Int8Array,u8:Uint8Array,i16:Int16Array,u16:Uint16Array,f32:Float32Array,i32:Int32Array,u32:Uint32Array};function lv(t,e){if(2!=e.length||e[0]!==en.ValueType.BINARY||!vg(e[1],Array))return e;var i=e[1],r=i[0],n=i[1],s=i[2],o=i[3];if(!o)return t[r].slice(n,s);var a=hv[o]||Uint8Array;return new a(t[r],n,s/a.BYTES_PER_ELEMENT)}var cv,uv=function(){function t(t,e){var i=Lo.create(t,{shader:{vertex:this.vertexShader,fragment:this.fragmentShader,shared:!0}});i.depthTest=!0,i.depthMask=!0,this.mesh=El.create(t,{name:"boxMesh",material:i,geometry:wl.create(t,this.geometry),priority:e})}var e=t.prototype;return e.update=function(t,e,i,r){var n=this.mesh.material;n.setMatrix("effects_ObjectToWorld",t);for(var s=0;s<i.length;s+=3)n.setVector3("_PositionList["+s/3+"]",Vg.fromArray(i,s));n.setVector3("_LineColor",r)},e.dispose=function(){this.mesh.dispose(),this.mesh=void 0},$g(t,[{key:"vertexShader",get:function(){return"\n precision highp float;\n\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n uniform vec3 _PositionList[8];\n attribute vec3 aPos;\n void main(){\n int index = int(aPos.x + 0.5);\n vec4 pos = effects_ObjectToWorld * vec4(_PositionList[index], 1);\n gl_Position = effects_MatrixVP * pos;\n }\n "}},{key:"fragmentShader",get:function(){return"\n precision highp float;\n\n uniform vec3 _LineColor;\n void main(){\n gl_FragColor = vec4(_LineColor, 1);\n }\n "}},{key:"geometry",get:function(){var t=new Float32Array([0,1,2,3,4,5,6,7]),e=new Uint32Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);return{attributes:{aPos:{type:Ys.FLOAT,size:1,data:t,stride:Float32Array.BYTES_PER_ELEMENT,offset:0}},mode:Ys.LINES,indices:{data:e},drawStart:0,drawCount:24}}}]),t}(),dv="precision highp float;\n#define FEATURES\n#include <animation.vert.glsl>\nattribute vec4 aPos;varying vec3 v_Position;\n#ifdef HAS_NORMALS\nattribute vec4 aNormal;\n#endif\n#ifdef HAS_TANGENTS\nattribute vec4 aTangent;\n#endif\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 v_TBN;\n#else\nvarying vec3 v_Normal;\n#endif\n#endif\n#ifdef HAS_UV_SET1\nattribute vec2 aUV;\n#endif\n#ifdef HAS_UV_SET2\nattribute vec2 aUV2;\n#endif\nvarying vec2 v_UVCoord1;\n#ifdef HAS_UV_SET2\nvarying vec2 v_UVCoord2;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC3\nattribute vec3 aColor;varying vec3 v_Color;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC4\nattribute vec4 aColor;varying vec4 v_Color;\n#endif\nuniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 _NormalMatrix;\n#ifdef USE_SHADOW_MAPPING\nuniform mat4 _LightViewProjectionMatrix;uniform float _DeltaSceneSize;varying vec4 v_PositionLightSpace;varying vec4 v_dPositionLightSpace;\n#endif\nvec4 getPosition(){vec4 pos=vec4(aPos.xyz,1.0);\n#ifdef USE_MORPHING\npos+=getTargetPosition();\n#endif\n#ifdef USE_SKINNING\npos=getSkinningMatrix()*pos;\n#endif\nreturn pos;}\n#ifdef HAS_NORMALS\nvec4 getNormal(){vec4 normal=aNormal;\n#ifdef USE_MORPHING\nnormal+=getTargetNormal();\n#endif\n#ifdef USE_SKINNING\nnormal=getSkinningNormalMatrix()*normal;\n#endif\nreturn normalize(normal);}\n#endif\n#ifdef HAS_TANGENTS\nvec4 getTangent(){vec4 tangent=aTangent;\n#ifdef USE_MORPHING\ntangent+=getTargetTangent();\n#endif\n#ifdef USE_SKINNING\ntangent=getSkinningMatrix()*tangent;\n#endif\nreturn normalize(tangent);}\n#endif\nvoid main(){vec4 pos=effects_ObjectToWorld*getPosition();v_Position=vec3(pos.xyz)/pos.w;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvec4 tangent=getTangent();vec3 normalW=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));vec3 tangentW=normalize(vec3(effects_ObjectToWorld*vec4(tangent.xyz,0.0)));vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#else\nv_Normal=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));\n#endif\n#endif\nv_UVCoord1=vec2(0.0,0.0);\n#ifdef HAS_UV_SET1\nv_UVCoord1=aUV;\n#endif\n#ifdef HAS_UV_SET2\nv_UVCoord2=aUV2;\n#endif\n#if defined(HAS_VERTEX_COLOR_VEC3) || defined(HAS_VERTEX_COLOR_VEC4)\nv_Color=aColor;\n#endif\n#ifdef USE_SHADOW_MAPPING\nv_PositionLightSpace=_LightViewProjectionMatrix*pos;vec3 dpos=vec3(_DeltaSceneSize);v_dPositionLightSpace=_LightViewProjectionMatrix*(pos+vec4(dpos,0));\n#endif\ngl_Position=effects_MatrixVP*pos;}",fv="\n#define FEATURES\n#extension GL_OES_standard_derivatives : enable\n#if defined(USE_TEX_LOD)\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#ifdef USE_HDR\n#extension GL_OES_texture_float : enable\n#extension GL_OES_texture_float_linear : enable\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include <extensions.frag.glsl>\n#include <tone-mapping.frag.glsl>\n#include <textures.vert.glsl>\n#include <functions.frag.glsl>\n#include <shadow-common.vert.glsl>\n#include <shadow.frag.glsl>\nstruct Light{vec3 direction;float range;vec3 color;float intensity;vec3 position;float innerConeCos;float outerConeCos;int type;vec2 padding;};const int LightType_Directional=0;const int LightType_Point=1;const int LightType_Spot=2;const int LightType_Ambient=3;\n#ifdef USE_PUNCTUAL\nuniform Light _Lights[LIGHT_COUNT];\n#endif\n#if defined(MATERIAL_SPECULARGLOSSINESS) || defined(MATERIAL_METALLICROUGHNESS)\nuniform float _MetallicFactor;uniform float _RoughnessFactor;uniform vec4 _BaseColorFactor;\n#endif\n#ifdef MATERIAL_SPECULARGLOSSINESS\nuniform vec3 _SpecularFactor;uniform vec4 _DiffuseFactor;uniform float _GlossinessFactor;\n#endif\n#ifdef ALPHAMODE_MASK\nuniform float _AlphaCutoff;\n#endif\n#ifdef ADD_FOG\nuniform vec4 _FogColor;\n#ifdef LINEAR_FOG\nuniform float _FogNear;uniform float _FogFar;\n#endif\n#ifdef EXP_FOG\nuniform float _FogDensity;\n#endif\n#endif\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\nuniform vec3 _Camera;uniform int _MipCount;struct MaterialInfo{float perceptualRoughness;vec3 reflectance0;float alphaRoughness;vec3 diffuseColor;vec3 reflectance90;vec3 specularColor;};\n#ifdef ADD_FOG\nvec3 getMixFogColor(vec3 baseColor){vec3 distance=_Camera-v_Position;float fogAmount=0.0;\n#ifdef LINEAR_FOG\nfogAmount=smoothstep(_FogNear,_FogFar,distance[2]);\n#endif\n#ifdef EXP_FOG\n#define LOG2 1.442695\nfogAmount=1.-exp2(-_FogDensity*_FogDensity*distance[2]*distance[2]*LOG2);fogAmount=clamp(fogAmount,0.,1.);\n#endif\nvec3 mixColor=baseColor.rgb+(vec3(_FogColor)-baseColor.rgb)*fogAmount;return mixColor;}\n#endif\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 getIrradiance(vec3 norm,SHCoefficients c){float x=norm.x;float y=norm.y;float z=norm.z;float c1=0.429043;float c2=0.511664;float c3=0.743125;float c4=0.886227;float c5=0.247708;vec3 irradiance=c1*c.l22*(x*x-y*y)+c3*c.l20*(z*z)+c4*c.l00-c5*c.l20+2.0*c1*(c.l2m2*x*y+c.l21*x*z+c.l2m1*y*z)+2.0*c2*(c.l11*x+c.l1m1*y+c.l10*z);return irradiance;}\n#endif\n#ifdef USE_IBL\nvec3 getIBLContribution(MaterialInfo materialInfo,vec3 n,vec3 v){float NdotV=clamp(dot(n,v),0.0,1.0);float lod=clamp(materialInfo.perceptualRoughness*float(_MipCount),0.0,float(_MipCount));vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,materialInfo.perceptualRoughness),vec2(0.0,0.0),vec2(1.0,1.0));vec2 brdf=texture2D(_brdfLUT,brdfSamplePoint).rg;vec4 diffuseColor=vec4(1.0,0.0,0.0,1.0);\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 irradiance=getIrradiance(n,_shCoefficients);diffuseColor=vec4(irradiance,1.0);\n#else\ndiffuseColor=textureCube(_DiffuseEnvSampler,n);\n#endif\n#ifdef USE_TEX_LOD\nvec4 specularSample=_textureCubeLodEXT(_SpecularEnvSampler,reflection,lod);\n#else\nvec4 specularSample=textureCube(_SpecularEnvSampler,reflection,lod);\n#endif\n#ifdef USE_HDR\nvec3 diffuseLight=diffuseColor.rgb;vec3 specularLight=specularSample.rgb;\n#else\nvec3 diffuseLight=SRGBtoLINEAR(diffuseColor).rgb;vec3 specularLight=SRGBtoLINEAR(specularSample).rgb;\n#endif\nvec3 diffuse=diffuseLight*materialInfo.diffuseColor;vec3 specular=specularLight*(materialInfo.specularColor*brdf.x+brdf.y);return diffuse*_IblIntensity[0]+specular*_IblIntensity[1];}\n#endif\nvec3 diffuse(MaterialInfo materialInfo){return materialInfo.diffuseColor/M_PI;}vec3 specularReflection(MaterialInfo materialInfo,AngularInfo angularInfo){return materialInfo.reflectance0+(materialInfo.reflectance90-materialInfo.reflectance0)*pow(clamp(1.0-angularInfo.VdotH,0.0,1.0),5.0);}float visibilityOcclusion(MaterialInfo materialInfo,AngularInfo angularInfo){float NdotL=angularInfo.NdotL;float NdotV=angularInfo.NdotV;float alphaRoughnessSq=materialInfo.alphaRoughness*materialInfo.alphaRoughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-alphaRoughnessSq)+alphaRoughnessSq);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-alphaRoughnessSq)+alphaRoughnessSq);float GGX=GGXV+GGXL;if(GGX>0.0){return 0.5/GGX;}return 0.0;}float microfacetDistribution(MaterialInfo materialInfo,AngularInfo angularInfo){float alphaRoughnessSq=materialInfo.alphaRoughness*materialInfo.alphaRoughness;float f=(angularInfo.NdotH*alphaRoughnessSq-angularInfo.NdotH)*angularInfo.NdotH+1.0;return alphaRoughnessSq/(M_PI*f*f);}vec3 getPointShade(vec3 pointToLight,MaterialInfo materialInfo,vec3 normal,vec3 view){AngularInfo angularInfo=getAngularInfo(pointToLight,normal,view);if(angularInfo.NdotL>0.0||angularInfo.NdotV>0.0){vec3 F=specularReflection(materialInfo,angularInfo);float Vis=visibilityOcclusion(materialInfo,angularInfo);float D=microfacetDistribution(materialInfo,angularInfo);vec3 diffuseContrib=(1.0-F)*diffuse(materialInfo);vec3 specContrib=F*Vis*D;return angularInfo.NdotL*(diffuseContrib+specContrib);}return vec3(0.0,0.0,0.0);}float getRangeAttenuation(float range,float distance){if(range<=0.0){return 1.0;}return 1.0/(pow(5.0*distance/range,2.0)+1.0);}float getSpotAttenuation(vec3 pointToLight,vec3 spotDirection,float outerConeCos,float innerConeCos){float actualCos=dot(normalize(spotDirection),normalize(-pointToLight));if(actualCos>outerConeCos){if(actualCos<innerConeCos){return smoothstep(outerConeCos,innerConeCos,actualCos);}return 1.0;}return 0.0;}vec3 applyDirectionalLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view,float shadow){vec3 pointToLight=-light.direction;vec3 shade=getPointShade(pointToLight,materialInfo,normal,view)*shadow;return light.intensity*light.color*shade;}vec3 applyPointLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view){vec3 pointToLight=light.position-v_Position;float distance=length(pointToLight);float attenuation=getRangeAttenuation(light.range,distance);vec3 shade=getPointShade(pointToLight,materialInfo,normal,view);return light.color*shade*attenuation*light.intensity;}vec3 applySpotLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view,float shadow){vec3 pointToLight=light.position-v_Position;float distance=length(pointToLight);float rangeAttenuation=getRangeAttenuation(light.range,distance);float spotAttenuation=getSpotAttenuation(pointToLight,light.direction,light.outerConeCos,light.innerConeCos);vec3 shade=getPointShade(pointToLight,materialInfo,normal,view)*shadow;return rangeAttenuation*spotAttenuation*light.intensity*light.color*shade;}vec3 applyAmbientLight(Light light,MaterialInfo materialInfo){return light.intensity*light.color*diffuse(materialInfo);}float weight(float z,float a){return clamp(pow(min(1.0,a*10.0)+0.01,3.0)*1e8*pow(1.0-z*0.9,3.0),1e-2,3e3);}void main(){float perceptualRoughness=0.0;float metallic=0.0;vec4 baseColor=vec4(0.0,0.0,0.0,1.0);vec3 diffuseColor=vec3(0.0);vec3 specularColor=vec3(0.0);vec3 f0=vec3(0.04);\n#ifdef PREVIEW_BORDER\ngl_FragColor=uPreviewColor;return;\n#endif\n#ifdef MATERIAL_SPECULARGLOSSINESS\n#ifdef HAS_SPECULAR_GLOSSINESS_MAP\nvec4 sgSample=SRGBtoLINEAR(texture2D(_SpecularGlossinessSampler,getSpecularGlossinessUV()));perceptualRoughness=(1.0-sgSample.a*_GlossinessFactor);f0=sgSample.rgb*_SpecularFactor;\n#else\nf0=_SpecularFactor;perceptualRoughness=1.0-_GlossinessFactor;\n#endif\n#ifdef HAS_DIFFUSE_MAP\nbaseColor=SRGBtoLINEAR(texture2D(_DiffuseSampler,getDiffuseUV()))*_DiffuseFactor;\n#else\nbaseColor=SRGBtoLINEAR(_DiffuseFactor);\n#endif\nbaseColor*=getVertexColor();specularColor=f0;float oneMinusSpecularStrength=1.0-max(max(f0.r,f0.g),f0.b);diffuseColor=baseColor.rgb*oneMinusSpecularStrength;\n#ifdef DEBUG_METALLIC\nmetallic=solveMetallic(baseColor.rgb,specularColor,oneMinusSpecularStrength);\n#endif\n#endif\n#ifdef MATERIAL_METALLICROUGHNESS\n#ifdef HAS_METALLIC_ROUGHNESS_MAP\nvec4 mrSample=texture2D(_MetallicRoughnessSampler,getMetallicRoughnessUV());perceptualRoughness=mrSample.g*_RoughnessFactor;metallic=mrSample.b*_MetallicFactor;\n#else\nmetallic=_MetallicFactor;perceptualRoughness=_RoughnessFactor;\n#endif\n#ifdef HAS_BASE_COLOR_MAP\nbaseColor=SRGBtoLINEAR(texture2D(_BaseColorSampler,getBaseColorUV()))*_BaseColorFactor;\n#else\nbaseColor=SRGBtoLINEAR(_BaseColorFactor);\n#endif\nbaseColor*=getVertexColor();diffuseColor=baseColor.rgb*(vec3(1.0)-f0)*(1.0-metallic);specularColor=mix(f0,baseColor.rgb,metallic);\n#endif\n#ifdef ALPHAMODE_MASK\nif(baseColor.a<_AlphaCutoff){discard;}baseColor.a=1.0;\n#endif\n#ifdef ALPHAMODE_OPAQUE\nbaseColor.a=1.0;\n#endif\n#ifdef MATERIAL_UNLIT\n#ifndef DEBUG_OUTPUT\n#ifdef ADD_FOG\nvec3 mixColor=getMixFogColor(baseColor.rgb);vec4 fragColorUnlit=vec4(LINEARtoSRGB(mixColor)*baseColor.a,baseColor.a);\n#else\nvec4 fragColorUnlit=vec4(LINEARtoSRGB(baseColor.rgb)*baseColor.a,baseColor.a);\n#endif\ngl_FragColor=fragColorUnlit;\n#else\n#ifdef DEBUG_UV\ngl_FragColor.rgb=vec3(getDebugUVColor(getBaseColorUV(),getNormal()));\n#endif\n#ifdef DEBUG_METALLIC\ngl_FragColor.rgb=vec3(metallic);\n#endif\n#ifdef DEBUG_ROUGHNESS\ngl_FragColor.rgb=vec3(perceptualRoughness);\n#endif\n#ifdef DEBUG_NORMAL\ngl_FragColor.rgb=getNormal()*0.5+0.5;\n#endif\n#ifdef DEBUG_BASECOLOR\ngl_FragColor.rgb=LINEARtoSRGB(baseColor.rgb);\n#endif\n#ifdef DEBUG_OCCLUSION\ngl_FragColor.rgb=vec3(1.0);\n#endif\n#ifdef DEBUG_EMISSIVE\ngl_FragColor.rgb=vec3(0.0);\n#endif\n#ifdef DEBUG_ALPHA\ngl_FragColor.rgb=vec3(baseColor.a);\n#endif\ngl_FragColor.a=1.0;\n#endif\nreturn;\n#endif\nmetallic=clamp(metallic,0.0,1.0);float alphaRoughness=perceptualRoughness*perceptualRoughness;vec3 normal=getNormal();\n#ifdef USE_SPECULAR_AA\nfloat AARoughnessFactor=getAARoughnessFactor(normal);perceptualRoughness+=AARoughnessFactor;alphaRoughness+=AARoughnessFactor;\n#endif\nperceptualRoughness=clamp(perceptualRoughness,0.04,1.0);alphaRoughness=clamp(alphaRoughness,0.04,1.0);float reflectance=max(max(specularColor.r,specularColor.g),specularColor.b);vec3 specularEnvironmentR0=specularColor.rgb;vec3 specularEnvironmentR90=vec3(clamp(reflectance*50.0,0.0,1.0));MaterialInfo materialInfo=MaterialInfo(perceptualRoughness,specularEnvironmentR0,alphaRoughness,diffuseColor,specularEnvironmentR90,specularColor);vec3 color=vec3(0.0,0.0,0.0);vec3 view=normalize(_Camera-v_Position);float shadow=1.0;\n#ifdef USE_SHADOW_MAPPING\nshadow=getShadowContribution();\n#endif\n#ifdef USE_PUNCTUAL\nfor(int i=0;i<LIGHT_COUNT;++i){Light light=_Lights[i];if(light.type==LightType_Directional){color+=applyDirectionalLight(light,materialInfo,normal,view,shadow);}else if(light.type==LightType_Point){color+=applyPointLight(light,materialInfo,normal,view);}else if(light.type==LightType_Spot){color+=applySpotLight(light,materialInfo,normal,view,shadow);}else if(light.type==LightType_Ambient){color+=applyAmbientLight(light,materialInfo);}}\n#endif\n#ifdef USE_IBL\ncolor+=getIBLContribution(materialInfo,normal,view);\n#endif\nfloat ao=1.0;\n#ifdef HAS_OCCLUSION_MAP\nao=texture2D(_OcclusionSampler,getOcclusionUV()).r;color=mix(color,color*ao,_OcclusionStrength);\n#endif\nvec3 emissive=vec3(0);\n#ifndef DEBUG_OUTPUT\n#ifdef ADD_FOG\nvec4 toneMapColor=SRGBtoLINEAR(vec4(toneMap(color),baseColor.a));color=getMixFogColor(toneMapColor.rgb);vec4 fragColorOut=vec4(LINEARtoSRGB(color.rgb)*baseColor.a,baseColor.a);\n#else\ncolor=toneMap(color)*baseColor.a;\n#ifdef HAS_EMISSIVE\ncolor+=_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\n#ifdef HAS_EMISSIVE_MAP\nemissive=SRGBtoLINEAR(texture2D(_EmissiveSampler,getEmissiveUV())).rgb*_EmissiveFactor.rgb*_EmissiveIntensity;color+=emissive;\n#endif\nvec4 fragColorOut=vec4(color,baseColor.a);\n#endif\ngl_FragColor=fragColorOut;\n#else\n#ifdef DEBUG_UV\ngl_FragColor.rgb=vec3(getDebugUVColor(getBaseColorUV(),normal));\n#endif\n#ifdef DEBUG_METALLIC\ngl_FragColor.rgb=vec3(metallic);\n#endif\n#ifdef DEBUG_ROUGHNESS\ngl_FragColor.rgb=vec3(perceptualRoughness);\n#endif\n#ifdef DEBUG_NORMAL\ngl_FragColor.rgb=normal*0.5+0.5;\n#endif\n#ifdef DEBUG_BASECOLOR\ngl_FragColor.rgb=LINEARtoSRGB(baseColor.rgb);\n#endif\n#ifdef DEBUG_OCCLUSION\n#ifdef HAS_OCCLUSION_MAP\ngl_FragColor.rgb=vec3(mix(1.0,ao,_OcclusionStrength));\n#else\ngl_FragColor.rgb=vec3(1.0);\n#endif\n#endif\n#ifdef DEBUG_EMISSIVE\n#ifdef HAS_EMISSIVE\nemissive=_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\n#ifdef HAS_EMISSIVE_MAP\nemissive=SRGBtoLINEAR(texture2D(_EmissiveSampler,getEmissiveUV())).rgb*_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\ngl_FragColor.rgb=LINEARtoSRGB(emissive);\n#endif\n#ifdef DEBUG_F0\ngl_FragColor.rgb=vec3(f0);\n#endif\n#ifdef DEBUG_ALPHA\ngl_FragColor.rgb=vec3(baseColor.a);\n#endif\n#ifdef DEBUG_DIFFUSE\nvec3 debugDiffuse=vec3(0.0);\n#ifdef USE_PUNCTUAL\nMaterialInfo diffuseMaterialInfo=MaterialInfo(1.0,f0,1.0,vec3(0.35),f0,f0);for(int i=0;i<LIGHT_COUNT;++i){Light light=_Lights[i];if(light.type==LightType_Directional){debugDiffuse+=applyDirectionalLight(light,diffuseMaterialInfo,normal,view,shadow);}else if(light.type==LightType_Point){debugDiffuse+=applyPointLight(light,diffuseMaterialInfo,normal,view);}else if(light.type==LightType_Spot){debugDiffuse+=applySpotLight(light,diffuseMaterialInfo,normal,view,shadow);}else if(light.type==LightType_Ambient){debugDiffuse+=applyAmbientLight(light,diffuseMaterialInfo);}}\n#ifdef USE_IBL\ndebugDiffuse+=getIBLContribution(diffuseMaterialInfo,normal,view);\n#endif\n#endif\ngl_FragColor.rgb=toneMap(debugDiffuse);\n#endif\ngl_FragColor.a=1.0;\n#endif\n}",pv="#define FEATURES\n#include <shadow-common.vert.glsl>\n#if defined(SHADOWMAP_VSM)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvec4 CalcMomentVSM(float depth){float dx=0.0;float dy=0.0;\n#if defined(SHADOWMAP_VSM) && (defined(GL_OES_standard_derivatives) || defined(WEBGL2))\ndx=dFdx(depth);dy=dFdy(depth);\n#endif\nfloat moment2=depth*depth+0.25*(dx*dx+dy*dy);return vec4(1.0-depth,1.0-moment2,0.0,1.0);}vec4 CalcMomentEVSM(float depth){float pos=EVSM_FUNC0(depth);float neg=EVSM_FUNC1(depth);return vec4(pos,pos*pos,neg,neg*neg);}void main(){\n#if defined(SHADOWMAP_STANDARD) || defined(SHADOWMAP_VSM)\ngl_FragColor=CalcMomentVSM(gl_FragCoord.z);\n#else\ngl_FragColor=CalcMomentEVSM(gl_FragCoord.z);\n#endif\n}",mv="precision highp float;\n#define FEATURES\nattribute vec3 aPos;varying vec3 v_CameraDir;uniform mat4 _InvViewProjectionMatrix;void main(){vec4 dir=_InvViewProjectionMatrix*vec4(aPos.xy,1,1);v_CameraDir=normalize(dir.xyz/dir.w);gl_Position=vec4(aPos.xy,0.99999,1);}",gv="\n#define FEATURES\n#if defined(USE_TEX_LOD)\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#extension GL_OES_standard_derivatives : enable\nprecision highp float;\n#include <extensions.frag.glsl>\nuniform sampler2D _brdfLUT;uniform vec2 _IblIntensity;uniform int _MipCount;uniform samplerCube _DiffuseEnvSampler;uniform samplerCube _SpecularEnvSampler;varying vec3 v_CameraDir;\n#ifdef IRRADIANCE_COEFFICIENTS\nstruct SHCoefficients{vec3 l00,l1m1,l10,l11,l2m2,l2m1,l20,l21,l22;};uniform SHCoefficients _shCoefficients;vec3 getIrradiance(vec3 norm,SHCoefficients c){float x=norm.x;float y=norm.y;float z=norm.z;float c1=0.429043;float c2=0.511664;float c3=0.743125;float c4=0.886227;float c5=0.247708;vec3 irradiance=c1*c.l22*(x*x-y*y)+c3*c.l20*(z*z)+c4*c.l00-c5*c.l20+2.0*c1*(c.l2m2*x*y+c.l21*x*z+c.l2m1*y*z)+2.0*c2*(c.l11*x+c.l1m1*y+c.l10*z);return irradiance;}\n#endif\nvec3 getIBLContribution(vec3 n,vec3 v){const float metallic=0.9;const float perceptualRoughness=0.1;const vec4 baseColor=vec4(1.0);const vec3 f0=vec3(0.04);const vec3 diffuseColor=baseColor.rgb*(vec3(1.0)-f0)*(1.0-metallic);const vec3 specularColor=mix(f0,baseColor.rgb,metallic);float NdotV=clamp(dot(n,v),0.0,1.0);float lod=clamp(perceptualRoughness*float(_MipCount),0.0,float(_MipCount));vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,perceptualRoughness),vec2(0.0,0.0),vec2(1.0,1.0));vec2 brdf=texture2D(_brdfLUT,brdfSamplePoint).rg;vec4 diffuseSample=vec4(1.0,0.0,0.0,1.0);\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 irradiance=getIrradiance(n,_shCoefficients);diffuseSample=vec4(irradiance,1.0);\n#else\ndiffuseSample=textureCube(_DiffuseEnvSampler,n);\n#endif\n#ifdef USE_TEX_LOD\nvec4 specularSample=_textureCubeLodEXT(_SpecularEnvSampler,reflection,lod);\n#else\nvec4 specularSample=textureCube(_SpecularEnvSampler,reflection,lod);\n#endif\nvec3 diffuseLight=diffuseSample.rgb;vec3 specularLight=specularSample.rgb;vec3 diffuse=diffuseLight*diffuseColor;vec3 specular=specularLight*(specularColor*brdf.x+brdf.y);return diffuse*_IblIntensity[0]+specular*_IblIntensity[1];}void main(){vec3 dir=normalize(v_CameraDir);gl_FragColor=vec4(getIBLContribution(dir,dir),1.0);}";(cv||(cv={})).build=function(t,e){return t=t.replace(/#define FEATURES/,e.map(function(t){return"#define "+t}).join("\n"))},Cl.registerInclude("animation.vert.glsl","#ifdef HAS_TARGET_POSITION0\nattribute vec3 aTargetPosition0;\n#endif\n#ifdef HAS_TARGET_POSITION1\nattribute vec3 aTargetPosition1;\n#endif\n#ifdef HAS_TARGET_POSITION2\nattribute vec3 aTargetPosition2;\n#endif\n#ifdef HAS_TARGET_POSITION3\nattribute vec3 aTargetPosition3;\n#endif\n#ifdef HAS_TARGET_POSITION4\nattribute vec3 aTargetPosition4;\n#endif\n#ifdef HAS_TARGET_POSITION5\nattribute vec3 aTargetPosition5;\n#endif\n#ifdef HAS_TARGET_POSITION6\nattribute vec3 aTargetPosition6;\n#endif\n#ifdef HAS_TARGET_POSITION7\nattribute vec3 aTargetPosition7;\n#endif\n#ifdef HAS_TARGET_NORMAL0\nattribute vec3 aTargetNormal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nattribute vec3 aTargetNormal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nattribute vec3 aTargetNormal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nattribute vec3 aTargetNormal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nattribute vec3 aTargetNormal4;\n#endif\n#ifdef HAS_TARGET_TANGENT0\nattribute vec3 aTargetTangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\nattribute vec3 aTargetTangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\nattribute vec3 aTargetTangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\nattribute vec3 aTargetTangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\nattribute vec3 aTargetTangent4;\n#endif\n#ifdef USE_MORPHING\nuniform float _morphWeights[WEIGHT_COUNT];\n#endif\n#ifdef HAS_JOINT_SET1\nattribute vec4 aJoints;\n#endif\n#ifdef HAS_JOINT_SET2\nattribute vec4 aJoint2;\n#endif\n#ifdef HAS_WEIGHT_SET1\nattribute vec4 aWeights;\n#endif\n#ifdef HAS_WEIGHT_SET2\nattribute vec4 aWeight2;\n#endif\n#ifdef USE_SKINNING\n#ifdef USE_SKINNING_TEXTURE\nuniform sampler2D _jointMatrixSampler;uniform sampler2D _jointNormalMatrixSampler;\n#else\nuniform mat4 _jointMatrix[JOINT_COUNT];uniform mat4 _jointNormalMatrix[JOINT_COUNT];\n#endif\n#endif\n#define ROW0_U ((0.5 + 0.0) / 4.0)\n#define ROW1_U ((0.5 + 1.0) / 4.0)\n#define ROW2_U ((0.5 + 2.0) / 4.0)\n#define ROW3_U ((0.5 + 3.0) / 4.0)\n#ifdef USE_SKINNING\nmat4 getJointMatrix(float boneNdx){\n#ifdef USE_SKINNING_TEXTURE\nfloat v=(boneNdx+0.5)/float(JOINT_COUNT);return mat4(texture2D(_jointMatrixSampler,vec2(ROW0_U,v)),texture2D(_jointMatrixSampler,vec2(ROW1_U,v)),texture2D(_jointMatrixSampler,vec2(ROW2_U,v)),texture2D(_jointMatrixSampler,vec2(ROW3_U,v)));\n#else\nreturn _jointMatrix[int(boneNdx)];\n#endif\n}mat4 getJointNormalMatrix(float boneNdx){\n#ifdef USE_SKINNING_TEXTURE\nfloat v=(boneNdx+0.5)/float(JOINT_COUNT);return mat4(texture2D(_jointNormalMatrixSampler,vec2(ROW0_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW1_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW2_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW3_U,v)));\n#else\nreturn _jointNormalMatrix[int(boneNdx)];\n#endif\n}mat4 getSkinningMatrix(){mat4 skin=mat4(0);\n#if defined(HAS_WEIGHT_SET1) && defined(HAS_JOINT_SET1)\nskin+=aWeights.x*getJointMatrix(aJoints.x)+aWeights.y*getJointMatrix(aJoints.y)+aWeights.z*getJointMatrix(aJoints.z)+aWeights.w*getJointMatrix(aJoints.w);\n#endif\nreturn skin;}mat4 getSkinningNormalMatrix(){mat4 skin=mat4(0);\n#if defined(HAS_WEIGHT_SET1) && defined(HAS_JOINT_SET1)\nskin+=aWeights.x*getJointNormalMatrix(aJoints.x)+aWeights.y*getJointNormalMatrix(aJoints.y)+aWeights.z*getJointNormalMatrix(aJoints.z)+aWeights.w*getJointNormalMatrix(aJoints.w);\n#endif\nreturn skin;}\n#endif\n#ifdef USE_MORPHING\nvec4 getTargetPosition(){vec4 pos=vec4(0);\n#ifdef HAS_TARGET_POSITION0\npos.xyz+=_morphWeights[0]*aTargetPosition0;\n#endif\n#ifdef HAS_TARGET_POSITION1\npos.xyz+=_morphWeights[1]*aTargetPosition1;\n#endif\n#ifdef HAS_TARGET_POSITION2\npos.xyz+=_morphWeights[2]*aTargetPosition2;\n#endif\n#ifdef HAS_TARGET_POSITION3\npos.xyz+=_morphWeights[3]*aTargetPosition3;\n#endif\n#ifdef HAS_TARGET_POSITION4\npos.xyz+=_morphWeights[4]*aTargetPosition4;\n#endif\nreturn pos;}vec4 getTargetNormal(){vec4 normal=vec4(0);\n#ifdef HAS_TARGET_NORMAL0\nnormal.xyz+=_morphWeights[0]*aTargetNormal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nnormal.xyz+=_morphWeights[1]*aTargetNormal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nnormal.xyz+=_morphWeights[2]*aTargetNormal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nnormal.xyz+=_morphWeights[3]*aTargetNormal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nnormal.xyz+=_morphWeights[4]*aTargetNormal4;\n#endif\nreturn normal;}vec4 getTargetTangent(){vec4 tangent=vec4(0);\n#ifdef HAS_TARGET_TANGENT0\ntangent.xyz+=_morphWeights[0]*aTargetTangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\ntangent.xyz+=_morphWeights[1]*aTargetTangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\ntangent.xyz+=_morphWeights[2]*aTargetTangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\ntangent.xyz+=_morphWeights[3]*aTargetTangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\ntangent.xyz+=_morphWeights[4]*aTargetTangent4;\n#endif\nreturn tangent;}\n#endif\n"),Cl.registerInclude("extensions.frag.glsl","vec3 _dFdx(vec3 coord){\n#if defined(GL_OES_standard_derivatives) || defined(WEBGL2)\nreturn dFdx(coord);\n#endif\nreturn vec3(0.0);}vec3 _dFdy(vec3 coord){\n#if defined(GL_OES_standard_derivatives) || defined(WEBGL2)\nreturn dFdy(coord);\n#endif\nreturn vec3(0.0);}\n#ifdef USE_TEX_LOD\nvec4 _textureCubeLodEXT(samplerCube sampler,vec3 coord,float lod){\n#if defined(WEBGL2) || defined(GL_EXT_shader_texture_lod)\nreturn textureCubeLodEXT(sampler,coord,lod);\n#else\nreturn textureCube(sampler,coord,lod);\n#endif\n}\n#endif\n"),Cl.registerInclude("tone-mapping.frag.glsl","uniform float _Exposure;const float GAMMA=2.2;const float INV_GAMMA=1.0/GAMMA;vec3 LINEARtoSRGB(vec3 color){return pow(color,vec3(INV_GAMMA));}vec4 SRGBtoLINEAR(vec4 srgbIn){return vec4(pow(srgbIn.xyz,vec3(GAMMA)),srgbIn.w);}vec3 toneMapUncharted2Impl(vec3 color){const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;return((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;}vec3 toneMapUncharted(vec3 color){const float W=11.2;color=toneMapUncharted2Impl(color*2.0);vec3 whiteScale=1.0/toneMapUncharted2Impl(vec3(W));return LINEARtoSRGB(color*whiteScale);}vec3 toneMapHejlRichard(vec3 color){color=max(vec3(0.0),color-vec3(0.004));return(color*(6.2*color+.5))/(color*(6.2*color+1.7)+0.06);}vec3 toneMapACES(vec3 color){const float A=2.51;const float B=0.03;const float C=2.43;const float D=0.59;const float E=0.14;return LINEARtoSRGB(clamp((color*(A*color+B))/(color*(C*color+D)+E),0.0,1.0));}vec3 toneMap(vec3 color){color*=_Exposure;\n#ifdef TONEMAP_UNCHARTED\nreturn toneMapUncharted(color);\n#endif\n#ifdef TONEMAP_HEJLRICHARD\nreturn toneMapHejlRichard(color);\n#endif\n#ifdef TONEMAP_ACES\nreturn toneMapACES(color);\n#endif\nreturn LINEARtoSRGB(color);}"),Cl.registerInclude("textures.vert.glsl","varying vec2 v_UVCoord1;\n#ifdef HAS_UV_SET2\nvarying vec2 v_UVCoord2;\n#endif\n#ifdef HAS_NORMAL_MAP\nuniform sampler2D _NormalSampler;uniform float _NormalScale;uniform int _NormalUVSet;uniform mat3 _NormalUVTransform;\n#endif\n#ifdef HAS_EMISSIVE_MAP\nuniform sampler2D _EmissiveSampler;uniform int _EmissiveUVSet;uniform vec4 _EmissiveFactor;uniform float _EmissiveIntensity;uniform mat3 _EmissiveUVTransform;\n#endif\n#ifdef HAS_EMISSIVE\nuniform vec4 _EmissiveFactor;uniform float _EmissiveIntensity;\n#endif\n#ifdef HAS_OCCLUSION_MAP\nuniform sampler2D _OcclusionSampler;uniform int _OcclusionUVSet;uniform float _OcclusionStrength;uniform mat3 _OcclusionUVTransform;\n#endif\n#ifdef HAS_BASE_COLOR_MAP\nuniform sampler2D _BaseColorSampler;uniform int _BaseColorUVSet;uniform mat3 _BaseColorUVTransform;\n#endif\n#ifdef HAS_METALLIC_ROUGHNESS_MAP\nuniform sampler2D _MetallicRoughnessSampler;uniform int _MetallicRoughnessUVSet;uniform mat3 _MetallicRoughnessUVTransform;\n#endif\n#ifdef HAS_DIFFUSE_MAP\nuniform sampler2D _DiffuseSampler;uniform int _DiffuseUVSet;uniform mat3 _DiffuseUVTransform;\n#endif\n#ifdef HAS_SPECULAR_GLOSSINESS_MAP\nuniform sampler2D _SpecularGlossinessSampler;uniform int _SpecularGlossinessUVSet;uniform mat3 _SpecularGlossinessUVTransform;\n#endif\n#ifdef USE_IBL\nuniform samplerCube _DiffuseEnvSampler;uniform samplerCube _SpecularEnvSampler;uniform sampler2D _brdfLUT;uniform vec2 _IblIntensity;\n#endif\n#ifdef IRRADIANCE_COEFFICIENTS\nstruct SHCoefficients{vec3 l00,l1m1,l10,l11,l2m2,l2m1,l20,l21,l22;};uniform SHCoefficients _shCoefficients;\n#endif\n#ifdef USE_SHADOW_MAPPING\nuniform sampler2D _ShadowSampler;\n#endif\nvec2 getNormalUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_NORMAL_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_NormalUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_NORMAL_UV_TRANSFORM\nuv*=_NormalUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getEmissiveUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_EMISSIVE_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_EmissiveUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_EMISSIVE_UV_TRANSFORM\nuv*=_EmissiveUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getOcclusionUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_OCCLUSION_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_OcclusionUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_OCCLUSION_UV_TRANSFORM\nuv*=_OcclusionUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getBaseColorUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_BASE_COLOR_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_BaseColorUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_BASECOLOR_UV_TRANSFORM\nuv*=_BaseColorUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getMetallicRoughnessUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_METALLIC_ROUGHNESS_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_MetallicRoughnessUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_METALLICROUGHNESS_UV_TRANSFORM\nuv*=_MetallicRoughnessUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getSpecularGlossinessUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_SPECULAR_GLOSSINESS_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_SpecularGlossinessUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_SPECULARGLOSSINESS_UV_TRANSFORM\nuv*=_SpecularGlossinessUVTransform;\n#endif\n#endif\nreturn uv.xy;}vec2 getDiffuseUV(){vec3 uv=vec3(v_UVCoord1,1.0);\n#ifdef HAS_DIFFUSE_MAP\n#ifdef HAS_UV_SET2\nuv.xy=_DiffuseUVSet<1 ? v_UVCoord1 : v_UVCoord2;\n#endif\n#ifdef HAS_DIFFUSE_UV_TRANSFORM\nuv*=_DiffuseUVTransform;\n#endif\n#endif\nreturn uv.xy;}"),Cl.registerInclude("functions.frag.glsl","const float M_PI=3.141592653589793;const float c_MinReflectance=0.04;varying vec3 v_Position;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 v_TBN;\n#else\nvarying vec3 v_Normal;\n#endif\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC3\nvarying vec3 v_Color;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC4\nvarying vec4 v_Color;\n#endif\nstruct AngularInfo{float NdotL;float NdotV;float NdotH;float LdotH;float VdotH;vec3 padding;};vec4 getVertexColor(){vec4 color=vec4(1.0,1.0,1.0,1.0);\n#ifdef HAS_VERTEX_COLOR_VEC3\ncolor.rgb=v_Color;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC4\ncolor=v_Color;\n#endif\nreturn color;}vec3 getNormal(){vec2 UV=getNormalUV();\n#ifndef HAS_TANGENTS\nvec3 pos_dx=_dFdx(v_Position);vec3 pos_dy=_dFdy(v_Position);vec3 tex_dx=_dFdx(vec3(UV,0.0));vec3 tex_dy=_dFdy(vec3(UV,0.0));vec3 t=(tex_dy.t*pos_dx-tex_dx.t*pos_dy)/(tex_dx.s*tex_dy.t-tex_dy.s*tex_dx.t);\n#ifdef HAS_NORMALS\nvec3 ng=normalize(v_Normal);\n#else\nvec3 ng=cross(pos_dx,pos_dy);\n#endif\nt=normalize(t-ng*dot(ng,t));vec3 b=normalize(cross(ng,t));mat3 tbn=mat3(t,b,ng);\n#else\nmat3 tbn=v_TBN;\n#endif\n#ifdef HAS_NORMAL_MAP\nvec3 n=texture2D(_NormalSampler,UV).rgb;n=normalize(tbn*((2.0*n-1.0)*vec3(_NormalScale,_NormalScale,1.0)));\n#else\nvec3 n=normalize(tbn[2].xyz);\n#endif\n#ifdef DOUBLE_SIDED\nfloat faceDirection=gl_FrontFacing ? 1.0 :-1.0;n=n*faceDirection;\n#endif\nreturn n;}float getPerceivedBrightness(vec3 vector){return sqrt(0.299*vector.r*vector.r+0.587*vector.g*vector.g+0.114*vector.b*vector.b);}float solveMetallic(vec3 diffuse,vec3 specular,float oneMinusSpecularStrength){float specularBrightness=getPerceivedBrightness(specular);if(specularBrightness<c_MinReflectance){return 0.0;}float diffuseBrightness=getPerceivedBrightness(diffuse);float a=c_MinReflectance;float b=diffuseBrightness*oneMinusSpecularStrength/(1.0-c_MinReflectance)+specularBrightness-2.0*c_MinReflectance;float c=c_MinReflectance-specularBrightness;float D=b*b-4.0*a*c;return clamp((-b+sqrt(D))/(2.0*a),0.0,1.0);}AngularInfo getAngularInfo(vec3 pointToLight,vec3 normal,vec3 view){vec3 n=normalize(normal);vec3 v=normalize(view);vec3 l=normalize(pointToLight);vec3 h=normalize(l+v);float NdotL=clamp(dot(n,l),0.0,1.0);float NdotV=clamp(dot(n,v),0.0,1.0);float NdotH=clamp(dot(n,h),0.0,1.0);float LdotH=clamp(dot(l,h),0.0,1.0);float VdotH=clamp(dot(v,h),0.0,1.0);return AngularInfo(NdotL,NdotV,NdotH,LdotH,VdotH,vec3(0,0,0));}float getAARoughnessFactor(vec3 normal){vec3 dxy=max(abs(_dFdx(normal)),abs(_dFdy(normal)));return max(max(dxy.x,dxy.y),dxy.z)*2.0;}\n#ifdef DEBUG_UV\nuniform float _DebugUVGridSize;float getDebugUVColor(vec2 uv,vec3 n){float s=dot(abs(n),vec3(1,1,1))*0.6;uv=uv/(_DebugUVGridSize*2.0);uv=uv-floor(uv);uv=uv*2.0-vec2(1.0);return s*(uv.x*uv.y>=0.0 ? 0.2: 1.0);}\n#endif\n"),Cl.registerInclude("shadow.frag.glsl","#ifdef USE_SHADOW_MAPPING\nuniform vec2 _ShadowMapSizeInv;varying vec4 v_PositionLightSpace;varying vec4 v_dPositionLightSpace;\n#endif\nfloat linstep(float low,float high,float v){return clamp((v-low)/(high-low),0.0,1.0);}\n#ifdef USE_SHADOW_MAPPING\nfloat chebyshev(vec2 moments,float depth,float minVar){float p=step(depth,moments.x+SHADOWMAP_BAIS);float variance=max(moments.y-moments.x*moments.x,minVar);float d=depth-(moments.x+SHADOWMAP_BAIS);float pMax=linstep(0.2,1.0,variance/(variance+d*d));return mix(0.1,1.0,min(max(p,pMax),1.0));}float getShadowContributionSM(){vec3 coords=v_PositionLightSpace.xyz/v_PositionLightSpace.w*0.5+0.5;if(coords.z<0.01||coords.z>0.99||coords.x<0.01||coords.x>0.99||coords.y<0.01||coords.y>0.99){return 1.0;}vec2 moments=vec2(1.0)-texture2D(_ShadowSampler,coords.xy).xy;return coords.z<moments.x*1.008+0.008? 1.0: 0.2;}float getShadowContributionVSM(){vec3 coords=v_PositionLightSpace.xyz/v_PositionLightSpace.w*0.5+0.5;if(coords.z<0.01||coords.z>0.99||coords.x<0.01||coords.x>0.99||coords.y<0.01||coords.y>0.99){return 1.0;}vec2 moments=vec2(1.0)-texture2D(_ShadowSampler,coords.xy).xy;return chebyshev(moments,coords.z,0.00002);}float computeEVSMShadow(vec2 coords,float pos,float neg){vec4 moments=texture2D(_ShadowSampler,coords);float posShadow=chebyshev(moments.xy,pos,0.00002);float negShadow=chebyshev(moments.zw,neg,0.00002);return min(posShadow,negShadow);}float getShadowContributionEVSM(){vec3 coords=v_PositionLightSpace.xyz/v_PositionLightSpace.w*0.5+0.5;if(coords.z<0.01||coords.z>0.99||coords.x<0.01||coords.x>0.99||coords.y<0.01||coords.y>0.99){return 1.0;}float depth=coords.z;float pos=EVSM_FUNC0(depth);float neg=EVSM_FUNC1(depth);\n#ifdef SHADOWMAP_EVSM_PCF\nvec2 newCoords=v_dPositionLightSpace.xy/v_dPositionLightSpace.w*0.5+0.5;vec2 dCoords=min(abs(newCoords-coords.xy),_ShadowMapSizeInv);if(max(dCoords.x,dCoords.y)>=min(_ShadowMapSizeInv.x,_ShadowMapSizeInv.y)*0.5){vec2 coords0=coords.xy+vec2(-1.0,-1.0)*dCoords;vec2 coords1=coords.xy+vec2(-1.0,1.0)*dCoords;vec2 coords2=coords.xy+vec2(1.0,-1.0)*dCoords;vec2 coords3=coords.xy+vec2(1.0,1.0)*dCoords;float shadow0=computeEVSMShadow(coords0,pos,neg);float shadow1=computeEVSMShadow(coords1,pos,neg);float shadow2=computeEVSMShadow(coords2,pos,neg);float shadow3=computeEVSMShadow(coords3,pos,neg);return(shadow0+shadow1+shadow2+shadow3)*0.25;}else{return computeEVSMShadow(coords.xy,pos,neg);}\n#else\nreturn computeEVSMShadow(coords.xy,pos,neg);\n#endif\n}float getShadowContribution(){\n#if defined(SHADOWMAP_STANDARD)\nreturn getShadowContributionSM();\n#elif defined(SHADOWMAP_VSM)\nreturn getShadowContributionVSM();\n#else\nreturn getShadowContributionEVSM();\n#endif\n}\n#endif\n"),Cl.registerInclude("shadow-common.vert.glsl","\n#define SHADOWMAP_BAIS 0.001\n#define EVSM_FUNC0(DEPTH) -exp(-7.0 * DEPTH)\n#define EVSM_FUNC1(DEPTH) -exp(-6.0 * DEPTH)\n");var vv=function(){function t(){}return t.getVertexShaderCode=function(t){var e=t.featureList,i=t.material.materialType;switch(i){case Og.unlit:case Og.pbr:case Og.shadowBase:return cv.build(dv,e);case Og.skyboxFilter:return cv.build(mv,e);default:throw new Error("Invalid material type "+i+" for getVertexShaderString!")}},t.getFragmentShaderCode=function(t){var e=t.featureList,i=t.material.materialType;switch(i){case Og.unlit:case Og.pbr:return cv.build(fv,e);case Og.shadowBase:return cv.build(pv,e);case Og.skyboxFilter:return cv.build(gv,e);default:throw new Error("Invalid material type "+i+" for getFragmentShaderString!")}},t.genVertexShaderCode=function(t){switch(t){case Og.unlit:case Og.pbr:case Og.shadowBase:return dv;case Og.skyboxFilter:return mv;default:throw new Error("Invalid material type "+t+" for genVertexShaderCode!")}},t.genFragmentShaderCode=function(t){switch(t){case Og.unlit:case Og.pbr:return fv;case Og.shadowBase:return pv;case Og.skyboxFilter:return gv;default:throw new Error("Invalid material type "+t+" for genFragmentShaderCode!")}},t}();function yv(t){return{vertexShaderCode:vv.getVertexShaderCode(t),fragmentShaderCode:vv.getFragmentShaderCode(t)}}function xv(t){return{vertexShaderCode:vv.getVertexShaderCode(t),fragmentShaderCode:vv.getFragmentShaderCode(t)}}function bv(t){return{vertexShaderCode:vv.getVertexShaderCode(t),fragmentShaderCode:vv.getFragmentShaderCode(t)}}function _v(t){return{vertexShaderCode:Ev({hasNormals:!0}),fragmentShaderCode:"\n #version 100\n precision highp float;\n varying vec3 v_Normal;\n void main(){\n gl_FragColor = vec4(v_Normal * 0.5 + 0.5, 1);\n }\n "}}function wv(t){return{vertexShaderCode:"\n #version 100\n precision highp float;\n attribute vec3 aPos;\n attribute vec2 aUV;\n\n varying vec2 v_UVCoord1;\n void main(){\n v_UVCoord1 = aUV;\n gl_Position = vec4(aPos.xy, 0.0, 1.0);\n }\n ",fragmentShaderCode:"\n #version 100\n precision highp float;\n uniform sampler2D _FilterSampler;\n\n varying vec2 v_UVCoord1;\n void main() {\n gl_FragColor = texture2D(_FilterSampler, v_UVCoord1) * vec4(0.5);\n }\n "}}function Tv(t){return{vertexShaderCode:"\n #version 100\n precision highp float;\n attribute vec3 aPos;\n attribute vec2 aUV;\n\n varying vec2 v_UVCoord1;\n void main(){\n v_UVCoord1 = aUV;\n gl_Position = vec4(aPos.xy, 0.0, 1.0);\n }\n ",fragmentShaderCode:"\n #version 100\n precision highp float;\n uniform vec2 _BlurScale;\n uniform sampler2D _FilterSampler;\n\n varying vec2 v_UVCoord1;\n void main() {\n vec4 color = vec4(0);\n vec2 offset0 = vec2(0.53805) * _BlurScale.xy;\n vec2 offset1 = vec2(2.06278) * _BlurScale.xy;\n color += (texture2D(_FilterSampler, v_UVCoord1 + offset0) + texture2D(_FilterSampler, v_UVCoord1 - offset0)) * 0.44908;\n color += (texture2D(_FilterSampler, v_UVCoord1 + offset1) + texture2D(_FilterSampler, v_UVCoord1 - offset1)) * 0.05092;\n gl_FragColor = color;\n }\n "}}function Ev(t){void 0===t&&(t={});var e=["#version 100"];return t.hasUVs&&e.push("#define HAS_UVS 1"),t.hasNormals&&e.push("#define HAS_NORMALS 1"),e.push("\n precision highp float;\n\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n attribute vec3 aPos;\n varying vec3 v_Position;\n\n #ifdef HAS_UVS\n attribute vec2 aUV;\n varying vec2 v_UVCoord1;\n #endif\n\n #ifdef HAS_NORMALS\n uniform mat4 _NormalMatrix;\n attribute vec3 aNormal;\n varying vec3 v_Normal;\n #endif\n\n void main(){\n vec4 pos = effects_ObjectToWorld * vec4(aPos, 1);\n v_Position = pos.xyz / pos.w;\n\n #ifdef HAS_UVS\n v_UVCoord1 = aUV;\n #endif\n\n #ifdef HAS_NORMALS\n v_Normal = normalize(vec3(effects_ObjectToWorld * vec4(aNormal, 0)));\n #endif\n\n gl_Position = effects_MatrixVP * pos;\n }\n "),e.join("\n")}vv.environment="webgl1";var Sv=function(){function t(){this.now=new Set,this.last=new Set}var e=t.prototype;return e.clear=function(){this.now.clear(),this.last.clear()},e.forward=function(){var t=this.last;this.last=this.now,this.now=t,this.now.clear()},e.forAddedItem=function(t){var e=this;this.now.forEach(function(i){e.last.has(i)||t(i)})},e.forRemovedItem=function(t){var e=this;this.last.forEach(function(i){e.now.has(i)||t(i)})},e.forNowItem=function(t){this.now.forEach(function(e){t(e)})},t}(),Iv=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).morphWeights=[],r.firstUpdate=!0,r.getHitTestParams=function(t){r.computeBoundingBox();var e=r.bounding;if(e&&(t||Number.isInteger(e.behavior))){var i=e.type;if(i===en.ModelBoundingType.box){if(vg(r.content,yy)){var n=r.content;return{behavior:e.behavior,type:Oo.custom,collect:function(t,e){return n.hitTesting(t.origin,t.direction)}}}var s=r.transform.getWorldMatrix(),o={behavior:e.behavior,type:Oo.custom,collect:function(t,i){var r=function(t,e,i){var r=e,n=r.clone().invert(),s=t.clone().applyMatrix(n),o=Vg.fromArray(i.center),a=Vg.fromArray(i.size).multiply(.5),h=o.clone().subtract(a),l=o.clone().add(a),c=s.intersectBox({min:h,max:l},new Vg);return void 0!==c?[r.transformPoint(c)]:void 0}(t,s,e);return r}};return o}if(i===en.ModelBoundingType.sphere){var a=new Vg;r.transform.assignWorldTRS(a);var h=new Vg;return e.center&&h.setFromArray(e.center),h.add(a),{type:i,behavior:e.behavior,radius:e.radius||0,center:h}}}},i&&r.fromData(i),r}gg(e,t);var i=e.prototype;return i.onStart=function(){var t;this.sceneManager=Sy(this),this.createContent(),this.item.type=dg,this.priority=this.item.renderOrder,null==(t=this.sceneManager)||t.addItem(this.content),this.item.parentId&&this.item.parent&&this.content.updateParentInfo(this.item.parentId,this.item.parent),this.setVisible(!0),this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.sceneManager&&(this.content.build(this.sceneManager),this.firstUpdate&&(this.materials=this.content.subMeshes.map(function(t){return t.getEffectsMaterial()}),this.firstUpdate=!1)),this.content.update()},i.onLateUpdate=function(t){this.content.lateUpdate()},i.render=function(t){this.getVisible()&&this.sceneManager&&(this.maskManager.drawStencilMask(t,this),this.content.render(this.sceneManager,t))},i.onDestroy=function(){var t;null==(t=this.sceneManager)||t.removeItem(this.content),this.sceneManager=void 0,this.content.dispose()},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.data=Qg({},e,{materials:[]}),this.data.rootBone=e.rootBone?this.engine.findObject(e.rootBone):void 0,this.data.geometry=this.engine.findObject(e.geometry),e.materials)for(var i=0;i<e.materials.length;i++)this.data.materials[i]=this.engine.findObject(e.materials[i])},i.createContent=function(){if(this.data){var t=this.data.interaction;this.bounding=t&&JSON.parse(JSON.stringify(t)),this.content=new yy(this.engine,this.item.name,this.data,this,this.item.parentId)}},i.setVisible=function(t){var e;null==(e=this.content)||e.onVisibleChanged(t)},i.getVisible=function(){var t,e;return null!=(e=null==(t=this.content)?void 0:t.visible)&&e},i.computeBoundingBox=function(){if(this.content&&vg(this.content,yy)){var t,e=this.transform.getWorldMatrix(),i=this.content.computeBoundingBox(e),r=i.getCenter(new Vg),n=i.getSize(new Vg);return this.bounding={behavior:null==(t=this.bounding)?void 0:t.behavior,type:en.ModelBoundingType.box,center:[r.x,r.y,r.z],size:[n.x,n.y,n.z]},this.bounding}},e}(Ho);Iv=wg([ln(en.DataType.MeshComponent)],Iv);var Av=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}gg(e,t);var i=e.prototype;return i.onStart=function(){var t;this.createContent(),this.item.type=dg,this.priority=this.item.renderOrder,this.sceneManager=Sy(this),null==(t=this.sceneManager)||t.addItem(this.content),this.setVisible(!0),this.content.skyboxMesh&&(this.materials=[this.content.skyboxMesh.material])},i.render=function(t){this.getVisible()&&this.sceneManager&&(this.maskManager.drawStencilMask(t,this),this.content.render(this.sceneManager,t))},i.onDestroy=function(){var t;null==(t=this.sceneManager)||t.removeItem(this.content),this.sceneManager=void 0,this.content.dispose()},i.fromData=function(e){t.prototype.fromData.call(this,e),e.diffuseImage=e.diffuseImage?this.engine.findObject(e.diffuseImage):void 0,e.specularImage=this.engine.findObject(e.specularImage),this.data=e},i.createContent=function(){if(this.data){var t=this.data;this.content=new ly(this.item.name,t,this)}},i.setVisible=function(t){var e;null==(e=this.content)||e.onVisibleChanged(t)},i.getVisible=function(){var t,e;return null!=(e=null==(t=this.content)?void 0:t.visible)&&e},e}(Ho);Av=wg([ln(en.DataType.SkyboxComponent)],Av);var Cv=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}gg(e,t);var i=e.prototype;return i.onStart=function(){this.createContent(),this.item.type=dg;var t=Sy(this);null==t||t.addItem(this.content),this.setVisible(!0)},i.onUpdate=function(t){this.content.update()},i.onDestroy=function(){this.content.dispose()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.data=e},i.createContent=function(){if(this.data){var t=this.data;this.content=new gy(this.item.name,t,this)}},i.setVisible=function(t){var e;null==(e=this.content)||e.onVisibleChanged(t)},i.getVisible=function(){var t,e;return null!=(e=null==(t=this.content)?void 0:t.visible)&&e},e}(Us);Cv=wg([ln(en.DataType.LightComponent)],Cv);var Pv=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}gg(e,t);var i=e.prototype;return i.onStart=function(){this.createContent(),this.item.type=dg;var t=Sy(this);null==t||t.addItem(this.content),this.updateMainCamera()},i.onUpdate=function(t){this.content.update(),this.updateMainCamera()},i.onDestroy=function(){var t;null==(t=this.content)||t.dispose()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.data=e},i.createContent=function(){if(this.data){var t=this.data,e=this.engine.renderer.getWidth(),i=this.engine.renderer.getHeight();this.content=new py(this.item.name,e,i,t,this)}},i.updateMainCamera=function(){this.content.matrix=this.transform.getWorldMatrix();var t=this.item.composition;t&&(t.camera.near=this.content.nearPlane,t.camera.far=this.content.farPlane,t.camera.fov=this.content.fov,t.camera.setTransform(this.transform))},i.setTransform=function(t,e){t&&this.transform.setPosition(t.x,t.y,t.z),e&&this.transform.setRotation(e.x,e.y,e.z),this.updateMainCamera()},e}(Us);Pv=wg([ln(en.DataType.CameraComponent)],Pv);var Mv=function(t){function e(e){var i;return(i=t.call(this,e)||this).elapsedTime=0,i.animation=-1,i.clips=[],i}gg(e,t);var i=e.prototype;return i.onStart=function(){this.elapsedTime=0,this.item.type=dg},i.onUpdate=function(t){this.elapsedTime+=.001*t,this.animation>=0&&this.animation<this.clips.length&&this.clips[this.animation].sampleAnimation(this.item,this.elapsedTime)},i.onDestroy=function(){},i.fromData=function(e){var i,r,n=this;t.prototype.fromData.call(this,e),this.data=e,this.name=null!=(i=e.name)?i:"<empty>",this.animation=null!=(r=e.animation)?r:-1,this.clips=[],e.animationClips.forEach(function(t){var e=new Rv(n.engine),i=n.engine.findObject(t);e.setFromAnimationClip(i),n.clips.push(e)})},e}(Us);Mv=wg([ln(en.DataType.AnimationComponent)],Mv);var Rv=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).path2Node={},e}gg(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=this.duration,n=Math.max(0,e)%r,s=Sg(this.positionCurves);!(i=s()).done;){var o=i.value,a=o.keyFrames.getValue(n%this.duration),h=this.getTargetItem(t,o.path);null==h||h.transform.setPosition(a.x,a.y,a.z)}for(var l,c=Sg(this.rotationCurves);!(l=c()).done;){var u=l.value,d=u.keyFrames.getValue(n%this.duration),f=this.getTargetItem(t,u.path);null==f||f.transform.setQuaternion(d.x,d.y,d.z,d.w)}for(var p,m=Sg(this.scaleCurves);!(p=m()).done;){var g=p.value,v=g.keyFrames.getValue(n%this.duration),y=this.getTargetItem(t,g.path);null==y||y.transform.setScale(v.x,v.y,v.z)}for(var x,b=Sg(this.floatCurves);!(x=b()).done;){var _=x.value,w=_.keyFrames.getValue(n%this.duration),T=this.getTargetItem(t,_.path);if("ModelMeshComponent"===_.className){var E=null==T?void 0:T.getComponent(Iv);if(E)Ov(E,_.property.split("."),w);else console.error("Can't find mesh component.")}else console.warn("Ignore curve: className "+_.className+".")}},i.setFromAnimationClip=function(t){this.duration=t.duration,this.positionCurves=t.positionCurves.slice(),this.rotationCurves=t.rotationCurves.slice(),this.scaleCurves=t.scaleCurves.slice(),this.floatCurves=t.floatCurves.slice()},i.getTargetItem=function(t,e){if(this.path2Node[e])return this.path2Node[e];for(var i,r=t,n=Sg(e.split("/"));!(i=n()).done;){for(var s,o=i.value,a=!1,h=Sg(r.children);!(s=h()).done;){var l=s.value;if(l.name===o){r=l,a=!0;break}}if(!a)throw new Error("Can't find path in tree "+t.id+", "+e+".")}return this.path2Node[e]=r,r},e}(Tc);function Ov(t,e,i){for(var r=e.length,n=t,s=0;s<r-1;s++){var o=e[s];if(!(o in n)||"object"!=typeof n[o])return void console.error("Invalid properties "+e+".");n=n[o]}n[e[r-1]]=i}function Dv(t,e,i,r){var n=0,s=0,o=0,a=0,h=0,l=0,c=1/e.x,u=1/e.y,d=1/e.z;if(c>=0?(n=(i.x-t.x)*c,s=(r.x-t.x)*c):(n=(r.x-t.x)*c,s=(i.x-t.x)*c),u>=0?(o=(i.y-t.y)*u,a=(r.y-t.y)*u):(o=(r.y-t.y)*u,a=(i.y-t.y)*u),!(n>a||o>s||((o>n||n!=n)&&(n=o),(a<s||s!=s)&&(s=a),d>=0?(h=(i.z-t.z)*d,l=(r.z-t.z)*d):(h=(r.z-t.z)*d,l=(i.z-t.z)*d),n>l||h>s||((h>n||n!=n)&&(n=h),(l<s||s!=s)&&(s=l),s<0))))return n>=0?n:s}var kv=new Vg,Lv=new Vg,Fv=new Vg,Nv=new Vg;function Bv(t,e,i,r,n,s){Lv.subtractVectors(r,i),Fv.subtractVectors(n,i),Nv.crossVectors(Lv,Fv);var o=e.dot(Nv),a=0;if(o>0){if(s)return;a=1}else{if(!(o<0))return;a=-1,o=-o}kv.subtractVectors(t,i),Fv.crossVectors(kv,Fv);var h=a*e.dot(Fv);if(!(h<0)){Lv.crossVectors(Lv,kv);var l=a*e.dot(Lv);if(!(l<0||h+l>o)){var c=-a*kv.dot(Nv);if(!(c<0))return c/o}}}var zv=function(){function t(){}return t.createTexture2D=function(e,i,r,n,s){return pg(function(){var o,a,h,l;return Tg(this,function(c){return void 0===i.imageData?(console.error("createTexture2D: Invalid image data from "+i+"."),[2,To.create(e,{name:"createTexture2D",sourceType:Hs.data,data:{data:new Uint8Array([255,255,255,255]),width:1,height:1}})]):(o=new Blob([i.imageData],{type:i.mimeType}),a=window.URL||window.webkitURL,h=a.createObjectURL(o),(l=new Image).src=h,[2,new Promise(function(i,o){l.onload=function(){var o,c=null!=(o=r.minFilter)?o:Ys.LINEAR_MIPMAP_LINEAR,u=!1;s&&(c=Ys.LINEAR_MIPMAP_LINEAR,t.isPow2(l.width)&&t.isPow2(l.height)||(c=Ys.LINEAR),u=!n);var d,f,p,m=!1;c!=Ys.NEAREST_MIPMAP_NEAREST&&c!=Ys.LINEAR_MIPMAP_NEAREST&&c!=Ys.NEAREST_MIPMAP_LINEAR&&c!=Ys.LINEAR_MIPMAP_LINEAR||(m=!0);var g=To.create(e,{name:"createTexture2D",wrapS:null!=(d=r.wrapS)?d:Ys.REPEAT,wrapT:null!=(f=r.wrapT)?f:Ys.REPEAT,magFilter:null!=(p=r.magFilter)?p:Ys.LINEAR,minFilter:c,anisotropic:1,premultiplyAlpha:u,sourceType:Hs.image,image:l,generateMipmap:m});i(g),a.revokeObjectURL(h)},l.onerror=o})])})})()},t.createTextureList=function(t,e,i){var r=this;return pg(function(){return Tg(this,function(n){switch(n.label){case 0:return[4,Promise.all(i.map(function(i){return r.createTexture2D(t,e[i.source],i)}))];case 1:return[2,n.sent()]}})})()},t.getTextureCubeData=function(t){return pg(function(){var e;return Tg(this,function(i){switch(i.label){case 0:return[4,Hv.loadImageFromImageData(t[0])];case 1:return e=[i.sent()],[4,Hv.loadImageFromImageData(t[1])];case 2:return e=e.concat([i.sent()]),[4,Hv.loadImageFromImageData(t[2])];case 3:return e=e.concat([i.sent()]),[4,Hv.loadImageFromImageData(t[3])];case 4:return e=e.concat([i.sent()]),[4,Hv.loadImageFromImageData(t[4])];case 5:return e=e.concat([i.sent()]),[4,Hv.loadImageFromImageData(t[5])];case 6:return[2,e.concat([i.sent()])]}})})()},t.getTextureCubeMipmapData=function(t){var e=this;return pg(function(){var i,r,n;return Tg(this,function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(n=i.push,[4,e.getTextureCubeData(t[r])]):[3,4];case 2:n.apply(i,[s.sent()]),s.label=3;case 3:return r++,[3,1];case 4:return[2,i]}})})()},t.createTextureCubeFromURL=function(t,e){var i=this;return pg(function(){var r;return Tg(this,function(n){switch(n.label){case 0:return[4,Ro().loadSource({type:Hs.image,target:Ys.TEXTURE_CUBE_MAP,map:e},i.cubemapTexConfig)];case 1:return r=n.sent(),[2,To.create(t,r)]}})})()},t.createTextureCubeMipmapFromURL=function(t,e){var i=this;return pg(function(){var r;return Tg(this,function(n){switch(n.label){case 0:return[4,Ro().loadSource({type:Hs.mipmaps,target:Ys.TEXTURE_CUBE_MAP,maps:e},i.cubemapMipTexConfig)];case 1:return r=n.sent(),[2,To.create(t,r)]}})})()},t.createTextureCubeFromBuffer=function(e,i){var r=this;return pg(function(){var n;return Tg(this,function(s){switch(s.label){case 0:return[4,t.getTextureCubeData(i)];case 1:return n=s.sent(),[2,To.create(e,Qg({name:"createTextureCubeFromBuffer",sourceType:Hs.image,cube:n,target:Ys.TEXTURE_CUBE_MAP},r.cubemapTexConfig))]}})})()},t.createTextureCubeMipmapFromBuffer=function(e,i,r){var n=this;return pg(function(){var s,o,a,h;return Tg(this,function(l){switch(l.label){case 0:return[4,t.getTextureCubeMipmapData(i)];case 1:for(s=l.sent(),o=0;Math.pow(2,o)<r;)++o;l.label=2;case 2:return s.length<=o?(a=Math.pow(2,o-s.length),[4,lo("https://gw.alipayobjects.com/zos/gltf-asset/67896749597915/img"+a+".png")]):[3,4];case 3:return h=l.sent(),s.push([h,h,h,h,h,h]),[3,2];case 4:return[2,To.create(e,Qg({name:"createTextureCubeMipmapFromBuffer",sourceType:Hs.mipmaps,mipmaps:s,target:Ys.TEXTURE_CUBE_MAP},n.cubemapMipTexConfig))]}})})()},t.getTexture=function(t,e){return t<0||t>=e.length?null:e[t]},t.createTextureFromImage=function(t,e){var i={name:"createTextureFromImage",image:e,sourceType:Hs.image,flipY:!1,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,wrapT:Ys.REPEAT,wrapS:Ys.REPEAT};return To.create(t,i)},t.deleteTexture=function(t){t.dispose()},t.deleteMesh=function(t){t.dispose({geometries:Ge.destroy})},t.deleteGeometry=function(t){t.dispose()},t.deleteRenderPass=function(t){t.dispose({meshes:{geometries:Ge.destroy},depthStencilAttachment:hl.force,colorAttachment:hl.force})},t.isTransparentMesh=function(t){return!0===t.material.blending},t.isSupportFloatTexture=function(t){return 0!==t.gpuCapability.detail.floatTexture},t.isSupportHalfFloatTexture=function(t){return 0!==t.gpuCapability.detail.halfFloatTexture},t.isPow2=function(t){return!(t&t-1||!t)},t}();zv.cubemapTexConfig={name:"cubemap texture",wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR},zv.cubemapMipTexConfig={wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR};var Uv,Vv,Gv=function(){function t(){}return t.createFilterMesh=function(e,i,r){var n=nv.getInstance(),s=r.vertexShaderCode,o=r.fragmentShaderCode,a=wl.create(e,t.getPlaneGeometry()),h=2===e.gpuCapability.level,l=Lo.create(e,{shader:{vertex:s,fragment:o,shared:n.shaderShared,glslVersion:h?fl.GLSL3:fl.GLSL1}});return r.setMaterialStates(l),El.create(e,{name:i,worldMatrix:Hg.fromIdentity(),material:l,geometry:a})},t.getPlaneGeometry=function(){var e=t.getPlaneVertexArray();return{attributes:{aPos:{type:Ys.FLOAT,size:3,data:e,stride:8*Float32Array.BYTES_PER_ELEMENT,offset:0},aUV:{type:Ys.FLOAT,size:2,stride:8*Float32Array.BYTES_PER_ELEMENT,offset:3*Float32Array.BYTES_PER_ELEMENT,dataSource:"aPos"},aNormal:{type:Ys.FLOAT,size:3,stride:8*Float32Array.BYTES_PER_ELEMENT,offset:5*Float32Array.BYTES_PER_ELEMENT,dataSource:"aPos"}},drawStart:0,drawCount:e.length/8}},t.getPlaneVertexArray=function(){return new Float32Array([-1,-1,0,0,0,0,0,1,1,-1,0,1,0,0,0,1,1,1,0,1,1,0,0,1,-1,-1,0,0,0,0,0,1,1,1,0,1,1,0,0,1,-1,1,0,0,1,0,0,1])},t}(),jv=function(){function t(){}return t.createLightOptions=function(t){var e,i,r,n,s,o,a,h,l=null!=(e=t.color)?e:[255,255,255,255];return"point"===t.type?{color:l,intensity:null!=(i=t.intensity)?i:1,lightType:"point",range:null!=(r=t.range)?r:0}:"spot"===t.type?{color:l,intensity:null!=(n=t.intensity)?n:1,lightType:"spot",range:null!=(s=t.range)?s:0,innerConeAngle:null!=(o=t.innerConeAngle)?o:0,outerConeAngle:null!=(a=t.outerConeAngle)?a:Math.PI/4}:{color:l,intensity:null!=(h=t.intensity)?h:1,lightType:"directional"}},t.createCameraOptions=function(t){if(void 0!==t.perspective){var e,i=t.perspective;return{near:i.znear,far:null!=(e=i.zfar)?e:1e3,fov:i.yfov,clipMode:0}}},t.toPlayerColor3=function(t){return[this.scaleTo255(t[0]),this.scaleTo255(t[1]),this.scaleTo255(t[2])]},t.toPlayerColor4=function(t){return[this.scaleTo255(t[0]),this.scaleTo255(t[1]),this.scaleTo255(t[2]),this.scaleTo255(t[3])]},t.toPluginColor3=function(t){return[this.scaleTo1(t[0]),this.scaleTo1(t[1]),this.scaleTo1(t[2])]},t.toPluginColor4=function(t){return[this.scaleTo1(t[0]),this.scaleTo1(t[1]),this.scaleTo1(t[2]),this.scaleTo1(t[3])]},t.createUVTransform=function(t,e,i){var r=t.getVector4(e),n=t.getFloat(i),s=jg.fromIdentity();r&&s.setFromArray([1,0,0,0,1,0,r.z,r.w,1]);var o=new jg;if(n){var a=Math.cos(n),h=Math.sin(n);o.setFromArray([a,h,0,-h,a,0,0,0,1]),s.multiply(o)}return r&&(o.setFromArray([r.x,0,0,0,r.y,0,0,0,1]),s.multiply(o)),s.transpose(),s},t.clamp=function(t,e,i){return Math.max(Math.min(t,i),e)},t.scaleTo255=function(t){var e=Math.round(255*t);return Math.max(0,Math.min(e,255))},t.scaleTo1=function(t){var e=t/255;return Math.max(0,Math.min(e,1))},t.focusOnPoint=function(t,e,i){var r=Vg.fromArray(t),n=Vg.fromArray(i),s=(new Vg).copyFrom(r).subtract(n);Hg.fromRotationAxis(new Vg(0,1,0),e*Zg).transformPoint(s);var o=s.clone().add(n),a=(new Hg).lookAt(o,n,new Vg(0,1,0)).invert(),h=new ua;return h.setValid(!0),h.cloneFromMatrix(a),h},t.preprocessScene=function(t,e,i){var r=this,n=e!==Xo,s="tiny3d"===i,o=t.jsonScene;if(!(o&&o.textures&&o.materials))return{};var a={};t.textureOptions.forEach(function(t){var e=t.id;e&&(a[e]=t)});var h=!1;return n&&(o.materials.forEach(function(t){r.preprocessTextureOptions(a,t.textures._BaseColorSampler,!0,s),r.preprocessTextureOptions(a,t.textures._MetallicRoughnessSampler,!1,s),r.preprocessTextureOptions(a,t.textures._NormalSampler,!1,s),r.preprocessTextureOptions(a,t.textures._OcclusionSampler,!1,s),r.preprocessTextureOptions(a,t.textures._EmissiveSampler,!1,s)}),o.components.forEach(function(t){if(t.dataType===en.DataType.SkyboxComponent){h=!0;var e=t;e.diffuseImage&&r.preprocessTextureOptions(a,e.diffuseImage,!1,s),e.specularImage&&r.preprocessTextureOptions(a,e.specularImage,!1,s)}})),{loadSkybox:h}},t.preprocessTextureOptions=function(t,e,i,r){var n;if(r&&e&&(n="texture"in e?e.texture.id:e.id)){var s=t[n];if(s)if(void 0===s.target||s.target===Ys.TEXTURE_2D){s.wrapS=Ys.REPEAT,s.wrapT=Ys.REPEAT,s.magFilter=Ys.LINEAR,s.minFilter=Ys.LINEAR_MIPMAP_LINEAR,i||(s.premultiplyAlpha=!0);var o=s;o.generateMipmap=!0;var a=o.image;a&&a.width&&a.height&&(zv.isPow2(a.width)&&zv.isPow2(a.height)||(s.minFilter=Ys.LINEAR))}else s.target===Ys.TEXTURE_CUBE_MAP&&(s.wrapS=Ys.CLAMP_TO_EDGE,s.wrapT=Ys.CLAMP_TO_EDGE,void 0!==s.mipmaps?1===s.mipmaps.length?(s.magFilter=Ys.LINEAR,s.minFilter=Ys.LINEAR):(s.magFilter=Ys.LINEAR,s.minFilter=Ys.LINEAR_MIPMAP_LINEAR):(s.magFilter=Ys.LINEAR,s.minFilter=Ys.LINEAR))}},t.createGeometry=function(t,e,i){var r=function(t,e){var i,r=t.attributes,n=Qg({},t);if(n.indices)n.indices=Qg({},n.indices),n.indices.data&&(n.indices.data=lv(e,null==(i=t.indices)?void 0:i.data));else if(n.index){var s;n.indices=Qg({},n.index),n.indices.data&&(n.indices.data=lv(e,null==(s=t.index)?void 0:s.data))}return Object.keys(r).forEach(function(t){var i=r[t],s=i.data;n.attributes[t]=Qg({},i),s&&(n.attributes[t].data=lv(e,s))}),n}(e,i),n={};for(var s in r.attributes){var o=r.attributes[s];n[this.getAttributeName(s)]=o}return r.attributes=n,wl.create(t,r)},t.getIndexArray=function(t,e){switch(t){case WebGLRenderingContext.UNSIGNED_INT:case WebGLRenderingContext.UNSIGNED_SHORT:case WebGLRenderingContext.UNSIGNED_BYTE:return e;default:console.error("Invalid index attribute type "+t+".")}},t.getAttributeName=function(t){switch(t){case"POSITION":return"aPos";case"NORMAL":return"aNormal";case"TANGENT":return"aTangent";case"TEXCOORD_0":return"aUV";case"TEXCOORD_1":return"aUV2";case"JOINTS_0":return"aJoints";case"WEIGHTS_0":return"aWeights"}return t.startsWith("a")||console.warn("Unknown attribute name: "+t+"."),t},t.getTextureObj=function(t,e){return"number"!=typeof e?null:((e<0||e>=t.length)&&console.error("Invalid index for textures: "+e+", "+t.length+"."),t[e])},t}(),Hv=function(){function t(){}return t.getImageFileName=function(t,e){var i=t.lastIndexOf("/"),r=t.lastIndexOf("."),n=t.substring(i+1,r);return e?n+e:n},t.getCurrnetTimeStr=function(){var t=new Date(Date.now()),e=t.toLocaleString("zh-CN"),i=""+t.getMilliseconds();return e.split(/[ /:]+/).join("")+i.padStart(3,"0")},t.saveFileForURL=function(t,e){var i=document.createElement("a");i.setAttribute("download",e),i.target="_blank",i.href=t,i.click()},t.createPlayer=function(t){void 0===t&&(t=!0);var e=document.createElement("canvas");return e.width=512,e.height=512,new km({canvas:e,renderFramework:"webgl2",env:Xo,renderOptions:{willCaptureImage:!0},manualRender:t})},t.sleep=function(t){return pg(function(){return Tg(this,function(e){return[2,new Promise(function(e){return setTimeout(e,t)})]})})()},t.loadImageFromGLTFImage=function(t){return pg(function(){return Tg(this,function(e){return[2,lo(new Blob([t.imageData],{type:t.mimeType}))]})})()},t.loadImageFromImageData=function(t){return pg(function(){return Tg(this,function(e){return[2,lo(new Blob([t.data],{type:t.mimeType}))]})})()},t.getCanvasArrayBuffer=function(t){return pg(function(){return Tg(this,function(e){return[2,new Promise(function(e,i){t.toBlob(function(t){t?e(t.arrayBuffer()):i(new Error("No canvas blob."))},"image/png",1)})]})})()},t.getImageArrayBuffer=function(t){var e=this;return pg(function(){var i;return Tg(this,function(r){return(i=document.createElement("canvas")).width=t.width,i.height=t.height,i.getContext("2d").drawImage(t,0,0),[2,e.getCanvasArrayBuffer(i)]})})()},t.getCanvasImageData=function(t){return t.getContext("2d").getImageData(0,0,t.width,t.height)},t.flipImageData=function(t){var e=document.createElement("canvas"),i=e.getContext("2d");return e.width=t.width,e.height=t.height,i.putImageData(t,0,0),i.globalCompositeOperation="copy",i.scale(1,-1),i.translate(0,-t.height),i.drawImage(e,0,0),i.setTransform(1,0,0,1,0,0),i.globalCompositeOperation="source-over",i.getImageData(0,0,e.width,e.height)},t.getImageData=function(t){var e=document.createElement("canvas");e.width=t.width,e.height=t.height;var i=e.getContext("2d");return i.drawImage(t,0,0),this.flipImageData(i.getImageData(0,0,e.width,e.height))},t.getWebGLCanvasImageBuffer=function(t){var e=t.getContext("webgl2"),i=new Uint8Array(t.width*t.height*4);return e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,i),i},t}(),Wv=function(){function t(){this.length=0,this.offset=0,this.stride=0,this.typeSize=0,this.compCount=0,this.signed=!1,this.compressed=!1,this.compressScale=1}var e=t.prototype;return e.create=function(t,e){switch(t.type){case WebGLRenderingContext.INT:this.typeSize=4,this.signed=!0,this.compressScale=1/2147483647;break;case WebGLRenderingContext.SHORT:this.typeSize=2,this.signed=!0,this.compressScale=1/32767;break;default:this.typeSize=4,this.signed=!0,this.compressScale=1}var i,r;this.data=e,this.length=this.data.length,this.compCount=t.size,this.offset=null!=(i=t.offset)?i:0,this.offset>0&&(this.offset%this.typeSize!==0&&console.error("Invalid offset "+this.offset+", type size "+this.typeSize+"."),this.offset=this.offset/this.typeSize),this.stride=null!=(r=t.stride)?r:0,this.stride>0?(this.stride%this.typeSize!==0&&console.error("Invalid stride "+this.stride+", type size "+this.typeSize+"."),this.stride=this.stride/this.typeSize):this.stride=this.compCount,this.compressed=!0===t.normalize},e.getData=function(t){var e=this.offset;if(!((e+=t*this.stride)+this.compCount>this.length)){var i;if(i=2===this.compCount?[this.data[e],this.data[e+1],0,0]:3===this.compCount?[this.data[e],this.data[e+1],this.data[e+2],0]:[this.data[e],this.data[e+1],this.data[e+2],this.data[e+3]],this.compressed)for(var r=0;r<this.compCount;r++)i[r]*=this.compressScale,this.signed&&(i[r]=Math.max(i[r],-1));return i}},e.getLength=function(){return Math.round((this.length-this.offset)/this.stride)},t}(),Xv=function(){function t(){this.drawStart=0,this.drawCount=0,this.bindMatrices=[]}var e=t.prototype;return e.create=function(t,e){this.drawStart=0,this.drawCount=Math.abs(t.getDrawCount());var i=t.attributes;this.index=t.getIndexData();var r=i.aPos,n=t.getAttributeData("aPos");this.position=new Wv,this.position.create(r,n);var s=i.aJoints,o=i.aWeights;if(void 0!==s&&void 0!==o){var a=t.getAttributeData("aJoints"),h=t.getAttributeData("aWeights");this.joint=new Wv,this.joint.create(s,a),this.weight=new Wv,this.weight.create(o,h)}this.bindMatrices=e},e.getBoundingBox=function(t){var e=this;t.makeEmpty();var i=new Hg,r=void 0!==this.joint&&void 0!==this.weight&&this.bindMatrices.length>0,n=new Set;if(void 0!==this.index)for(var s=0;s<this.drawCount;s++){var o=this.drawStart+s;o<this.index.length&&n.add(this.index[o])}else for(var a=0;a<this.drawCount;a++)n.add(this.drawStart+a);return n.forEach(function(n){var s=e.position.getData(n);if(void 0!==s){var o=Vg.fromArray(s);if(r){var a,h,l=null==(a=e.joint)?void 0:a.getData(n),c=null==(h=e.weight)?void 0:h.getData(n);if(void 0!==l&&void 0!==c){i.setZero();for(var u=!1,d=0;d<4;d++)if(0!==c[d]){if(l[d]<0||l[d]>=e.bindMatrices.length){u=!0;break}var f=e.bindMatrices[l[d]];i.addScaledMatrix(f,c[d])}if(!u){var p=i.transformVector4(new Gg(o.x,o.y,o.z,1));Math.abs(p.w)>1e-4&&(p.multiply(1/p.w),o.set(p.x,p.y,p.z))}}}t.expandByPoint(o)}}),t},t}(),Yv=function(){function t(){this.drawStart=0,this.drawCount=0,this.doubleSided=!1,this.bindMatrices=[],this.hasAnimation=!1,this.skinMatrix=new Hg}var e=t.prototype;return e.create=function(t,e,i){this.drawStart=0,this.drawCount=Math.abs(t.getDrawCount());var r=t.attributes;this.index=t.getIndexData();var n=r.aPos,s=t.getAttributeData("aPos");this.position=new Wv,this.position.create(n,s);var o=r.aJoints,a=r.aWeights;if(void 0!==o&&void 0!==a){var h=t.getAttributeData("aJoints"),l=t.getAttributeData("aWeights");this.joint=new Wv,this.joint.create(o,h),this.weight=new Wv,this.weight.create(a,l)}this.doubleSided=e,this.bindMatrices=i,this.hasAnimation=void 0!==this.joint&&void 0!==this.weight&&this.bindMatrices.length>0},e.getHitPoint=function(t,e){for(var i,r=new Vg,n=new Vg,s=new Vg,o=new Gg,a=new Gg,h=new Gg,l=!this.doubleSided,c=0;c+2<this.drawCount;c+=3){var u=this.drawStart+c,d=this.drawStart+c+1,f=this.drawStart+c+2;void 0!==this.index&&(u=this.index[u],d=this.index[d],f=this.index[f]);var p=this.getPosition(u,r,o),m=this.getPosition(d,n,a),g=this.getPosition(f,s,h);if(p&&m&&g){var v=Bv(t,e,p,m,g,l);void 0!==v&&(void 0===i||i>v)&&(i=v)}}return i},e.getPosition=function(t,e,i){var r=this.position.getData(t);if(void 0===r)return null;if(this.hasAnimation){var n,s,o=null==(n=this.joint)?void 0:n.getData(t),a=null==(s=this.weight)?void 0:s.getData(t);if(void 0!==o&&void 0!==a){var h=this.skinMatrix;h.setZero();for(var l=0;l<4;l++)if(0!==a[l]){var c=this.bindMatrices[o[l]];h.addScaledMatrix(c,a[l])}i.set(r[0],r[1],r[2],1);var u=h.transformVector4(i),d=1/u.w;e.set(u.x*d,u.y*d,u.z*d)}}else e.set(r[0],r[1],r[2]);return e},t}(),qv=function(){function t(t){this.size=t,this.data=new Uint16Array(t)}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=Kv(t[i])},$g(t,[{key:"bytes",get:function(){return 2*this.size}}]),t}(),Kv=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){t[0]=i;var r=e[0],n=r>>16&32768,s=r>>12&2047,o=r>>23&255;return o<103?n:o>142?(n|=31744,n|=(255==o?0:1)&&8388607&r):o<113?n|=((s|=2048)>>114-o)+(s>>113-o&1):(n|=o-112<<10|s>>1,n+=1&s)}}();(Vv=Uv||(Uv={}))[Vv.none=0]="none",Vv[Vv.float=1]="float",Vv[Vv.half_float=2]="half_float";var Zv,Jv,$v,Qv,ty=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).skeleton=0,e.jointItem=[],e.inverseBindMatrices=[],e.animationMatrices=[],e.textureDataMode=0,e.maxJointCount=0,e}gg(e,t);var i=e.prototype;return i.create=function(t,e,i,r){var n;this.name=null!=(n=t.rootBoneName)?n:"Unnamed skin",this.type=Ig.skin,this.rootBoneItem=i,this.skeleton=-1,this.jointItem=this.getJointItems(t,i),this.maxJointCount=Math.max(r,this.jointItem.length),this.animationMatrices=[],this.inverseBindMatrices=[],this.textureDataMode=this.getTextureDataMode(this.maxJointCount,e);var s=t.inverseBindMatrices;if(void 0!==s&&s.length>0){if(s.length%16!=0||s.length!==16*this.jointItem.length)throw new Error("Invalid array length, invert bind matrices "+s.length+", joint array "+this.jointItem.length+".");for(var o=s.length/16,a=0;a<o;a++){var h=Hg.fromArray(s,16*a);this.inverseBindMatrices.push(h)}}},i.updateSkinMatrices=function(){var t=this;this.animationMatrices=[];for(var e=0;e<this.jointItem.length;e++){var i=this.jointItem[e].transform.getWorldMatrix();this.animationMatrices.push(i.clone())}this.animationMatrices.length===this.inverseBindMatrices.length?this.animationMatrices.forEach(function(e,i){e.multiply(t.inverseBindMatrices[i])}):(this.animationMatrices=this.inverseBindMatrices,console.error("Some error occured, replace skin animation matrices by invert bind matrices."))},i.computeMeshAnimMatrices=function(t,e,i){var r=t.clone().invert(),n=new Hg;this.animationMatrices.forEach(function(t,s){var o=n.multiplyMatrices(r,t);o.elements.forEach(function(t,i){return e[16*s+i]=t}),o.clone().invert().transpose().elements.forEach(function(t,e){return i[16*s+e]=t})})},i.updateParentItem=function(t){this.rootBoneItem=t},i.getJointCount=function(){return this.jointItem.length},i.isTextureDataMode=function(){return 0!==this.textureDataMode},i.dispose=function(){this.rootBoneItem=void 0,this.jointItem=[],this.inverseBindMatrices=[],this.animationMatrices=[]},i.getTextureDataMode=function(t,e){var i=e.gpuCapability.detail,r=i.maxVertexUniforms-25;if(t>Math.floor(r/8)){if(i.floatTexture)return 1;if(i.halfFloatTexture)return 2;throw new Error("Too many joint count "+t+", half float texture not support.")}return 0},i.getJointItems=function(t,e){var i,r=this.genNodeName(e),n=[];return null==(i=t.boneNames)||i.forEach(function(t){var e=r[t];if(!e)throw new Error("Can't find node of bone name "+t+".");n.push(e)}),n},i.genNodeName=function(t){var e={},i=[];e[""]=t;for(var r,n=Sg(t.children);!(r=n()).done;){var s=r.value;this.genNodeNameDFS(s,i,e)}return e},i.genNodeNameDFS=function(t,e,i){e.push(t.name),i[e.join("/")]=t;for(var r,n=Sg(t.children);!(r=n()).done;){var s=r.value;this.genNodeNameDFS(s,e,i)}e.pop()},e}(ov),ey=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).morphWeightsLength=0,e.morphWeightsArray=[],e.hasPositionMorph=!1,e.hasNormalMorph=!1,e.hasTangentMorph=!1,e}gg(e,t);var i=e.prototype;return i.create=function(t){var i=this;this.name=this.genName("Morph target"),this.type=Ig.morph;var r=this.getAttributeMorphCount(e.positionNameList,t),n=this.getAttributeMorphCount(e.normalNameList,t),s=this.getAttributeMorphCount(e.tangentNameList,t),o=[r,n,s];return this.morphWeightsLength=0,o.forEach(function(t){t>0&&(0===i.morphWeightsLength?i.morphWeightsLength=t:i.morphWeightsLength=Math.min(i.morphWeightsLength,t))}),this.morphWeightsLength>0&&(this.morphWeightsArray=Array(this.morphWeightsLength).fill(0),this.hasPositionMorph=r==this.morphWeightsLength,this.hasNormalMorph=n==this.morphWeightsLength,this.hasTangentMorph=s==this.morphWeightsLength),r>0&&r!=this.morphWeightsLength?(console.error("Position morph count mismatch: "+this.morphWeightsLength+", "+r+"."),!1):n>0&&n!=this.morphWeightsLength?(console.error("Normal morph count mismatch: "+this.morphWeightsLength+", "+n+"."),!1):s>0&&s!=this.morphWeightsLength?(console.error("Tangent morph count mismatch: "+this.morphWeightsLength+", "+s+"."),!1):!(this.morphWeightsLength>5)||(console.error("Tangent morph count should not greater than 5, current "+this.morphWeightsLength+"."),!1)},i.initWeights=function(t){if(0!==this.morphWeightsArray.length){var e=this.morphWeightsArray;t.forEach(function(t,i){i<e.length&&(e[i]=t)})}},i.updateWeights=function(t){var e=this;t.length==this.morphWeightsArray.length?t.forEach(function(t,i){return e.morphWeightsArray[i]=t}):console.error("Length of morph weights mismatch: input "+t.length+", internel "+this.morphWeightsArray.length+".")},i.hasMorph=function(){return this.morphWeightsLength>0&&(this.hasPositionMorph||this.hasNormalMorph||this.hasTangentMorph)},i.equals=function(t){return this.morphWeightsLength===t.morphWeightsLength&&this.hasPositionMorph===t.hasPositionMorph&&this.hasNormalMorph===t.hasNormalMorph&&this.hasTangentMorph===t.hasTangentMorph},i.getMorphWeightsArray=function(){return this.morphWeightsArray},i.getAttributeMorphCount=function(t,e){for(var i=0;i<t.length;i++){var r=t[i];if(void 0===e.getAttributeData(r))return i}return t.length},e}(ov);ey.positionNameList=["aTargetPosition0","aTargetPosition1","aTargetPosition2","aTargetPosition3","aTargetPosition4","aTargetPosition5","aTargetPosition6","aTargetPosition7"],ey.normalNameList=["aTargetNormal0","aTargetNormal1","aTargetNormal2","aTargetNormal3","aTargetNormal4","aTargetNormal5","aTargetNormal6","aTargetNormal7"],ey.tangentNameList=["aTargetTangent0","aTargetTangent1","aTargetTangent2","aTargetTangent3","aTargetTangent4","aTargetTangent5","aTargetTangent6","aTargetTangent7"],(Jv=Zv||(Zv={}))[Jv.linear=0]="linear",Jv[Jv.step=1]="step",Jv[Jv.cubicSpline=2]="cubicSpline",(Qv=$v||($v={}))[Qv.translation=0]="translation",Qv[Qv.rotation=1]="rotation",Qv[Qv.scale=2]="scale",Qv[Qv.weights=3]="weights";var iy=function(){function t(t){this.engine=t,this.isHalfFloat=!0,this.width=0,this.height=0}var e=t.prototype;return e.create=function(t,e,i){var r,n;this.width=4,this.height=t,this.isHalfFloat=e,this.isHalfFloat&&(this.buffer=new qv(4*this.getSize()));var s=null!=(n=null==(r=this.buffer)?void 0:r.data)?n:new Float32Array(4*this.getSize()),o=this.isHalfFloat?Ys.HALF_FLOAT:Ys.FLOAT;this.texture=To.create(this.engine,{name:i,data:{width:this.width,height:this.height,data:s},target:Ys.TEXTURE_2D,format:Ys.RGBA,type:o,wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,minFilter:Ys.NEAREST,magFilter:Ys.NEAREST})},e.update=function(t){var e,i;(void 0!==this.buffer&&this.buffer.set(t,0),void 0!==this.texture)&&this.texture.updateSource({sourceType:Hs.data,data:{width:this.width,height:this.height,data:null!=(i=null==(e=this.buffer)?void 0:e.data)?i:t},target:Ys.TEXTURE_2D})},e.dispose=function(){var t;this.engine=null,this.buffer=void 0,null==(t=this.texture)||t.dispose()},e.getSize=function(){return this.width*this.height},e.getTexture=function(){return this.texture},t}(),ry=function(){function t(){this.funcMap=new Map,this.funcMap.set(Og.unlit,yv),this.funcMap.set(Og.pbr,yv),this.funcMap.set(Og.shadowBase,xv),this.funcMap.set(Og.shadowFilter,Tv),this.funcMap.set(Og.normalVis,_v),this.funcMap.set(Og.simpleFilter,wv),this.funcMap.set(Og.skyboxFilter,bv)}return t.prototype.genShaderCode=function(t){var e=t.material.materialType,i=this.funcMap.get(e);if(void 0!==i)return i(t);throw new Error("Invalid material type "+e+", shader content "+t+".")},t.getInstance=function(){return this._instance||(this._instance=new this)},t}(),ny=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materialType=Og.none,e.vertexShaderCode="",e.fragmentShaderCode="",e.ZWrite=!0,e.ZTest=!0,e.renderType=en.RenderType.Opaque,e.alphaClip=!1,e.alphaCutoff=.5,e.renderFace=en.RenderFace.Front,e}gg(e,t);var i=e.prototype;return i.getShaderFeatures=function(){var t=[];return this.isAlphaClip()?t.push("ALPHAMODE_MASK 1"):this.isOpaque()&&t.push("ALPHAMODE_OPAQUE 1"),this.renderFace===en.RenderFace.Both&&t.push("DOUBLE_SIDED 1"),t},i.getShaderMacros=function(){var t=[];return this.isAlphaClip()?t.push({name:"ALPHAMODE_MASK"}):this.isOpaque()&&t.push({name:"ALPHAMODE_OPAQUE"}),this.renderFace===en.RenderFace.Both&&t.push({name:"DOUBLE_SIDED"}),t},i.updateUniforms=function(t){if(nv.getInstance().renderMode3D===en.RenderMode3D.uv){var e=nv.getInstance().renderMode3DUVGridSize;t.setFloat("_DebugUVGridSize",e)}},i.build=function(t){var e=this.getFeatureList(t),i=nv.getInstance().isWebGL2,r=ry.getInstance().genShaderCode({material:this,isWebGL2:i,featureList:e});this.vertexShaderCode=r.vertexShaderCode,this.fragmentShaderCode=r.fragmentShaderCode},i.getFeatureList=function(t){var e,i=this.getShaderFeatures();void 0!==t&&(e=i).push.apply(e,[].concat(t));this.materialType!==Og.shadowBase&&(nv.getInstance().isEditorEnv&&i.push("EDITOR_TRANSFORM"));return i},i.getMacroList=function(t){var e,i=this.getShaderMacros();void 0!==t&&(e=i).push.apply(e,[].concat(t));this.materialType!==Og.shadowBase&&(nv.getInstance().isEditorEnv&&i.push({name:"EDITOR_TRANSFORM"}));return i},i.setMaterialStates=function(t){this.renderType===en.RenderType.Transparent?(t.blending=!0,t.depthTest=this.ZTest,t.depthMask=this.ZWrite,t.blendEquation=[Ys.FUNC_ADD,Ys.FUNC_ADD],t.blendFunction=[Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA]):nv.getInstance().isTiny3dMode?(t.blending=!1,t.depthTest=!0,t.depthMask=!0):(t.blending=!1,t.depthTest=this.ZTest,t.depthMask=this.ZWrite),this.setFaceSideStates(t)},i.setFaceSideStates=function(t){this.isBothSide()?t.culling=!1:this.isBackSide()?(t.cullFace=Ys.FRONT,t.frontFace=Ys.CCW,t.culling=!0):(t.cullFace=Ys.BACK,t.frontFace=Ys.CCW,t.culling=!0)},i.dispose=function(){this.vertexShaderCode="",this.fragmentShaderCode=""},i.isValid=function(){return this.materialType!==Og.none&&t.prototype.isValid.call(this)},i.isOpaque=function(){return this.renderType===en.RenderType.Opaque},i.isAlphaClip=function(){return this.alphaClip},i.isTransparent=function(){return this.renderType===en.RenderType.Transparent},i.isFrontSide=function(){return this.renderFace===en.RenderFace.Front},i.isBackSide=function(){return this.renderFace===en.RenderFace.Back},i.isBothSide=function(){return this.renderFace===en.RenderFace.Both},e}(ov),sy=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseColorFactor=new Wg(1,1,1,1),e}gg(e,t);var i=e.prototype;return i.create=function(t){var e,i,r,n,s;this.effectMaterial=t,this.name=t.name,this.type=Ig.material,this.materialType=Og.unlit,this.baseColorTexture=null!=(e=t.getTexture("_BaseColorSampler"))?e:void 0,this.baseColorTextureTrans=jv.createUVTransform(t,"_BaseColorSampler_ST","_BaseColorRotation"),this.baseColorFactor=null!=(i=t.getColor("_BaseColorFactor"))?i:new Wg(1,1,1,1),this.ZWrite=0!==t.getFloat("ZWrite"),this.ZTest=0!==t.getFloat("ZTest"),this.renderType=null!=(r=t.stringTags.RenderType)?r:en.RenderType.Opaque,this.alphaClip=1===t.getFloat("AlphaClip"),this.alphaCutoff=null!=(n=t.getFloat("_AlphaCutoff"))?n:0,this.renderFace=null!=(s=t.stringTags.RenderFace)?s:en.RenderFace.Front},i.dispose=function(){t.prototype.dispose.call(this),this.baseColorTexture=void 0},i.getShaderFeatures=function(){var e=t.prototype.getShaderFeatures.call(this);return e.push("MATERIAL_METALLICROUGHNESS 1"),this.hasBaseColorTexture()&&e.push("HAS_BASE_COLOR_MAP 1"),e.push("MATERIAL_UNLIT 1"),e},i.getShaderMacros=function(){var e=t.prototype.getShaderMacros.call(this);return e.push({name:"MATERIAL_METALLICROUGHNESS"}),this.hasBaseColorTexture()&&e.push({name:"HAS_BASE_COLOR_MAP"}),e.push({name:"MATERIAL_UNLIT"}),e},i.updateUniforms=function(e){t.prototype.updateUniforms.call(this,e),void 0!==this.baseColorTexture&&(e.setInt("_BaseColorUVSet",0),e.setMatrix3("_BaseColorUVTransform",this.baseColorTextureTrans)),e.setFloat("_MetallicFactor",0),e.setFloat("_RoughnessFactor",0),e.setFloat("_Exposure",1)},i.hasBaseColorTexture=function(){return void 0!==this.baseColorTexture},i.getBaseColorTexture=function(){return this.baseColorTexture},i.setBaseColorTexture=function(t){this.baseColorTexture=t},i.getBaseColorFactor=function(){return this.baseColorFactor},i.setBaseColorFactor=function(t){vg(t,Wg)?this.baseColorFactor.set(t.r,t.g,t.b,t.a):vg(t,Gg)?this.baseColorFactor.set(t.x,t.y,t.z,t.w):this.baseColorFactor.set(t[0],t[1],t[2],t[3])},e}(ny),oy=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseColorFactor=new Wg(1,1,1,1),e.useSpecularAA=!1,e.metallicFactor=0,e.roughnessFactor=1,e.normalTextureScale=1,e.occlusionTextureStrength=1,e.emissiveFactor=new Wg(0,0,0,0),e.emissiveIntensity=1,e}gg(e,t);var i=e.prototype;return i.create=function(t){var e,i,r,n,s,o,a,h,l,c,u,d,f,p,m;this.effectMaterial=t,this.name=t.name,this.type=Ig.material,this.materialType=Og.pbr,this.baseColorTexture=null!=(e=t.getTexture("_BaseColorSampler"))?e:void 0,this.baseColorTextureTrans=jv.createUVTransform(t,"_BaseColorSampler_ST","_BaseColorRotation"),this.baseColorFactor=null!=(i=t.getColor("_BaseColorFactor"))?i:new Wg(1,1,1,1),this.metallicRoughnessTexture=null!=(r=t.getTexture("_MetallicRoughnessSampler"))?r:void 0,this.metallicRoughnessTextureTrans=jv.createUVTransform(t,"_MetallicRoughnessSampler_ST","_MetallicRoughnessRotation"),this.useSpecularAA=1===t.getFloat("_SpecularAA"),this.metallicFactor=null!=(n=t.getFloat("_MetallicFactor"))?n:1,this.roughnessFactor=null!=(s=t.getFloat("_RoughnessFactor"))?s:0,this.normalTexture=null!=(o=t.getTexture("_NormalSampler"))?o:void 0,this.normalTextureTrans=jv.createUVTransform(t,"_NormalSampler_ST","_NormalRotation"),this.normalTextureScale=null!=(a=t.getFloat("_NormalScale"))?a:1,this.occlusionTexture=null!=(h=t.getTexture("_OcclusionSampler"))?h:void 0,this.occlusionTextureTrans=jv.createUVTransform(t,"_OcclusionSampler_ST","_OcclusionRotation"),this.occlusionTextureStrength=null!=(l=t.getFloat("_OcclusionStrength"))?l:1,this.emissiveTexture=null!=(c=t.getTexture("_EmissiveSampler"))?c:void 0,this.emissiveTextureTrans=jv.createUVTransform(t,"_EmissiveSampler_ST","_EmissiveRotation"),this.emissiveFactor=null!=(u=t.getColor("_EmissiveFactor"))?u:new Wg(0,0,0,1),this.emissiveIntensity=null!=(d=t.getFloat("_EmissiveIntensity"))?d:1,this.ZWrite=0!==t.getFloat("ZWrite"),this.ZTest=0!==t.getFloat("ZTest"),this.renderType=null!=(f=t.stringTags.RenderType)?f:en.RenderType.Opaque,this.alphaClip=1===t.getFloat("AlphaClip"),this.alphaCutoff=null!=(p=t.getFloat("_AlphaCutoff"))?p:0,this.renderFace=null!=(m=t.stringTags.RenderFace)?m:en.RenderFace.Front},i.dispose=function(){t.prototype.dispose.call(this),this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveTexture=void 0},i.getShaderFeatures=function(){var e=t.prototype.getShaderFeatures.call(this);return e.push("MATERIAL_METALLICROUGHNESS 1"),this.hasBaseColorTexture()&&(e.push("HAS_BASE_COLOR_MAP 1"),void 0!==this.baseColorTextureTrans&&e.push("HAS_BASECOLOR_UV_TRANSFORM 1")),this.hasMetallicRoughnessTexture()&&(e.push("HAS_METALLIC_ROUGHNESS_MAP 1"),void 0!==this.metallicRoughnessTextureTrans&&e.push("HAS_METALLICROUGHNESS_UV_TRANSFORM 1")),this.useSpecularAA&&e.push("USE_SPECULAR_AA 1"),this.hasNormalTexture()&&(e.push("HAS_NORMAL_MAP 1"),void 0!==this.normalTextureTrans&&e.push("HAS_NORMAL_UV_TRANSFORM 1")),this.hasOcclusionTexture()&&(e.push("HAS_OCCLUSION_MAP 1"),void 0!==this.occlusionTextureTrans&&e.push("HAS_OCCLUSION_UV_TRANSFORM 1")),this.hasEmissiveTexture()?(e.push("HAS_EMISSIVE_MAP 1"),void 0!==this.emissiveTextureTrans&&e.push("HAS_EMISSIVE_UV_TRANSFORM 1")):this.hasEmissiveValue()&&e.push("HAS_EMISSIVE 1"),e},i.getShaderMacros=function(){var e=t.prototype.getShaderMacros.call(this);return e.push({name:"MATERIAL_METALLICROUGHNESS"}),this.hasBaseColorTexture()&&(e.push({name:"HAS_BASE_COLOR_MAP"}),void 0!==this.baseColorTextureTrans&&e.push({name:"HAS_BASECOLOR_UV_TRANSFORM"})),this.hasMetallicRoughnessTexture()&&(e.push({name:"HAS_METALLIC_ROUGHNESS_MAP"}),void 0!==this.metallicRoughnessTextureTrans&&e.push({name:"HAS_METALLICROUGHNESS_UV_TRANSFORM"})),this.useSpecularAA&&e.push({name:"USE_SPECULAR_AA"}),this.hasNormalTexture()&&(e.push({name:"HAS_NORMAL_MAP"}),void 0!==this.normalTextureTrans&&e.push({name:"HAS_NORMAL_UV_TRANSFORM"})),this.hasOcclusionTexture()&&(e.push({name:"HAS_OCCLUSION_MAP"}),void 0!==this.occlusionTextureTrans&&e.push({name:"HAS_OCCLUSION_UV_TRANSFORM"})),this.hasEmissiveTexture()?(e.push({name:"HAS_EMISSIVE_MAP"}),void 0!==this.emissiveTextureTrans&&e.push({name:"HAS_EMISSIVE_UV_TRANSFORM"})):this.hasEmissiveValue()&&e.push({name:"HAS_EMISSIVE"}),e},i.updateUniforms=function(e){t.prototype.updateUniforms.call(this,e),void 0!==this.baseColorTexture&&(e.setInt("_BaseColorUVSet",0),e.setMatrix3("_BaseColorUVTransform",this.baseColorTextureTrans)),void 0!==this.metallicRoughnessTexture&&(e.setInt("_MetallicRoughnessUVSet",0),e.setMatrix3("_MetallicRoughnessUVTransform",this.metallicRoughnessTextureTrans)),void 0!==this.normalTexture&&(e.setInt("_NormalUVSet",0),e.setMatrix3("_NormalUVTransform",this.normalTextureTrans)),void 0!==this.occlusionTexture&&(e.setInt("_OcclusionUVSet",0),e.setMatrix3("_OcclusionUVTransform",this.occlusionTextureTrans)),void 0!==this.emissiveTexture&&(e.setInt("_EmissiveUVSet",0),e.setMatrix3("_EmissiveUVTransform",this.emissiveTextureTrans)),e.setFloat("_Exposure",3)},i.hasBaseColorTexture=function(){return void 0!==this.baseColorTexture},i.setBaseColorTexture=function(t){this.baseColorTexture=t},i.getBaseColorFactor=function(){return this.baseColorFactor},i.setBaseColorFactor=function(t){vg(t,Wg)?this.baseColorFactor.set(t.r,t.g,t.b,t.a):vg(t,Gg)?this.baseColorFactor.set(t.x,t.y,t.z,t.w):this.baseColorFactor.set(t[0],t[1],t[2],t[3])},i.hasMetallicRoughnessTexture=function(){return void 0!==this.metallicRoughnessTexture},i.getMetallicRoughnessTexture=function(){return this.metallicRoughnessTexture},i.setMetallicRoughnessTexture=function(t){this.metallicRoughnessTexture=t},i.hasNormalTexture=function(){return void 0!==this.normalTexture},i.getNormalTexture=function(){return this.normalTexture},i.setNormalTexture=function(t){this.normalTexture=t},i.hasOcclusionTexture=function(){return void 0!==this.occlusionTexture},i.getOcclusionTexture=function(){return this.occlusionTexture},i.setOcclusionTexture=function(t){this.occlusionTexture=t},i.hasEmissiveTexture=function(){return void 0!==this.emissiveTexture},i.getEmissiveTexture=function(){return this.emissiveTexture},i.setEmissiveTexture=function(t){this.emissiveTexture=t},i.hasEmissiveValue=function(){return this.emissiveFactor.luminance()*this.emissiveIntensity>0},i.getEmissiveFactor=function(){return this.emissiveFactor},i.setEmissiveFactor=function(t){vg(t,Wg)?this.emissiveFactor.set(t.r,t.g,t.b,t.a):vg(t,Vg)?this.emissiveFactor.set(t.x,t.y,t.z,0):this.emissiveFactor.set(t[0],t[1],t[2],0)},i.getEmissiveIntensity=function(){return this.emissiveIntensity},i.setEmissiveIntensity=function(t){this.emissiveIntensity=t},e}(ny);var ay,hy,ly=function(t){function e(e,i,r){var n,s;(n=t.call(this)||this).renderable=!0,n.intensity=1,n.reflectionsIntensity=1,n.specularImageSize=0,n.specularMipCount=0,n.priority=0,n.isBuilt=!1,n.name=e,n.type=Ig.skybox,n.visible=!1,n.owner=r;var o=i.irradianceCoeffs;if(n.renderable=i.renderable,n.intensity=i.intensity,n.reflectionsIntensity=i.reflectionsIntensity,o){n.irradianceCoeffs=[];for(var a=0;a<o.length;a+=3)n.irradianceCoeffs.push([o[a],o[a+1],o[a+2]])}else n.irradianceCoeffs=[];return n.diffuseImage=i.diffuseImage,n.specularImage=i.specularImage,n.specularImageSize=i.specularImageSize,n.specularMipCount=i.specularMipCount,n.priority=(null==r||null==(s=r.item)?void 0:s.renderOrder)||0,n}gg(e,t);var i=e.prototype;return i.setup=function(t){this.brdfLUT=t},i.build=function(t){if(!this.isBuilt){this.isBuilt=!0,this.skyboxMaterial=new cy,this.skyboxMaterial.create(this),this.skyboxMaterial.build();var e=t.getSceneCache();this.skyboxMesh=e.getFilterMesh("SkyboxFilterPlane",this.skyboxMaterial),this.skyboxMesh.priority=this.priority,this.skyboxMaterial.updateUniforms(this.skyboxMesh.material)}},i.render=function(t,e){if(this.updateMaterial(t),this.visible&&this.renderable&&void 0!==this.skyboxMesh){var i=this.skyboxMesh;e.drawGeometry(i.geometry,Hg.IDENTITY,i.material)}},i.dispose=function(){var e;t.prototype.dispose.call(this),this.owner=void 0,this.diffuseImage=void 0,this.specularImage=void 0,this.brdfLUT=void 0,this.skyboxMesh=void 0,null==(e=this.skyboxMaterial)||e.dispose(),this.skyboxMaterial=void 0},i.updateMaterial=function(t){if(this.build(t),this.visible&&this.renderable&&void 0!==this.skyboxMesh&&void 0!==this.skyboxMaterial){var e=t.sceneStates,i=e.camera,r=e.viewMatrix,n=i.getNewProjectionMatrix(i.fov).multiply(r).invert(),s=this.skyboxMesh.material;this.skyboxMaterial.updateUniforms(s),s.setMatrix("_InvViewProjectionMatrix",n)}},$g(e,[{key:"available",get:function(){return!!this.isValid()&&(!(this.intensity<=0&&this.reflectionsIntensity<=0)&&((void 0!==this.irradianceCoeffs||void 0!==this.diffuseImage)&&(void 0!==this.specularImage&&this.specularMipCount>=0)))}},{key:"currentIntensity",get:function(){return this.visible?this.intensity:0}},{key:"currentReflectionsIntensity",get:function(){return this.visible?this.reflectionsIntensity:0}},{key:"hasDiffuseImage",get:function(){return void 0!==this.diffuseImage}},{key:"hasIrradianceCoeffs",get:function(){return void 0!==this.irradianceCoeffs}}]),e}(av),cy=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).intensity=1,e.reflectionsIntensity=1,e.specularMipCount=0,e}gg(e,t);var i=e.prototype;return i.create=function(t){this.type=Ig.material,this.materialType=Og.skyboxFilter,this.ZTest=!1,this.name=t.name,this.intensity=t.intensity,this.reflectionsIntensity=t.reflectionsIntensity,this.brdfLUT=t.brdfLUT,this.irradianceCoeffs=t.irradianceCoeffs,this.diffuseImage=t.diffuseImage,this.specularImage=t.specularImage,this.specularMipCount=t.specularMipCount},i.dispose=function(){t.prototype.dispose.call(this),this.brdfLUT=void 0,this.irradianceCoeffs=void 0,this.diffuseImage=void 0,this.specularImage=void 0},i.getShaderFeatures=function(){var t=[];return t.push("USE_IBL 1"),t.push("USE_TEX_LOD 1"),void 0===this.diffuseImage&&t.push("IRRADIANCE_COEFFICIENTS 1"),t},i.updateUniforms=function(t){if(void 0===this.brdfLUT)throw new Error("Setup brdfLUT for skybox at first.");if(t.setVector2("_IblIntensity",new Ug(2,2)),t.setTexture("_brdfLUT",this.brdfLUT),void 0!==this.diffuseImage)t.setTexture("_DiffuseEnvSampler",this.diffuseImage);else{var e=this.irradianceCoeffs;if(void 0===e||9!=e.length)throw new Error("Invalid skybox irradiance coeffs "+e+".");["l00","l1m1","l10","l11","l2m2","l2m1","l20","l21","l22"].forEach(function(i,r){t.setVector3("_shCoefficients."+i,Vg.fromArray(e[r]))})}t.setInt("_MipCount",this.specularMipCount-1),t.setTexture("_SpecularEnvSampler",this.specularImage)},i.setMaterialStates=function(t){t.depthTest=!0,t.depthMask=!1,this.setFaceSideStates(t)},e}(ny);(hy=ay||(ay={}))[hy.NFT=0]="NFT",hy[hy.FARM=1]="FARM";var uy=function(){function t(){}return t.prototype.checkCubeMapImage=function(t){return pg(function(){var e,i,r,n;return Tg(this,function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?[4,lo(t[r])]:[3,4];case 2:if(n=s.sent(),r>0)if(r%6==0){if(2*n.width!==e.width||2*n.height!==e.height)throw new Error("Invalid cube map list1: index "+r+", image0 "+e+", image1 "+n+".")}else if(n.width!==e.width||n.height!==e.height)throw new Error("Invalid cube map list2: index "+r+", image0 "+e+", image1 "+n+".");r%6==0&&i.push([]),i[i.length-1].push(n),e=n,s.label=3;case 3:return r++,[3,1];case 4:return[2]}})})()},t.getBrdfLutTextureOptions=function(){return pg(function(){var t;return Tg(this,function(e){switch(e.label){case 0:return[4,lo("https://gw.alipayobjects.com/zos/gltf-asset/61420044606400/lut-ggx.png")];case 1:return t=e.sent(),[2,{name:"brdfLut",wrapS:Ys.CLAMP_TO_EDGE,wrapT:Ys.CLAMP_TO_EDGE,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,anisotropic:1,sourceType:Hs.image,image:t,generateMipmap:!1,flipY:!1,premultiplyAlpha:!1}]}})})()},t.createBrdfLutTexture=function(t){var e=this;return pg(function(){var i;return Tg(this,function(r){switch(r.label){case 0:return[4,e.getBrdfLutTextureOptions()];case 1:return i=r.sent(),[2,To.create(t,i)]}})})()},t.createSkyboxOptions=function(t,e){var i=this;return pg(function(){var r,n,s,o,a,h,l,c;return Tg(this,function(u){switch(u.label){case 0:return[4,i.createSpecularCubeMap(t,e)];case 1:return r=u.sent(),[4,i.createDiffuseCubeMap(t,e)];case 2:return n=u.sent(),s=e.renderable,o=e.intensity,a=e.reflectionsIntensity,h=e.irradianceCoeffs,l=e.specularImageSize,c=e.specularMipCount,[2,{renderable:s,intensity:o,reflectionsIntensity:a,irradianceCoeffs:h,diffuseImage:n,specularImage:r,specularImageSize:l,specularMipCount:c}]}})})()},t.createSkyboxComponentData=function(e){var i,r,n,s=t.getSpecularCubeMapData(e),o=t.getDiffuseCubeMapData(e),a=e.renderable,h=e.intensity,l=e.reflectionsIntensity,c=e.irradianceCoeffs,u=e.specularImageSize,d=e.specularMipCount,f=[],p=[];o&&((n=f).push.apply(n,[].concat(o.images)),p.push(o.textureOptions),r={id:o.textureOptions.id});(i=f).push.apply(i,[].concat(s.images)),p.push(s.textureOptions);var m={id:s.textureOptions.id};return{imageList:f,textureOptionsList:p,component:{id:ei(),dataType:en.DataType.SkyboxComponent,item:{id:ei()},renderable:a,intensity:h,reflectionsIntensity:l,irradianceCoeffs:c,diffuseImage:r,specularImage:m,specularImageSize:u,specularMipCount:d}}},t.createSpecularCubeMap=function(t,e){return pg(function(){return Tg(this,function(i){return"url"===e.type?[2,zv.createTextureCubeMipmapFromURL(t,e.specularImage)]:[2,zv.createTextureCubeMipmapFromBuffer(t,e.specularImage,e.specularImageSize)]})})()},t.getSpecularCubeMapData=function(t){var e=[],i=[];t.specularImage.forEach(function(t){var r=[];t.forEach(function(t){var i=ei();e.push({id:i,url:t}),r.push({id:i})}),i.push(r)});var r=Qg({id:ei(),dataType:en.DataType.Texture,sourceType:Hs.mipmaps,target:Ys.TEXTURE_CUBE_MAP,mipmaps:i},zv.cubemapMipTexConfig);return{images:e,textureOptions:r}},t.createDiffuseCubeMap=function(t,e){return pg(function(){return Tg(this,function(i){return void 0===e.diffuseImage?[2,null]:"url"===e.type?[2,zv.createTextureCubeFromURL(t,e.diffuseImage)]:[2,zv.createTextureCubeFromBuffer(t,e.diffuseImage)]})})()},t.getDiffuseCubeMapData=function(t){if(void 0!==t.diffuseImage){var e=[],i=[];t.diffuseImage.forEach(function(t){var r=ei();e.push({id:r,url:t}),i.push({id:r})});var r=Qg({id:ei(),dataType:en.DataType.Texture,sourceType:Hs.mipmaps,target:Ys.TEXTURE_CUBE_MAP,mipmaps:[i]},zv.cubemapTexConfig);return{images:e,textureOptions:r}}},t.getSkyboxParams=function(t){void 0===t&&(t=0);var e=this.getSpecularImageList(t);return{type:"url",renderable:!0,intensity:1.8,reflectionsIntensity:1.8,irradianceCoeffs:this.getIrradianceCoeffs(t),diffuseImage:this.getDiffuseImageList(t,e),specularImage:e,specularImageSize:Math.pow(2,e.length-1),specularMipCount:e.length}},t.getIrradianceCoeffs=function(t){var e=[];switch(t){case 0:return;case 1:e=[.2665672302246094,.27008703351020813,.2836797833442688,-.15421263873577118,-.15587495267391205,-.16371899843215942,.06483837962150574,.06468029320240021,.06616337597370148,-.11598809063434601,-.11796595901250839,-.1261979341506958,.023678265511989594,.02456280030310154,.02591511607170105,-.032404184341430664,-.03217344358563423,-.03126845508813858,.009165619499981403,.009345818310976028,.008521141484379768,-.021998587995767593,-.02203795686364174,-.021759089082479477,.00046658870996907353,.0005610908847302198,.0007202711421996355];break;default:e=[.3746267259120941,.3523011803627014,.33955901861190796,.12082185596227646,.18179306387901306,.26912716031074524,-.020699946209788322,-.004648427478969097,.00797625258564949,-.06842170655727386,-.05139023810625076,-.03317255899310112,.044127799570560455,.028159862384200096,.007428745273500681,.07887077331542969,.06773484498262405,.04738233983516693,-.012322401627898216,-.015187464654445648,-.02020176313817501,-.1091032400727272,-.0823250338435173,-.046844951808452606,-.05779704451560974,-.06689254194498062,-.08212742954492569]}return e},t.getDiffuseImageList=function(t,e){if(0==t)return e[e.length-1]},t.getSpecularImageList=function(t){var e,i,r=[];1===t?(e=r).push.apply(e,[].concat(this.getSpecularImageListAntFarm())):(i=r).push.apply(i,[].concat(this.getSpecularImageListNFT()));var n=[];return r.forEach(function(t,e){e%6==0&&n.push([]),n[n.length-1].push(t)}),n},t.getSpecularImageListNFT=function(){return["https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img0.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img1.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img2.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img3.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img5.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img4.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img6.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img7.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img8.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img9.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img11.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img10.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img12.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img13.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img14.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img15.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img17.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img16.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img18.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img19.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img20.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img21.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img23.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img22.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img24.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img25.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img26.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img27.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img29.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img28.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img30.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img31.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img32.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img33.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img35.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img34.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img36.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img37.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img38.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img39.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img41.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img40.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img42.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img43.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img44.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img45.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img47.png","https://gw.alipayobjects.com/zos/gltf-asset/1656063861448/227da6e6-8d07-4f8b-bbb0-3b22fde48c0b_img46.png"]},t.getSpecularImageListAntFarm=function(){return["https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_32_5.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_16_5.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_8_5.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_4_5.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_2_5.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_0.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_1.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_2.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_3.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_4.png","https://gw.alipayobjects.com/zos/gltf-asset/58741584603363/M_Cubemap_1_5.png"]},t}(),dy=function(){function t(t){this.engine=t,this.loadSkybox=!1,this.meshCache=new Map,this.textureCache=new Map,this.geometryCache=new Map,this.renderPassCache=new Map}var e=t.prototype;return e.setup=function(e){if(this.loadSkybox=e,void 0===this.brdfLutTexture||this.brdfLutTexture.isDestroyed){if(void 0===t.brdfLutTexOptions)throw new Error("Please load brdfLutTexOptions at first.");var i="brdfLutTexture";this.brdfLutTexture=To.create(this.engine,t.brdfLutTexOptions),this.deleteTexture(i),this.setTexture(i,this.brdfLutTexture)}},e.getTexture=function(t){return this.textureCache.get(t)},e.setTexture=function(t,e){this.textureCache.set(t,e)},e.getOrCreateTexture=function(t,e){var i=this.textureCache.get(t);if(void 0!==i)return i;var r=To.create(this.engine,e);return this.textureCache.set(t,r),r},e.deleteTexture=function(t){var e=this.textureCache.get(t);return void 0!==e&&e.dispose(),this.textureCache.delete(t)},e.getOrCreateGeometry=function(t,e,i){var r=this.geometryCache.get(t);if(void 0!==r)return r;var n=jv.createGeometry(this.engine,e,i);return this.geometryCache.set(t,n),n},e.getFilterMesh=function(t,e){var i=this.meshCache.get(t);if(void 0!==i)return i;var r=Gv.createFilterMesh(this.engine,t,e);return this.meshCache.set(t,r),r},e.dispose=function(){this.engine=null,this.brdfLutTexture=void 0,this.meshCache.forEach(function(t){zv.deleteMesh(t)}),this.meshCache.clear(),this.textureCache.forEach(function(t){zv.deleteTexture(t)}),this.textureCache.clear(),this.geometryCache.forEach(function(t){zv.deleteGeometry(t)}),this.geometryCache.clear(),this.renderPassCache.forEach(function(t){zv.deleteRenderPass(t)}),this.renderPassCache.clear()},e.getRenderPasses=function(){var t=[];return this.renderPassCache.forEach(function(e){t.push(e)}),t},e.getBrdfLutTexture=function(){return this.brdfLutTexture},e.getSkyboxOptions=function(){return t.skyboxOptions},t.loadStaticResources=function(){var t=this;return pg(function(){return Tg(this,function(e){switch(e.label){case 0:return void 0!==t.brdfLutTexOptions?[2]:[4,uy.getBrdfLutTextureOptions()];case 1:return t.brdfLutTexOptions=e.sent(),[2]}})})()},t.genSkyboxOptions=function(e,i){return pg(function(){var r;return Tg(this,function(n){switch(n.label){case 0:return void 0===(r=i)&&(r=uy.getSkyboxParams()),[4,uy.createSkyboxOptions(e,r)];case 1:return t.skyboxOptions=n.sent(),[2,t.skyboxOptions]}})})()},t}(),fy=Math.PI/180,py=function(t){function e(e,i,r,n,s){var o,a,h,l,c,u;return(o=t.call(this)||this).width=512,o.height=512,o.nearPlane=.001,o.farPlane=1e3,o.fov=45,o.viewportMatrix=Hg.fromIdentity(),o.aspect=1,o.clipMode=en.CameraClipMode.landscape,o.projectionMatrix=new Hg,o.viewMatrix=new Hg,o.type=Ig.camera,o.visible=!1,o.owner=s,o.name=e,o.width=i,o.height=r,o.nearPlane=null!=(a=n.near)?a:.001,o.farPlane=null!=(h=n.far)?h:1e3,o.fov=null!=(l=n.fov)?l:45,o.aspect=null!=(c=n.aspect)?c:o.width/o.height,o.clipMode=null!=(u=n.clipMode)?u:en.CameraClipMode.landscape,o.update(),o}gg(e,t);var i=e.prototype;return i.update=function(){void 0!==this.owner&&this.transform.fromEffectsTransform(this.owner.transform);var t=this.clipMode===en.CameraClipMode.portrait;this.projectionMatrix.perspective(this.fov*fy,this.aspect,this.nearPlane,this.farPlane,t),this.projectionMatrix.premultiply(this.viewportMatrix),this.viewMatrix=this.matrix.invert()},i.getNewProjectionMatrix=function(t){var e=this.clipMode===en.CameraClipMode.portrait;return(new Hg).perspective(Math.min(1.25*t,140)*fy,this.aspect,this.nearPlane,this.farPlane,e).premultiply(this.viewportMatrix)},i.computeViewAABB=function(t){var e=Math.tan(this.fov*fy*.5),i=this.aspect,r=0,n=0,s=0,o=0;this.isReversed()?(r=(s=this.farPlane*e)/i,n=(o=this.nearPlane*e)/i):(s=i*(r=this.farPlane*e),o=i*(n=this.nearPlane*e)),t.makeEmpty();var a=this.matrix;return t.expandByPoint(a.transformPoint(new Vg(s,r,-this.farPlane))),t.expandByPoint(a.transformPoint(new Vg(s,-r,-this.farPlane))),t.expandByPoint(a.transformPoint(new Vg(-s,r,-this.farPlane))),t.expandByPoint(a.transformPoint(new Vg(-s,-r,-this.farPlane))),t.expandByPoint(a.transformPoint(new Vg(o,n,-this.nearPlane))),t.expandByPoint(a.transformPoint(new Vg(o,-n,-this.nearPlane))),t.expandByPoint(a.transformPoint(new Vg(-o,n,-this.nearPlane))),t.expandByPoint(a.transformPoint(new Vg(-o,-n,-this.nearPlane))),t},i.getSize=function(){return new Ug(this.width,this.height)},i.isReversed=function(){return this.clipMode===en.CameraClipMode.portrait},i.getEye=function(){return this.translation},i.setEye=function(t){this.translation=t},e}(av),my=function(){function t(){this.winWidth=512,this.winHeight=512,this.cameraList=[],this.defaultCamera=new py("camera",512,512,{id:"0",dataType:"camera",fov:60,far:1e3,near:.001,clipMode:en.CameraClipMode.portrait,item:{id:"0"}})}var e=t.prototype;return e.initial=function(t,e){this.winWidth=t,this.winHeight=e;var i=this.defaultCamera;i.width=t,i.height=e,i.aspect=t/e,i.update()},e.insert=function(t,e,i){var r=new py(t,this.winWidth,this.winHeight,e,i);return this.cameraList.push(r),r},e.insertCamera=function(t){this.cameraList.push(t)},e.remove=function(t){if(vg(t,py)){var e=this.cameraList.findIndex(function(e){return e===t});-1!==e&&this.cameraList.splice(e,1)}else t>=0&&t<this.cameraList.length&&this.cameraList.splice(t,1)},e.dispose=function(){this.cameraList=[]},e.updateDefaultCamera=function(t,e,i,r,n,s,o,a){this.defaultCamera.fov=t,this.defaultCamera.viewportMatrix=e.clone(),this.defaultCamera.aspect=i,this.defaultCamera.nearPlane=r,this.defaultCamera.farPlane=n,this.defaultCamera.position=s,this.defaultCamera.rotation=o,this.defaultCamera.aspect=i,this.defaultCamera.clipMode=a,this.defaultCamera.update()},e.getCameraList=function(){return this.cameraList},e.getDefaultCamera=function(){return this.defaultCamera},e.getCameraCount=function(){return this.cameraList.length},e.getActiveCamera=function(){return this.defaultCamera},e.getAspect=function(){return this.winWidth/this.winHeight},t}(),gy=function(t){function e(e,i,r){var n;(n=t.call(this)||this).direction=new Vg(0,0,1),n.range=0,n.color=new Vg(1,1,1),n.intensity=0,n.outerConeAngle=0,n.innerConeAngle=0,n.lightType=Cg.ambient,n.padding=new Ug(0,0),n.followCamera=!1,n.name=e,n.type=Ig.light,n.visible=!1,n.owner=r,n.direction=new Vg(0,0,-1),n.range=0,n.outerConeAngle=0,n.innerConeAngle=0;var s,o,a=i.color;if(n.color=new Vg(a.r,a.g,a.b),n.intensity=i.intensity,n.followCamera=null!=(s=i.followCamera)&&s,i.lightType===en.LightType.point)n.lightType=Cg.point,n.range=null!=(o=i.range)?o:-1;else if(i.lightType===en.LightType.spot){var h,l,c;n.lightType=Cg.spot,n.range=null!=(h=i.range)?h:-1,n.outerConeAngle=null!=(l=i.outerConeAngle)?l:Math.PI,n.innerConeAngle=null!=(c=i.innerConeAngle)?c:0}else i.lightType===en.LightType.directional?n.lightType=Cg.directional:n.lightType=Cg.ambient;return n.update(),n}gg(e,t);var i=e.prototype;return i.update=function(){void 0!==this.owner&&this.transform.fromEffectsTransform(this.owner.transform)},i.isDirectional=function(){return this.lightType===Cg.directional},i.isPoint=function(){return this.lightType===Cg.point},i.isSpot=function(){return this.lightType===Cg.spot},i.isAmbient=function(){return this.lightType===Cg.ambient},i.getWorldPosition=function(){return this.translation},i.getWorldDirection=function(){return this.matrix.transformNormal(this.direction,new Vg)},$g(e,[{key:"position",get:function(){return this.translation}}]),e}(av),vy=function(){function t(){this.lightList=[]}var e=t.prototype;return e.insertItem=function(t,e,i){var r=new gy(t,e,i);return this.lightList.push(r),r},e.insertLight=function(t){return this.lightList.push(t),t},e.remove=function(t){var e=this.lightList.findIndex(function(e){return e===t});-1!==e&&this.lightList.splice(e,1)},e.dispose=function(){this.lightList=[]},$g(t,[{key:"lightCount",get:function(){return this.lightList.length}}]),t}();var yy=function(t){function e(e,i,r,n,s,o){var a,h;(a=t.call(this)||this).engine=e,a.parentIndex=-1,a.subMeshes=[],a.hide=!0,a.priority=0,a.boundingBox=new Kg,a.visBoundingBox=!1,a.isBuilt=!1,a.isDisposed=!1;var l=new _y(r,n,o);a.name=i,a.type=Ig.mesh,a.visible=!1,a.owner=n,a.parentIndex=l.getParentIndex(),a.parentItem=l.parentItem,a.parentItemId=s,a.rootBoneItem=r.rootBone,a.skin=l.getSkinObj(e),a.morph=l.getMorphObj(),a.hide=l.isHide(),a.priority=(null==n||null==(h=n.item)?void 0:h.renderOrder)||0,a.subMeshes=[];var c,u=l.getGeometry();return(null!=(c=null==n?void 0:n.materials)?c:[]).forEach(function(t){var e=new xy(a.engine);e.create(u,t,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(a)),a.subMeshes.push(e)}),a.subMeshes.length<=0&&console.warn("No primitive inside mesh item "+i+"."),a.boundingBox=a.getItemBoundingBox(r.interaction),a}gg(e,t);var i=e.prototype;return i.build=function(t){this.isBuilt||(this.isBuilt=!0,this.subMeshes.forEach(function(e){e.build(t.maxLightCount,t.skybox)}),nv.getInstance().visBoundingBox&&(this.boundingBoxMesh=new uv(this.engine,this.priority)))},i.update=function(){void 0!==this.owner&&(this.transform.fromEffectsTransform(this.owner.transform),this.morph&&this.morph.hasMorph()&&this.owner.morphWeights.length>0&&this.morph.updateWeights(this.owner.morphWeights))},i.lateUpdate=function(){var t;null==(t=this.skin)||t.updateSkinMatrices()},i.render=function(t,e){var i=this;if(this.updateMaterial(t),this.subMeshes.forEach(function(t,r){e.drawGeometry(t.getEffectsGeometry(),i.matrix,t.getEffectsMaterial(),r)}),this.visBoundingBox&&void 0!==this.boundingBoxMesh){var r=this.boundingBoxMesh.mesh;e.drawGeometry(r.geometry,Hg.IDENTITY,r.material)}},i.dispose=function(){var e,i,r;this.isDisposed||(t.prototype.dispose.call(this),this.owner=void 0,this.isDisposed=!0,this.engine=null,this.parentItem=void 0,null==(e=this.skin)||e.dispose(),this.skin=void 0,null==(i=this.morph)||i.dispose(),this.morph=void 0,this.subMeshes.forEach(function(t){t.dispose()}),this.subMeshes=[],null==(r=this.boundingBoxMesh)||r.dispose(),this.boundingBoxMesh=void 0)},i.updateMorphWeights=function(t){if(void 0!==this.morph&&this.morph.hasMorph()){var e=this.morph.morphWeightsArray;if(void 0!==e){if(e.length!=t.length)throw new Error("Weight array length mismatch.");for(var i=0;i<e.length;i++)e[i]=t[i]}}},i.updateParentInfo=function(t,e){this.parentItemId=t,this.parentItem=e,void 0!==this.skin&&this.skin.updateParentItem(e)},i.updateMaterial=function(t){var e=this.matrix,i=e.clone().invert().transpose(),r=t.sceneStates;if(this.subMeshes.forEach(function(t){t.updateMaterial(e,i,r)}),void 0!==this.boundingBoxMesh){this.computeBoundingBox(e);var n=new Vg(1,1,1),s=this.boundingBox.min,o=this.boundingBox.max,a=new Float32Array([s.x,s.y,s.z,o.x,s.y,s.z,o.x,o.y,s.z,s.x,o.y,s.z,s.x,s.y,o.z,o.x,s.y,o.z,o.x,o.y,o.z,s.x,o.y,o.z]);this.boundingBoxMesh.update(e,r.viewProjectionMatrix,a,n)}},i.hitTesting=function(t,e){var i,r=this.matrix,n=r.clone().invert(),s=n.transformPoint(t,new Vg),o=n.transformNormal(e,new Vg),a=this.boundingBox,h=Dv(s,o,a.min,a.max);return void 0===h?[]:(nv.getInstance().isEditorEnv?this.subMeshes.forEach(function(t){var e=t.hitTesting(s,o,r,n);void 0!==e&&(void 0===i||i>e)&&(i=e)}):i=h,void 0===i?[]:(o.multiply(i),s.add(o),r.transformPoint(s),[s]))},i.computeBoundingBox=function(t){var e=this.boundingBox.makeEmpty(),i=t.clone().invert();return this.subMeshes.forEach(function(t){var r=t.computeBoundingBox(i);e.union(r)}),e},i.getItemBoundingBox=function(t){if(void 0===t)return new Kg;if(t.type===en.ModelBoundingType.box){var e,i,r=null!=(e=t.center)?e:[0,0,0],n=null!=(i=t.size)?i:[0,0,0],s=Vg.fromArray(r),o=Vg.fromArray(n).multiply(.5),a=s.clone().subtract(o),h=s.clone().add(o);return new Kg(a,h)}var l,c,u=null!=(l=t.center)?l:[0,0,0],d=.5*(null!=(c=t.radius)?c:0),f=Vg.fromArray(u),p=f.clone().subtract(d),m=f.clone().add(d);return new Kg(p,m)},i.getParentId=function(){return this.parentItemId},$g(e,[{key:"hasSkin",get:function(){return void 0!==this.skin}}]),e}(av),xy=function(){function t(t){this.engine=t,this.name="",this.effectsPriority=0,this.boundingBox=new Kg,this.isCompressed=!1}var e=t.prototype;return e.create=function(t,e,i){if(this.parent=i,this.skin=i.skin,this.morph=i.morph,this.setGeometry(t),this.setMaterial(e),this.name=i.name,this.effectsPriority=i.priority,this.geometry.setHide(i.hide),void 0!==this.skin){var r=this.skin.maxJointCount;if(this.jointMatrixList=new Float32Array(16*r),this.jointNormalMatList=new Float32Array(16*r),this.skin.isTextureDataMode()){var n=this.skin.textureDataMode===Uv.half_float;this.jointMatrixTexture=new iy(this.engine),this.jointNormalMatTexture=new iy(this.engine),this.jointMatrixTexture.create(r,n,"jointMatrixTexture"),this.jointNormalMatTexture.create(r,n,"jointNormalMatTexture")}}else(this.geometry.hasWeights()||this.geometry.hasJoints())&&console.warn("Geometry has weight and/or joint array, but the skin is missing.");this.isCompressed=this.geometry.isCompressed()},e.build=function(t,e){var i,r=nv.getInstance(),n=this.getMacroList(t,!0,e),s=this.material.getMacroList(n),o=nv.getInstance().isWebGL2;this.material.effectMaterial?(i=this.material.effectMaterial,s.forEach(function(t){var e=t.name,r=t.value;i.enableMacro(e,r)}),this.material.setMaterialStates(i)):(i=Lo.create(this.engine,{shader:{vertex:this.material.vertexShaderCode,fragment:this.material.fragmentShaderCode,shared:r.shaderShared,glslVersion:o?fl.GLSL3:fl.GLSL1}}),this.material.setMaterialStates(i))},e.getFeatureList=function(t,e,i){var r=[];if(this.geometry.hasNormals()&&r.push("HAS_NORMALS 1"),this.geometry.hasTangents()&&r.push("HAS_TANGENTS 1"),this.geometry.hasUVCoords(1)&&r.push("HAS_UV_SET1 1"),this.geometry.hasUVCoords(2)&&r.push("HAS_UV_SET2 1"),void 0!==this.morph&&this.morph.hasMorph()){r.push("USE_MORPHING"),r.push("WEIGHT_COUNT "+this.morph.morphWeightsLength);for(var n=0;n<this.morph.morphWeightsLength;n++)this.morph.hasPositionMorph&&r.push("HAS_TARGET_POSITION"+n),this.morph.hasNormalMorph&&r.push("HAS_TARGET_NORMAL"+n),this.morph.hasTangentMorph&&r.push("HAS_TARGET_TANGENT"+n)}void 0!==this.skin&&(r.push("USE_SKINNING 1"),r.push("JOINT_COUNT "+this.skin.getJointCount()),r.push("HAS_JOINT_SET1 1"),r.push("HAS_WEIGHT_SET1 1"),this.skin.textureDataMode&&r.push("USE_SKINNING_TEXTURE 1")),this.material.materialType!==Og.unlit&&(t>0&&this.geometry.hasNormals()&&(r.push("USE_PUNCTUAL 1"),r.push("LIGHT_COUNT "+t)),void 0!==i&&i.available&&(r.push("USE_IBL 1"),r.push("USE_TEX_LOD 1"),i.hasDiffuseImage||r.push("IRRADIANCE_COEFFICIENTS 1")));var s=nv.getInstance().renderMode3D,o=this.getRenderMode3DDefine(s);return void 0!==o&&(r.push("DEBUG_OUTPUT 1"),r.push(o+" 1")),r},e.getMacroList=function(t,e,i){var r=[];if(this.geometry.hasNormals()&&r.push({name:"HAS_NORMALS"}),this.geometry.hasTangents()&&r.push({name:"HAS_TANGENTS"}),this.geometry.hasUVCoords(1)&&r.push({name:"HAS_UV_SET1"}),this.geometry.hasUVCoords(2)&&r.push({name:"HAS_UV_SET2"}),void 0!==this.morph&&this.morph.hasMorph()){r.push({name:"USE_MORPHING"}),r.push({name:"WEIGHT_COUNT",value:this.morph.morphWeightsLength});for(var n=0;n<this.morph.morphWeightsLength;n++)this.morph.hasPositionMorph&&r.push({name:"HAS_TARGET_POSITION"+n}),this.morph.hasNormalMorph&&r.push({name:"HAS_TARGET_NORMAL"+n}),this.morph.hasTangentMorph&&r.push({name:"HAS_TARGET_TANGENT"+n})}void 0!==this.skin&&(r.push({name:"USE_SKINNING"}),r.push({name:"JOINT_COUNT",value:this.skin.maxJointCount}),r.push({name:"HAS_JOINT_SET1"}),r.push({name:"HAS_WEIGHT_SET1"}),this.skin.textureDataMode&&r.push({name:"USE_SKINNING_TEXTURE"})),this.material.materialType!==Og.unlit&&(t>0&&this.geometry.hasNormals()&&(r.push({name:"USE_PUNCTUAL"}),r.push({name:"LIGHT_COUNT",value:t})),void 0!==i&&i.available&&(r.push({name:"USE_IBL"}),r.push({name:"USE_TEX_LOD"}),i.hasDiffuseImage||r.push({name:"IRRADIANCE_COEFFICIENTS"})));var s=nv.getInstance().renderMode3D,o=this.getRenderMode3DDefine(s);return void 0!==o&&(r.push({name:"DEBUG_OUTPUT"}),r.push({name:o})),r},e.dispose=function(){var t,e;this.engine=null,this.parent=void 0,this.skin=void 0,this.morph=void 0,this.geometry.dispose(),this.material.dispose(),this.jointMatrixList=void 0,this.jointNormalMatList=void 0,null==(t=this.jointMatrixTexture)||t.dispose(),this.jointMatrixTexture=void 0,null==(e=this.jointNormalMatTexture)||e.dispose(),this.jointNormalMatTexture=void 0},e.updateMaterial=function(t,e,i){this.updateUniformsByAnimation(t,e),this.updateUniformsByScene(i),this.material.updateUniforms(this.getEffectsMaterial())},e.hitTesting=function(t,e,i,r){var n=this.boundingBox,s=Dv(t,e,n.min,n.max),o=[];if(void 0!==s){if(void 0!==this.skin)this.skin.animationMatrices.forEach(function(t){o.push((new Hg).multiplyMatrices(r,t))});var a=new Yv,h=this.material.isBothSide();return a.create(this.geometry.geometry,h,o),a.getHitPoint(t,e)}},e.computeBoundingBox=function(t){if(void 0===this.skin&&!this.boundingBox.isEmpty())return this.boundingBox;var e=[];void 0!==this.skin&&this.skin.animationMatrices.forEach(function(i){e.push((new Hg).multiplyMatrices(t,i))});var i=new Xv;return i.create(this.geometry.geometry,e),i.getBoundingBox(this.boundingBox)},e.getRenderMode3DDefine=function(t){switch(t){case en.RenderMode3D.uv:return"DEBUG_UV";case en.RenderMode3D.normal:return"DEBUG_NORMAL";case en.RenderMode3D.basecolor:return"DEBUG_BASECOLOR";case en.RenderMode3D.alpha:return"DEBUG_ALPHA";case en.RenderMode3D.metallic:return"DEBUG_METALLIC";case en.RenderMode3D.roughness:return"DEBUG_ROUGHNESS";case en.RenderMode3D.ao:return"DEBUG_OCCLUSION";case en.RenderMode3D.emissive:return"DEBUG_EMISSIVE";case en.RenderMode3D.diffuse:return"DEBUG_DIFFUSE"}},e.updateUniformsByAnimation=function(t,e){var i=this.getEffectsMaterial();i.setMatrix("_NormalMatrix",e);var r=this.skin;if(void 0!==r){var n=this.jointMatrixList,s=this.jointNormalMatList;if(r.computeMeshAnimMatrices(t,n,s),r.textureDataMode){var o=this.jointMatrixTexture,a=this.jointNormalMatTexture;o.update(n),a.update(s),i.setTexture("_jointMatrixSampler",o.getTexture()),i.setTexture("_jointNormalMatrixSampler",a.getTexture())}else{var h=[],l=[];n.forEach(function(t){return h.push(t)}),s.forEach(function(t){return l.push(t)}),i.setMatrixNumberArray("_jointMatrix",h),i.setMatrixNumberArray("_jointNormalMatrix",l)}}var c=this.morph;if(void 0!==c&&c.hasMorph()){var u=c.morphWeightsArray.slice();i.setFloats("_morphWeights",u)}},e.updateUniformsByScene=function(t){var e=this.getEffectsMaterial();if(e.setVector3("_Camera",t.cameraPosition),!this.isUnlitMaterial()){for(var i=t.maxLightCount,r=t.lightList,n=t.inverseViewMatrix,s=0;s<i;s++)if(s<r.length){var o=r[s],a=o.visible?o.intensity:0;if(o.followCamera){var h=n.transformNormal(o.getWorldDirection(),new Vg),l=n.transformPoint(o.getWorldPosition(),new Vg);e.setVector3("_Lights["+s+"].direction",h),e.setVector3("_Lights["+s+"].position",l)}else e.setVector3("_Lights["+s+"].direction",o.getWorldDirection()),e.setVector3("_Lights["+s+"].position",o.getWorldPosition());e.setFloat("_Lights["+s+"].range",o.range),e.setVector3("_Lights["+s+"].color",o.color),e.setFloat("_Lights["+s+"].intensity",a),e.setFloat("_Lights["+s+"].innerConeCos",Math.cos(o.innerConeAngle)),e.setFloat("_Lights["+s+"].outerConeCos",Math.cos(o.outerConeAngle)),e.setInt("_Lights["+s+"].type",o.lightType),e.setVector2("_Lights["+s+"].padding",o.padding)}else e.setVector3("_Lights["+s+"].direction",Vg.ZERO),e.setFloat("_Lights["+s+"].range",0),e.setVector3("_Lights["+s+"].color",Vg.ZERO),e.setFloat("_Lights["+s+"].intensity",0),e.setVector3("_Lights["+s+"].position",Vg.ZERO),e.setFloat("_Lights["+s+"].innerConeCos",0),e.setFloat("_Lights["+s+"].outerConeCos",0),e.setInt("_Lights["+s+"].type",99999),e.setVector2("_Lights["+s+"].padding",Ug.ZERO);var c=t.skybox;if(void 0!==c&&c.available){if(e.setVector2("_IblIntensity",new Ug(c.currentIntensity,c.currentReflectionsIntensity)),e.setTexture("_brdfLUT",c.brdfLUT),void 0!==c.diffuseImage)e.setTexture("_DiffuseEnvSampler",c.diffuseImage);else{var u=c.irradianceCoeffs;["l00","l1m1","l10","l11","l2m2","l2m1","l20","l21","l22"].forEach(function(t,i){e.setVector3("_shCoefficients."+t,Vg.fromArray(u[i]))})}e.setInt("_MipCount",c.specularMipCount-1),e.setTexture("_SpecularEnvSampler",c.specularImage)}}},e.hasSkin=function(){return void 0!==this.skin},e.getEffectsGeometry=function(){return this.geometry.geometry},e.setGeometry=function(t){vg(t,by)?this.geometry=t:this.geometry=new by(t)},e.setMaterial=function(t){vg(t,sy)||vg(t,oy)?this.material=t:this.material=function(t){if(t.shader.getInstanceId()===tv){var e=new oy;return e.create(t),e}var i=new sy;return i.create(t),i}(t)},e.getEffectsMaterial=function(){return this.material.effectMaterial},e.isUnlitMaterial=function(){return this.material.materialType===Og.unlit},e.hasMorph=function(){return void 0!==this.morph&&this.morph.hasMorph()},e.getWorldBoundingBox=function(){if(void 0===this.parent)return this.boundingBox.isEmpty()&&this.computeBoundingBox(Hg.fromIdentity()),this.boundingBox;var t=this.parent.matrix;return this.boundingBox.isEmpty()&&this.computeBoundingBox(t.clone().invert()),this.boundingBox.clone().applyMatrix4(t)},t}(),by=function(){function t(t){this.geometry=t,this.attributeNames=t.getAttributeNames()}var e=t.prototype;return e.dispose=function(){this.geometry=void 0,this.attributeNames=[]},e.hasAttribute=function(t){return-1!==this.attributeNames.findIndex(function(e){return e===t})},e.setHide=function(t){var e=this.geometry;if(0===e.getDrawCount()){var i=e.getIndexData();void 0!==i&&e.setDrawCount(i.length)}t?e.getDrawCount()>=0&&e.setDrawCount(-e.getDrawCount()):e.getDrawCount()<0&&e.setDrawCount(-e.getDrawCount())},e.isCompressed=function(){this.geometry.getAttributeData("aPos");return!1},e.hasPositions=function(){return this.hasAttribute("aPos")},e.hasNormals=function(){return this.hasAttribute("aNormal")},e.hasTangents=function(){return this.hasAttribute("aTangent")},e.hasUVCoords=function(t){return 1===t?this.hasAttribute("aUV"):this.hasAttribute("aUV"+t)},e.hasColors=function(){return this.hasAttribute("aColor")},e.hasJoints=function(){return this.hasAttribute("aJoints")},e.hasWeights=function(){return this.hasAttribute("aWeights")},t}(),_y=function(){function t(t,e,i){this.itemData=t,this.parentComponent=e,this.parentItem=i,this.data=t,this.geometry=t.geometry,this.rootBoneItem=t.rootBone;var r=new ey;if(r.create(this.geometry)){var n,s;if(null==(n=t.morph)?void 0:n.weights)r.initWeights(null==(s=t.morph)?void 0:s.weights);this.morphObj=r}}var e=t.prototype;return e.hasMorphTarget=function(){return this.morphObj.hasMorph()},e.getMorphObj=function(){if(this.hasMorphTarget())return this.morphObj},e.isHide=function(){return!0===this.data.hide},e.getParentIndex=function(){return-1},e.getGeometry=function(){return this.data.geometry},e.getMaterials=function(){return this.data.materials},e.getMaterialCount=function(){return this.data.materials.length},e.hasSkin=function(){var t=this.geometry.getSkinProps();return!!(t.rootBoneName&&t.boneNames&&t.inverseBindMatrices&&this.rootBoneItem)},e.getSkinOpts=function(){return this.geometry.getSkinProps()},e.getSkinObj=function(t){var e=this.getSkinOpts();if(e.rootBoneName&&e.boneNames&&e.inverseBindMatrices&&this.rootBoneItem){var i,r,n=new ty,s=null!=(r=null==(i=this.parentComponent.sceneManager)?void 0:i.maxJointCount)?r:0;return n.create(e,t,this.rootBoneItem,s),n}},t}(),wy=function(){function t(t){this.maxLightCount=16,this.maxJointCount=0,this.renderSkybox=!1,this.compName="SceneManger",this.itemList=[],this.meshList=[],this.engine=t,this.lightManager=new vy,this.cameraManager=new my,this.parentId2Mesh=new Map,this.enableDynamicSort=!1,this.tickCount=0,this.lastTickSecond=-1,this.sceneAABBCache=new Kg,this.renderedMeshSet=new Sv}var e=t.prototype;return e.initial=function(t){this.clean(),this.compName=t.componentName,this.renderer=t.renderer,this.engine=t.renderer.engine,this.sceneCache=t.sceneCache,this.enableDynamicSort=!0===t.enableDynamicSort,this.renderSkybox=t.renderSkybox,this.maxLightCount=t.lightItemCount,this.maxJointCount=t.maxJointCount,this.cameraManager.initial(this.renderer.getWidth(),this.renderer.getHeight()),this.brdfLUT=this.sceneCache.getBrdfLutTexture(),this.initGlobalState(t),this.maxLightCount>8&&console.warn("Too many light items: "+this.maxLightCount+" light(s).")},e.initGlobalState=function(t){var e,i,r,n,s,o=this.engine.gpuCapability,a=nv.getInstance();a.reset(),a.isWebGL2=2===o.level,a.runtimeEnv=null!=(e=t.runtimeEnv)?e:Xo,a.compatibleMode=null!=(i=t.compatibleMode)?i:"gltf",a.visBoundingBox=null!=(r=t.visBoundingBox)&&r,a.renderMode3D=null!=(n=t.renderMode3D)?n:en.RenderMode3D.none,a.renderMode3DUVGridSize=null!=(s=t.renderMode3DUVGridSize)?s:1/16},e.clean=function(){this.dispose(),this.compName="",this.renderer=void 0,this.sceneCache=void 0,this.itemList=[],this.meshList=[],this.lightManager=new vy,this.cameraManager=new my,this.parentId2Mesh=new Map,this.brdfLUT=void 0,this.skybox=void 0,this.lastTickSecond=-1,this.tickCount=0,this.renderedMeshSet=new Sv},e.dispose=function(){var t;this.itemList.forEach(function(t){return t.dispose()}),this.itemList=[],this.meshList.forEach(function(t){return t.dispose()}),this.meshList=[],this.lightManager.dispose(),this.cameraManager.dispose(),this.brdfLUT=void 0,null==(t=this.skybox)||t.dispose(),this.skybox=void 0,this.renderedMeshSet.clear(),this.renderer=void 0,this.sceneCache=void 0,this.engine=void 0,this.parentId2Mesh.clear()},e.addItem=function(t){if(vg(t,yy)){var e=t;void 0!==e.parentItemId&&this.parentId2Mesh.set(e.parentItemId,e),le(this.meshList,e)}else if(vg(t,ly)){var i=t;i.setup(this.brdfLUT),this.renderSkybox||(i.renderable=!1),this.skybox=i}else vg(t,gy)?this.lightManager.insertLight(t):this.cameraManager.insertCamera(t);le(this.itemList,t)},e.removeItem=function(t){if(vg(t,yy)){var e=t;void 0!==e.parentItemId&&this.parentId2Mesh.delete(e.parentItemId),ce(this.meshList,e)}else vg(t,ly)?this.skybox=void 0:vg(t,gy)?this.lightManager.remove(t):this.cameraManager.remove(t);ce(this.itemList,t)},e.updateDefaultCamera=function(t,e){var i=new ua(Qg({},t,{valid:!0})),r=(new iv).fromEffectsTransform(i);this.cameraManager.updateDefaultCamera(t.fov,e,t.aspect,t.near,t.far,r.getPosition(),r.getRotation(),t.clipMode)},e.tick=function(t){var e=t,i=this.activeCamera,r=i.viewMatrix,n=i.projectionMatrix,s=n.clone().multiply(r);this.sceneStates={deltaSeconds:e,camera:i,cameraPosition:i.getEye(),viewMatrix:r,inverseViewMatrix:r.clone().invert(),projectionMatrix:n,viewProjectionMatrix:s,winSize:i.getSize(),sceneRadius:1,lightList:this.lightManager.lightList,maxLightCount:this.maxLightCount,maxJointCount:this.maxJointCount,skybox:this.skybox},this.enableDynamicSort&&this.dynamicSortMeshes(this.sceneStates),this.tickCount+=1,this.lastTickSecond+=e},e.dynamicSortMeshes=function(t){var e=[],i=[];this.meshList.forEach(function(t){if(t.owner&&t.owner.enabled){var r=t.owner;e.push(r),i.push(r.priority)}}),i.sort(function(t,e){return t-e});var r=t.viewMatrix;e.sort(function(t,e){var i=zv.isTransparentMesh(t),n=zv.isTransparentMesh(e);if(i&&n){var s=t.transform.getWorldPosition(),o=e.transform.getWorldPosition(),a=r.transformPoint(s),h=r.transformPoint(o);return a.z===h.z?t.priority-e.priority:a.z-h.z}return i?1:n?-1:t.priority-e.priority});for(var n=-99999,s=0;s<e.length;s++){var o=e[s],a=i[s];n<a?(n=a,o.priority=a):(n+=.1,o.priority=n)}},e.queryMesh=function(t){var e=this.parentId2Mesh.get(t);if(void 0!==e&&e.visible)return e},e.getSceneAABB=function(t){var e=null!=t?t:new Kg;return this.itemList.forEach(function(t){if(t.type===Ig.mesh){var i=t;if(i.owner){var r=i.owner.item.getWorldTransform().getWorldMatrix(),n=i.computeBoundingBox(r);n.applyMatrix4(r),e.union(n)}else e.union(i.computeBoundingBox(Hg.fromIdentity()))}}),e},e.printDebugInfo=function(){console.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"),console.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"),this.meshList.forEach(function(t,e){console.info("Mesh: ",e,t)}),this.cameraManager.getCameraList().forEach(function(t,e){console.info("Camera: ",e,t)}),console.info("Default Camera: ",this.cameraManager.getDefaultCamera()),this.lightManager.lightList.forEach(function(t,e){console.info("Light: ",e,t)}),console.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"),console.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")},e.getRenderer=function(){return this.renderer},e.getSceneCache=function(){return this.sceneCache},$g(t,[{key:"activeCamera",get:function(){return this.cameraManager.getActiveCamera()}},{key:"lightCount",get:function(){return this.lightManager.lightCount}},{key:"shaderLightCount",get:function(){return Math.min(10,this.lightManager.lightCount)}}]),t}(),Ty=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="model",e}gg(e,t);var i=e.prototype;return i.onAssetsLoadStart=function(t,e){return pg(function(){return Tg(this,function(t){switch(t.label){case 0:return[4,dy.loadStaticResources()];case 1:return t.sent(),[2]}})})()},i.onAssetsLoadFinish=function(t,e,i){var r,n;if(void 0!==e.pluginData){var s=e.pluginData;["compatibleMode","renderSkybox","visBoundingBox","autoAdjustScene","enableDynamicSort","renderMode3D","renderMode3DUVGridSize"].forEach(function(e){return t.storage[e]=s[e]})}var o,a=null!=(n=e.env)?n:"";t.storage.runtimeEnv=a;var h=null!=(o=null==(r=e.pluginData)?void 0:r.compatibleMode)?o:"gltf";jv.preprocessScene(t,a,h);var l=2===i.gpuCapability.level,c={vertexShaderCode:vv.genVertexShaderCode(Og.pbr),fragmentShaderCode:vv.genFragmentShaderCode(Og.pbr)},u={vertexShaderCode:vv.genVertexShaderCode(Og.unlit),fragmentShaderCode:vv.genFragmentShaderCode(Og.unlit)},d={id:tv,name:"PBR Shader",dataType:en.DataType.Shader,fragment:c.fragmentShaderCode,vertex:c.vertexShaderCode,glslVersion:l?fl.GLSL3:fl.GLSL1},f={id:ev,name:"Unlit Shader",dataType:en.DataType.Shader,fragment:u.fragmentShaderCode,vertex:u.vertexShaderCode,glslVersion:l?fl.GLSL3:fl.GLSL1};i.addEffectsObjectData(d),i.addEffectsObjectData(f)},i.onCompositionCreated=function(t,e){var i={id:"ModelPluginItem",name:"ModelPluginItem",duration:9999999,endBehavior:en.END_BEHAVIOR_FORWARD},r=new da(t.engine,i);t.addItem(r),r.addComponent(Ey).sceneParams=e.storage},e}(_g(Bi)),Ey=function(t){function e(e){var i;return(i=t.call(this,e)||this).runtimeEnv=Xo,i.compatibleMode="gltf",i.renderSkybox=!0,i.visBoundingBox=!1,i.autoAdjustScene=!1,i.enableDynamicSort=!1,i.renderMode3D=en.RenderMode3D.none,i.renderMode3DUVGridSize=1/16,i}gg(e,t);var i=e.prototype;return i.onAwake=function(){this.cache=new dy(this.engine),this.cache.setup(!1),this.scene=new wy(this.engine),this.initial(this.sceneParams)},i.onLateUpdate=function(t){var e=this.item.composition;if(this.autoAdjustScene&&1==this.scene.tickCount){var i,r,n,s=e.camera,o=(new iv).fromMatrix4(s.getViewMatrix()),a=(new rv).fromPTransform(o).zAxis.clone(),h=null!=(r=s.fov)?r:45,l=null!=(n=s.aspect)?n:1,c=this.scene.getSceneAABB(),u=c.clone().applyMatrix4(o.getMatrix()).getSize(new Vg).multiply(.5),d=u.x,f=u.y,p=f*Math.max(d/f/l,1),m=c.getCenter(new Vg),g=p/Math.tan(.5*h*Zg),v=m.clone().add(a.clone().multiply(g+u.z));e.camera.position=v,null==(i=e.items)||i.forEach(function(t){if(t.type===dg){var e=t.getComponent(Pv);if(null==e?void 0:e.content){var i,r=((null==(i=t.transform.parentTransform)?void 0:i.getWorldMatrix())||Hg.IDENTITY.clone()).invert().transformPoint(v);e.setTransform(r),console.info("Scene AABB ["+c.min.toArray()+"], ["+c.max.toArray()+"]."),console.info("Update camera position ["+r.toArray()+"].")}}})}this.updateSceneCamera(e),this.scene.tick(t)},i.onDestroy=function(){this.scene.dispose(),this.scene=null,this.cache.dispose(),this.cache=null},i.initial=function(t){var e,i,r,n,s,o,a,h,l;this.runtimeEnv=null!=(i=t.runtimeEnv)?i:this.runtimeEnv,this.compatibleMode=null!=(r=t.compatibleMode)?r:this.compatibleMode,this.renderSkybox=null!=(n=t.renderSkybox)?n:this.renderSkybox,this.visBoundingBox=null!=(s=t.visBoundingBox)?s:this.visBoundingBox,this.autoAdjustScene=null!=(o=t.autoAdjustScene)?o:this.autoAdjustScene,this.enableDynamicSort=null!=(a=t.enableDynamicSort)?a:this.enableDynamicSort,this.renderMode3D=null!=(h=t.renderMode3D)?h:this.renderMode3D,this.renderMode3DUVGridSize=null!=(l=t.renderMode3DUVGridSize)?l:this.renderMode3DUVGridSize;var c,u=this.item.composition;this.scene.initial({componentName:""+u.id,renderer:this.engine.renderer,sceneCache:this.cache,runtimeEnv:this.runtimeEnv,compatibleMode:this.compatibleMode,visBoundingBox:this.visBoundingBox,enableDynamicSort:this.enableDynamicSort,renderMode3D:this.renderMode3D,renderMode3DUVGridSize:this.renderMode3DUVGridSize,renderSkybox:this.renderSkybox,lightItemCount:this.getLightItemCount(),maxJointCount:this.getMaxJointCount(null!=(c=null==(e=this.item.composition)?void 0:e.items)?c:[])}),this.updateSceneCamera(u)},i.updateSceneCamera=function(t){this.scene.updateDefaultCamera(t.camera.getOptions(),t.camera.getViewportMatrix())},i.getLightItemCount=function(){var t,e,i=0;return(null!=(e=null==(t=this.item.composition)?void 0:t.items)?e:[]).forEach(function(t){t.getComponent(Cv)&&i++}),i},i.getMaxJointCount=function(t){var e=this,i=0;return t.forEach(function(t){var r=t.getComponent(Iv);if(r&&r.data){var n=r.data.geometry;if(vg(n,wl)){var s=n.getSkinProps();s.boneNames&&(i=Math.max(s.boneNames.length,i))}}0!==t.children.length&&(i=Math.max(e.getMaxJointCount(t.children),i))}),i},e}(Us);function Sy(t){var e,i=null==t||null==(e=t.item)?void 0:e.composition,r=null==i?void 0:i.getItemByName("ModelPluginItem"),n=null==r?void 0:r.getComponent(Ey);return null==n?void 0:n.scene}Ey=wg([ln(en.DataType.ModelPluginComponent)],Ey);var Iy,Ay,Cy=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}return gg(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e},e}(Us);Cy=wg([ln(en.DataType.TreeComponent)],Cy),(Ay=Iy||(Iy={}))[Ay.none=0]="none",Ay[Ay.translate=1]="translate",Ay[Ay.rotate_focus=2]="rotate_focus",Ay[Ay.rotate_self=3]="rotate_self",Ay[Ay.scale=4]="scale",oi("model",Ty);var Py="2.9.0-alpha.1";function My(t,e,i,r,n,s,o){try{var a=t[s](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,n)}function Ry(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var s=t.apply(e,i);function o(t){My(s,r,n,o,a,"next",t)}function a(t){My(s,r,n,o,a,"throw",t)}o(void 0)})}}function Oy(t,e){return(Oy=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Dy(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Oy(t,e)}function ky(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ky=function(){return!!t})()}function Ly(t,e,i){return(Ly=ky()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Oy(n,i.prototype),n}).apply(null,arguments)}function Fy(t){return(Fy=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ny(t){var e="function"==typeof Map?new Map:void 0;return Ny=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return Ly(t,arguments,Fy(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Oy(r,t)},Ny(t)}function By(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):By(t,e)}function zy(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}function Uy(t,e){var i,r,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(h){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,h])}}}function Vy(t,e,i){return Gy.apply(this,arguments)}function Gy(){return Gy=Ry(function(t,e,i){var r,n;return Uy(this,function(s){return r=i.renderLevel,n=t.map(function(n){if(op(n.renderLevel,r)){if(e===en.MultimediaType.video){var s=function(t,e){if(!e.useHevcVideo)return t.url;var i=t.hevc;if(!(null==i?void 0:i.url)||!(null==i?void 0:i.codec))return t.url;var r=function(t){if(function(t){return Object.keys(en.HevcVideoCodec).some(function(e){return en.HevcVideoCodec[e]===t})}(t))return t;if(function(t){return t in en.HevcVideoCodec}(t))return en.HevcVideoCodec[t];return}(i.codec);return r&&function(t){var e=document.createElement("video"),i='video/mp4; codecs="'+t+'"',r=e.canPlayType(i);return"probably"===r||"maybe"===r}(r)?i.url:t.url}(n,i);return po(new URL(s,location.href).href)}if(e===en.MultimediaType.audio)return function(t){return jy.apply(this,arguments)}(new URL(n.url,location.href).href)}throw new Error("Invalid "+e+" source: "+JSON.stringify(t)+".")}),[2,Promise.all(n)]})}),Gy.apply(this,arguments)}function jy(){return(jy=Ry(function(t){var e,i;return Uy(this,function(r){switch(r.label){case 0:if(!!!window.AudioContext)return[3,5];r.label=1;case 1:return r.trys.push([1,4,,5]),e=new AudioContext,[4,uo(t)];case 2:return i=r.sent(),[4,e.decodeAudioData(i)];case 3:return[2,r.sent()];case 4:throw r.sent(),new Error("Failed to load audio from "+t+".");case 5:return[2,new Promise(function(e,i){var r=new Audio;"string"==typeof t?r.src=t:r.srcObject=t,r.muted=!1,r.addEventListener("canplaythrough",function(){e(r)}),r.addEventListener("error",function(){i(new Error("Failed to load audio from "+r.src+"."))}),r.load()})]}})})).apply(this,arguments)}He.info("Plugin model version: "+Py+".");Ny(Error);var Hy=function(t){function e(){return t.apply(this,arguments)}return Dy(e,t),e.prototype.onAssetsLoadStart=function(t,e){return void 0===e&&(e={}),Ry(function(){var i,r,n,s,o,a;return Uy(this,function(h){switch(h.label){case 0:return i=t.jsonScene,r=i.videos,[4,Vy(n=void 0===r?[]:r,en.MultimediaType.video,e)];case 1:for(s=h.sent(),o=0;o<n.length;o++)a=n[o],t.assets[a.id]=s[o];return[2]}})})()},e}(Ny(Bi)),Wy=function(t){function e(){return t.apply(this,arguments)}return Dy(e,t),e.prototype.onAssetsLoadStart=function(t,e){return void 0===e&&(e={}),Ry(function(){var i,r,n,s,o,a;return Uy(this,function(h){switch(h.label){case 0:return i=t.jsonScene,r=i.audios,[4,Vy(n=void 0===r?[]:r,en.MultimediaType.audio,e)];case 1:for(s=h.sent(),o=0;o<n.length;o++)a=n[o],t.assets[a.id]=s[o];return[2]}})})()},e}(Ny(Bi)),Xy=0,Yy=function(t){function e(e){var i;return(i=t.call(this,e)||this).played=!1,i.pendingPause=!1,i.threshold=.03,i.isPlayLoading=!1,i.isVideoActive=!1,i.transparent=!1,i.name="MVideo"+Xy++,i}Dy(e,t);var i=e.prototype;return i.setTexture=function(t){var e=this;return Ry(function(){var i,r,n;return Uy(this,function(s){switch(s.label){case 0:return i=e.renderer.texture,r=e.item.composition,"string"!=typeof t?[3,2]:[4,To.fromVideo(t,e.item.engine)];case 1:return n=s.sent(),[3,3];case 2:n=t,s.label=3;case 3:return r?(r.textures.forEach(function(t,e){t===i&&(r.textures[e]=n)}),e.engine.removeTexture(i),e.renderer.texture=n,e.material.setTexture("_MainTex",n),e.video=n.source.video,[2]):[2]}})})()},i.onAwake=function(){var e=this;t.prototype.onAwake.call(this);var i=this.item.composition;i&&(this.handleGoto=function(t){e.setCurrentTime(e.item.time)},this.handlePause=function(){e.pauseVideo()},this.handlePlay=function(t){e.item.time<0||e.playVideo()},i.on("goto",this.handleGoto),i.on("pause",this.handlePause),i.on("play",this.handlePlay))},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options,n=r.video,s=r.startColor,o=void 0===s?[1,1,1,1]:s,a=r.playbackRate,h=void 0===a?1:a,l=r.volume,c=void 0===l?1:l,u=r.muted,d=void 0!==u&&u,f=r.transparent,p=void 0!==f&&f;if(this.transparent=p,n){var m=this.engine.findObject(n);if(m){this.video=m.data,this.setPlaybackRate(h),this.setVolume(c),this.setMuted(d);var g=this.item.defination.endBehavior;g===en.EndBehavior.destroy||g===en.EndBehavior.freeze?this.setLoop(!1):g===en.EndBehavior.restart&&this.setLoop(!0)}}this.interaction=i,this.pauseVideo(),this.transparent&&this.material.enableMacro("TRANSPARENT_VIDEO",this.transparent),this.material.setColor("_Color",(new oa.Color).setFromArray(o))},i.render=function(e){t.prototype.render.call(this,e),this.renderer.texture.uploadCurrentVideoFrame()},i.onUpdate=function(e){t.prototype.onUpdate.call(this,e);var i=this.item,r=i.time,n=i.duration,s=i.endBehavior,o=i.composition;Be(o);var a,h,l=o.rootItem,c=l.endBehavior,u=l.duration,d=0===r||Math.abs(o.time-u)<=this.threshold||Math.abs(r-n)<=this.threshold;(r>=0&&!d&&!this.played&&this.isVideoActive&&this.playVideo(),r+this.threshold>=n)&&(s===en.EndBehavior.freeze&&((null==(a=this.video)?void 0:a.paused)||this.pauseVideo()));o.time+this.threshold>=u&&(c===en.EndBehavior.freeze?(null==(h=this.video)?void 0:h.paused)||this.pauseVideo():c===en.EndBehavior.restart&&this.setCurrentTime(0))},i.getDuration=function(){return this.video?this.video.duration:0},i.getCurrentTime=function(){return this.video?this.video.currentTime:0},i.setCurrentTime=function(t){this.video&&(this.video.currentTime=t)},i.setLoop=function(t){this.video&&(this.video.loop=t)},i.setMuted=function(t){this.video&&this.video.muted!==t&&(this.video.muted=t)},i.setVolume=function(t){this.video&&this.video.volume!==t&&(this.video.volume=t)},i.setTransparent=function(t){this.transparent!==t&&(t?this.material.enableMacro("TRANSPARENT_VIDEO",!0):this.material.disableMacro("TRANSPARENT_VIDEO"),this.transparent=t)},i.setPlaybackRate=function(t){this.video&&this.video.playbackRate!==t&&(this.video.playbackRate=t)},i.playVideo=function(){var t=this;this.played||this.video&&(this.played=!0,this.isPlayLoading=!0,this.pendingPause=!1,this.video.play().then(function(){var e;(t.isPlayLoading=!1,!t.played||t.pendingPause)&&(t.pendingPause=!1,t.played=!1,null==(e=t.video)||e.pause())}).catch(function(e){t.isPlayLoading=!1,t.played=!1,t.pendingPause=!1,"AbortError"!==e.name&&t.engine.renderErrors.add(e)}))},i.pauseVideo=function(){this.played&&(this.played=!1),this.video&&(this.isPlayLoading?this.pendingPause=!0:this.video.pause())},i.onDestroy=function(){var e;t.prototype.onDestroy.call(this),this.played=!1,this.isPlayLoading=!1,this.pendingPause=!1,this.isVideoActive=!1,this.video&&(this.video.pause(),this.video.removeAttribute("src"),this.video.load(),this.video=void 0);var i=null==(e=this.item)?void 0:e.composition;i&&(this.handleGoto&&i.off("goto",this.handleGoto),this.handlePause&&i.off("pause",this.handlePause),this.handlePlay&&i.off("play",this.handlePlay)),this.handleGoto=void 0,this.handlePause=void 0,this.handlePlay=void 0},i.onDisable=function(){t.prototype.onDisable.call(this),this.isVideoActive=!1,this.pauseVideo()},i.onEnable=function(){t.prototype.onEnable.call(this),this.isVideoActive=!0,this.played=!1,this.video&&this.item.composition&&this.setCurrentTime(Math.max(0,this.item.time)),this.playVideo()},e}(Hl);Yy=zy([ln(en.DataType.VideoComponent)],Yy);var qy=function(){function t(t,e){this.engine=t,this.audioSourceInfo={},this.pendingOffset=0,this.isSupportAudioContext=!!window.AudioContext,this.options={endBehavior:en.EndBehavior.destroy,duration:0},this.destroyed=!1,this.started=!1,this.initialized=!1,this.currentVolume=1,e&&this.setAudioSource(e)}var e=t.prototype;return e.setAudioSource=function(t){if((this.audio||this.audioSourceInfo.source)&&this.dispose(),By(t,AudioBuffer)){var e=new AudioContext,i=e.createGain();i.connect(e.destination);var r=e.createBufferSource();r.buffer=t,r.connect(i),this.audioSourceInfo={source:r,audioContext:e,gainNode:i}}else this.audio=t;this.started&&this.play()},e.getCurrentTime=function(){if(this.isSupportAudioContext){var t=this.audioSourceInfo.audioContext;return(null==t?void 0:t.currentTime)||0}var e;return(null==(e=this.audio)?void 0:e.currentTime)||0},e.setCurrentTime=function(t){var e=Math.max(0,t);if(this.isSupportAudioContext){var i=this.options.duration&&this.options.duration>0?this.options.duration:void 0;this.pendingOffset=i?Math.min(e,i):e}else if(this.audio){var r=Number.isFinite(this.audio.duration)?this.audio.duration:void 0,n=r?Math.min(e,r):e;this.audio.currentTime=n}},e.play=function(){var t=this;if(this.isSupportAudioContext){var e=this.audioSourceInfo,i=e.audioContext,r=e.source,n=e.gainNode;if(!i||!n)return;var s=null==r?void 0:r.buffer;if(!s)return;var o=this.options.duration&&this.options.duration>0?this.options.duration:s.duration;try{null==r||r.stop()}catch(t){}var a,h,l,c,u=i.createBufferSource();if(u.buffer=s,u.connect(n),u.playbackRate.value=null!=(a=null==r?void 0:r.playbackRate.value)?a:1,this.options.endBehavior===en.EndBehavior.restart)u.loop=!0,u.loopStart=0,u.loopEnd=o;else u.loop=null!=(h=null==r?void 0:r.loop)&&h,u.loopStart=null!=(l=null==r?void 0:r.loopStart)?l:0,u.loopEnd=null!=(c=null==r?void 0:r.loopEnd)?c:o;this.audioSourceInfo.source=u,"suspended"===i.state&&i.resume().catch(function(e){return t.engine.renderErrors.add(e)});try{u.start(0,this.pendingOffset||0),this.pendingOffset=0,this.started=!0}catch(t){this.engine.renderErrors.add(t)}}else this.audio&&(this.audio.loop=this.options.endBehavior===en.EndBehavior.restart,this.audio.play().catch(function(e){return t.engine.renderErrors.add(e)}),this.started=!0)},e.pause=function(){if(this.isSupportAudioContext){var t=this.audioSourceInfo,e=t.source,i=t.audioContext;if(!i)return;i.currentTime>0&&this.started&&(null==e||e.stop())}else{var r;null==(r=this.audio)||r.pause()}},e.setVolume=function(t){if(this.isSupportAudioContext){var e=this.audioSourceInfo.gainNode;e&&(e.gain.value=t,this.currentVolume=t)}else this.audio&&(this.audio.volume=t,this.currentVolume=t)},e.setPlaybackRate=function(t){if(this.isSupportAudioContext){var e=this.audioSourceInfo.source;e&&(e.playbackRate.value=t)}else this.audio&&(this.audio.playbackRate=t)},e.setLoop=function(t){if(this.isSupportAudioContext){var e=this.audioSourceInfo.source;e?e.loop=t:this.engine.renderErrors.add(new Error("Audio source is not found."))}else this.audio&&(this.audio.loop=t)},e.setOptions=function(t){this.initialized||(this.options=t,this.initialized=!0)},e.setMuted=function(t){if(this.isSupportAudioContext){var e=this.audioSourceInfo.gainNode,i=t?0:this.currentVolume;e&&(e.gain.value=i)}else this.audio&&(this.audio.muted=t)},e.dispose=function(){var t=this;if(!this.destroyed){if(this.isSupportAudioContext){var e=this.audioSourceInfo,i=e.audioContext,r=e.source;this.started&&(null==r||r.stop()),null==i||i.close().catch(function(e){t.engine.renderErrors.add(e)})}else{var n;null==(n=this.audio)||n.pause()}this.destroyed=!0}},t}(),Ky=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isPlaying=!1,e}Dy(e,t);var i=e.prototype;return i.onAwake=function(){var e,i,r,n=this;t.prototype.onAwake.call(this),null==(e=this.item.composition)||e.on("play",function(t){n.audioPlayer.setMuted(!1),n.item.time<=0||(n.audioPlayer.setCurrentTime(n.item.time),n.audioPlayer.play(),n.isPlaying=!0)}),null==(i=this.item.composition)||i.on("pause",function(){n.audioPlayer.setMuted(!0),n.audioPlayer.pause(),n.isPlaying=!1}),null==(r=this.item.composition)||r.on("goto",function(t){n.audioPlayer.setMuted(!0),n.audioPlayer.setCurrentTime(n.item.time)})},i.onUpdate=function(e){t.prototype.onUpdate.call(this,e);var i=this.item,r=i.time,n=i.duration,s=i.endBehavior;r>0&&0==this.isPlaying&&(this.audioPlayer.play(),this.isPlaying=!0),this.audioPlayer.setOptions({duration:n,endBehavior:s})},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options,r=i.playbackRate,n=void 0===r?1:r,s=i.muted,o=void 0!==s&&s,a=i.volume,h=void 0===a?1:a,l=void 0;i.audio&&(l=this.engine.findObject(i.audio).data);this.audioPlayer=new qy(this.engine,l),this.audioPlayer.pause(),this.setPlaybackRate(n),this.setMuted(o),this.setVolume(h)},i.setAudioSource=function(t){this.audioPlayer.setAudioSource(t)},i.setVolume=function(t){this.audioPlayer.setVolume(t)},i.getCurrentTime=function(){return this.audioPlayer.getCurrentTime()},i.setMuted=function(t){this.audioPlayer.setMuted(t)},i.setLoop=function(t){this.audioPlayer.setLoop(t)},i.setPlaybackRate=function(t){this.audioPlayer.setPlaybackRate(t)},i.onDisable=function(){t.prototype.onDisable.call(this),this.audioPlayer.pause()},i.dispose=function(){t.prototype.dispose.call(this),this.audioPlayer.dispose()},e}(Ho);Ky=zy([ln(en.DataType.AudioComponent)],Ky);var Zy="2.9.0-alpha.1";function Jy(t,e){return(Jy=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jy(t,e)}function Qy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qy=function(){return!!t})()}function tx(t,e,i){return(tx=Qy()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Jy(n,i.prototype),n}).apply(null,arguments)}function ex(t){return(ex=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ix(t){var e="function"==typeof Map?new Map:void 0;return ix=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return tx(t,arguments,ex(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Jy(r,t)},ix(t)}function rx(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function nx(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return rx(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?rx(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function sx(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):sx(t,e)}function ox(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}oi("video",Hy),oi("audio",Wy),He.info("Plugin multimedia version: "+Zy+".");var ax=function(){function t(){this.entries={},this.size=0}var e=t.prototype;return e.add=function(t){var e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)},e.addAll=function(t){for(var e=this.size,i=0,r=t.length;i<r;i++)this.add(t[i]);return e!=this.size},e.contains=function(t){return this.entries[t]},e.clear=function(){this.entries={},this.size=0},t}(),hx=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this.clamp()},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.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?1:parseInt(t.substr(6,2),16)/255,this},e.add=function(t,e,i,r){return this.r+=t,this.g+=e,this.b+=i,this.a+=r,this.clamp()},e.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},e.toRgb888=function(){var t=function(t){return("0"+(255*t).toString(16)).slice(-2)};return Number("0x"+t(this.r)+t(this.g)+t(this.b))},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t.fromString=function(e){return(new t).setFromString(e)},t}();hx.WHITE=new hx(1,1,1,1),hx.RED=new hx(1,0,0,1),hx.GREEN=new hx(0,1,0,1),hx.BLUE=new hx(0,0,1,1),hx.MAGENTA=new hx(1,0,1,1);var lx=function(){function t(){}return t.clamp=function(t,e,i){return t<e?e:t>i?i:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.atan2Deg=function(e,i){return Math.atan2(e,i)*t.degRad},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var r=Math.random(),n=e-t;return r<=(i-t)/n?t+Math.sqrt(r*n*(i-t)):e-Math.sqrt((1-r)*n*(e-i))},t.isPowerOfTwo=function(t){return t&&!(t&t-1)},t}();lx.PI=3.1415927,lx.PI2=2*lx.PI,lx.invPI2=1/lx.PI2,lx.radiansToDegrees=180/lx.PI,lx.radDeg=lx.radiansToDegrees,lx.degreesToRadians=lx.PI/180,lx.degRad=lx.degreesToRadians;var cx=function(){function t(){}return t.arrayCopy=function(t,e,i,r,n){for(var s=e,o=r;s<e+n;s++,o++)i[o]=t[s]},t.arrayFill=function(t,e,i,r){for(var n=e;n<i;n++)t[n]=r},t.setArraySize=function(t,e,i){void 0===i&&(i=0);var r=t.length;if(r==e)return t;if(t.length=e,r<e)for(var n=r;n<e;n++)t[n]=i;return t},t.ensureArrayCapacity=function(e,i,r){return void 0===r&&(r=0),e.length>=i?e:t.setArraySize(e,i,r)},t.newArray=function(t,e){for(var i=new Array(t),r=0;r<t;r++)i[r]=e;return i},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var i=new Array(e),r=0;r<i.length;r++)i[r]=0;return i},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var i=new Array(e),r=0;r<i.length;r++)i[r]=0;return i},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,i){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},t.enumValue=function(t,e){return t[e[0].toUpperCase()+e.slice(1)]},t}();cx.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var ux=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),dx=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),fx=function(t){if(!t)throw new Error("name cannot be null.");this.name=t},px=function(t){function e(i){var r;return(r=t.call(this,i)||this).id=e.nextID++,r.bones=null,r.vertices=[],r.worldVerticesLength=0,r.timelineAttachment=ox(r),r}$y(e,t);var i=e.prototype;return i.computeWorldVertices=function(t,e,i,r,n,s){i=n+(i>>1)*s;var o=t.bone.skeleton,a=t.deform,h=this.vertices,l=this.bones;if(l){for(var c=0,u=0,d=0;d<e;d+=2){var f=l[c];c+=f+1,u+=f}var p=o.bones;if(0==a.length)for(var m=n,g=3*u;m<i;m+=s){var v=0,y=0,x=l[c++];for(x+=c;c<x;c++,g+=3){var b=p[l[c]],_=h[g],w=h[g+1],T=h[g+2];v+=(_*b.a+w*b.b+b.worldX)*T,y+=(_*b.c+w*b.d+b.worldY)*T}r[m]=v,r[m+1]=y}else for(var E=a,S=n,I=3*u,A=u<<1;S<i;S+=s){var C=0,P=0,M=l[c++];for(M+=c;c<M;c++,I+=3,A+=2){var R=p[l[c]],O=h[I]+E[A],D=h[I+1]+E[A+1],k=h[I+2];C+=(O*R.a+D*R.b+R.worldX)*k,P+=(O*R.c+D*R.d+R.worldY)*k}r[S]=C,r[S+1]=P}}else{a.length>0&&(h=a);for(var L=t.bone,F=L.worldX,N=L.worldY,B=L.a,z=L.b,U=L.c,V=L.d,G=e,j=n;j<i;G+=2,j+=s){var H=h[G],W=h[G+1];r[j]=H*B+W*z+F,r[j+1]=H*U+W*V+N}}},i.copyTo=function(t){this.bones?(t.bones=new Array(this.bones.length),cx.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=cx.newFloatArray(this.vertices.length),cx.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment},e}(fx);px.nextID=0;var mx,gx,vx=function(){function t(e){this.id=t.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(e)}var e=t.prototype;return e.copy=function(){var e=new t(this.regions.length);return cx.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e},e.apply=function(t,e){var i=t.sequenceIndex;-1==i&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);var r=this.regions[i];e.region!=r&&(e.region=r,e.updateRegion())},e.getPath=function(t,e){for(var i=t,r=(this.start+e).toString(),n=this.digits-r.length;n>0;n--)i+="0";return i+=r},t.nextID=function(){return t._nextID++},t}();vx._nextID=0,(gx=mx||(mx={}))[gx.hold=0]="hold",gx[gx.once=1]="once",gx[gx.loop=2]="loop",gx[gx.pingpong=3]="pingpong",gx[gx.onceReverse=4]="onceReverse",gx[gx.loopReverse=5]="loopReverse",gx[gx.pingpongReverse=6]="pingpongReverse";var yx,xx,bx,_x,wx=[mx.hold,mx.once,mx.loop,mx.pingpong,mx.onceReverse,mx.loopReverse,mx.pingpongReverse],Tx=function(){function t(t,e,i){if(this.timelines=[],this.timelineIds=new ax,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=i}var e=t.prototype;return e.setTimelines=function(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())},e.hasTimeline=function(t){for(var e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1},e.apply=function(t,e,i,r,n,s,o,a){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(i%=this.duration,e>0&&(e%=this.duration));for(var h=this.timelines,l=0,c=h.length;l<c;l++)h[l].apply(t,e,i,n,s,o,a)},t}();(xx=yx||(yx={}))[xx.setup=0]="setup",xx[xx.first=1]="first",xx[xx.replace=2]="replace",xx[xx.add=3]="add",(_x=bx||(bx={}))[_x.mixIn=0]="mixIn",_x[_x.mixOut=1]="mixOut";var Ex={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},Sx=function(){function t(t,e){this.propertyIds=e,this.frames=cx.newFloatArray(t*this.getFrameEntries())}var e=t.prototype;return e.getPropertyIds=function(){return this.propertyIds},e.getFrameEntries=function(){return 1},e.getFrameCount=function(){return this.frames.length/this.getFrameEntries()},e.getDuration=function(){return this.frames[this.frames.length-this.getFrameEntries()]},t.search1=function(t,e){for(var i=t.length,r=1;r<i;r++)if(t[r]>e)return r-1;return i-1},t.search=function(t,e,i){for(var r=t.length,n=i;n<r;n+=i)if(t[n]>e)return n-i;return r-i},t}(),Ix=function(t){function e(e,i,r){var n;return(n=t.call(this,e,r)||this).curves=cx.newFloatArray(e+18*i),n.curves[e-1]=1,n}$y(e,t);var i=e.prototype;return i.setLinear=function(t){this.curves[t]=0},i.setStepped=function(t){this.curves[t]=1},i.shrink=function(t){var e=this.getFrameCount()+18*t;if(this.curves.length>e){var i=cx.newFloatArray(e);cx.arrayCopy(this.curves,0,i,0,e),this.curves=i}},i.setBezier=function(t,e,i,r,n,s,o,a,h,l,c){var u=this.curves,d=this.getFrameCount()+18*t;0==i&&(u[e]=2+d);for(var f=.03*(r-2*s+a),p=.03*(n-2*o+h),m=.006*(3*(s-a)-r+l),g=.006*(3*(o-h)-n+c),v=2*f+m,y=2*p+g,x=.3*(s-r)+f+.16666667*m,b=.3*(o-n)+p+.16666667*g,_=r+x,w=n+b,T=d+18;d<T;d+=2)u[d]=_,u[d+1]=w,x+=v,b+=y,v+=m,y+=g,_+=x,w+=b},i.getBezierValue=function(t,e,i,r){var n=this.curves;if(n[r]>t){var s=this.frames[e],o=this.frames[e+i];return o+(t-s)/(n[r]-s)*(n[r+1]-o)}var a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){var h=n[r-2],l=n[r-1];return l+(t-h)/(n[r]-h)*(n[r+1]-l)}e+=this.getFrameEntries();var c=n[a-2],u=n[a-1];return u+(t-c)/(this.frames[e]-c)*(this.frames[e+i]-u)},e}(Sx),Ax=function(t){function e(e,i,r){return t.call(this,e,i,[r])}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 2},i.setFrame=function(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+1]=i},i.getCurveValue=function(t){for(var e=this.frames,i=e.length-2,r=2;r<=i;r+=2)if(e[r]>t){i=r-2;break}var n=this.curves[i>>1];switch(n){case 0:var s=e[i],o=e[i+1];return o+(t-s)/(e[i+2]-s)*(e[i+2+1]-o);case 1:return e[i+1]}return this.getBezierValue(t,i,1,n-2)},i.getRelativeValue=function(t,e,i,r,n){if(t<this.frames[0]){switch(i){case yx.setup:return n;case yx.first:return r+(n-r)*e}return r}var s=this.getCurveValue(t);switch(i){case yx.setup:return n+s*e;case yx.first:case yx.replace:s+=n-r}return r+s*e},i.getAbsoluteValue=function(t,e,i,r,n){if(t<this.frames[0]){switch(i){case yx.setup:return n;case yx.first:return r+(n-r)*e}return r}var s=this.getCurveValue(t);return i==yx.setup?n+(s-n)*e:r+(s-r)*e},i.getAbsoluteValue2=function(t,e,i,r,n,s){if(t<this.frames[0]){switch(i){case yx.setup:return n;case yx.first:return r+(n-r)*e}return r}return i==yx.setup?n+(s-n)*e:r+(s-r)*e},i.getScaleValue=function(t,e,i,r,n,s){if(t<this.frames[0]){switch(i){case yx.setup:return s;case yx.first:return n+(s-n)*e}return n}var o=this.getCurveValue(t)*s;if(1==e)return i==yx.add?n+o-s:o;if(r==bx.mixOut)switch(i){case yx.setup:return s+(Math.abs(o)*lx.signum(s)-s)*e;case yx.first:case yx.replace:return n+(Math.abs(o)*lx.signum(n)-n)*e}else{var a=0;switch(i){case yx.setup:return(a=Math.abs(s)*lx.signum(o))+(o-a)*e;case yx.first:case yx.replace:return(a=Math.abs(n)*lx.signum(o))+(o-a)*e}}return n+(o-s)*e},e}(Ix),Cx=function(t){function e(e,i,r,n){return t.call(this,e,i,[r,n])}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 3},i.setFrame=function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},e}(Ix),Px=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.rotate+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(i,n,s,a.rotation,a.data.rotation))},e}(Ax),Mx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.x+"|"+r,Ex.y+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];if(a.active){var h=this.frames;if(i<h[0])switch(s){case yx.setup:return a.x=a.data.x,void(a.y=a.data.y);case yx.first:a.x+=(a.data.x-a.x)*n,a.y+=(a.data.y-a.y)*n}else{var l=0,c=0,u=Sx.search(h,i,3),d=this.curves[u/3];switch(d){case 0:var f=h[u];l=h[u+1],c=h[u+2];var p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break;case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}switch(s){case yx.setup:a.x=a.data.x+l*n,a.y=a.data.y+c*n;break;case yx.first:case yx.replace:a.x+=(a.data.x+l-a.x)*n,a.y+=(a.data.y+c-a.y)*n;break;case yx.add:a.x+=l*n,a.y+=c*n}}}},e}(Cx),Rx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.x+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(i,n,s,a.x,a.data.x))},e}(Ax),Ox=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.y+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(i,n,s,a.y,a.data.y))},e}(Ax),Dx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.scaleX+"|"+r,Ex.scaleY+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];if(a.active){var h=this.frames;if(i<h[0])switch(s){case yx.setup:return a.scaleX=a.data.scaleX,void(a.scaleY=a.data.scaleY);case yx.first:a.scaleX+=(a.data.scaleX-a.scaleX)*n,a.scaleY+=(a.data.scaleY-a.scaleY)*n}else{var l,c,u=Sx.search(h,i,3),d=this.curves[u/3];switch(d){case 0:var f=h[u];l=h[u+1],c=h[u+2];var p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break;case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,1==n)s==yx.add?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{var m=0,g=0;if(o==bx.mixOut)switch(s){case yx.setup:m=a.data.scaleX,g=a.data.scaleY,a.scaleX=m+(Math.abs(l)*lx.signum(m)-m)*n,a.scaleY=g+(Math.abs(c)*lx.signum(g)-g)*n;break;case yx.first:case yx.replace:m=a.scaleX,g=a.scaleY,a.scaleX=m+(Math.abs(l)*lx.signum(m)-m)*n,a.scaleY=g+(Math.abs(c)*lx.signum(g)-g)*n;break;case yx.add:a.scaleX+=(l-a.data.scaleX)*n,a.scaleY+=(c-a.data.scaleY)*n}else switch(s){case yx.setup:m=Math.abs(a.data.scaleX)*lx.signum(l),g=Math.abs(a.data.scaleY)*lx.signum(c),a.scaleX=m+(l-m)*n,a.scaleY=g+(c-g)*n;break;case yx.first:case yx.replace:m=Math.abs(a.scaleX)*lx.signum(l),g=Math.abs(a.scaleY)*lx.signum(c),a.scaleX=m+(l-m)*n,a.scaleY=g+(c-g)*n;break;case yx.add:a.scaleX+=(l-a.data.scaleX)*n,a.scaleY+=(c-a.data.scaleY)*n}}}}},e}(Cx),kx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.scaleX+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(i,n,s,o,a.scaleX,a.data.scaleX))},e}(Ax),Lx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.scaleY+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(i,n,s,o,a.scaleY,a.data.scaleY))},e}(Ax),Fx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.shearX+"|"+r,Ex.shearY+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];if(a.active){var h=this.frames;if(i<h[0])switch(s){case yx.setup:return a.shearX=a.data.shearX,void(a.shearY=a.data.shearY);case yx.first:a.shearX+=(a.data.shearX-a.shearX)*n,a.shearY+=(a.data.shearY-a.shearY)*n}else{var l=0,c=0,u=Sx.search(h,i,3),d=this.curves[u/3];switch(d){case 0:var f=h[u];l=h[u+1],c=h[u+2];var p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break;case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}switch(s){case yx.setup:a.shearX=a.data.shearX+l*n,a.shearY=a.data.shearY+c*n;break;case yx.first:case yx.replace:a.shearX+=(a.data.shearX+l-a.shearX)*n,a.shearY+=(a.data.shearY+c-a.shearY)*n;break;case yx.add:a.shearX+=l*n,a.shearY+=c*n}}}},e}(Cx),Nx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.shearX+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(i,n,s,a.shearX,a.data.shearX))},e}(Ax),Bx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.shearY+"|"+r)||this).boneIndex=0,n.boneIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(i,n,s,a.shearY,a.data.shearY))},e}(Ax),zx=function(t){function e(e,i){var r;return(r=t.call(this,e,[Ex.inherit+"|"+i])||this).boneIndex=0,r.boneIndex=i,r}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 2},i.setFrame=function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i},i.apply=function(t,e,i,r,n,s,o){var a=t.bones[this.boneIndex];if(a.active){var h=this.frames;i<h[0]?s!=yx.setup&&s!=yx.first||(a.inherit=a.data.inherit):a.inherit=this.frames[Sx.search(h,i,2)+1]}},e}(Sx),Ux=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.rgb+"|"+r,Ex.alpha+"|"+r])||this).slotIndex=0,n.slotIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 5},i.setFrame=function(t,e,i,r,n,s){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=s},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=this.frames,l=a.color;if(i<h[0]){var c=a.data.color;switch(s){case yx.setup:return void l.setFromColor(c);case yx.first:l.add((c.r-l.r)*n,(c.g-l.g)*n,(c.b-l.b)*n,(c.a-l.a)*n)}}else{var u=0,d=0,f=0,p=0,m=Sx.search(h,i,5),g=this.curves[m/5];switch(g){case 0:var v=h[m];u=h[m+1],d=h[m+2],f=h[m+3],p=h[m+4];var y=(i-v)/(h[m+5]-v);u+=(h[m+5+1]-u)*y,d+=(h[m+5+2]-d)*y,f+=(h[m+5+3]-f)*y,p+=(h[m+5+4]-p)*y;break;case 1:u=h[m+1],d=h[m+2],f=h[m+3],p=h[m+4];break;default:u=this.getBezierValue(i,m,1,g-2),d=this.getBezierValue(i,m,2,g+18-2),f=this.getBezierValue(i,m,3,g+36-2),p=this.getBezierValue(i,m,4,g+54-2)}1==n?l.set(u,d,f,p):(s==yx.setup&&l.setFromColor(a.data.color),l.add((u-l.r)*n,(d-l.g)*n,(f-l.b)*n,(p-l.a)*n))}}},e}(Ix),Vx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.rgb+"|"+r])||this).slotIndex=0,n.slotIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 4},i.setFrame=function(t,e,i,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=this.frames,l=a.color;if(i<h[0]){var c=a.data.color;switch(s){case yx.setup:return l.r=c.r,l.g=c.g,void(l.b=c.b);case yx.first:l.r+=(c.r-l.r)*n,l.g+=(c.g-l.g)*n,l.b+=(c.b-l.b)*n}}else{var u=0,d=0,f=0,p=Sx.search(h,i,4),m=this.curves[p>>2];switch(m){case 0:var g=h[p];u=h[p+1],d=h[p+2],f=h[p+3];var v=(i-g)/(h[p+4]-g);u+=(h[p+4+1]-u)*v,d+=(h[p+4+2]-d)*v,f+=(h[p+4+3]-f)*v;break;case 1:u=h[p+1],d=h[p+2],f=h[p+3];break;default:u=this.getBezierValue(i,p,1,m-2),d=this.getBezierValue(i,p,2,m+18-2),f=this.getBezierValue(i,p,3,m+36-2)}if(1==n)l.r=u,l.g=d,l.b=f;else{if(s==yx.setup){var y=a.data.color;l.r=y.r,l.g=y.g,l.b=y.b}l.r+=(u-l.r)*n,l.g+=(d-l.g)*n,l.b+=(f-l.b)*n}}}},e}(Ix),Gx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.alpha+"|"+r)||this).slotIndex=0,n.slotIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=a.color;if(i<this.frames[0]){var l=a.data.color;switch(s){case yx.setup:return void(h.a=l.a);case yx.first:h.a+=(l.a-h.a)*n}}else{var c=this.getCurveValue(i);1==n?h.a=c:(s==yx.setup&&(h.a=a.data.color.a),h.a+=(c-h.a)*n)}}},e}(Ax),jx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.rgb+"|"+r,Ex.alpha+"|"+r,Ex.rgb2+"|"+r])||this).slotIndex=0,n.slotIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 8},i.setFrame=function(t,e,i,r,n,s,o,a,h){t<<=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=s,this.frames[t+5]=o,this.frames[t+6]=a,this.frames[t+7]=h},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=this.frames,l=a.color,c=a.darkColor;if(i<h[0]){var u=a.data.color,d=a.data.darkColor;switch(s){case yx.setup:return l.setFromColor(u),c.r=d.r,c.g=d.g,void(c.b=d.b);case yx.first:l.add((u.r-l.r)*n,(u.g-l.g)*n,(u.b-l.b)*n,(u.a-l.a)*n),c.r+=(d.r-c.r)*n,c.g+=(d.g-c.g)*n,c.b+=(d.b-c.b)*n}}else{var f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=Sx.search(h,i,8),_=this.curves[b>>3];switch(_){case 0:var w=h[b];f=h[b+1],p=h[b+2],m=h[b+3],g=h[b+4],v=h[b+5],y=h[b+6],x=h[b+7];var T=(i-w)/(h[b+8]-w);f+=(h[b+8+1]-f)*T,p+=(h[b+8+2]-p)*T,m+=(h[b+8+3]-m)*T,g+=(h[b+8+4]-g)*T,v+=(h[b+8+5]-v)*T,y+=(h[b+8+6]-y)*T,x+=(h[b+8+7]-x)*T;break;case 1:f=h[b+1],p=h[b+2],m=h[b+3],g=h[b+4],v=h[b+5],y=h[b+6],x=h[b+7];break;default:f=this.getBezierValue(i,b,1,_-2),p=this.getBezierValue(i,b,2,_+18-2),m=this.getBezierValue(i,b,3,_+36-2),g=this.getBezierValue(i,b,4,_+54-2),v=this.getBezierValue(i,b,5,_+72-2),y=this.getBezierValue(i,b,6,_+90-2),x=this.getBezierValue(i,b,7,_+108-2)}if(1==n)l.set(f,p,m,g),c.r=v,c.g=y,c.b=x;else{if(s==yx.setup){l.setFromColor(a.data.color);var E=a.data.darkColor;c.r=E.r,c.g=E.g,c.b=E.b}l.add((f-l.r)*n,(p-l.g)*n,(m-l.b)*n,(g-l.a)*n),c.r+=(v-c.r)*n,c.g+=(y-c.g)*n,c.b+=(x-c.b)*n}}}},e}(Ix),Hx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.rgb+"|"+r,Ex.rgb2+"|"+r])||this).slotIndex=0,n.slotIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 7},i.setFrame=function(t,e,i,r,n,s,o,a){t*=7,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=s,this.frames[t+5]=o,this.frames[t+6]=a},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=this.frames,l=a.color,c=a.darkColor;if(i<h[0]){var u=a.data.color,d=a.data.darkColor;switch(s){case yx.setup:return l.r=u.r,l.g=u.g,l.b=u.b,c.r=d.r,c.g=d.g,void(c.b=d.b);case yx.first:l.r+=(u.r-l.r)*n,l.g+=(u.g-l.g)*n,l.b+=(u.b-l.b)*n,c.r+=(d.r-c.r)*n,c.g+=(d.g-c.g)*n,c.b+=(d.b-c.b)*n}}else{var f=0,p=0,m=0,g=0,v=0,y=0,x=Sx.search(h,i,7),b=this.curves[x/7];switch(b){case 0:var _=h[x];f=h[x+1],p=h[x+2],m=h[x+3],g=h[x+4],v=h[x+5],y=h[x+6];var w=(i-_)/(h[x+7]-_);f+=(h[x+7+1]-f)*w,p+=(h[x+7+2]-p)*w,m+=(h[x+7+3]-m)*w,g+=(h[x+7+4]-g)*w,v+=(h[x+7+5]-v)*w,y+=(h[x+7+6]-y)*w;break;case 1:f=h[x+1],p=h[x+2],m=h[x+3],g=h[x+4],v=h[x+5],y=h[x+6];break;default:f=this.getBezierValue(i,x,1,b-2),p=this.getBezierValue(i,x,2,b+18-2),m=this.getBezierValue(i,x,3,b+36-2),g=this.getBezierValue(i,x,4,b+54-2),v=this.getBezierValue(i,x,5,b+72-2),y=this.getBezierValue(i,x,6,b+90-2)}if(1==n)l.r=f,l.g=p,l.b=m,c.r=g,c.g=v,c.b=y;else{if(s==yx.setup){var T=a.data.color,E=a.data.darkColor;l.r=T.r,l.g=T.g,l.b=T.b,c.r=E.r,c.g=E.g,c.b=E.b}l.r+=(f-l.r)*n,l.g+=(p-l.g)*n,l.b+=(m-l.b)*n,c.r+=(g-c.r)*n,c.g+=(v-c.g)*n,c.b+=(y-c.b)*n}}}},e}(Ix),Wx=function(t){function e(e,i){var r;return(r=t.call(this,e,[Ex.attachment+"|"+i])||this).slotIndex=0,r.slotIndex=i,r.attachmentNames=new Array(e),r}$y(e,t);var i=e.prototype;return i.getFrameCount=function(){return this.frames.length},i.setFrame=function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];a.bone.active&&(o!=bx.mixOut?i<this.frames[0]?s!=yx.setup&&s!=yx.first||this.setAttachment(t,a,a.data.attachmentName):this.setAttachment(t,a,this.attachmentNames[Sx.search1(this.frames,i)]):s==yx.setup&&this.setAttachment(t,a,a.data.attachmentName))},i.setAttachment=function(t,e,i){e.setAttachment(i?t.getAttachment(this.slotIndex,i):null)},e}(Sx),Xx=function(t){function e(e,i,r,n){var s;return(s=t.call(this,e,i,[Ex.deform+"|"+r+"|"+n.id])||this).slotIndex=0,s.slotIndex=r,s.attachment=n,s.vertices=new Array(e),s}$y(e,t);var i=e.prototype;return i.getFrameCount=function(){return this.frames.length},i.setFrame=function(t,e,i){this.frames[t]=e,this.vertices[t]=i},i.setBezier=function(t,e,i,r,n,s,o,a,h,l,c){var u=this.curves,d=this.getFrameCount()+18*t;0==i&&(u[e]=2+d);for(var f=.03*(r-2*s+a),p=.03*h-.06*o,m=.006*(3*(s-a)-r+l),g=.018*(o-h+.33333333),v=2*f+m,y=2*p+g,x=.3*(s-r)+f+.16666667*m,b=.3*o+p+.16666667*g,_=r+x,w=b,T=d+18;d<T;d+=2)u[d]=_,u[d+1]=w,x+=v,b+=y,v+=m,y+=g,_+=x,w+=b},i.getCurvePercent=function(t,e){var i=this.curves,r=i[e];switch(r){case 0:var n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i[r-=2]>t){var s=this.frames[e];return i[r+1]*(t-s)/(i[r]-s)}var o=r+18;for(r+=2;r<o;r+=2)if(i[r]>=t){var a=i[r-2],h=i[r-1];return h+(t-a)/(i[r]-a)*(i[r+1]-h)}var l=i[o-2],c=i[o-1];return c+(1-c)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)},i.apply=function(t,e,i,r,n,s,o){var a=t.slots[this.slotIndex];if(a.bone.active){var h=a.getAttachment();if(h&&sx(h,px)&&h.timelineAttachment==this.attachment){var l=a.deform;0==l.length&&(s=yx.setup);var c=this.vertices,u=c[0].length,d=this.frames;if(i<d[0])switch(s){case yx.setup:return void(l.length=0);case yx.first:if(1==n)return void(l.length=0);l.length=u;var f=h;if(f.bones){n=1-n;for(m=0;m<u;m++)l[m]*=n}else for(var p=f.vertices,m=0;m<u;m++)l[m]+=(p[m]-l[m])*n}else if(l.length=u,i>=d[d.length-1]){var g=c[d.length-1];if(1==n)if(s==yx.add){var v=h;if(v.bones)for(var y=0;y<u;y++)l[y]+=g[y];else for(var x=v.vertices,b=0;b<u;b++)l[b]+=g[b]-x[b]}else cx.arrayCopy(g,0,l,0,u);else switch(s){case yx.setup:var _=h;if(_.bones)for(var w=0;w<u;w++)l[w]=g[w]*n;else for(var T=_.vertices,E=0;E<u;E++){var S=T[E];l[E]=S+(g[E]-S)*n}break;case yx.first:case yx.replace:for(var I=0;I<u;I++)l[I]+=(g[I]-l[I])*n;break;case yx.add:var A=h;if(A.bones)for(var C=0;C<u;C++)l[C]+=g[C]*n;else for(var P=A.vertices,M=0;M<u;M++)l[M]+=(g[M]-P[M])*n}}else{var R=Sx.search1(d,i),O=this.getCurvePercent(i,R),D=c[R],k=c[R+1];if(1==n)if(s==yx.add){var L=h;if(L.bones)for(var F=0;F<u;F++){var N=D[F];l[F]+=N+(k[F]-N)*O}else for(var B=L.vertices,z=0;z<u;z++){var U=D[z];l[z]+=U+(k[z]-U)*O-B[z]}}else for(var V=0;V<u;V++){var G=D[V];l[V]=G+(k[V]-G)*O}else switch(s){case yx.setup:var j=h;if(j.bones)for(var H=0;H<u;H++){var W=D[H];l[H]=(W+(k[H]-W)*O)*n}else for(var X=j.vertices,Y=0;Y<u;Y++){var q=D[Y],K=X[Y];l[Y]=K+(q+(k[Y]-q)*O-K)*n}break;case yx.first:case yx.replace:for(var Z=0;Z<u;Z++){var J=D[Z];l[Z]+=(J+(k[Z]-J)*O-l[Z])*n}break;case yx.add:var $=h;if($.bones)for(var Q=0;Q<u;Q++){var tt=D[Q];l[Q]+=(tt+(k[Q]-tt)*O)*n}else for(var et=$.vertices,it=0;it<u;it++){var rt=D[it];l[it]+=(rt+(k[it]-rt)*O-et[it])*n}}}}}},e}(Ix),Yx=function(t){function e(i){var r;return(r=t.call(this,i,e.propertyIds)||this).events=new Array(i),r}$y(e,t);var i=e.prototype;return i.getFrameCount=function(){return this.frames.length},i.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},i.apply=function(t,e,i,r,n,s,o){if(r){var a=this.frames,h=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,r,n,s,o),e=-1;else if(e>=a[h-1])return;if(!(i<a[0])){var l=0;if(e<a[0])l=0;else for(var c=a[l=Sx.search1(a,e)+1];l>0&&a[l-1]==c;)l--;for(;l<h&&i>=a[l];l++)r.push(this.events[l])}}},e}(Sx);Yx.propertyIds=[""+Ex.event];var qx=function(t){function e(i){var r;return(r=t.call(this,i,e.propertyIds)||this).drawOrders=new Array(i),r}$y(e,t);var i=e.prototype;return i.getFrameCount=function(){return this.frames.length},i.setFrame=function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},i.apply=function(t,e,i,r,n,s,o){if(o!=bx.mixOut)if(i<this.frames[0])s!=yx.setup&&s!=yx.first||cx.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var a=Sx.search1(this.frames,i),h=this.drawOrders[a];if(h)for(var l=t.drawOrder,c=t.slots,u=0,d=h.length;u<d;u++)l[u]=c[h[u]];else cx.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}else s==yx.setup&&cx.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},e}(Sx);qx.propertyIds=[""+Ex.drawOrder];var Kx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.ikConstraint+"|"+r])||this).constraintIndex=0,n.constraintIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 6},i.setFrame=function(t,e,i,r,n,s,o){t*=6,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=s?1:0,this.frames[t+5]=o?1:0},i.apply=function(t,e,i,r,n,s,o){var a=t.ikConstraints[this.constraintIndex];if(a.active){var h=this.frames;if(i<h[0])switch(s){case yx.setup:return a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,void(a.stretch=a.data.stretch);case yx.first:a.mix+=(a.data.mix-a.mix)*n,a.softness+=(a.data.softness-a.softness)*n,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}else{var l=0,c=0,u=Sx.search(h,i,6),d=this.curves[u/6];switch(d){case 0:var f=h[u];l=h[u+1],c=h[u+2];var p=(i-f)/(h[u+6]-f);l+=(h[u+6+1]-l)*p,c+=(h[u+6+2]-c)*p;break;case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}s==yx.setup?(a.mix=a.data.mix+(l-a.data.mix)*n,a.softness=a.data.softness+(c-a.data.softness)*n,o==bx.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=h[u+3],a.compress=0!=h[u+4],a.stretch=0!=h[u+5])):(a.mix+=(l-a.mix)*n,a.softness+=(c-a.softness)*n,o==bx.mixIn&&(a.bendDirection=h[u+3],a.compress=0!=h[u+4],a.stretch=0!=h[u+5]))}}},e}(Ix),Zx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.transformConstraint+"|"+r])||this).constraintIndex=0,n.constraintIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 7},i.setFrame=function(t,e,i,r,n,s,o,a){var h=this.frames;h[t*=7]=e,h[t+1]=i,h[t+2]=r,h[t+3]=n,h[t+4]=s,h[t+5]=o,h[t+6]=a},i.apply=function(t,e,i,r,n,s,o){var a=t.transformConstraints[this.constraintIndex];if(a.active){var h=this.frames;if(i<h[0]){var l=a.data;switch(s){case yx.setup:return a.mixRotate=l.mixRotate,a.mixX=l.mixX,a.mixY=l.mixY,a.mixScaleX=l.mixScaleX,a.mixScaleY=l.mixScaleY,void(a.mixShearY=l.mixShearY);case yx.first:a.mixRotate+=(l.mixRotate-a.mixRotate)*n,a.mixX+=(l.mixX-a.mixX)*n,a.mixY+=(l.mixY-a.mixY)*n,a.mixScaleX+=(l.mixScaleX-a.mixScaleX)*n,a.mixScaleY+=(l.mixScaleY-a.mixScaleY)*n,a.mixShearY+=(l.mixShearY-a.mixShearY)*n}}else{var c,u,d,f,p,m,g=Sx.search(h,i,7),v=this.curves[g/7];switch(v){case 0:var y=h[g];c=h[g+1],u=h[g+2],d=h[g+3],f=h[g+4],p=h[g+5],m=h[g+6];var x=(i-y)/(h[g+7]-y);c+=(h[g+7+1]-c)*x,u+=(h[g+7+2]-u)*x,d+=(h[g+7+3]-d)*x,f+=(h[g+7+4]-f)*x,p+=(h[g+7+5]-p)*x,m+=(h[g+7+6]-m)*x;break;case 1:c=h[g+1],u=h[g+2],d=h[g+3],f=h[g+4],p=h[g+5],m=h[g+6];break;default:c=this.getBezierValue(i,g,1,v-2),u=this.getBezierValue(i,g,2,v+18-2),d=this.getBezierValue(i,g,3,v+36-2),f=this.getBezierValue(i,g,4,v+54-2),p=this.getBezierValue(i,g,5,v+72-2),m=this.getBezierValue(i,g,6,v+90-2)}if(s==yx.setup){var b=a.data;a.mixRotate=b.mixRotate+(c-b.mixRotate)*n,a.mixX=b.mixX+(u-b.mixX)*n,a.mixY=b.mixY+(d-b.mixY)*n,a.mixScaleX=b.mixScaleX+(f-b.mixScaleX)*n,a.mixScaleY=b.mixScaleY+(p-b.mixScaleY)*n,a.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else a.mixRotate+=(c-a.mixRotate)*n,a.mixX+=(u-a.mixX)*n,a.mixY+=(d-a.mixY)*n,a.mixScaleX+=(f-a.mixScaleX)*n,a.mixScaleY+=(p-a.mixScaleY)*n,a.mixShearY+=(m-a.mixShearY)*n}}},e}(Ix),Jx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.pathConstraintPosition+"|"+r)||this).constraintIndex=0,n.constraintIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(i,n,s,a.position,a.data.position))},e}(Ax),$x=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,Ex.pathConstraintSpacing+"|"+r)||this).constraintIndex=0,n.constraintIndex=r,n}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(i,n,s,a.spacing,a.data.spacing))},e}(Ax),Qx=function(t){function e(e,i,r){var n;return(n=t.call(this,e,i,[Ex.pathConstraintMix+"|"+r])||this).constraintIndex=0,n.constraintIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return 4},i.setFrame=function(t,e,i,r,n){var s=this.frames;s[t<<=2]=e,s[t+1]=i,s[t+2]=r,s[t+3]=n},i.apply=function(t,e,i,r,n,s,o){var a=t.pathConstraints[this.constraintIndex];if(a.active){var h=this.frames;if(i<h[0])switch(s){case yx.setup:return a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,void(a.mixY=a.data.mixY);case yx.first:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*n,a.mixX+=(a.data.mixX-a.mixX)*n,a.mixY+=(a.data.mixY-a.mixY)*n}else{var l,c,u,d=Sx.search(h,i,4),f=this.curves[d>>2];switch(f){case 0:var p=h[d];l=h[d+1],c=h[d+2],u=h[d+3];var m=(i-p)/(h[d+4]-p);l+=(h[d+4+1]-l)*m,c+=(h[d+4+2]-c)*m,u+=(h[d+4+3]-u)*m;break;case 1:l=h[d+1],c=h[d+2],u=h[d+3];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2),u=this.getBezierValue(i,d,3,f+36-2)}if(s==yx.setup){var g=a.data;a.mixRotate=g.mixRotate+(l-g.mixRotate)*n,a.mixX=g.mixX+(c-g.mixX)*n,a.mixY=g.mixY+(u-g.mixY)*n}else a.mixRotate+=(l-a.mixRotate)*n,a.mixX+=(c-a.mixX)*n,a.mixY+=(u-a.mixY)*n}}},e}(Ix),tb=function(t){function e(e,i,r,n){var s;return(s=t.call(this,e,i,n+"|"+r)||this).constraintIndex=0,s.constraintIndex=r,s}return $y(e,t),e.prototype.apply=function(t,e,i,r,n,s,o){var a;if(-1==this.constraintIndex)for(var h,l=i>=this.frames[0]?this.getCurveValue(i):0,c=nx(t.physicsConstraints);!(h=c()).done;){var u=h.value;u.active&&this.global(u.data)&&this.set(u,this.getAbsoluteValue2(i,n,s,this.get(u),this.setup(u),l))}else(a=t.physicsConstraints[this.constraintIndex]).active&&this.set(a,this.getAbsoluteValue(i,n,s,this.get(a),this.setup(a)))},e}(Ax),eb=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintInertia)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.inertia},i.get=function(t){return t.inertia},i.set=function(t,e){t.inertia=e},i.global=function(t){return t.inertiaGlobal},e}(tb),ib=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintStrength)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.strength},i.get=function(t){return t.strength},i.set=function(t,e){t.strength=e},i.global=function(t){return t.strengthGlobal},e}(tb),rb=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintDamping)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.damping},i.get=function(t){return t.damping},i.set=function(t,e){t.damping=e},i.global=function(t){return t.dampingGlobal},e}(tb),nb=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintMass)}$y(e,t);var i=e.prototype;return i.setup=function(t){return 1/t.data.massInverse},i.get=function(t){return 1/t.massInverse},i.set=function(t,e){t.massInverse=1/e},i.global=function(t){return t.massGlobal},e}(tb),sb=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintWind)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.wind},i.get=function(t){return t.wind},i.set=function(t,e){t.wind=e},i.global=function(t){return t.windGlobal},e}(tb),ob=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintGravity)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.gravity},i.get=function(t){return t.gravity},i.set=function(t,e){t.gravity=e},i.global=function(t){return t.gravityGlobal},e}(tb),ab=function(t){function e(e,i,r){return t.call(this,e,i,r,Ex.physicsConstraintMix)}$y(e,t);var i=e.prototype;return i.setup=function(t){return t.data.mix},i.get=function(t){return t.mix},i.set=function(t,e){t.mix=e},i.global=function(t){return t.mixGlobal},e}(tb),hb=function(t){function e(i,r){var n;return(n=t.call(this,i,e.propertyIds)||this).constraintIndex=r,n}$y(e,t);var i=e.prototype;return i.getFrameCount=function(){return this.frames.length},i.setFrame=function(t,e){this.frames[t]=e},i.apply=function(t,e,i,r,n,s,o){var a;if(-1==this.constraintIndex||(a=t.physicsConstraints[this.constraintIndex]).active){var h=this.frames;if(e>i)this.apply(t,e,Number.MAX_VALUE,[],n,s,o),e=-1;else if(e>=h[h.length-1])return;if(!(i<h[0])&&(e<h[0]||i>=h[Sx.search1(h,e)+1]))if(null!=a)a.reset();else for(var l,c=nx(t.physicsConstraints);!(l=c()).done;){var u=l.value;u.active&&u.reset()}}},e}(Sx);hb.propertyIds=[Ex.physicsConstraintReset.toString()];var lb=function(t){function e(e,i,r){var n;return(n=t.call(this,e,[Ex.sequence+"|"+i+"|"+r.sequence.id])||this).slotIndex=i,n.attachment=r,n}$y(e,t);var i=e.prototype;return i.getFrameEntries=function(){return e.ENTRIES},i.getSlotIndex=function(){return this.slotIndex},i.getAttachment=function(){return this.attachment},i.setFrame=function(t,i,r,n,s){var o=this.frames;o[t*=e.ENTRIES]=i,o[t+e.MODE]=r|n<<4,o[t+e.DELAY]=s},i.apply=function(t,i,r,n,s,o,a){var h=t.slots[this.slotIndex];if(h.bone.active){var l=h.attachment,c=this.attachment;if(l==c||sx(l,px)&&l.timelineAttachment==c){var u=this.frames;if(r<u[0])o!=yx.setup&&o!=yx.first||(h.sequenceIndex=-1);else{var d=Sx.search(u,r,e.ENTRIES),f=u[d],p=u[d+e.MODE],m=u[d+e.DELAY];if(this.attachment.sequence){var g=p>>4,v=this.attachment.sequence.regions.length,y=wx[15&p];if(y!=mx.hold)switch(g+=(r-f)/m+1e-5|0,y){case mx.once:g=Math.min(v-1,g);break;case mx.loop:g%=v;break;case mx.pingpong:var x=(v<<1)-2;(g=0==x?0:g%x)>=v&&(g=x-g);break;case mx.onceReverse:g=Math.max(v-1-g,0);break;case mx.loopReverse:g=v-1-g%v;break;case mx.pingpongReverse:var b=(v<<1)-2;(g=0==b?0:(g+v-1)%b)>=v&&(g=b-g)}h.sequenceIndex=g}}}}},e}(Sx);function cb(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ub(t,e,i){return e&&cb(t.prototype,e),i&&cb(t,i),t}lb.ENTRIES=3,lb.MODE=1,lb.DELAY=2;var db=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new gb(this),this.propertyIDs=new ax,this.animationsChanged=!1,this.trackEntryPool=new ux(function(){return new mb}),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,i=0,r=e.length;i<r;i++){var n=e[i];if(n){n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;var s=t*n.timeScale;if(n.delay>0){if(n.delay-=s,n.delay>0)continue;s=-n.delay,n.delay=0}var o=n.next;if(o){var a=n.trackLast-o.delay;if(a>=0){for(o.delay=0,o.trackTime+=0==n.timeScale?0:(a/n.timeScale+t)*o.timeScale,n.trackTime+=s,this.setCurrent(i,o,!0);o.mixingFrom;)o.mixTime+=t,o=o.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){var h=n.mixingFrom;for(n.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}n.trackTime+=s}}this.queue.drain()},e.updateMixingFrom=function(t,e){var i=t.mixingFrom;if(!i)return!0;var r=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=i.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)},e.apply=function(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var e=this.events,i=this.tracks,r=!1,n=0,s=i.length;n<s;n++){var o=i[n];if(o&&!(o.delay>0)){r=!0;var a=0==n?yx.first:o.mixBlend,h=o.alpha;o.mixingFrom?h*=this.applyMixingFrom(o,t,a):o.trackTime>=o.trackEnd&&!o.next&&(h=0);var l=h>=o.alphaAttachmentThreshold,c=o.animationLast,u=o.getAnimationTime(),d=u,f=e;o.reverse&&(d=o.animation.duration-d,f=null);var p=o.animation.timelines,m=p.length;if(0==n&&1==h||a==yx.add){0==n&&(l=!0);for(var g=0;g<m;g++){cx.webkit602BugfixHelper(h,a);var v=p[g];sx(v,Wx)?this.applyAttachmentTimeline(v,t,d,a,l):v.apply(t,c,d,f,h,a,bx.mixIn)}}else{var y=o.timelineMode,x=o.shortestRotation,b=!x&&o.timelinesRotation.length!=m<<1;b&&(o.timelinesRotation.length=m<<1);for(var _=0;_<m;_++){var w=p[_],T=y[_]==_b?a:yx.setup;!x&&sx(w,Px)?this.applyRotateTimeline(w,t,d,h,T,o.timelinesRotation,_<<1,b):sx(w,Wx)?this.applyAttachmentTimeline(w,t,d,a,l):(cx.webkit602BugfixHelper(h,a),w.apply(t,c,d,f,h,T,bx.mixIn))}}this.queueEvents(o,u),e.length=0,o.nextAnimationLast=u,o.nextTrackLast=o.trackTime}}for(var E=this.unkeyedState+Ib,S=t.slots,I=0,A=t.slots.length;I<A;I++){var C=S[I];if(C.attachmentState==E){var P=C.data.attachmentName;C.setAttachment(P?t.getAttachment(C.data.index,P):null)}}return this.unkeyedState+=2,this.queue.drain(),r},e.applyMixingFrom=function(t,e,i){var r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,i);var n=0;0==t.mixDuration?(n=1,i==yx.first&&(i=yx.setup)):((n=t.mixTime/t.mixDuration)>1&&(n=1),i!=yx.first&&(i=r.mixBlend));var s=n<r.mixAttachmentThreshold,o=n<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,l=r.alpha*t.interruptAlpha,c=l*(1-n),u=r.animationLast,d=r.getAnimationTime(),f=d,p=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(p=this.events),i==yx.add)for(var m=0;m<h;m++)a[m].apply(e,u,f,p,c,i,bx.mixOut);else{var g=r.timelineMode,v=r.timelineHoldMix,y=r.shortestRotation,x=!y&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(var b=0;b<h;b++){var _=a[b],w=bx.mixOut,T=void 0,E=0;switch(g[b]){case _b:if(!o&&sx(_,qx))continue;T=i,E=c;break;case wb:T=yx.setup,E=c;break;case Tb:T=i,E=l;break;case Eb:T=yx.setup,E=l;break;default:T=yx.setup;var S=v[b];E=l*Math.max(0,1-S.mixTime/S.mixDuration)}r.totalAlpha+=E,!y&&sx(_,Px)?this.applyRotateTimeline(_,e,f,E,T,r.timelinesRotation,b<<1,x):sx(_,Wx)?this.applyAttachmentTimeline(_,e,f,T,s&&E>=r.alphaAttachmentThreshold):(cx.webkit602BugfixHelper(E,i),o&&sx(_,qx)&&T==yx.setup&&(w=bx.mixIn),_.apply(e,u,f,p,E,T,w))}}return t.mixDuration>0&&this.queueEvents(r,d),this.events.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime,n},e.applyAttachmentTimeline=function(t,e,i,r,n){var s=e.slots[t.slotIndex];s.bone.active&&(i<t.frames[0]?r!=yx.setup&&r!=yx.first||this.setAttachment(e,s,s.data.attachmentName,n):this.setAttachment(e,s,t.attachmentNames[Sx.search1(t.frames,i)],n),s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+Ib))},e.setAttachment=function(t,e,i,r){e.setAttachment(i?t.getAttachment(e.data.index,i):null),r&&(e.attachmentState=this.unkeyedState+Ab)},e.applyRotateTimeline=function(t,e,i,r,n,s,o,a){if(a&&(s[o]=0),1!=r){var h=e.bones[t.boneIndex];if(h.active){var l=0,c=0;if(i<t.frames[0])switch(n){case yx.setup:h.rotation=h.data.rotation;default:return;case yx.first:l=h.rotation,c=h.data.rotation}else l=n==yx.setup?h.data.rotation:h.rotation,c=h.data.rotation+t.getCurveValue(i);var u=0,d=c-l;if(0==(d-=360*Math.ceil(d/360-.5)))u=s[o];else{var f=0,p=0;a?(f=0,p=d):(f=s[o],p=s[o+1]);var m=f-f%360;u=d+m;var g=d>=0,v=f>=0;Math.abs(p)<=90&&lx.signum(p)!=lx.signum(d)&&(Math.abs(f-m)>180?(u+=360*lx.signum(f),v=g):0!=m?u-=360*lx.signum(f):v=g),v!=g&&(u+=360*lx.signum(f)),s[o]=u}s[o+1]=d,h.rotation=l+u*r}}else t.apply(e,0,i,null,1,n,bx.mixIn)},e.queueEvents=function(t,e){for(var i=t.animationStart,r=t.animationEnd,n=r-i,s=t.trackLast%n,o=this.events,a=0,h=o.length;a<h;a++){var l=o[a];if(l.time<s)break;l.time>r||this.queue.event(t,l)}var c=!1;if(t.loop)if(0==n)c=!0;else{var u=Math.floor(t.trackTime/n);c=u>0&&u>Math.floor(t.trackLast/n)}else c=e>=r&&t.animationLast<r;for(c&&this.queue.complete(t);a<h;a++){var d=o[a];d.time<i||this.queue.event(t,d)}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,i=this.tracks.length;e<i;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(e){this.queue.end(e),this.clearNext(e);for(var i=e;;){var r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,i){var r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(i&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,i){void 0===i&&(i=!1);var r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,i)},e.setAnimationWith=function(t,e,i){if(void 0===i&&(i=!1),!e)throw new Error("animation cannot be null.");var r=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));var s=this.trackEntry(t,e,i,n);return this.setCurrent(t,s,r),this.queue.drain(),s},e.addAnimation=function(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=0);var n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,i,r)},e.addAnimationWith=function(t,e,i,r){if(void 0===i&&(i=!1),void 0===r&&(r=0),!e)throw new Error("animation cannot be null.");var n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;var s=this.trackEntry(t,e,i,n);return n?(n.next=s,s.previous=n,r<=0&&(r+=n.getTrackComplete()-s.mixDuration)):(this.setCurrent(t,s,!0),this.queue.drain()),s.delay=r,s},e.setEmptyAnimation=function(e,i){void 0===i&&(i=0);var r=this.setAnimationWith(e,t.emptyAnimation(),!1);return r.mixDuration=i,r.trackEnd=i,r},e.addEmptyAnimation=function(e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=this.addAnimationWith(e,t.emptyAnimation(),!1,r);return r<=0&&(n.delay+=n.mixDuration-i),n.mixDuration=i,n.trackEnd=i,n},e.setEmptyAnimations=function(t){void 0===t&&(t=0);var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var i=0,r=this.tracks.length;i<r;i++){var n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(cx.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,i,r){var n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=i,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=r?this.data.getMix(r.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=yx.replace,n},e.clearNext=function(t){for(var e=t.next;e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=this.tracks,e=0,i=t.length;e<i;e++){var r=t[e];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do{r.mixingTo&&r.mixBlend==yx.add||this.computeHold(r),r=r.mixingTo}while(r)}}},e.computeHold=function(t){var e=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,n=t.timelineMode;n.length=r;var s=t.timelineHoldMix;s.length=0;var o=this.propertyIDs;if(e&&e.holdPrevious)for(var a=0;a<r;a++)n[a]=o.addAll(i[a].getPropertyIds())?Eb:Tb;else t:for(var h=0;h<r;h++){var l=i[h],c=l.getPropertyIds();if(o.addAll(c))if(!e||sx(l,Wx)||sx(l,qx)||sx(l,Yx)||!e.animation.hasTimeline(c))n[h]=wb;else{for(var u=e.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(t.mixDuration>0){n[h]=Sb,s[h]=u;continue t}break}n[h]=Eb}else n[h]=_b}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t.emptyAnimation=function(){return t._emptyAnimation},t}();db._emptyAnimation=new Tx("<empty>",[],0);var fb,pb,mb=function(){function t(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=yx.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.setMixDurationWithDelay=function(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e},e.reset=function(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},e.getTrackComplete=function(){var t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime},e.wasApplied=function(){return-1!=this.nextTrackLast},ub(t,[{key:"mixDuration",get:function(){return this._mixDuration},set:function(t){this._mixDuration=t}}]),t}(),gb=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(fb.start),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(fb.interrupt),this.objects.push(t)},e.end=function(t){this.objects.push(fb.end),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(fb.dispose),this.objects.push(t)},e.complete=function(t){this.objects.push(fb.complete),this.objects.push(t)},e.event=function(t,e){this.objects.push(fb.event),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,i=0;i<t.length;i+=2){var r=t[i],n=t[i+1];switch(r){case fb.start:n.listener&&n.listener.start&&n.listener.start(n);for(var s=0;s<e.length;s++){var o=e[s];o.start&&o.start(n)}break;case fb.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(var a=0;a<e.length;a++){var h=e[a];h.interrupt&&h.interrupt(n)}break;case fb.end:n.listener&&n.listener.end&&n.listener.end(n);for(var l=0;l<e.length;l++){var c=e[l];c.end&&c.end(n)}case fb.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(var u=0;u<e.length;u++){var d=e[u];d.dispose&&d.dispose(n)}this.animState.trackEntryPool.free(n);break;case fb.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(var f=0;f<e.length;f++){var p=e[f];p.complete&&p.complete(n)}break;case fb.event:var m=t[2+i++];n.listener&&n.listener.event&&n.listener.event(n,m);for(var g=0;g<e.length;g++){var v=e[g];v.event&&v.event(n,m)}}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();(pb=fb||(fb={}))[pb.start=0]="start",pb[pb.interrupt=1]="interrupt",pb[pb.end=2]="end",pb[pb.dispose=3]="dispose",pb[pb.complete=4]="complete",pb[pb.event=5]="event";var vb,yb,xb,bb,_b=0,wb=1,Tb=2,Eb=3,Sb=4,Ib=1,Ab=2,Cb=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,i){var r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);var n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(r,n,i)},e.setMixWith=function(t,e,i){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");var r=t.name+"."+e.name;this.animationToMixTime[r]=i},e.getMix=function(t,e){var i=t.name+"."+e.name,r=this.animationToMixTime[i];return void 0===r?this.defaultMix:r},t}(),Pb=function(t){function e(e){var i;return(i=t.call(this,e)||this).color=new hx(1,1,1,1),i}return $y(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(px),Mb=function(t){function e(e){var i;return(i=t.call(this,e)||this).endSlot=null,i.color=new hx(.2275,.2275,.8078,1),i}return $y(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(px);(yb=vb||(vb={}))[yb.Nearest=9728]="Nearest",yb[yb.Linear=9729]="Linear",yb[yb.MipMap=9987]="MipMap",yb[yb.MipMapNearestNearest=9984]="MipMapNearestNearest",yb[yb.MipMapLinearNearest=9985]="MipMapLinearNearest",yb[yb.MipMapNearestLinear=9986]="MipMapNearestLinear",yb[yb.MipMapLinearLinear=9987]="MipMapLinearLinear",(bb=xb||(xb={}))[bb.MirroredRepeat=33648]="MirroredRepeat",bb[bb.ClampToEdge=33071]="ClampToEdge",bb[bb.Repeat=10497]="Repeat";var Rb=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0},Ob=function(){function t(t){this.pages=new Array,this.regions=new Array;for(var e=new Db(t),i=new Array(4),r={size:function(t){t.width=parseInt(i[1]),t.height=parseInt(i[2])},format:function(){},filter:function(t){t.minFilter=cx.enumValue(vb,i[1]),t.magFilter=cx.enumValue(vb,i[2])},repeat:function(t){-1!=i[1].indexOf("x")&&(t.uWrap=xb.Repeat),-1!=i[1].indexOf("y")&&(t.vWrap=xb.Repeat)},pma:function(t){t.pma="true"==i[1]}},n={xy:function(t){t.x=parseInt(i[1]),t.y=parseInt(i[2])},size:function(t){t.width=parseInt(i[1]),t.height=parseInt(i[2])},bounds:function(t){t.x=parseInt(i[1]),t.y=parseInt(i[2]),t.width=parseInt(i[3]),t.height=parseInt(i[4])},offset:function(t){t.offsetX=parseInt(i[1]),t.offsetY=parseInt(i[2])},orig:function(t){t.originalWidth=parseInt(i[1]),t.originalHeight=parseInt(i[2])},offsets:function(t){t.offsetX=parseInt(i[1]),t.offsetY=parseInt(i[2]),t.originalWidth=parseInt(i[3]),t.originalHeight=parseInt(i[4])},rotate:function(t){var e=i[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:function(t){t.index=parseInt(i[1])}},s=e.readLine();s&&0==s.trim().length;)s=e.readLine();for(;s&&0!=s.trim().length&&0!=e.readEntry(i,s);)s=e.readLine();for(var o=null,a=null,h=null;null!==s;)if(0==s.trim().length)o=null,s=e.readLine();else if(o){for(var l=new Lb(o,s);;){var c=e.readEntry(i,s=e.readLine());if(0==c)break;var u=n[i[0]];if(u)u(l);else{a||(a=[]),h||(h=[]),a.push(i[0]);for(var d=[],f=0;f<c;f++)d.push(parseInt(i[f+1]));h.push(d)}}0==l.originalWidth&&0==l.originalHeight&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&h&&h.length>0&&(l.names=a,l.values=h,a=null,h=null),l.u=l.x/o.width,l.v=l.y/o.height,90==l.degrees?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new kb(s.trim());0!=e.readEntry(i,s=e.readLine());){var p=r[i[0]];p&&p(o)}this.pages.push(o)}}var e=t.prototype;return e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.setTextures=function(t,e){void 0===e&&(e="");for(var i,r=nx(this.pages);!(i=r()).done;){var n=i.value;n.setTexture(t.get(e+n.name))}},e.dispose=function(){for(var t=0;t<this.pages.length;t++){var e;null==(e=this.pages[t].texture)||e.dispose()}},t}(),Db=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readEntry=function(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;var i=e.indexOf(":");if(-1==i)return 0;t[0]=e.substr(0,i).trim();for(var r=1,n=i+1;;r++){var s=e.indexOf(",",n);if(-1==s)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,s-n).trim(),n=s+1,4==r)return 4}},t}(),kb=function(){function t(t){this.minFilter=vb.Nearest,this.magFilter=vb.Nearest,this.uWrap=xb.ClampToEdge,this.vWrap=xb.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=t}return t.prototype.setTexture=function(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(var e,i=nx(this.regions);!(e=i()).done;){e.value.texture=t}},t}(),Lb=function(t){function e(e,i){var r;return(r=t.call(this)||this).x=0,r.y=0,r.offsetX=0,r.offsetY=0,r.originalWidth=0,r.originalHeight=0,r.index=0,r.degrees=0,r.names=null,r.values=null,r.page=e,r.name=i,e.regions.push(ox(r)),r}return $y(e,t),e}(Rb),Fb=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).region=null,r.regionUVs=[],r.uvs=[],r.triangles=[],r.color=new hx(1,1,1,1),r.width=0,r.height=0,r.hullLength=0,r.edges=[],r.parentMesh=null,r.sequence=null,r.tempColor=new hx(0,0,0,0),r.path=i,r}$y(e,t);var i=e.prototype;return i.updateRegion=function(){if(!this.region)throw new Error("Region not set.");var t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=cx.newFloatArray(t.length));var e=this.uvs,i=this.uvs.length,r=this.region.u,n=this.region.v,s=0,o=0;if(sx(this.region,Lb)){var a=this.region,h=a.page,l=h.width,c=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/l,n-=(a.originalWidth-a.offsetX-a.width)/c,s=a.originalHeight/l,o=a.originalWidth/c;for(var u=0;u<i;u+=2)e[u]=r+t[u+1]*s,e[u+1]=n+(1-t[u])*o;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/l,n-=a.offsetY/c,s=a.originalWidth/l,o=a.originalHeight/c;for(var d=0;d<i;d+=2)e[d]=r+(1-t[d])*s,e[d+1]=n+(1-t[d+1])*o;return;case 270:r-=a.offsetY/l,n-=a.offsetX/c,s=a.originalHeight/l,o=a.originalWidth/c;for(var f=0;f<i;f+=2)e[f]=r+(1-t[f+1])*s,e[f+1]=n+t[f]*o;return}r-=a.offsetX/l,n-=(a.originalHeight-a.offsetY-a.height)/c,s=a.originalWidth/l,o=a.originalHeight/c}else this.region?(s=this.region.u2-r,o=this.region.v2-n):(r=n=0,s=o=1);for(var p=0;p<i;p+=2)e[p]=r+t[p]*s,e[p+1]=n+t[p+1]*o},i.getParentMesh=function(){return this.parentMesh},i.setParentMesh=function(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},i.copy=function(){if(this.parentMesh)return this.newLinkedMesh();var t=new e(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),cx.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),cx.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),cx.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),cx.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},i.computeWorldVertices=function(e,i,r,n,s,o){null!=this.sequence&&this.sequence.apply(e,this),t.prototype.computeWorldVertices.call(this,e,i,r,n,s,o)},i.newLinkedMesh=function(){var t=new e(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t},e}(px),Nb=function(t){function e(e){var i;return(i=t.call(this,e)||this).lengths=[],i.closed=!1,i.constantSpeed=!1,i.color=new hx(1,1,1,1),i}return $y(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),cx.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(px),Bb=function(t){function e(e){var i;return(i=t.call(this,e)||this).x=0,i.y=0,i.rotation=0,i.color=new hx(.38,.94,0,1),i}$y(e,t);var i=e.prototype;return i.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},i.computeWorldRotation=function(t){var e=this.rotation*lx.degRad,i=Math.cos(e),r=Math.sin(e),n=i*t.a+r*t.b,s=i*t.c+r*t.d;return lx.atan2Deg(s,n)},i.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(px),zb=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).x=0,r.y=0,r.scaleX=1,r.scaleY=1,r.rotation=0,r.width=0,r.height=0,r.color=new hx(1,1,1,1),r.region=null,r.sequence=null,r.offset=cx.newFloatArray(8),r.uvs=cx.newFloatArray(8),r.tempColor=new hx(1,1,1,1),r.path=i,r}$y(e,t);var i=e.prototype;return i.updateRegion=function(){if(!this.region)throw new Error("Region not set.");var t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);var i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*i,s=-this.height/2*this.scaleY+this.region.offsetY*r,o=n+this.region.width*i,a=s+this.region.height*r,h=this.rotation*lx.degRad,l=Math.cos(h),c=Math.sin(h),u=this.x,d=this.y,f=n*l+u,p=n*c,m=s*l+d,g=s*c,v=o*l+u,y=o*c,x=a*l+d,b=a*c,_=this.offset;_[0]=f-g,_[1]=m+p,_[2]=f-b,_[3]=x+p,_[4]=v-b,_[5]=x+y,_[6]=v-g,_[7]=m+y,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},i.computeWorldVertices=function(t,e,i,r){null!=this.sequence&&this.sequence.apply(t,this);var n=t.bone,s=this.offset,o=n.worldX,a=n.worldY,h=n.a,l=n.b,c=n.c,u=n.d,d=0,f=0;d=s[0],f=s[1],e[i]=d*h+f*l+o,e[i+1]=d*c+f*u+a,i+=r,d=s[2],f=s[3],e[i]=d*h+f*l+o,e[i+1]=d*c+f*u+a,i+=r,d=s[4],f=s[5],e[i]=d*h+f*l+o,e[i+1]=d*c+f*u+a,i+=r,d=s[6],f=s[7],e[i]=d*h+f*l+o,e[i+1]=d*c+f*u+a},i.copy=function(){var t=new e(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,cx.arrayCopy(this.uvs,0,t.uvs,0,8),cx.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t},e}(fx);zb.X1=0,zb.Y1=1,zb.C1R=2,zb.C1G=3,zb.C1B=4,zb.C1A=5,zb.U1=6,zb.V1=7,zb.X2=8,zb.Y2=9,zb.C2R=10,zb.C2G=11,zb.C2B=12,zb.C2A=13,zb.U2=14,zb.V2=15,zb.X3=16,zb.Y3=17,zb.C3R=18,zb.C3G=19,zb.C3B=20,zb.C3A=21,zb.U3=22,zb.V3=23,zb.X4=24,zb.Y4=25,zb.C4R=26,zb.C4G=27,zb.C4B=28,zb.C4A=29,zb.U4=30,zb.V4=31;var Ub,Vb,Gb=function(){function t(t){this.atlas=t}var e=t.prototype;return e.loadSequence=function(t,e,i){for(var r=i.regions,n=0,s=r.length;n<s;n++){var o=i.getPath(e,n),a=this.atlas.findRegion(o);if(null==a)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");r[n]=a}},e.newRegionAttachment=function(t,e,i,r){var n=new zb(e,i);if(null!=r)this.loadSequence(e,i,r);else{var s=this.atlas.findRegion(i);if(!s)throw new Error("Region not found in atlas: "+i+" (region attachment: "+e+")");n.region=s}return n},e.newMeshAttachment=function(t,e,i,r){var n=new Fb(e,i);if(null!=r)this.loadSequence(e,i,r);else{var s=this.atlas.findRegion(i);if(!s)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+e+")");n.region=s}return n},e.newBoundingBoxAttachment=function(t,e){return new Pb(e)},e.newPathAttachment=function(t,e){return new Nb(e)},e.newPointAttachment=function(t,e){return new Bb(e)},e.newClippingAttachment=function(t,e){return new Mb(e)},t}(),jb=function(t,e,i){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=Ub.Normal,this.skinRequired=!1,this.color=new hx,this.visible=!1,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=i};(Vb=Ub||(Ub={}))[Vb.Normal=0]="Normal",Vb[Vb.OnlyTranslation=1]="OnlyTranslation",Vb[Vb.NoRotationOrReflection=2]="NoRotationOrReflection",Vb[Vb.NoScale=3]="NoScale",Vb[Vb.NoScaleOrReflection=4]="NoScaleOrReflection";var Hb,Wb,Xb,Yb,qb,Kb,Zb=function(){function t(t,e,i){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=Ub.Normal,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,i,r,n,s,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=r,this.ascaleY=n,this.ashearX=s,this.ashearY=o;var a=this.parent;if(!a){var h=this.skeleton,l=h.scaleX,c=h.scaleY,u=(i+s)*lx.degRad,d=(i+90+o)*lx.degRad;return this.a=Math.cos(u)*r*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(u)*r*c,this.d=Math.sin(d)*n*c,this.worldX=t*l+h.x,void(this.worldY=e*c+h.y)}var f=a.a,p=a.b,m=a.c,g=a.d;switch(this.worldX=f*t+p*e+a.worldX,this.worldY=m*t+g*e+a.worldY,this.inherit){case Ub.Normal:var v=(i+s)*lx.degRad,y=(i+90+o)*lx.degRad,x=Math.cos(v)*r,b=Math.cos(y)*n,_=Math.sin(v)*r,w=Math.sin(y)*n;return this.a=f*x+p*_,this.b=f*b+p*w,this.c=m*x+g*_,void(this.d=m*b+g*w);case Ub.OnlyTranslation:var T=(i+s)*lx.degRad,E=(i+90+o)*lx.degRad;this.a=Math.cos(T)*r,this.b=Math.cos(E)*n,this.c=Math.sin(T)*r,this.d=Math.sin(E)*n;break;case Ub.NoRotationOrReflection:var S=f*f+m*m,I=0;S>1e-4?(S=Math.abs(f*g-p*m)/S,f/=this.skeleton.scaleX,p=(m/=this.skeleton.scaleY)*S,g=f*S,I=Math.atan2(m,f)*lx.radDeg):(f=0,m=0,I=90-Math.atan2(g,p)*lx.radDeg);var A=(i+s-I)*lx.degRad,C=(i+o-I+90)*lx.degRad,P=Math.cos(A)*r,M=Math.cos(C)*n,R=Math.sin(A)*r,O=Math.sin(C)*n;this.a=f*P-p*R,this.b=f*M-p*O,this.c=m*P+g*R,this.d=m*M+g*O;break;case Ub.NoScale:case Ub.NoScaleOrReflection:i*=lx.degRad;var D=Math.cos(i),k=Math.sin(i),L=(f*D+p*k)/this.skeleton.scaleX,F=(m*D+g*k)/this.skeleton.scaleY,N=Math.sqrt(L*L+F*F);N>1e-5&&(N=1/N),L*=N,F*=N,N=Math.sqrt(L*L+F*F),this.inherit==Ub.NoScale&&f*g-p*m<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(N=-N),i=Math.PI/2+Math.atan2(F,L);var B=Math.cos(i)*N,z=Math.sin(i)*N;s*=lx.degRad,o=(90+o)*lx.degRad;var U=Math.cos(s)*r,V=Math.cos(o)*n,G=Math.sin(s)*r,j=Math.sin(o)*n;this.a=L*U+B*G,this.b=L*V+B*j,this.c=F*U+z*G,this.d=F*V+z*j}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.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.inherit=t.inherit},e.updateAppliedTransform=function(){var t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*lx.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*lx.radDeg);var e,i,r,n,s=t.a,o=t.b,a=t.c,h=t.d,l=1/(s*h-o*a),c=h*l,u=o*l,d=a*l,f=s*l,p=this.worldX-t.worldX,m=this.worldY-t.worldY;if(this.ax=p*c-m*u,this.ay=m*f-p*d,this.inherit==Ub.OnlyTranslation)e=this.a,i=this.b,r=this.c,n=this.d;else{switch(this.inherit){case Ub.NoRotationOrReflection:var g=Math.abs(s*h-o*a)/(s*s+a*a),v=s/this.skeleton.scaleX;o=-(a/this.skeleton.scaleY)*g*this.skeleton.scaleX,c=(h=v*g*this.skeleton.scaleY)*(l=1/(s*h-o*a)),u=o*l;break;case Ub.NoScale:case Ub.NoScaleOrReflection:var y=lx.cosDeg(this.rotation),x=lx.sinDeg(this.rotation);s=(s*y+o*x)/this.skeleton.scaleX,a=(a*y+h*x)/this.skeleton.scaleY;var b=Math.sqrt(s*s+a*a);b>1e-5&&(b=1/b),s*=b,a*=b,b=Math.sqrt(s*s+a*a),this.inherit==Ub.NoScale&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b);var _=lx.PI/2+Math.atan2(a,s);o=Math.cos(_)*b,c=(h=Math.sin(_)*b)*(l=1/(s*h-o*a)),u=o*l,d=a*l,f=s*l}e=c*this.a-u*this.c,i=c*this.b-u*this.d,r=f*this.c-d*this.a,n=f*this.d-d*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){var w=e*n-i*r;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(e*i+r*n,w)*lx.radDeg,this.arotation=Math.atan2(r,e)*lx.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(i*i+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,i)*lx.radDeg},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*lx.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*lx.radDeg},e.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.worldToLocal=function(t){var e=1/(this.a*this.d-this.b*this.c),i=t.x-this.worldX,r=t.y-this.worldY;return t.x=i*this.d*e-r*this.b*e,t.y=r*this.a*e-i*this.c*e,t},e.localToWorld=function(t){var e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t},e.worldToParent=function(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)},e.parentToWorld=function(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)},e.worldToLocalRotation=function(t){var e=lx.sinDeg(t),i=lx.cosDeg(t);return Math.atan2(this.a*e-this.c*i,this.d*i-this.b*e)*lx.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=lx.sinDeg(t),i=lx.cosDeg(t);return Math.atan2(i*this.c+e*this.d,i*this.a+e*this.b)*lx.radDeg},e.rotateWorld=function(t){t*=lx.degRad;var e=Math.sin(t),i=Math.cos(t),r=this.a,n=this.b;this.a=i*r-e*this.c,this.b=i*n-e*this.d,this.c=e*r+i*this.c,this.d=e*n+i*this.d},t}(),Jb=function(t,e,i){this.name=t,this.order=e,this.skinRequired=i},$b=function(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e},Qb=function(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t},t_=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0;i<t.bones.length;i++){var r=e.findBone(t.bones[i].name);if(!r)throw new Error("Couldn't find bone "+t.bones[i].name);this.bones.push(r)}var n=e.findBone(t.target.name);if(!n)throw new Error("Couldn't find bone "+t.target.name);this.target=n,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}var e=t.prototype;return e.isActive=function(){return this.active},e.setToSetupPose=function(){var t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch},e.update=function(t){if(0!=this.mix){var e=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}},e.apply1=function(t,e,i,r,n,s,o){var a=t.parent;if(!a)throw new Error("IK bone must have parent.");var h=a.a,l=a.b,c=a.c,u=a.d,d=-t.ashearX-t.arotation,f=0,p=0;switch(t.inherit){case Ub.OnlyTranslation:f=(e-t.worldX)*lx.signum(t.skeleton.scaleX),p=(i-t.worldY)*lx.signum(t.skeleton.scaleY);break;case Ub.NoRotationOrReflection:var m=Math.abs(h*u-l*c)/Math.max(1e-4,h*h+c*c),g=h/t.skeleton.scaleX,v=c/t.skeleton.scaleY;l=-v*m*t.skeleton.scaleX,u=g*m*t.skeleton.scaleY,d+=Math.atan2(v,g)*lx.radDeg;default:var y=e-a.worldX,x=i-a.worldY,b=h*u-l*c;Math.abs(b)<=1e-4?(f=0,p=0):(f=(y*u-x*l)/b-t.ax,p=(x*h-y*c)/b-t.ay)}d+=Math.atan2(p,f)*lx.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var _=t.ascaleX,w=t.ascaleY;if(r||n){switch(t.inherit){case Ub.NoScale:case Ub.NoScaleOrReflection:f=e-t.worldX,p=i-t.worldY}var T=t.data.length*_;if(T>1e-4){var E=f*f+p*p;if(r&&E<T*T||n&&E>T*T){var S=(Math.sqrt(E)/T-1)*o+1;_*=S,s&&(w*=S)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*o,_,w,t.ashearX,t.ashearY)},e.apply2=function(t,e,i,r,n,s,o,a,h){if(t.inherit==Ub.Normal&&e.inherit==Ub.Normal){var l=t.ax,c=t.ay,u=t.ascaleX,d=t.ascaleY,f=u,p=d,m=e.ascaleX,g=0,v=0,y=0;u<0?(u=-u,g=180,y=-1):(g=0,y=1),d<0&&(d=-d,y=-y),m<0?(m=-m,v=180):v=0;var x=e.ax,b=0,_=0,w=0,T=t.a,E=t.b,S=t.c,I=t.d,A=Math.abs(u-d)<=1e-4;!A||s?(b=0,_=T*x+t.worldX,w=S*x+t.worldY):(_=T*x+E*(b=e.ay)+t.worldX,w=S*x+I*b+t.worldY);var C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");T=C.a,E=C.b,S=C.c;var P,M,R=T*(I=C.d)-E*S,O=_-C.worldX,D=w-C.worldY,k=(O*I-D*E)*(R=Math.abs(R)<=1e-4?0:1/R)-l,L=(D*T-O*S)*R-c,F=Math.sqrt(k*k+L*L),N=e.data.length*m;if(F<1e-4)return this.apply1(t,i,r,!1,s,!1,h),void e.updateWorldTransformWith(x,b,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((O=i-C.worldX)*I-(D=r-C.worldY)*E)*R-l,z=(D*T-O*S)*R-c,U=B*B+z*z;if(0!=a){a*=u*(m+1)*.5;var V=Math.sqrt(U),G=V-F-N*u+a;if(G>0){var j=Math.min(1,G/(2*a))-1;U=(B-=(j=(G-a*(1-j*j))/V)*B)*B+(z-=j*z)*z}}t:if(A){var H=(U-F*F-(N*=u)*N)/(2*F*N);H<-1?(H=-1,M=Math.PI*n):H>1?(H=1,M=0,s&&(f*=T=(Math.sqrt(U)/(F+N)-1)*h+1,o&&(p*=T))):M=Math.acos(H)*n,T=F+N*H,E=N*Math.sin(M),P=Math.atan2(z*T-B*E,B*T+z*E)}else{var W=(T=u*N)*T,X=(E=d*N)*E,Y=Math.atan2(z,B),q=-2*X*F,K=X-W;if((I=q*q-4*K*(S=X*F*F+W*U-W*X))>=0){var Z=Math.sqrt(I);q<0&&(Z=-Z);var J=(Z=.5*-(q+Z))/K,$=S/Z,Q=Math.abs(J)<Math.abs($)?J:$;if(Q*Q<=U){D=Math.sqrt(U-Q*Q)*n,P=Y-Math.atan2(D,Q),M=Math.atan2(D/d,(Q-F)/u);break t}}var tt=lx.PI,et=F-T,it=et*et,rt=0,nt=0,st=F+T,ot=st*st,at=0;(S=-T*F/(W-X))>=-1&&S<=1&&(S=Math.acos(S),(I=(O=T*Math.cos(S)+F)*O+(D=E*Math.sin(S))*D)<it&&(tt=S,it=I,et=O,rt=D),I>ot&&(nt=S,ot=I,st=O,at=D)),U<=.5*(it+ot)?(P=Y-Math.atan2(rt*n,et),M=tt*n):(P=Y-Math.atan2(at*n,st),M=nt*n)}var ht=Math.atan2(b,x)*y,lt=t.arotation;(P=(P-ht)*lx.radDeg+g-lt)>180?P-=360:P<-180&&(P+=360),t.updateWorldTransformWith(l,c,lt+P*h,f,p,0,0),lt=e.arotation,(M=((M+ht)*lx.radDeg-e.ashearX)*y+v-lt)>180?M-=360:M<-180&&(M+=360),e.updateWorldTransformWith(x,b,lt+M*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},t}(),e_=function(t){function e(e){var i;return(i=t.call(this,e,0,!1)||this).bones=new Array,i._target=null,i.bendDirection=0,i.compress=!1,i.stretch=!1,i.uniform=!1,i.mix=0,i.softness=0,i}return $y(e,t),ub(e,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),e}(Jb),i_=function(t){function e(e){var i;return(i=t.call(this,e,0,!1)||this).bones=new Array,i._target=null,i.positionMode=Hb.Fixed,i.spacingMode=Xb.Fixed,i.rotateMode=qb.Chain,i.offsetRotation=0,i.position=0,i.spacing=0,i.mixRotate=0,i.mixX=0,i.mixY=0,i}return $y(e,t),ub(e,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("SlotData not set.")},set:function(t){this._target=t}}]),e}(Jb);(Wb=Hb||(Hb={}))[Wb.Fixed=0]="Fixed",Wb[Wb.Percent=1]="Percent",(Yb=Xb||(Xb={}))[Yb.Length=0]="Length",Yb[Yb.Fixed=1]="Fixed",Yb[Yb.Percent=2]="Percent",Yb[Yb.Proportional=3]="Proportional",(Kb=qb||(qb={}))[Kb.Tangent=0]="Tangent",Kb[Kb.Chain=1]="Chain",Kb[Kb.ChainScale=2]="ChainScale";var r_=function(){function t(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0,r=t.bones.length;i<r;i++){var n=e.findBone(t.bones[i].name);if(!n)throw new Error("Couldn't find bone "+t.bones[i].name+".");this.bones.push(n)}var s=e.findSlot(t.target.name);if(!s)throw new Error("Couldn't find target bone "+t.target.name);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}var e=t.prototype;return e.isActive=function(){return this.active},e.setToSetupPose=function(){var t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY},e.update=function(e){var i=this.target.getAttachment();if(sx(i,Nb)){var r=this.mixRotate,n=this.mixX,s=this.mixY;if(0!=r||0!=n||0!=s){var o=this.data,a=o.rotateMode==qb.Tangent,h=o.rotateMode==qb.ChainScale,l=this.bones,c=l.length,u=a?c:c+1,d=cx.setArraySize(this.spaces,u),f=h?this.lengths=cx.setArraySize(this.lengths,c):[],p=this.spacing;switch(o.spacingMode){case Xb.Percent:if(h)for(var m=0,g=u-1;m<g;m++){var v=l[m],y=v.data.length,x=y*v.a,b=y*v.c;f[m]=Math.sqrt(x*x+b*b)}cx.arrayFill(d,1,u,p);break;case Xb.Proportional:for(var _=0,w=0,T=u-1;w<T;){var E=l[w],S=E.data.length;if(S<t.epsilon)h&&(f[w]=0),d[++w]=p;else{var I=S*E.a,A=S*E.c,C=Math.sqrt(I*I+A*A);h&&(f[w]=C),d[++w]=C,_+=C}}if(_>0){_=u/_*p;for(var P=1;P<u;P++)d[P]*=_}break;default:for(var M=o.spacingMode==Xb.Length,R=0,O=u-1;R<O;){var D=l[R],k=D.data.length;if(k<t.epsilon)h&&(f[R]=0),d[++R]=p;else{var L=k*D.a,F=k*D.c,N=Math.sqrt(L*L+F*F);h&&(f[R]=N),d[++R]=(M?k+p:p)*N/k}}}var B=this.computeWorldPositions(i,u,a),z=B[0],U=B[1],V=o.offsetRotation,G=!1;if(0==V)G=o.rotateMode==qb.Chain;else{G=!1;var j=this.target.bone;V*=j.a*j.d-j.b*j.c>0?lx.degRad:-lx.degRad}for(var H=0,W=3;H<c;H++,W+=3){var X=l[H];X.worldX+=(z-X.worldX)*n,X.worldY+=(U-X.worldY)*s;var Y=B[W],q=B[W+1],K=Y-z,Z=q-U;if(h){var J=f[H];if(0!=J){var $=(Math.sqrt(K*K+Z*Z)/J-1)*r+1;X.a*=$,X.c*=$}}if(z=Y,U=q,r>0){var Q=X.a,tt=X.b,et=X.c,it=X.d,rt=0,nt=0,st=0;if(rt=a?B[W-1]:0==d[H+1]?B[W+2]:Math.atan2(Z,K),rt-=Math.atan2(et,Q),G){nt=Math.cos(rt),st=Math.sin(rt);var ot=X.data.length;z+=(ot*(nt*Q-st*et)-K)*r,U+=(ot*(st*Q+nt*et)-Z)*r}else rt+=V;rt>lx.PI?rt-=lx.PI2:rt<-lx.PI&&(rt+=lx.PI2),rt*=r,nt=Math.cos(rt),st=Math.sin(rt),X.a=nt*Q-st*et,X.b=nt*tt-st*it,X.c=st*Q+nt*et,X.d=st*tt+nt*it}X.updateAppliedTransform()}}}},e.computeWorldPositions=function(e,i,r){var n=this.target,s=this.position,o=this.spaces,a=cx.setArraySize(this.positions,3*i+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,d=t.NONE;if(!e.constantSpeed){var f,p=e.lengths,m=p[u-=l?1:2];switch(this.data.positionMode==Hb.Percent&&(s*=m),this.data.spacingMode){case Xb.Percent:f=m;break;case Xb.Proportional:f=m/i;break;default:f=1}h=cx.setArraySize(this.world,8);for(var g=0,v=0,y=0;g<i;g++,v+=3){var x=o[g]*f,b=s+=x;if(l)(b%=m)<0&&(b+=m),y=0;else{if(b<0){d!=t.BEFORE&&(d=t.BEFORE,e.computeWorldVertices(n,2,4,h,0,2)),this.addBeforePosition(b,h,0,a,v);continue}if(b>m){d!=t.AFTER&&(d=t.AFTER,e.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(b-m,h,0,a,v);continue}}for(;;y++){var _=p[y];if(!(b>_)){if(0==y)b/=_;else{var w=p[y-1];b=(b-w)/(_-w)}break}}y!=d&&(d=y,l&&y==u?(e.computeWorldVertices(n,c-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,6*y+2,8,h,0,2)),this.addCurvePosition(b,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,v,r||g>0&&0==x)}return a}l?(c+=2,h=cx.setArraySize(this.world,c),e.computeWorldVertices(n,2,c-4,h,0,2),e.computeWorldVertices(n,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=cx.setArraySize(this.world,c),e.computeWorldVertices(n,2,c,h,0,2));for(var T,E=cx.setArraySize(this.curves,u),S=0,I=h[0],A=h[1],C=0,P=0,M=0,R=0,O=0,D=0,k=0,L=0,F=0,N=0,B=0,z=0,U=0,V=0,G=0,j=2;G<u;G++,j+=6)C=h[j],P=h[j+1],M=h[j+2],R=h[j+3],B=2*(k=.1875*(I-2*C+M))+(F=.09375*(3*(C-M)-I+(O=h[j+4]))),z=2*(L=.1875*(A-2*P+R))+(N=.09375*(3*(P-R)-A+(D=h[j+5]))),U=.75*(C-I)+k+.16666667*F,V=.75*(P-A)+L+.16666667*N,S+=Math.sqrt(U*U+V*V),U+=B,V+=z,B+=F,z+=N,S+=Math.sqrt(U*U+V*V),U+=B,V+=z,S+=Math.sqrt(U*U+V*V),U+=B+F,V+=z+N,S+=Math.sqrt(U*U+V*V),E[G]=S,I=O,A=D;switch(this.data.positionMode==Hb.Percent&&(s*=S),this.data.spacingMode){case Xb.Percent:T=S;break;case Xb.Proportional:T=S/i;break;default:T=1}for(var H=this.segments,W=0,X=0,Y=0,q=0,K=0;X<i;X++,Y+=3){var Z=o[X]*T,J=s+=Z;if(l)(J%=S)<0&&(J+=S),q=0;else{if(J<0){this.addBeforePosition(J,h,0,a,Y);continue}if(J>S){this.addAfterPosition(J-S,h,c-4,a,Y);continue}}for(;;q++){var $=E[q];if(!(J>$)){if(0==q)J/=$;else{var Q=E[q-1];J=(J-Q)/($-Q)}break}}if(q!=d){d=q;var tt=6*q;for(I=h[tt],A=h[tt+1],C=h[tt+2],P=h[tt+3],M=h[tt+4],R=h[tt+5],B=2*(k=.03*(I-2*C+M))+(F=.006*(3*(C-M)-I+(O=h[tt+6]))),z=2*(L=.03*(A-2*P+R))+(N=.006*(3*(P-R)-A+(D=h[tt+7]))),U=.3*(C-I)+k+.16666667*F,V=.3*(P-A)+L+.16666667*N,W=Math.sqrt(U*U+V*V),H[0]=W,tt=1;tt<8;tt++)U+=B,V+=z,B+=F,z+=N,W+=Math.sqrt(U*U+V*V),H[tt]=W;U+=B,V+=z,W+=Math.sqrt(U*U+V*V),H[8]=W,U+=B+F,V+=z+N,W+=Math.sqrt(U*U+V*V),H[9]=W,K=0}for(J*=W;;K++){var et=H[K];if(!(J>et)){if(0==K)J/=et;else{var it=H[K-1];J=K+(J-it)/(et-it)}break}}this.addCurvePosition(.1*J,I,A,C,P,M,R,O,D,a,Y,r||X>0&&0==Z)}return a},e.addBeforePosition=function(t,e,i,r,n){var s=e[i],o=e[i+1],a=e[i+2]-s,h=e[i+3]-o,l=Math.atan2(h,a);r[n]=s+t*Math.cos(l),r[n+1]=o+t*Math.sin(l),r[n+2]=l},e.addAfterPosition=function(t,e,i,r,n){var s=e[i+2],o=e[i+3],a=s-e[i],h=o-e[i+1],l=Math.atan2(h,a);r[n]=s+t*Math.cos(l),r[n+1]=o+t*Math.sin(l),r[n+2]=l},e.addCurvePosition=function(t,e,i,r,n,s,o,a,h,l,c,u){if(0==t||isNaN(t))return l[c]=e,l[c+1]=i,void(l[c+2]=Math.atan2(n-i,r-e));var d=t*t,f=d*t,p=1-t,m=p*p,g=m*p,v=p*t,y=3*v,x=p*y,b=y*t,_=e*g+r*x+s*b+a*f,w=i*g+n*x+o*b+h*f;l[c]=_,l[c+1]=w,u&&(l[c+2]=t<.001?Math.atan2(n-i,r-e):Math.atan2(w-(i*m+n*v*2+o*d),_-(e*m+r*v*2+s*d)))},t}();r_.NONE=-1,r_.BEFORE=-2,r_.AFTER=-3,r_.epsilon=1e-5;var n_,s_,o_=function(){function t(t,e){this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0,this.active=!1,this.remaining=0,this.lastTime=0,this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}var e=t.prototype;return e.reset=function(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0},e.setToSetupPose=function(){var t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix},e.isActive=function(){return this.active},e.update=function(t){var e=this.mix;if(0!=e){var i=this.data.x>0,r=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,s=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(t){case n_.none:return;case n_.reset:this.reset();case n_.update:var h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=this.skeleton.time;var l=o.worldX,c=o.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=c;else{var u=this.remaining,d=this.inertia,f=this.data.limit*h,p=this.data.step,m=this.skeleton.data.referenceScale,g=-1;if(i||r){if(i){var v=(this.ux-l)*d;this.xOffset+=v>f?f:v<-f?-f:v,this.ux=l}if(r){var y=(this.uy-c)*d;this.yOffset+=y>f?f:y<-f?-f:y,this.uy=c}if(u>=p){g=Math.pow(this.damping,60*p);var x=this.massInverse*p,b=this.strength,_=this.wind*m,w=(l_.yDown?-this.gravity:this.gravity)*m;do{i&&(this.xVelocity+=(_-this.xOffset*b)*x,this.xOffset+=this.xVelocity*p,this.xVelocity*=g),r&&(this.yVelocity-=(w+this.yOffset*b)*x,this.yOffset+=this.yVelocity*p,this.yVelocity*=g),u-=p}while(u>=p)}i&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(n||s){var T=Math.atan2(o.c,o.a),E=0,S=0,I=0,A=this.cx-o.worldX,C=this.cy-o.worldY;if(A>f?A=f:A<-f&&(A=-f),C>f?C=f:C<-f&&(C=-f),n){I=(this.data.rotate+this.data.shearX)*e;var P=Math.atan2(C+this.ty,A+this.tx)-T-this.rotateOffset*I;this.rotateOffset+=(P-Math.ceil(P*lx.invPI2-.5)*lx.PI2)*d,P=this.rotateOffset*I+T,E=Math.cos(P),S=Math.sin(P),s&&(P=a*o.getWorldScaleX())>0&&(this.scaleOffset+=(A*E+C*S)*d/P)}else{E=Math.cos(T),S=Math.sin(T);var M=a*o.getWorldScaleX();M>0&&(this.scaleOffset+=(A*E+C*S)*d/M)}if((u=this.remaining)>=p){-1==g&&(g=Math.pow(this.damping,60*p));for(var R=this.massInverse*p,O=this.strength,D=this.wind,k=l_.yDown?-this.gravity:this.gravity,L=a/m;;)if(u-=p,s&&(this.scaleVelocity+=(D*E-k*S-this.scaleOffset*O)*R,this.scaleOffset+=this.scaleVelocity*p,this.scaleVelocity*=g),n){if(this.rotateVelocity-=((D*S+k*E)*L+this.rotateOffset*O)*R,this.rotateOffset+=this.rotateVelocity*p,this.rotateVelocity*=g,u<p)break;var F=this.rotateOffset*I+T;E=Math.cos(F),S=Math.sin(F)}else if(u<p)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case n_.pose:i&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(n){var N=this.rotateOffset*e,B=0,z=0,U=0;if(this.data.shearX>0){var V=0;this.data.rotate>0&&(V=N*this.data.rotate,B=Math.sin(V),z=Math.cos(V),U=o.b,o.b=z*U-B*o.d,o.d=B*U+z*o.d),V+=N*this.data.shearX,B=Math.sin(V),z=Math.cos(V),U=o.a,o.a=z*U-B*o.c,o.c=B*U+z*o.c}else N*=this.data.rotate,B=Math.sin(N),z=Math.cos(N),U=o.a,o.a=z*U-B*o.c,o.c=B*U+z*o.c,U=o.b,o.b=z*U-B*o.d,o.d=B*U+z*o.d}if(s){var G=1+this.scaleOffset*e*this.data.scaleX;o.a*=G,o.c*=G}t!=n_.pose&&(this.tx=a*o.a,this.ty=a*o.c),o.updateAppliedTransform()}},e.translate=function(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e},e.rotate=function(t,e,i){var r=i*lx.degRad,n=Math.cos(r),s=Math.sin(r),o=this.cx-t,a=this.cy-e;this.translate(o*n-a*s-o,o*s+a*n-a)},ub(t,[{key:"bone",get:function(){if(this._bone)return this._bone;throw new Error("Bone not set.")},set:function(t){this._bone=t}}]),t}(),a_=function(){function t(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new hx,this.darkColor=t.darkColor?new hx:null,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(sx(t,px)&&sx(this.attachment,px)&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null},t}(),h_=function(){function t(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new dx,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0;i<t.bones.length;i++){var r=e.findBone(t.bones[i].name);if(!r)throw new Error("Couldn't find bone "+t.bones[i].name+".");this.bones.push(r)}var n=e.findBone(t.target.name);if(!n)throw new Error("Couldn't find target bone "+t.target.name+".");this.target=n,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}var e=t.prototype;return e.isActive=function(){return this.active},e.setToSetupPose=function(){var t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY},e.update=function(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())},e.applyAbsoluteWorld=function(){for(var t=this.mixRotate,e=this.mixX,i=this.mixY,r=this.mixScaleX,n=this.mixScaleY,s=this.mixShearY,o=0!=e||0!=i,a=this.target,h=a.a,l=a.b,c=a.c,u=a.d,d=h*u-l*c>0?lx.degRad:-lx.degRad,f=this.data.offsetRotation*d,p=this.data.offsetShearY*d,m=this.bones,g=0,v=m.length;g<v;g++){var y=m[g];if(0!=t){var x=y.a,b=y.b,_=y.c,w=y.d,T=Math.atan2(c,h)-Math.atan2(_,x)+f;T>lx.PI?T-=lx.PI2:T<-lx.PI&&(T+=lx.PI2),T*=t;var E=Math.cos(T),S=Math.sin(T);y.a=E*x-S*_,y.b=E*b-S*w,y.c=S*x+E*_,y.d=S*b+E*w}if(o){var I=this.temp;a.localToWorld(I.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(I.x-y.worldX)*e,y.worldY+=(I.y-y.worldY)*i}if(0!=r){var A=Math.sqrt(y.a*y.a+y.c*y.c);0!=A&&(A=(A+(Math.sqrt(h*h+c*c)-A+this.data.offsetScaleX)*r)/A),y.a*=A,y.c*=A}if(0!=n){var C=Math.sqrt(y.b*y.b+y.d*y.d);0!=C&&(C=(C+(Math.sqrt(l*l+u*u)-C+this.data.offsetScaleY)*n)/C),y.b*=C,y.d*=C}if(s>0){var P=y.b,M=y.d,R=Math.atan2(M,P),O=Math.atan2(u,l)-Math.atan2(c,h)-(R-Math.atan2(y.c,y.a));O>lx.PI?O-=lx.PI2:O<-lx.PI&&(O+=lx.PI2),O=R+(O+p)*s;var D=Math.sqrt(P*P+M*M);y.b=Math.cos(O)*D,y.d=Math.sin(O)*D}y.updateAppliedTransform()}},e.applyRelativeWorld=function(){for(var t=this.mixRotate,e=this.mixX,i=this.mixY,r=this.mixScaleX,n=this.mixScaleY,s=this.mixShearY,o=0!=e||0!=i,a=this.target,h=a.a,l=a.b,c=a.c,u=a.d,d=h*u-l*c>0?lx.degRad:-lx.degRad,f=this.data.offsetRotation*d,p=this.data.offsetShearY*d,m=this.bones,g=0,v=m.length;g<v;g++){var y=m[g];if(0!=t){var x=y.a,b=y.b,_=y.c,w=y.d,T=Math.atan2(c,h)+f;T>lx.PI?T-=lx.PI2:T<-lx.PI&&(T+=lx.PI2),T*=t;var E=Math.cos(T),S=Math.sin(T);y.a=E*x-S*_,y.b=E*b-S*w,y.c=S*x+E*_,y.d=S*b+E*w}if(o){var I=this.temp;a.localToWorld(I.set(this.data.offsetX,this.data.offsetY)),y.worldX+=I.x*e,y.worldY+=I.y*i}if(0!=r){var A=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleX)*r+1;y.a*=A,y.c*=A}if(0!=n){var C=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleY)*n+1;y.b*=C,y.d*=C}if(s>0){var P=Math.atan2(u,l)-Math.atan2(c,h);P>lx.PI?P-=lx.PI2:P<-lx.PI&&(P+=lx.PI2);var M=y.b,R=y.d;P=Math.atan2(R,M)+(P-lx.PI/2+p)*s;var O=Math.sqrt(M*M+R*R);y.b=Math.cos(P)*O,y.d=Math.sin(P)*O}y.updateAppliedTransform()}},e.applyAbsoluteLocal=function(){for(var t=this.mixRotate,e=this.mixX,i=this.mixY,r=this.mixScaleX,n=this.mixScaleY,s=this.mixShearY,o=this.target,a=this.bones,h=0,l=a.length;h<l;h++){var c=a[h],u=c.arotation;0!=t&&(u+=(o.arotation-u+this.data.offsetRotation)*t);var d=c.ax,f=c.ay;d+=(o.ax-d+this.data.offsetX)*e,f+=(o.ay-f+this.data.offsetY)*i;var p=c.ascaleX,m=c.ascaleY;0!=r&&0!=p&&(p=(p+(o.ascaleX-p+this.data.offsetScaleX)*r)/p),0!=n&&0!=m&&(m=(m+(o.ascaleY-m+this.data.offsetScaleY)*n)/m);var g=c.ashearY;0!=s&&(g+=(o.ashearY-g+this.data.offsetShearY)*s),c.updateWorldTransformWith(d,f,u,p,m,c.ashearX,g)}},e.applyRelativeLocal=function(){for(var t=this.mixRotate,e=this.mixX,i=this.mixY,r=this.mixScaleX,n=this.mixScaleY,s=this.mixShearY,o=this.target,a=this.bones,h=0,l=a.length;h<l;h++){var c=a[h],u=c.arotation+(o.arotation+this.data.offsetRotation)*t,d=c.ax+(o.ax+this.data.offsetX)*e,f=c.ay+(o.ay+this.data.offsetY)*i,p=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),m=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*n+1),g=c.ashearY+(o.ashearY+this.data.offsetShearY)*s;c.updateWorldTransformWith(d,f,u,p,m,c.ashearX,g)}},t}(),l_=function(){function t(t){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var i=t.bones[e],r=void 0;if(i.parent){var n=this.bones[i.parent.index];r=new Zb(i,this,n),n.children.push(r)}else r=new Zb(i,this,null);this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var s=0;s<t.slots.length;s++){var o=t.slots[s],a=this.bones[o.boneData.index],h=new a_(o,a);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var c=t.ikConstraints[l];this.ikConstraints.push(new t_(c,this))}this.transformConstraints=new Array;for(var u=0;u<t.transformConstraints.length;u++){var d=t.transformConstraints[u];this.transformConstraints.push(new h_(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var p=t.pathConstraints[f];this.pathConstraints.push(new r_(p,this))}this.physicsConstraints=new Array;for(var m=0;m<t.physicsConstraints.length;m++){var g=t.physicsConstraints[m];this.physicsConstraints.push(new o_(g,this))}this.color=new hx(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){this._updateCache.length=0;for(var t=this.bones,e=0,i=t.length;e<i;e++){var r=t[e];r.sorted=r.data.skinRequired,r.active=!r.sorted}if(this.skin)for(var n=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var a=this.bones[n[s].index];do{a.sorted=!1,a.active=!0,a=a.parent}while(a)}var h=this.ikConstraints,l=this.transformConstraints,c=this.pathConstraints,u=this.physicsConstraints,d=h.length,f=l.length,p=c.length,m=this.physicsConstraints.length,g=d+f+p+m;t:for(var v=0;v<g;v++){for(var y=0;y<d;y++){var x=h[y];if(x.data.order==v){this.sortIkConstraint(x);continue t}}for(var b=0;b<f;b++){var _=l[b];if(_.data.order==v){this.sortTransformConstraint(_);continue t}}for(var w=0;w<p;w++){var T=c[w];if(T.data.order==v){this.sortPathConstraint(T);continue t}}for(var E=0;E<m;E++){var S=u[E];if(S.data.order==v){this.sortPhysicsConstraint(S);continue t}}}for(var I=0,A=t.length;I<A;I++)this.sortBone(t[I])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&cx.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var i=t.bones,r=i[0];if(this.sortBone(r),1==i.length)this._updateCache.push(t),this.sortReset(r.children);else{var n=i[i.length-1];this.sortBone(n),this._updateCache.push(t),this.sortReset(r.children),n.sorted=!0}}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&cx.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,i=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(var n=0,s=this.data.skins.length;n<s;n++)this.sortPathConstraintAttachment(this.data.skins[n],i,r);var o=e.getAttachment();sx(o,Nb)&&this.sortPathConstraintAttachmentWith(o,r);for(var a=t.bones,h=a.length,l=0;l<h;l++)this.sortBone(a[l]);this._updateCache.push(t);for(var c=0;c<h;c++)this.sortReset(a[c].children);for(var u=0;u<h;u++)a[u].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&cx.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,i=e.length;if(t.data.local)for(var r=0;r<i;r++){var n=e[r];this.sortBone(n.parent),this.sortBone(n)}else for(var s=0;s<i;s++)this.sortBone(e[s]);this._updateCache.push(t);for(var o=0;o<i;o++)this.sortReset(e[o].children);for(var a=0;a<i;a++)e[a].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,i){var r=t.attachments[e];if(r)for(var n in r)this.sortPathConstraintAttachmentWith(r[n],i)},e.sortPathConstraintAttachmentWith=function(t,e){if(sx(t,Nb)){var i=t.bones;if(i)for(var r=this.bones,n=0,s=i.length;n<s;){var o=i[n++];for(o+=n;n<o;)this.sortBone(r[i[n++]])}else this.sortBone(e)}},e.sortPhysicsConstraint=function(t){var e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&cx.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)},e.sortBone=function(t){if(t&&!t.sorted){var e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,i=t.length;e<i;e++){var r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}},e.updateWorldTransform=function(t){if(null==t)throw new Error("physics is undefined");for(var e=this.bones,i=0,r=e.length;i<r;i++){var n=e[i];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY}for(var s=this._updateCache,o=0,a=s.length;o<a;o++)s[o].update(t)},e.updateWorldTransformWith=function(t,e){var i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");var r=e.a,n=e.b,s=e.c,o=e.d;i.worldX=r*this.x+n*this.y+e.worldX,i.worldY=s*this.x+o*this.y+e.worldY;var a=(i.rotation+i.shearX)*lx.degRad,h=(i.rotation+90+i.shearY)*lx.degRad,l=Math.cos(a)*i.scaleX,c=Math.cos(h)*i.scaleY,u=Math.sin(a)*i.scaleX,d=Math.sin(h)*i.scaleY;i.a=(r*l+n*u)*this.scaleX,i.b=(r*c+n*d)*this.scaleX,i.c=(s*l+o*u)*this.scaleY,i.d=(s*c+o*d)*this.scaleY;for(var f=this._updateCache,p=0,m=f.length;p<m;p++){var g=f[p];g!=i&&g.update(t)}},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t,e=nx(this.bones);!(t=e()).done;){t.value.setToSetupPose()}for(var i,r=nx(this.ikConstraints);!(i=r()).done;){i.value.setToSetupPose()}for(var n,s=nx(this.transformConstraints);!(n=s()).done;){n.value.setToSetupPose()}for(var o,a=nx(this.pathConstraints);!(o=a()).done;){o.value.setToSetupPose()}for(var h,l=nx(this.physicsConstraints);!(h=l()).done;){h.value.setToSetupPose()}},e.setSlotsToSetupPose=function(){var t=this.slots;cx.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,i=t.length;e<i;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(!t)throw new Error("boneName cannot be null.");for(var e=this.bones,i=0,r=e.length;i<r;i++){var n=e[i];if(n.data.name==t)return n}return null},e.findSlot=function(t){if(!t)throw new Error("slotName cannot be null.");for(var e=this.slots,i=0,r=e.length;i<r;i++){var n=e[i];if(n.data.name==t)return n}return null},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,i=0,r=e.length;i<r;i++){var n=e[i],s=n.data.attachmentName;if(s){var o=t.getAttachment(i,s);o&&n.setAttachment(o)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){var i=this.data.findSlot(t);if(!i)throw new Error("Can't find slot with name "+t);return this.getAttachment(i.index,e)},e.getAttachment=function(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){var i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(!t)throw new Error("slotName cannot be null.");for(var i=this.slots,r=0,n=i.length;r<n;r++){var s=i[r];if(s.data.name==t){var o=null;if(e&&!(o=this.getAttachment(r,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void s.setAttachment(o)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");var e;return null!=(e=this.ikConstraints.find(function(e){return e.data.name==t}))?e:null},e.findTransformConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");var e;return null!=(e=this.transformConstraints.find(function(e){return e.data.name==t}))?e:null},e.findPathConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");var e;return null!=(e=this.pathConstraints.find(function(e){return e.data.name==t}))?e:null},e.findPhysicsConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");var e;return null!=(e=this.physicsConstraints.find(function(e){return e.data.name==t}))?e:null},e.getBoundsRect=function(){var t=new dx,e=new dx;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}},e.getBounds=function(e,i,r,n){if(void 0===r&&(r=new Array(2)),void 0===n&&(n=null),!e)throw new Error("offset cannot be null.");if(!i)throw new Error("size cannot be null.");for(var s=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=0,u=s.length;c<u;c++){var d=s[c];if(d.bone.active){var f=0,p=null,m=null,g=d.getAttachment();if(sx(g,zb))f=8,p=cx.setArraySize(r,f,0),g.computeWorldVertices(d,p,0,2),m=t.quadTriangles;else if(sx(g,Fb)){var v=g;f=v.worldVerticesLength,p=cx.setArraySize(r,f,0),v.computeWorldVertices(d,0,f,p,0,2),m=v.triangles}else if(sx(g,Mb)&&null!=n){n.clipStart(d,g);continue}if(p&&m){null!=n&&n.isClipping()&&(n.clipTriangles(p,f,m,m.length),p=n.clippedVertices,f=n.clippedVertices.length);for(var y=0,x=p.length;y<x;y+=2){var b=p[y],_=p[y+1];o=Math.min(o,b),a=Math.min(a,_),h=Math.max(h,b),l=Math.max(l,_)}}null!=n&&n.clipEndWithSlot(d)}}null!=n&&n.clipEnd(),e.set(o,a),i.set(h-o,l-a)},e.update=function(t){this.time+=t},e.physicsTranslate=function(t,e){for(var i=this.physicsConstraints,r=0,n=i.length;r<n;r++)i[r].translate(t,e)},e.physicsRotate=function(t,e,i){for(var r=this.physicsConstraints,n=0,s=r.length;n<s;n++)r[n].rotate(t,e,i)},ub(t,[{key:"scaleY",get:function(){return t.yDown?-this._scaleY:this._scaleY},set:function(t){this._scaleY=t}}]),t}();l_.quadTriangles=[0,1,2,2,3,0],l_.yDown=!1,(s_=n_||(n_={}))[s_.none=0]="none",s_[s_.reset=1]="reset",s_[s_.update=2]="update",s_[s_.pose=3]="pose";var c_,u_,d_=function(t){function e(e){var i;return(i=t.call(this,e,0,!1)||this)._bone=null,i.x=0,i.y=0,i.rotate=0,i.scaleX=0,i.shearX=0,i.limit=0,i.step=0,i.inertia=0,i.strength=0,i.damping=0,i.massInverse=0,i.wind=0,i.gravity=0,i.mix=0,i.inertiaGlobal=!1,i.strengthGlobal=!1,i.dampingGlobal=!1,i.massGlobal=!1,i.windGlobal=!1,i.gravityGlobal=!1,i.mixGlobal=!1,i}return $y(e,t),ub(e,[{key:"bone",get:function(){if(this._bone)return this._bone;throw new Error("BoneData not set.")},set:function(t){this._bone=t}}]),e}(Jb),f_=function(){function t(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}var e=t.prototype;return e.findBone=function(t){if(!t)throw new Error("boneName cannot be null.");for(var e=this.bones,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findSlot=function(t){if(!t)throw new Error("slotName cannot be null.");for(var e=this.slots,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findSkin=function(t){if(!t)throw new Error("skinName cannot be null.");for(var e=this.skins,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findEvent=function(t){if(!t)throw new Error("eventDataName cannot be null.");for(var e=this.events,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findAnimation=function(t){if(!t)throw new Error("animationName cannot be null.");for(var e=this.animations,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findIkConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findTransformConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findPathConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},e.findPhysicsConstraint=function(t){if(!t)throw new Error("constraintName cannot be null.");for(var e=this.physicsConstraints,i=0,r=e.length;i<r;i++){var n=e[i];if(n.name==t)return n}return null},t}(),p_=function(t,e,i){void 0===t&&(t=0),this.slotIndex=t,this.name=e,this.attachment=i},m_=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new hx(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,i){if(!i)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=i},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var i=t.bones[e],r=!1,n=0;n<this.bones.length;n++)if(this.bones[n]==i){r=!0;break}r||this.bones.push(i)}for(var s=0;s<t.constraints.length;s++){for(var o=t.constraints[s],a=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==o){a=!0;break}a||this.constraints.push(o)}for(var l=t.getAttachments(),c=0;c<l.length;c++){var u=l[c];this.setAttachment(u.slotIndex,u.name,u.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var i=t.bones[e],r=!1,n=0;n<this.bones.length;n++)if(this.bones[n]==i){r=!0;break}r||this.bones.push(i)}for(var s=0;s<t.constraints.length;s++){for(var o=t.constraints[s],a=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==o){a=!0;break}a||this.constraints.push(o)}for(var l=t.getAttachments(),c=0;c<l.length;c++){var u=l[c];u.attachment&&(sx(u.attachment,Fb)?(u.attachment=u.attachment.newLinkedMesh(),this.setAttachment(u.slotIndex,u.name,u.attachment)):(u.attachment=u.attachment.copy(),this.setAttachment(u.slotIndex,u.name,u.attachment)))}},e.getAttachment=function(t,e){var i=this.attachments[t];return i?i[e]:null},e.removeAttachment=function(t,e){var i=this.attachments[t];i&&delete i[e]},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var i=this.attachments[e];if(i)for(var r in i){var n=i[r];n&&t.push(new p_(e,r,n))}}return t},e.getAttachmentsForSlot=function(t,e){var i=this.attachments[t];if(i)for(var r in i){var n=i[r];n&&e.push(new p_(t,r,n))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var i=0,r=0;r<t.slots.length;r++){var n=t.slots[r],s=n.getAttachment();if(s&&i<e.attachments.length){var o=e.attachments[i];for(var a in o){if(s==o[a]){var h=this.getAttachment(i,a);h&&n.setAttachment(h);break}}}i++}},t}(),g_=function(t,e,i){if(this.index=0,this.color=new hx(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=c_.Normal,this.visible=!0,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=i};(u_=c_||(c_={}))[u_.Normal=0]="Normal",u_[u_.Additive=1]="Additive",u_[u_.Multiply=2]="Multiply",u_[u_.Screen=3]="Screen";var v_,y_,x_=function(t){function e(e){var i;return(i=t.call(this,e,0,!1)||this).bones=new Array,i._target=null,i.mixRotate=0,i.mixX=0,i.mixY=0,i.mixScaleX=0,i.mixScaleY=0,i.mixShearY=0,i.offsetRotation=0,i.offsetX=0,i.offsetY=0,i.offsetScaleX=0,i.offsetScaleY=0,i.offsetShearY=0,i.relative=!1,i.local=!1,i}return $y(e,t),ub(e,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),e}(Jb),b_=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(t){var e=this.scale,i=new f_;i.name="";var r=new __(t),n=r.readInt32(),s=r.readInt32();i.hash=0==s&&0==n?null:s.toString(16)+n.toString(16),i.version=r.readString(),i.x=r.readFloat(),i.y=r.readFloat(),i.width=r.readFloat(),i.height=r.readFloat(),i.referenceScale=r.readFloat()*e;var o=r.readBoolean();o&&(i.fps=r.readFloat(),i.imagesPath=r.readString(),i.audioPath=r.readString());var a=0;a=r.readInt(!0);for(var h=0;h<a;h++){var l=r.readString();if(!l)throw new Error("String in string table must not be null.");r.strings.push(l)}a=r.readInt(!0);for(var c=0;c<a;c++){var u=r.readString();if(!u)throw new Error("Bone name must not be null.");var d,f=0==c?null:i.bones[r.readInt(!0)],p=new jb(c,u,f);if(p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.inherit=r.readByte(),p.skinRequired=r.readBoolean(),o)hx.rgba8888ToColor(p.color,r.readInt32()),p.icon=null!=(d=r.readString())?d:void 0,p.visible=r.readBoolean();i.bones.push(p)}a=r.readInt(!0);for(var m=0;m<a;m++){var g=r.readString();if(!g)throw new Error("Slot name must not be null.");var v=i.bones[r.readInt(!0)],y=new g_(m,g,v);hx.rgba8888ToColor(y.color,r.readInt32());var x=r.readInt32();-1!=x&&hx.rgb888ToColor(y.darkColor=new hx,x),y.attachmentName=r.readStringRef(),y.blendMode=r.readInt(!0),o&&(y.visible=r.readBoolean()),i.slots.push(y)}a=r.readInt(!0);for(var b,_=0;_<a;_++){var w=r.readString();if(!w)throw new Error("IK constraint data name must not be null.");var T=new e_(w);T.order=r.readInt(!0),b=r.readInt(!0);for(var E=0;E<b;E++)T.bones.push(i.bones[r.readInt(!0)]);T.target=i.bones[r.readInt(!0)];var S=r.readByte();T.skinRequired=!!(1&S),T.bendDirection=2&S?1:-1,T.compress=!!(4&S),T.stretch=!!(8&S),T.uniform=!!(16&S),32&S&&(T.mix=64&S?r.readFloat():1),128&S&&(T.softness=r.readFloat()*e),i.ikConstraints.push(T)}a=r.readInt(!0);for(var I,A=0;A<a;A++){var C=r.readString();if(!C)throw new Error("Transform constraint data name must not be null.");var P=new x_(C);P.order=r.readInt(!0),I=r.readInt(!0);for(var M=0;M<I;M++)P.bones.push(i.bones[r.readInt(!0)]);P.target=i.bones[r.readInt(!0)];var R=r.readByte();P.skinRequired=!!(1&R),P.local=!!(2&R),P.relative=!!(4&R),8&R&&(P.offsetRotation=r.readFloat()),16&R&&(P.offsetX=r.readFloat()*e),32&R&&(P.offsetY=r.readFloat()*e),64&R&&(P.offsetScaleX=r.readFloat()),128&R&&(P.offsetScaleY=r.readFloat()),1&(R=r.readByte())&&(P.offsetShearY=r.readFloat()),2&R&&(P.mixRotate=r.readFloat()),4&R&&(P.mixX=r.readFloat()),8&R&&(P.mixY=r.readFloat()),16&R&&(P.mixScaleX=r.readFloat()),32&R&&(P.mixScaleY=r.readFloat()),64&R&&(P.mixShearY=r.readFloat()),i.transformConstraints.push(P)}a=r.readInt(!0);for(var O,D=0;D<a;D++){var k=r.readString();if(!k)throw new Error("Path constraint data name must not be null.");var L=new i_(k);L.order=r.readInt(!0),L.skinRequired=r.readBoolean(),O=r.readInt(!0);for(var F=0;F<O;F++)L.bones.push(i.bones[r.readInt(!0)]);L.target=i.slots[r.readInt(!0)];var N=r.readByte();L.positionMode=1&N,L.spacingMode=N>>1&3,L.rotateMode=N>>3&3,128&N&&(L.offsetRotation=r.readFloat()),L.position=r.readFloat(),L.positionMode==Hb.Fixed&&(L.position*=e),L.spacing=r.readFloat(),L.spacingMode!=Xb.Length&&L.spacingMode!=Xb.Fixed||(L.spacing*=e),L.mixRotate=r.readFloat(),L.mixX=r.readFloat(),L.mixY=r.readFloat(),i.pathConstraints.push(L)}a=r.readInt(!0);for(var B=0;B<a;B++){var z=r.readString();if(!z)throw new Error("Physics constraint data name must not be null.");var U=new d_(z);U.order=r.readInt(!0),U.bone=i.bones[r.readInt(!0)];var V=r.readByte();U.skinRequired=!!(1&V),2&V&&(U.x=r.readFloat()),4&V&&(U.y=r.readFloat()),8&V&&(U.rotate=r.readFloat()),16&V&&(U.scaleX=r.readFloat()),32&V&&(U.shearX=r.readFloat()),U.limit=(64&V?r.readFloat():5e3)*e,U.step=1/r.readUnsignedByte(),U.inertia=r.readFloat(),U.strength=r.readFloat(),U.damping=r.readFloat(),U.massInverse=128&V?r.readFloat():1,U.wind=r.readFloat(),U.gravity=r.readFloat(),1&(V=r.readByte())&&(U.inertiaGlobal=!0),2&V&&(U.strengthGlobal=!0),4&V&&(U.dampingGlobal=!0),8&V&&(U.massGlobal=!0),16&V&&(U.windGlobal=!0),32&V&&(U.gravityGlobal=!0),64&V&&(U.mixGlobal=!0),U.mix=128&V?r.readFloat():1,i.physicsConstraints.push(U)}var G=this.readSkin(r,i,!0,o);G&&(i.defaultSkin=G,i.skins.push(G));var j=i.skins.length;for(cx.setArraySize(i.skins,a=j+r.readInt(!0));j<a;j++){var H=this.readSkin(r,i,!1,o);if(!H)throw new Error("readSkin() should not have returned null.");i.skins[j]=H}a=this.linkedMeshes.length;for(var W=0;W<a;W++){var X=this.linkedMeshes[W],Y=i.skins[X.skinIndex];if(!X.parent)throw new Error("Linked mesh parent must not be null");var q=Y.getAttachment(X.slotIndex,X.parent);if(!q)throw new Error("Parent mesh not found: "+X.parent);X.mesh.timelineAttachment=X.inheritTimeline?q:X.mesh,X.mesh.setParentMesh(q),null!=X.mesh.region&&X.mesh.updateRegion()}this.linkedMeshes.length=0,a=r.readInt(!0);for(var K=0;K<a;K++){var Z=r.readString();if(!Z)throw new Error("Event data name must not be null");var J=new Qb(Z);J.intValue=r.readInt(!1),J.floatValue=r.readFloat(),J.stringValue=r.readString(),J.audioPath=r.readString(),J.audioPath&&(J.volume=r.readFloat(),J.balance=r.readFloat()),i.events.push(J)}a=r.readInt(!0);for(var $=0;$<a;$++){var Q=r.readString();if(!Q)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(r,Q,i))}return i},e.readSkin=function(t,e,i,r){var n=null,s=0;if(i){if(0==(s=t.readInt(!0)))return null;n=new m_("default")}else{var o=t.readString();if(!o)throw new Error("Skin name must not be null.");n=new m_(o),r&&hx.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(var a=0,h=n.bones.length;a<h;a++)n.bones[a]=e.bones[t.readInt(!0)];for(var l=0,c=t.readInt(!0);l<c;l++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,d=t.readInt(!0);u<d;u++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var f=0,p=t.readInt(!0);f<p;f++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(var m=0,g=t.readInt(!0);m<g;m++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);s=t.readInt(!0)}for(var v=0;v<s;v++)for(var y=t.readInt(!0),x=0,b=t.readInt(!0);x<b;x++){var _=t.readStringRef();if(!_)throw new Error("Attachment name must not be null");var w=this.readAttachment(t,e,n,y,_,r);w&&n.setAttachment(y,_,w)}return n},e.readAttachment=function(t,e,i,r,n,s){var o=this.scale,a=t.readByte(),h=8&a?t.readStringRef():n;if(!h)throw new Error("Attachment name must not be null");switch(7&a){case v_.Region:var l=16&a?t.readStringRef():null,c=32&a?t.readInt32():4294967295,u=64&a?this.readSequence(t):null,d=128&a?t.readFloat():0,f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),v=t.readFloat(),y=t.readFloat();l||(l=h);var x=this.attachmentLoader.newRegionAttachment(i,h,l,u);return x?(x.path=l,x.x=f*o,x.y=p*o,x.scaleX=m,x.scaleY=g,x.rotation=d,x.width=v*o,x.height=y*o,hx.rgba8888ToColor(x.color,c),x.sequence=u,null==u&&x.updateRegion(),x):null;case v_.BoundingBox:var b=this.readVertices(t,!!(16&a)),_=s?t.readInt32():0,w=this.attachmentLoader.newBoundingBoxAttachment(i,h);return w?(w.worldVerticesLength=b.length,w.vertices=b.vertices,w.bones=b.bones,s&&hx.rgba8888ToColor(w.color,_),w):null;case v_.Mesh:var T=16&a?t.readStringRef():h,E=32&a?t.readInt32():4294967295,S=64&a?this.readSequence(t):null,I=t.readInt(!0),A=this.readVertices(t,!!(128&a)),C=this.readFloatArray(t,A.length,1),P=this.readShortArray(t,3*(A.length-I-2)),M=[],R=0,O=0;s&&(M=this.readShortArray(t,t.readInt(!0)),R=t.readFloat(),O=t.readFloat()),T||(T=h);var D=this.attachmentLoader.newMeshAttachment(i,h,T,S);return D?(D.path=T,hx.rgba8888ToColor(D.color,E),D.bones=A.bones,D.vertices=A.vertices,D.worldVerticesLength=A.length,D.triangles=P,D.regionUVs=C,null==S&&D.updateRegion(),D.hullLength=I<<1,D.sequence=S,s&&(D.edges=M,D.width=R*o,D.height=O*o),D):null;case v_.LinkedMesh:var k=16&a?t.readStringRef():h;if(null==k)throw new Error("Path of linked mesh must not be null");var L=32&a?t.readInt32():4294967295,F=64&a?this.readSequence(t):null,N=!!(128&a),B=t.readInt(!0),z=t.readStringRef(),U=0,V=0;s&&(U=t.readFloat(),V=t.readFloat());var G=this.attachmentLoader.newMeshAttachment(i,h,k,F);return G?(G.path=k,hx.rgba8888ToColor(G.color,L),G.sequence=F,s&&(G.width=U*o,G.height=V*o),this.linkedMeshes.push(new w_(G,B,r,z,N)),G):null;case v_.Path:for(var j=!!(16&a),H=!!(32&a),W=this.readVertices(t,!!(64&a)),X=cx.newArray(W.length/6,0),Y=0,q=X.length;Y<q;Y++)X[Y]=t.readFloat()*o;var K=s?t.readInt32():0,Z=this.attachmentLoader.newPathAttachment(i,h);return Z?(Z.closed=j,Z.constantSpeed=H,Z.worldVerticesLength=W.length,Z.vertices=W.vertices,Z.bones=W.bones,Z.lengths=X,s&&hx.rgba8888ToColor(Z.color,K),Z):null;case v_.Point:var J=t.readFloat(),$=t.readFloat(),Q=t.readFloat(),tt=s?t.readInt32():0,et=this.attachmentLoader.newPointAttachment(i,h);return et?(et.x=$*o,et.y=Q*o,et.rotation=J,s&&hx.rgba8888ToColor(et.color,tt),et):null;case v_.Clipping:var it=t.readInt(!0),rt=this.readVertices(t,!!(16&a)),nt=s?t.readInt32():0,st=this.attachmentLoader.newClippingAttachment(i,h);return st?(st.endSlot=e.slots[it],st.worldVerticesLength=rt.length,st.vertices=rt.vertices,st.bones=rt.bones,s&&hx.rgba8888ToColor(st.color,nt),st):null}return null},e.readSequence=function(t){var e=new vx(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e},e.readVertices=function(t,e){var i=this.scale,r=t.readInt(!0),n=new T_;if(n.length=r<<1,!e)return n.vertices=this.readFloatArray(t,n.length,i),n;for(var s=new Array,o=new Array,a=0;a<r;a++){var h=t.readInt(!0);o.push(h);for(var l=0;l<h;l++)o.push(t.readInt(!0)),s.push(t.readFloat()*i),s.push(t.readFloat()*i),s.push(t.readFloat())}return n.vertices=cx.toFloatArray(s),n.bones=o,n},e.readFloatArray=function(t,e,i){var r=new Array(e);if(1==i)for(var n=0;n<e;n++)r[n]=t.readFloat();else for(var s=0;s<e;s++)r[s]=t.readFloat()*i;return r},e.readShortArray=function(t,e){for(var i=new Array(e),r=0;r<e;r++)i[r]=t.readInt(!0);return i},e.readAnimation=function(t,e,i){t.readInt(!0);for(var r=new Array,n=this.scale,s=0,o=t.readInt(!0);s<o;s++)for(var a=t.readInt(!0),h=0,l=t.readInt(!0);h<l;h++){var c=t.readByte(),u=t.readInt(!0),d=u-1;switch(c){case B_:for(var f=new Wx(u,a),p=0;p<u;p++)f.setFrame(p,t.readFloat(),t.readStringRef());r.push(f);break;case z_:for(var m=t.readInt(!0),g=new Ux(u,m,a),v=t.readFloat(),y=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255,w=0,T=0;g.setFrame(w,v,y,x,b,_),w!=d;w++){var E=t.readFloat(),S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;switch(t.readByte()){case rw:g.setStepped(w);break;case nw:I_(t,g,T++,w,0,v,E,y,S,1),I_(t,g,T++,w,1,v,E,x,I,1),I_(t,g,T++,w,2,v,E,b,A,1),I_(t,g,T++,w,3,v,E,_,C,1)}v=E,y=S,x=I,b=A,_=C}r.push(g);break;case U_:for(var P=t.readInt(!0),M=new Vx(u,P,a),R=t.readFloat(),O=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,L=0,F=0;M.setFrame(L,R,O,D,k),L!=d;L++){var N=t.readFloat(),B=t.readUnsignedByte()/255,z=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case rw:M.setStepped(L);break;case nw:I_(t,M,F++,L,0,R,N,O,B,1),I_(t,M,F++,L,1,R,N,D,z,1),I_(t,M,F++,L,2,R,N,k,U,1)}R=N,O=B,D=z,k=U}r.push(M);break;case V_:for(var V=t.readInt(!0),G=new jx(u,V,a),j=t.readFloat(),H=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,K=t.readUnsignedByte()/255,Z=t.readUnsignedByte()/255,J=0,$=0;G.setFrame(J,j,H,W,X,Y,q,K,Z),J!=d;J++){var Q=t.readFloat(),tt=t.readUnsignedByte()/255,et=t.readUnsignedByte()/255,it=t.readUnsignedByte()/255,rt=t.readUnsignedByte()/255,nt=t.readUnsignedByte()/255,st=t.readUnsignedByte()/255,ot=t.readUnsignedByte()/255;switch(t.readByte()){case rw:G.setStepped(J);break;case nw:I_(t,G,$++,J,0,j,Q,H,tt,1),I_(t,G,$++,J,1,j,Q,W,et,1),I_(t,G,$++,J,2,j,Q,X,it,1),I_(t,G,$++,J,3,j,Q,Y,rt,1),I_(t,G,$++,J,4,j,Q,q,nt,1),I_(t,G,$++,J,5,j,Q,K,st,1),I_(t,G,$++,J,6,j,Q,Z,ot,1)}j=Q,H=tt,W=et,X=it,Y=rt,q=nt,K=st,Z=ot}r.push(G);break;case G_:for(var at=t.readInt(!0),ht=new Hx(u,at,a),lt=t.readFloat(),ct=t.readUnsignedByte()/255,ut=t.readUnsignedByte()/255,dt=t.readUnsignedByte()/255,ft=t.readUnsignedByte()/255,pt=t.readUnsignedByte()/255,mt=t.readUnsignedByte()/255,gt=0,vt=0;ht.setFrame(gt,lt,ct,ut,dt,ft,pt,mt),gt!=d;gt++){var yt=t.readFloat(),xt=t.readUnsignedByte()/255,bt=t.readUnsignedByte()/255,_t=t.readUnsignedByte()/255,wt=t.readUnsignedByte()/255,Tt=t.readUnsignedByte()/255,Et=t.readUnsignedByte()/255;switch(t.readByte()){case rw:ht.setStepped(gt);break;case nw:I_(t,ht,vt++,gt,0,lt,yt,ct,xt,1),I_(t,ht,vt++,gt,1,lt,yt,ut,bt,1),I_(t,ht,vt++,gt,2,lt,yt,dt,_t,1),I_(t,ht,vt++,gt,3,lt,yt,ft,wt,1),I_(t,ht,vt++,gt,4,lt,yt,pt,Tt,1),I_(t,ht,vt++,gt,5,lt,yt,mt,Et,1)}lt=yt,ct=xt,ut=bt,dt=_t,ft=wt,pt=Tt,mt=Et}r.push(ht);break;case j_:for(var St=new Gx(u,t.readInt(!0),a),It=t.readFloat(),At=t.readUnsignedByte()/255,Ct=0,Pt=0;St.setFrame(Ct,It,At),Ct!=d;Ct++){var Mt=t.readFloat(),Rt=t.readUnsignedByte()/255;switch(t.readByte()){case rw:St.setStepped(Ct);break;case nw:I_(t,St,Pt++,Ct,0,It,Mt,At,Rt,1)}It=Mt,At=Rt}r.push(St)}}for(var Ot=0,Dt=t.readInt(!0);Ot<Dt;Ot++)for(var kt=t.readInt(!0),Lt=0,Ft=t.readInt(!0);Lt<Ft;Lt++){var Nt=t.readByte(),Bt=t.readInt(!0);if(Nt!=N_){var zt=t.readInt(!0);switch(Nt){case A_:r.push(E_(t,new Px(Bt,zt,kt),1));break;case C_:r.push(S_(t,new Mx(Bt,zt,kt),n));break;case P_:r.push(E_(t,new Rx(Bt,zt,kt),n));break;case M_:r.push(E_(t,new Ox(Bt,zt,kt),n));break;case R_:r.push(S_(t,new Dx(Bt,zt,kt),1));break;case O_:r.push(E_(t,new kx(Bt,zt,kt),1));break;case D_:r.push(E_(t,new Lx(Bt,zt,kt),1));break;case k_:r.push(S_(t,new Fx(Bt,zt,kt),1));break;case L_:r.push(E_(t,new Nx(Bt,zt,kt),1));break;case F_:r.push(E_(t,new Bx(Bt,zt,kt),1))}}else{for(var Ut=new zx(Bt,kt),Vt=0;Vt<Bt;Vt++)Ut.setFrame(Vt,t.readFloat(),t.readByte());r.push(Ut)}}for(var Gt=0,jt=t.readInt(!0);Gt<jt;Gt++){for(var Ht=t.readInt(!0),Wt=t.readInt(!0),Xt=Wt-1,Yt=new Kx(Wt,t.readInt(!0),Ht),qt=t.readByte(),Kt=t.readFloat(),Zt=1&qt?2&qt?t.readFloat():1:0,Jt=4&qt?t.readFloat()*n:0,$t=0,Qt=0;Yt.setFrame($t,Kt,Zt,Jt,8&qt?1:-1,!!(16&qt),!!(32&qt)),$t!=Xt;$t++){qt=t.readByte();var te=t.readFloat(),ee=1&qt?2&qt?t.readFloat():1:0,ie=4&qt?t.readFloat()*n:0;64&qt?Yt.setStepped($t):128&qt&&(I_(t,Yt,Qt++,$t,0,Kt,te,Zt,ee,1),I_(t,Yt,Qt++,$t,1,Kt,te,Jt,ie,n)),Kt=te,Zt=ee,Jt=ie}r.push(Yt)}for(var re=0,ne=t.readInt(!0);re<ne;re++){for(var se=t.readInt(!0),oe=t.readInt(!0),ae=oe-1,he=new Zx(oe,t.readInt(!0),se),le=t.readFloat(),ce=t.readFloat(),ue=t.readFloat(),de=t.readFloat(),fe=t.readFloat(),pe=t.readFloat(),me=t.readFloat(),ge=0,ve=0;he.setFrame(ge,le,ce,ue,de,fe,pe,me),ge!=ae;ge++){var ye=t.readFloat(),xe=t.readFloat(),be=t.readFloat(),_e=t.readFloat(),we=t.readFloat(),Te=t.readFloat(),Ee=t.readFloat();switch(t.readByte()){case rw:he.setStepped(ge);break;case nw:I_(t,he,ve++,ge,0,le,ye,ce,xe,1),I_(t,he,ve++,ge,1,le,ye,ue,be,1),I_(t,he,ve++,ge,2,le,ye,de,_e,1),I_(t,he,ve++,ge,3,le,ye,fe,we,1),I_(t,he,ve++,ge,4,le,ye,pe,Te,1),I_(t,he,ve++,ge,5,le,ye,me,Ee,1)}le=ye,ce=xe,ue=be,de=_e,fe=we,pe=Te,me=Ee}r.push(he)}for(var Se=0,Ie=t.readInt(!0);Se<Ie;Se++)for(var Ae=t.readInt(!0),Ce=i.pathConstraints[Ae],Pe=0,Me=t.readInt(!0);Pe<Me;Pe++){var Re=t.readByte(),Oe=t.readInt(!0),De=t.readInt(!0);switch(Re){case X_:r.push(E_(t,new Jx(Oe,De,Ae),Ce.positionMode==Hb.Fixed?n:1));break;case Y_:r.push(E_(t,new $x(Oe,De,Ae),Ce.spacingMode==Xb.Length||Ce.spacingMode==Xb.Fixed?n:1));break;case q_:for(var ke=new Qx(Oe,De,Ae),Le=t.readFloat(),Fe=t.readFloat(),Ne=t.readFloat(),Be=t.readFloat(),ze=0,Ue=0,Ve=ke.getFrameCount()-1;ke.setFrame(ze,Le,Fe,Ne,Be),ze!=Ve;ze++){var Ge=t.readFloat(),je=t.readFloat(),He=t.readFloat(),We=t.readFloat();switch(t.readByte()){case rw:ke.setStepped(ze);break;case nw:I_(t,ke,Ue++,ze,0,Le,Ge,Fe,je,1),I_(t,ke,Ue++,ze,1,Le,Ge,Ne,He,1),I_(t,ke,Ue++,ze,2,Le,Ge,Be,We,1)}Le=Ge,Fe=je,Ne=He,Be=We}r.push(ke)}}for(var Xe=0,Ye=t.readInt(!0);Xe<Ye;Xe++)for(var qe=t.readInt(!0)-1,Ke=0,Ze=t.readInt(!0);Ke<Ze;Ke++){var Je=t.readByte(),$e=t.readInt(!0);if(Je!=iw){var Qe=t.readInt(!0);switch(Je){case K_:r.push(E_(t,new eb($e,Qe,qe),1));break;case Z_:r.push(E_(t,new ib($e,Qe,qe),1));break;case J_:r.push(E_(t,new rb($e,Qe,qe),1));break;case $_:r.push(E_(t,new nb($e,Qe,qe),1));break;case Q_:r.push(E_(t,new sb($e,Qe,qe),1));break;case tw:r.push(E_(t,new ob($e,Qe,qe),1));break;case ew:r.push(E_(t,new ab($e,Qe,qe),1))}}else{for(var ti=new hb($e,qe),ei=0;ei<$e;ei++)ti.setFrame(ei,t.readFloat());r.push(ti)}}for(var ii=0,ri=t.readInt(!0);ii<ri;ii++)for(var ni=i.skins[t.readInt(!0)],si=0,oi=t.readInt(!0);si<oi;si++)for(var ai=t.readInt(!0),hi=0,li=t.readInt(!0);hi<li;hi++){var ci=t.readStringRef();if(!ci)throw new Error("attachmentName must not be null.");var ui=ni.getAttachment(ai,ci),di=t.readByte(),fi=t.readInt(!0),pi=fi-1;switch(di){case H_:for(var mi=ui,gi=mi.bones,vi=mi.vertices,yi=gi?vi.length/3*2:vi.length,xi=t.readInt(!0),bi=new Xx(fi,xi,ai,mi),_i=t.readFloat(),wi=0,Ti=0;;wi++){var Ei=void 0,Si=t.readInt(!0);if(0==Si)Ei=gi?cx.newFloatArray(yi):vi;else{Ei=cx.newFloatArray(yi);var Ii=t.readInt(!0);if(Si+=Ii,1==n)for(var Ai=Ii;Ai<Si;Ai++)Ei[Ai]=t.readFloat();else for(var Ci=Ii;Ci<Si;Ci++)Ei[Ci]=t.readFloat()*n;if(!gi)for(var Pi=0,Mi=Ei.length;Pi<Mi;Pi++)Ei[Pi]+=vi[Pi]}if(bi.setFrame(wi,_i,Ei),wi==pi)break;var Ri=t.readFloat();switch(t.readByte()){case rw:bi.setStepped(wi);break;case nw:I_(t,bi,Ti++,wi,0,_i,Ri,0,1,1)}_i=Ri}r.push(bi);break;case W_:for(var Oi=new lb(fi,ai,ui),Di=0;Di<fi;Di++){var ki=t.readFloat(),Li=t.readInt32();Oi.setFrame(Di,ki,wx[15&Li],Li>>4,t.readFloat())}r.push(Oi)}}var Fi=t.readInt(!0);if(Fi>0){for(var Ni=new qx(Fi),Bi=i.slots.length,zi=0;zi<Fi;zi++){for(var Ui=t.readFloat(),Vi=t.readInt(!0),Gi=cx.newArray(Bi,0),ji=Bi-1;ji>=0;ji--)Gi[ji]=-1;for(var Hi=cx.newArray(Bi-Vi,0),Wi=0,Xi=0,Yi=0;Yi<Vi;Yi++){for(var qi=t.readInt(!0);Wi!=qi;)Hi[Xi++]=Wi++;Gi[Wi+t.readInt(!0)]=Wi++}for(;Wi<Bi;)Hi[Xi++]=Wi++;for(var Ki=Bi-1;Ki>=0;Ki--)-1==Gi[Ki]&&(Gi[Ki]=Hi[--Xi]);Ni.setFrame(zi,Ui,Gi)}r.push(Ni)}var Zi=t.readInt(!0);if(Zi>0){for(var Ji=new Yx(Zi),$i=0;$i<Zi;$i++){var Qi=t.readFloat(),tr=i.events[t.readInt(!0)],er=new $b(Qi,tr);er.intValue=t.readInt(!1),er.floatValue=t.readFloat(),er.stringValue=t.readString(),null==er.stringValue&&(er.stringValue=tr.stringValue),er.data.audioPath&&(er.volume=t.readFloat(),er.balance=t.readFloat()),Ji.setFrame($i,er)}r.push(Ji)}for(var ir=0,rr=0,nr=r.length;rr<nr;rr++)ir=Math.max(ir,r[rr].getDuration());return new Tx(e,r,ir)},t}(),__=function(){function t(t,e,i,r){void 0===e&&(e=new Array),void 0===i&&(i=0),void 0===r&&(r=new DataView(t.buffer)),this.strings=e,this.index=i,this.buffer=r}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readUnsignedByte=function(){return this.buffer.getUint8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),i=127&e;return 128&e&&(i|=(127&(e=this.readByte()))<<7,128&e&&(i|=(127&(e=this.readByte()))<<14,128&e&&(i|=(127&(e=this.readByte()))<<21,128&e&&(i|=(127&(e=this.readByte()))<<28)))),t?i:i>>>1^-(1&i)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",i=0;i<t;){var r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),i+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),w_=function(t,e,i,r,n){this.mesh=t,this.skinIndex=e,this.slotIndex=i,this.parent=r,this.inheritTimeline=n},T_=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),this.bones=t,this.vertices=e,this.length=i};function E_(t,e,i){for(var r=t.readFloat(),n=t.readFloat()*i,s=0,o=0,a=e.getFrameCount()-1;e.setFrame(s,r,n),s!=a;s++){var h=t.readFloat(),l=t.readFloat()*i;switch(t.readByte()){case rw:e.setStepped(s);break;case nw:I_(t,e,o++,s,0,r,h,n,l,i)}r=h,n=l}return e}function S_(t,e,i){for(var r=t.readFloat(),n=t.readFloat()*i,s=t.readFloat()*i,o=0,a=0,h=e.getFrameCount()-1;e.setFrame(o,r,n,s),o!=h;o++){var l=t.readFloat(),c=t.readFloat()*i,u=t.readFloat()*i;switch(t.readByte()){case rw:e.setStepped(o);break;case nw:I_(t,e,a++,o,0,r,l,n,c,i),I_(t,e,a++,o,1,r,l,s,u,i)}r=l,n=c,s=u}return e}function I_(t,e,i,r,n,s,o,a,h,l){e.setBezier(i,r,n,s,a,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,h)}(y_=v_||(v_={}))[y_.Region=0]="Region",y_[y_.BoundingBox=1]="BoundingBox",y_[y_.Mesh=2]="Mesh",y_[y_.LinkedMesh=3]="LinkedMesh",y_[y_.Path=4]="Path",y_[y_.Point=5]="Point",y_[y_.Clipping=6]="Clipping";var A_=0,C_=1,P_=2,M_=3,R_=4,O_=5,D_=6,k_=7,L_=8,F_=9,N_=10,B_=0,z_=1,U_=2,V_=3,G_=4,j_=5,H_=0,W_=1,X_=0,Y_=1,q_=2,K_=0,Z_=1,J_=2,$_=4,Q_=5,tw=6,ew=7,iw=8,rw=1,nw=2,sw=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new ux(function(){return new Array}),this.polygonIndicesPool=new ux(function(){return new Array})}var e=t.prototype;return e.triangulate=function(e){var i=e,r=e.length>>1,n=this.indicesArray;n.length=0;for(var s=0;s<r;s++)n[s]=s;var o=this.isConcaveArray;o.length=0;for(var a=0,h=r;a<h;++a)o[a]=t.isConcave(a,r,i,n);var l=this.triangles;for(l.length=0;r>3;){for(var c=r-1,u=0,d=1;;){t:if(!o[u]){for(var f=n[c]<<1,p=n[u]<<1,m=n[d]<<1,g=i[f],v=i[f+1],y=i[p],x=i[p+1],b=i[m],_=i[m+1],w=(d+1)%r;w!=c;w=(w+1)%r)if(o[w]){var T=n[w]<<1,E=i[T],S=i[T+1];if(t.positiveArea(b,_,g,v,E,S)&&t.positiveArea(g,v,y,x,E,S)&&t.positiveArea(y,x,b,_,E,S))break t}break}if(0==d){do{if(!o[u])break;u--}while(u>0);break}c=u,u=d,d=(d+1)%r}l.push(n[(r+u-1)%r]),l.push(n[u]),l.push(n[(u+1)%r]),n.splice(u,1),o.splice(u,1);var I=(--r+u-1)%r,A=u==r?0:u;o[I]=t.isConcave(I,r,i,n),o[A]=t.isConcave(A,r,i,n)}return 3==r&&(l.push(n[2]),l.push(n[0]),l.push(n[1])),l},e.decompose=function(e,i){var r=e,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;var s=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(s),s.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var a=this.polygonPool.obtain();a.length=0;for(var h=-1,l=0,c=0,u=i.length;c<u;c+=3){var d=i[c]<<1,f=i[c+1]<<1,p=i[c+2]<<1,m=r[d],g=r[d+1],v=r[f],y=r[f+1],x=r[p],b=r[p+1],_=!1;if(h==d){var w=a.length-4,T=t.winding(a[w],a[w+1],a[w+2],a[w+3],x,b),E=t.winding(x,b,a[0],a[1],a[2],a[3]);T==l&&E==l&&(a.push(x),a.push(b),o.push(p),_=!0)}_||(a.length>0?(n.push(a),s.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),(a=this.polygonPool.obtain()).length=0,a.push(m),a.push(g),a.push(v),a.push(y),a.push(x),a.push(b),(o=this.polygonIndicesPool.obtain()).length=0,o.push(d),o.push(f),o.push(p),l=t.winding(m,g,v,y,x,b),h=d)}a.length>0&&(n.push(a),s.push(o));for(var S=0,I=n.length;S<I;S++)if(0!=(o=s[S]).length)for(var A=o[0],C=o[o.length-1],P=(a=n[S]).length-4,M=a[P],R=a[P+1],O=a[P+2],D=a[P+3],k=a[0],L=a[1],F=a[2],N=a[3],B=t.winding(M,R,O,D,k,L),z=0;z<I;z++)if(z!=S){var U=s[z];if(3==U.length){var V=U[0],G=U[1],j=U[2],H=n[z],W=H[H.length-2],X=H[H.length-1];if(V==A&&G==C){var Y=t.winding(M,R,O,D,W,X),q=t.winding(W,X,k,L,F,N);Y==B&&q==B&&(H.length=0,U.length=0,a.push(W),a.push(X),o.push(j),M=O,R=D,O=W,D=X,z=0)}}}for(var K=n.length-1;K>=0;K--)0==(a=n[K]).length&&(n.splice(K,1),this.polygonPool.free(a),o=s[K],s.splice(K,1),this.polygonIndicesPool.free(o));return n},t.isConcave=function(t,e,i,r){var n=r[(e+t-1)%e]<<1,s=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(i[n],i[n+1],i[s],i[s+1],i[o],i[o+1])},t.positiveArea=function(t,e,i,r,n,s){return t*(s-r)+i*(e-s)+n*(r-e)>=0},t.winding=function(t,e,i,r,n,s){var o=i-t,a=r-e;return n*a-s*o+o*e-t*a>=0?1:-1},t}(),ow=function(){function t(){this.triangulator=new sw,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}var e=t.prototype;return e.clipStart=function(e,i){if(this.clipAttachment)return 0;this.clipAttachment=i;var r=i.worldVerticesLength,n=cx.setArraySize(this.clippingPolygon,r);i.computeWorldVertices(e,0,r,n,0,2);var s=this.clippingPolygon;t.makeClockwise(s);for(var o=this.clippingPolygons=this.triangulator.decompose(s,this.triangulator.triangulate(s)),a=0,h=o.length;a<h;a++){var l=o[a];t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length},e.clipEndWithSlot=function(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,i,r,n,s,o,a){n&&s&&o&&"boolean"==typeof a?this.clipTrianglesRender(t,e,i,r,n,s,o,a):this.clipTrianglesNoRender(t,e,i,r)},e.clipTrianglesNoRender=function(t,e,i,r){var n=this.clipOutput,s=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,h=a.length,l=0;s.length=0,o.length=0;t:for(var c=0;c<r;c+=3)for(var u=i[c]<<1,d=t[u],f=t[u+1],p=t[u=i[c+1]<<1],m=t[u+1],g=t[u=i[c+2]<<1],v=t[u+1],y=0;y<h;y++){var x=s.length;if(!this.clip(d,f,p,m,g,v,a[y],n)){var b=cx.setArraySize(s,x+6);b[x]=d,b[x+1]=f,b[x+2]=p,b[x+3]=m,b[x+4]=g,b[x+5]=v,x=o.length;var _=cx.setArraySize(o,x+3);_[x]=l,_[x+1]=l+1,_[x+2]=l+2,l+=3;continue t}var w=n.length;if(0!=w){for(var T=w>>1,E=this.clipOutput,S=cx.setArraySize(s,x+2*T),I=0;I<w;I+=2){var A=E[I],C=E[I+1];S[x]=A,S[x+1]=C,x+=2}x=o.length;var P=cx.setArraySize(o,x+3*(T-2));T--;for(var M=1;M<T;M++)P[x]=l,P[x+1]=l+M,P[x+2]=l+M+1,x+=3;l+=T+1}}},e.clipTrianglesRender=function(t,e,i,r,n,s,o,a){var h=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,d=u.length,f=a?12:8,p=0;l.length=0,c.length=0;t:for(var m=0;m<r;m+=3)for(var g=i[m]<<1,v=t[g],y=t[g+1],x=n[g],b=n[g+1],_=t[g=i[m+1]<<1],w=t[g+1],T=n[g],E=n[g+1],S=t[g=i[m+2]<<1],I=t[g+1],A=n[g],C=n[g+1],P=0;P<d;P++){var M=l.length;if(!this.clip(v,y,_,w,S,I,u[P],h)){var R=cx.setArraySize(l,M+3*f);R[M]=v,R[M+1]=y,R[M+2]=s.r,R[M+3]=s.g,R[M+4]=s.b,R[M+5]=s.a,a?(R[M+6]=x,R[M+7]=b,R[M+8]=o.r,R[M+9]=o.g,R[M+10]=o.b,R[M+11]=o.a,R[M+12]=_,R[M+13]=w,R[M+14]=s.r,R[M+15]=s.g,R[M+16]=s.b,R[M+17]=s.a,R[M+18]=T,R[M+19]=E,R[M+20]=o.r,R[M+21]=o.g,R[M+22]=o.b,R[M+23]=o.a,R[M+24]=S,R[M+25]=I,R[M+26]=s.r,R[M+27]=s.g,R[M+28]=s.b,R[M+29]=s.a,R[M+30]=A,R[M+31]=C,R[M+32]=o.r,R[M+33]=o.g,R[M+34]=o.b,R[M+35]=o.a):(R[M+6]=x,R[M+7]=b,R[M+8]=_,R[M+9]=w,R[M+10]=s.r,R[M+11]=s.g,R[M+12]=s.b,R[M+13]=s.a,R[M+14]=T,R[M+15]=E,R[M+16]=S,R[M+17]=I,R[M+18]=s.r,R[M+19]=s.g,R[M+20]=s.b,R[M+21]=s.a,R[M+22]=A,R[M+23]=C),M=c.length;var O=cx.setArraySize(c,M+3);O[M]=p,O[M+1]=p+1,O[M+2]=p+2,p+=3;continue t}var D=h.length;if(0!=D){for(var k=w-I,L=S-_,F=v-S,N=I-y,B=1/(k*F+L*(y-I)),z=D>>1,U=this.clipOutput,V=cx.setArraySize(l,M+z*f),G=0;G<D;G+=2){var j=U[G],H=U[G+1];V[M]=j,V[M+1]=H,V[M+2]=s.r,V[M+3]=s.g,V[M+4]=s.b,V[M+5]=s.a;var W=j-S,X=H-I,Y=(k*W+L*X)*B,q=(N*W+F*X)*B,K=1-Y-q;V[M+6]=x*Y+T*q+A*K,V[M+7]=b*Y+E*q+C*K,a&&(V[M+8]=o.r,V[M+9]=o.g,V[M+10]=o.b,V[M+11]=o.a),M+=f}M=c.length;var Z=cx.setArraySize(c,M+3*(z-2));z--;for(var J=1;J<z;J++)Z[M]=p,Z[M+1]=p+J,Z[M+2]=p+J+1,M+=3;p+=z+1}}},e.clip=function(t,e,i,r,n,s,o,a){var h,l=a,c=!1;o.length%4>=2?(h=a,a=this.scratch):h=this.scratch,h.length=0,h.push(t),h.push(e),h.push(i),h.push(r),h.push(n),h.push(s),h.push(t),h.push(e),a.length=0;for(var u=o,d=o.length-4,f=0;;f+=2){for(var p=u[f],m=u[f+1],g=u[f+2],v=u[f+3],y=p-g,x=m-v,b=h,_=h.length-2,w=a.length,T=0;T<_;T+=2){var E=b[T],S=b[T+1],I=b[T+2],A=b[T+3],C=y*(A-v)-x*(I-g)>0;if(y*(S-v)-x*(E-g)>0){if(C){a.push(I),a.push(A);continue}var P=A-S,M=I-E,R=P*(g-p)-M*(v-m);if(Math.abs(R)>1e-6){var O=(M*(m-S)-P*(p-E))/R;a.push(p+(g-p)*O),a.push(m+(v-m)*O)}else a.push(p),a.push(m)}else if(C){var D=A-S,k=I-E,L=D*(g-p)-k*(v-m);if(Math.abs(L)>1e-6){var F=(k*(m-S)-D*(p-E))/L;a.push(p+(g-p)*F),a.push(m+(v-m)*F)}else a.push(p),a.push(m);a.push(I),a.push(A)}c=!0}if(w==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==d)break;var N=a;(a=h).length=0,h=N}if(l!=a){l.length=0;for(var B=0,z=a.length-2;B<z;B++)l[B]=a[B]}else l.length=l.length-2;return c},t.makeClockwise=function(t){for(var e=t,i=t.length,r=e[i-2]*e[1]-e[0]*e[i-1],n=0,s=0,o=0,a=0,h=i-3;a<h;a+=2)n=e[a],s=e[a+1],o=e[a+2],r+=n*e[a+3]-o*s;if(!(r<0))for(var l=0,c=i-2,u=i>>1;l<u;l+=2){var d=e[l],f=e[l+1],p=c-l;e[l]=e[p],e[l+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),aw=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(t){var e,i,r=this.scale,n=new f_,s="string"==typeof t?JSON.parse(t):t,o=s.skeleton;o&&(n.hash=o.hash,n.version=o.spine,n.x=o.x,n.y=o.y,n.width=o.width,n.height=o.height,n.referenceScale=dw(o,"referenceScale",100)*r,n.fps=o.fps,n.imagesPath=null!=(e=o.images)?e:null,n.audioPath=null!=(i=o.audio)?i:null);if(s.bones)for(var a=0;a<s.bones.length;a++){var h=s.bones[a],l=null,c=dw(h,"parent",null);c&&(l=n.findBone(c));var u=new jb(n.bones.length,h.name,l);u.length=dw(h,"length",0)*r,u.x=dw(h,"x",0)*r,u.y=dw(h,"y",0)*r,u.rotation=dw(h,"rotation",0),u.scaleX=dw(h,"scaleX",1),u.scaleY=dw(h,"scaleY",1),u.shearX=dw(h,"shearX",0),u.shearY=dw(h,"shearY",0),u.inherit=cx.enumValue(Ub,dw(h,"inherit","Normal")),u.skinRequired=dw(h,"skin",!1);var d=dw(h,"color",null);d&&u.color.setFromString(d),n.bones.push(u)}if(s.slots)for(var f=0;f<s.slots.length;f++){var p=s.slots[f],m=p.name,g=n.findBone(p.bone);if(!g)throw new Error("Couldn't find bone "+p.bone+" for slot "+m);var v=new g_(n.slots.length,m,g),y=dw(p,"color",null);y&&v.color.setFromString(y);var x=dw(p,"dark",null);x&&(v.darkColor=hx.fromString(x)),v.attachmentName=dw(p,"attachment",null),v.blendMode=cx.enumValue(c_,dw(p,"blend","normal")),v.visible=dw(p,"visible",!0),n.slots.push(v)}if(s.ik)for(var b=0;b<s.ik.length;b++){var _=s.ik[b],w=new e_(_.name);w.order=dw(_,"order",0),w.skinRequired=dw(_,"skin",!1);for(var T=0;T<_.bones.length;T++){var E=n.findBone(_.bones[T]);if(!E)throw new Error("Couldn't find bone "+_.bones[T]+" for IK constraint "+_.name+".");w.bones.push(E)}var S=n.findBone(_.target);if(!S)throw new Error("Couldn't find target bone "+_.target+" for IK constraint "+_.name+".");w.target=S,w.mix=dw(_,"mix",1),w.softness=dw(_,"softness",0)*r,w.bendDirection=dw(_,"bendPositive",!0)?1:-1,w.compress=dw(_,"compress",!1),w.stretch=dw(_,"stretch",!1),w.uniform=dw(_,"uniform",!1),n.ikConstraints.push(w)}if(s.transform)for(var I=0;I<s.transform.length;I++){var A=s.transform[I],C=new x_(A.name);C.order=dw(A,"order",0),C.skinRequired=dw(A,"skin",!1);for(var P=0;P<A.bones.length;P++){var M=A.bones[P],R=n.findBone(M);if(!R)throw new Error("Couldn't find bone "+M+" for transform constraint "+A.name+".");C.bones.push(R)}var O=A.target,D=n.findBone(O);if(!D)throw new Error("Couldn't find target bone "+O+" for transform constraint "+A.name+".");C.target=D,C.local=dw(A,"local",!1),C.relative=dw(A,"relative",!1),C.offsetRotation=dw(A,"rotation",0),C.offsetX=dw(A,"x",0)*r,C.offsetY=dw(A,"y",0)*r,C.offsetScaleX=dw(A,"scaleX",0),C.offsetScaleY=dw(A,"scaleY",0),C.offsetShearY=dw(A,"shearY",0),C.mixRotate=dw(A,"mixRotate",1),C.mixX=dw(A,"mixX",1),C.mixY=dw(A,"mixY",C.mixX),C.mixScaleX=dw(A,"mixScaleX",1),C.mixScaleY=dw(A,"mixScaleY",C.mixScaleX),C.mixShearY=dw(A,"mixShearY",1),n.transformConstraints.push(C)}if(s.path)for(var k=0;k<s.path.length;k++){var L=s.path[k],F=new i_(L.name);F.order=dw(L,"order",0),F.skinRequired=dw(L,"skin",!1);for(var N=0;N<L.bones.length;N++){var B=L.bones[N],z=n.findBone(B);if(!z)throw new Error("Couldn't find bone "+B+" for path constraint "+L.name+".");F.bones.push(z)}var U=L.target,V=n.findSlot(U);if(!V)throw new Error("Couldn't find target slot "+U+" for path constraint "+L.name+".");F.target=V,F.positionMode=cx.enumValue(Hb,dw(L,"positionMode","Percent")),F.spacingMode=cx.enumValue(Xb,dw(L,"spacingMode","Length")),F.rotateMode=cx.enumValue(qb,dw(L,"rotateMode","Tangent")),F.offsetRotation=dw(L,"rotation",0),F.position=dw(L,"position",0),F.positionMode==Hb.Fixed&&(F.position*=r),F.spacing=dw(L,"spacing",0),F.spacingMode!=Xb.Length&&F.spacingMode!=Xb.Fixed||(F.spacing*=r),F.mixRotate=dw(L,"mixRotate",1),F.mixX=dw(L,"mixX",1),F.mixY=dw(L,"mixY",F.mixX),n.pathConstraints.push(F)}if(s.physics)for(var G=0;G<s.physics.length;G++){var j=s.physics[G],H=new d_(j.name);H.order=dw(j,"order",0),H.skinRequired=dw(j,"skin",!1);var W=j.bone,X=n.findBone(W);if(null==X)throw new Error("Physics bone not found: "+W);H.bone=X,H.x=dw(j,"x",0),H.y=dw(j,"y",0),H.rotate=dw(j,"rotate",0),H.scaleX=dw(j,"scaleX",0),H.shearX=dw(j,"shearX",0),H.limit=dw(j,"limit",5e3)*r,H.step=1/dw(j,"fps",60),H.inertia=dw(j,"inertia",1),H.strength=dw(j,"strength",100),H.damping=dw(j,"damping",1),H.massInverse=1/dw(j,"mass",1),H.wind=dw(j,"wind",0),H.gravity=dw(j,"gravity",0),H.mix=dw(j,"mix",1),H.inertiaGlobal=dw(j,"inertiaGlobal",!1),H.strengthGlobal=dw(j,"strengthGlobal",!1),H.dampingGlobal=dw(j,"dampingGlobal",!1),H.massGlobal=dw(j,"massGlobal",!1),H.windGlobal=dw(j,"windGlobal",!1),H.gravityGlobal=dw(j,"gravityGlobal",!1),H.mixGlobal=dw(j,"mixGlobal",!1),n.physicsConstraints.push(H)}if(s.skins)for(var Y=0;Y<s.skins.length;Y++){var q=s.skins[Y],K=new m_(q.name);if(q.bones)for(var Z=0;Z<q.bones.length;Z++){var J=q.bones[Z],$=n.findBone(J);if(!$)throw new Error("Couldn't find bone "+J+" for skin "+q.name+".");K.bones.push($)}if(q.ik)for(var Q=0;Q<q.ik.length;Q++){var tt=q.ik[Q],et=n.findIkConstraint(tt);if(!et)throw new Error("Couldn't find IK constraint "+tt+" for skin "+q.name+".");K.constraints.push(et)}if(q.transform)for(var it=0;it<q.transform.length;it++){var rt=q.transform[it],nt=n.findTransformConstraint(rt);if(!nt)throw new Error("Couldn't find transform constraint "+rt+" for skin "+q.name+".");K.constraints.push(nt)}if(q.path)for(var st=0;st<q.path.length;st++){var ot=q.path[st],at=n.findPathConstraint(ot);if(!at)throw new Error("Couldn't find path constraint "+ot+" for skin "+q.name+".");K.constraints.push(at)}if(q.physics)for(var ht=0;ht<q.physics.length;ht++){var lt=q.physics[ht],ct=n.findPhysicsConstraint(lt);if(!ct)throw new Error("Couldn't find physics constraint "+lt+" for skin "+q.name+".");K.constraints.push(ct)}for(var ut in q.attachments){var dt=n.findSlot(ut);if(!dt)throw new Error("Couldn't find slot "+ut+" for skin "+q.name+".");var ft=q.attachments[ut];for(var pt in ft){var mt=this.readAttachment(ft[pt],K,dt.index,pt,n);mt&&K.setAttachment(dt.index,pt,mt)}}n.skins.push(K),"default"==K.name&&(n.defaultSkin=K)}for(var gt=0,vt=this.linkedMeshes.length;gt<vt;gt++){var yt=this.linkedMeshes[gt],xt=yt.skin?n.findSkin(yt.skin):n.defaultSkin;if(!xt)throw new Error("Skin not found: "+yt.skin);var bt=xt.getAttachment(yt.slotIndex,yt.parent);if(!bt)throw new Error("Parent mesh not found: "+yt.parent);yt.mesh.timelineAttachment=yt.inheritTimeline?bt:yt.mesh,yt.mesh.setParentMesh(bt),null!=yt.mesh.region&&yt.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(var _t in s.events){var wt=s.events[_t],Tt=new Qb(_t);Tt.intValue=dw(wt,"int",0),Tt.floatValue=dw(wt,"float",0),Tt.stringValue=dw(wt,"string",""),Tt.audioPath=dw(wt,"audio",null),Tt.audioPath&&(Tt.volume=dw(wt,"volume",1),Tt.balance=dw(wt,"balance",0)),n.events.push(Tt)}if(s.animations)for(var Et in s.animations){var St=s.animations[Et];this.readAnimation(St,Et,n)}return n},e.readAttachment=function(t,e,i,r,n){var s=this.scale;switch(r=dw(t,"name",r),dw(t,"type","region")){case"region":var o=dw(t,"path",r),a=this.readSequence(dw(t,"sequence",null)),h=this.attachmentLoader.newRegionAttachment(e,r,o,a);if(!h)return null;h.path=o,h.x=dw(t,"x",0)*s,h.y=dw(t,"y",0)*s,h.scaleX=dw(t,"scaleX",1),h.scaleY=dw(t,"scaleY",1),h.rotation=dw(t,"rotation",0),h.width=t.width*s,h.height=t.height*s,h.sequence=a;var l=dw(t,"color",null);return l&&h.color.setFromString(l),null!=h.region&&h.updateRegion(),h;case"boundingbox":var c=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);var u=dw(t,"color",null);return u&&c.color.setFromString(u),c;case"mesh":case"linkedmesh":var d=dw(t,"path",r),f=this.readSequence(dw(t,"sequence",null)),p=this.attachmentLoader.newMeshAttachment(e,r,d,f);if(!p)return null;p.path=d;var m=dw(t,"color",null);m&&p.color.setFromString(m),p.width=dw(t,"width",0)*s,p.height=dw(t,"height",0)*s,p.sequence=f;var g=dw(t,"parent",null);if(g)return this.linkedMeshes.push(new hw(p,dw(t,"skin",null),i,g,dw(t,"timelines",!0))),p;var v=t.uvs;return this.readVertices(t,p,v.length),p.triangles=t.triangles,p.regionUVs=v,null!=p.region&&p.updateRegion(),p.edges=dw(t,"edges",null),p.hullLength=2*dw(t,"hull",0),p;case"path":var y=this.attachmentLoader.newPathAttachment(e,r);if(!y)return null;y.closed=dw(t,"closed",!1),y.constantSpeed=dw(t,"constantSpeed",!0);var x=t.vertexCount;this.readVertices(t,y,x<<1);for(var b=cx.newArray(x/3,0),_=0;_<t.lengths.length;_++)b[_]=t.lengths[_]*s;y.lengths=b;var w=dw(t,"color",null);return w&&y.color.setFromString(w),y;case"point":var T=this.attachmentLoader.newPointAttachment(e,r);if(!T)return null;T.x=dw(t,"x",0)*s,T.y=dw(t,"y",0)*s,T.rotation=dw(t,"rotation",0);var E=dw(t,"color",null);return E&&T.color.setFromString(E),T;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,r);if(!S)return null;var I=dw(t,"end",null);I&&(S.endSlot=n.findSlot(I));var A=t.vertexCount;this.readVertices(t,S,A<<1);var C=dw(t,"color",null);return C&&S.color.setFromString(C),S}return null},e.readSequence=function(t){if(null==t)return null;var e=new vx(dw(t,"count",0));return e.start=dw(t,"start",1),e.digits=dw(t,"digits",0),e.setupIndex=dw(t,"setup",0),e},e.readVertices=function(t,e,i){var r=this.scale;e.worldVerticesLength=i;var n=t.vertices;if(i!=n.length){for(var s=new Array,o=new Array,a=0,h=n.length;a<h;){var l=n[a++];o.push(l);for(var c=a+4*l;a<c;a+=4)o.push(n[a]),s.push(n[a+1]*r),s.push(n[a+2]*r),s.push(n[a+3])}e.bones=o,e.vertices=cx.toFloatArray(s)}else{var u=cx.toFloatArray(n);if(1!=r)for(var d=0,f=n.length;d<f;d++)u[d]*=r;e.vertices=u}},e.readAnimation=function(t,e,i){var r=this.scale,n=new Array;if(t.slots)for(var s in t.slots){var o=t.slots[s],a=i.findSlot(s);if(!a)throw new Error("Slot not found: "+s);var h=a.index;for(var l in o){var c=o[l];if(c){var u=c.length;if("attachment"==l){for(var d=new Wx(u,h),f=0;f<u;f++){var p=c[f];d.setFrame(f,dw(p,"time",0),dw(p,"name",null))}n.push(d)}else if("rgba"==l){for(var m=new Ux(u,u<<2,h),g=c[0],v=dw(g,"time",0),y=hx.fromString(g.color),x=0,b=0;;x++){m.setFrame(x,v,y.r,y.g,y.b,y.a);var _=c[x+1];if(!_){m.shrink(b);break}var w=dw(_,"time",0),T=hx.fromString(_.color),E=g.curve;E&&(b=uw(E,m,b,x,0,v,w,y.r,T.r,1),b=uw(E,m,b,x,1,v,w,y.g,T.g,1),b=uw(E,m,b,x,2,v,w,y.b,T.b,1),b=uw(E,m,b,x,3,v,w,y.a,T.a,1)),v=w,y=T,g=_}n.push(m)}else if("rgb"==l){for(var S=new Vx(u,3*u,h),I=c[0],A=dw(I,"time",0),C=hx.fromString(I.color),P=0,M=0;;P++){S.setFrame(P,A,C.r,C.g,C.b);var R=c[P+1];if(!R){S.shrink(M);break}var O=dw(R,"time",0),D=hx.fromString(R.color),k=I.curve;k&&(M=uw(k,S,M,P,0,A,O,C.r,D.r,1),M=uw(k,S,M,P,1,A,O,C.g,D.g,1),M=uw(k,S,M,P,2,A,O,C.b,D.b,1)),A=O,C=D,I=R}n.push(S)}else if("alpha"==l)n.push(lw(c,new Gx(u,u,h),0,1));else if("rgba2"==l){for(var L=new jx(u,7*u,h),F=c[0],N=dw(F,"time",0),B=hx.fromString(F.light),z=hx.fromString(F.dark),U=0,V=0;;U++){L.setFrame(U,N,B.r,B.g,B.b,B.a,z.r,z.g,z.b);var G=c[U+1];if(!G){L.shrink(V);break}var j=dw(G,"time",0),H=hx.fromString(G.light),W=hx.fromString(G.dark),X=F.curve;X&&(V=uw(X,L,V,U,0,N,j,B.r,H.r,1),V=uw(X,L,V,U,1,N,j,B.g,H.g,1),V=uw(X,L,V,U,2,N,j,B.b,H.b,1),V=uw(X,L,V,U,3,N,j,B.a,H.a,1),V=uw(X,L,V,U,4,N,j,z.r,W.r,1),V=uw(X,L,V,U,5,N,j,z.g,W.g,1),V=uw(X,L,V,U,6,N,j,z.b,W.b,1)),N=j,B=H,z=W,F=G}n.push(L)}else if("rgb2"==l){for(var Y=new Hx(u,6*u,h),q=c[0],K=dw(q,"time",0),Z=hx.fromString(q.light),J=hx.fromString(q.dark),$=0,Q=0;;$++){Y.setFrame($,K,Z.r,Z.g,Z.b,J.r,J.g,J.b);var tt=c[$+1];if(!tt){Y.shrink(Q);break}var et=dw(tt,"time",0),it=hx.fromString(tt.light),rt=hx.fromString(tt.dark),nt=q.curve;nt&&(Q=uw(nt,Y,Q,$,0,K,et,Z.r,it.r,1),Q=uw(nt,Y,Q,$,1,K,et,Z.g,it.g,1),Q=uw(nt,Y,Q,$,2,K,et,Z.b,it.b,1),Q=uw(nt,Y,Q,$,3,K,et,J.r,rt.r,1),Q=uw(nt,Y,Q,$,4,K,et,J.g,rt.g,1),Q=uw(nt,Y,Q,$,5,K,et,J.b,rt.b,1)),K=et,Z=it,J=rt,q=tt}n.push(Y)}}}}if(t.bones)for(var st in t.bones){var ot=t.bones[st],at=i.findBone(st);if(!at)throw new Error("Bone not found: "+st);var ht=at.index;for(var lt in ot){var ct=ot[lt],ut=ct.length;if(0!=ut)if("rotate"===lt)n.push(lw(ct,new Px(ut,ut,ht),0,1));else if("translate"===lt){var dt=new Mx(ut,ut<<1,ht);n.push(cw(ct,dt,"x","y",0,r))}else if("translatex"===lt){var ft=new Rx(ut,ut,ht);n.push(lw(ct,ft,0,r))}else if("translatey"===lt){var pt=new Ox(ut,ut,ht);n.push(lw(ct,pt,0,r))}else if("scale"===lt){var mt=new Dx(ut,ut<<1,ht);n.push(cw(ct,mt,"x","y",1,1))}else if("scalex"===lt){var gt=new kx(ut,ut,ht);n.push(lw(ct,gt,1,1))}else if("scaley"===lt){var vt=new Lx(ut,ut,ht);n.push(lw(ct,vt,1,1))}else if("shear"===lt){var yt=new Fx(ut,ut<<1,ht);n.push(cw(ct,yt,"x","y",0,1))}else if("shearx"===lt){var xt=new Nx(ut,ut,ht);n.push(lw(ct,xt,0,1))}else if("sheary"===lt){var bt=new Bx(ut,ut,ht);n.push(lw(ct,bt,0,1))}else if("inherit"===lt){for(var _t=new zx(ut,at.index),wt=0;wt<ct.length;wt++){var Tt=ct[wt];_t.setFrame(wt,dw(Tt,"time",0),cx.enumValue(Ub,dw(Tt,"inherit","Normal")))}n.push(_t)}}}if(t.ik)for(var Et in t.ik){var St=t.ik[Et],It=St[0];if(It){var At=i.findIkConstraint(Et);if(!At)throw new Error("IK Constraint not found: "+Et);for(var Ct=i.ikConstraints.indexOf(At),Pt=new Kx(St.length,St.length<<1,Ct),Mt=dw(It,"time",0),Rt=dw(It,"mix",1),Ot=dw(It,"softness",0)*r,Dt=0,kt=0;;Dt++){Pt.setFrame(Dt,Mt,Rt,Ot,dw(It,"bendPositive",!0)?1:-1,dw(It,"compress",!1),dw(It,"stretch",!1));var Lt=St[Dt+1];if(!Lt){Pt.shrink(kt);break}var Ft=dw(Lt,"time",0),Nt=dw(Lt,"mix",1),Bt=dw(Lt,"softness",0)*r,zt=It.curve;zt&&(kt=uw(zt,Pt,kt,Dt,0,Mt,Ft,Rt,Nt,1),kt=uw(zt,Pt,kt,Dt,1,Mt,Ft,Ot,Bt,r)),Mt=Ft,Rt=Nt,Ot=Bt,It=Lt}n.push(Pt)}}if(t.transform)for(var Ut in t.transform){var Vt=t.transform[Ut],Gt=Vt[0];if(Gt){var jt=i.findTransformConstraint(Ut);if(!jt)throw new Error("Transform constraint not found: "+Ut);for(var Ht=i.transformConstraints.indexOf(jt),Wt=new Zx(Vt.length,6*Vt.length,Ht),Xt=dw(Gt,"time",0),Yt=dw(Gt,"mixRotate",1),qt=dw(Gt,"mixX",1),Kt=dw(Gt,"mixY",qt),Zt=dw(Gt,"mixScaleX",1),Jt=dw(Gt,"mixScaleY",Zt),$t=dw(Gt,"mixShearY",1),Qt=0,te=0;;Qt++){Wt.setFrame(Qt,Xt,Yt,qt,Kt,Zt,Jt,$t);var ee=Vt[Qt+1];if(!ee){Wt.shrink(te);break}var ie=dw(ee,"time",0),re=dw(ee,"mixRotate",1),ne=dw(ee,"mixX",1),se=dw(ee,"mixY",ne),oe=dw(ee,"mixScaleX",1),ae=dw(ee,"mixScaleY",oe),he=dw(ee,"mixShearY",1),le=Gt.curve;le&&(te=uw(le,Wt,te,Qt,0,Xt,ie,Yt,re,1),te=uw(le,Wt,te,Qt,1,Xt,ie,qt,ne,1),te=uw(le,Wt,te,Qt,2,Xt,ie,Kt,se,1),te=uw(le,Wt,te,Qt,3,Xt,ie,Zt,oe,1),te=uw(le,Wt,te,Qt,4,Xt,ie,Jt,ae,1),te=uw(le,Wt,te,Qt,5,Xt,ie,$t,he,1)),Xt=ie,Yt=re,qt=ne,Kt=se,Zt=oe,Jt=ae,Zt=oe,Gt=ee}n.push(Wt)}}if(t.path)for(var ce in t.path){var ue=t.path[ce],de=i.findPathConstraint(ce);if(!de)throw new Error("Path constraint not found: "+ce);var fe=i.pathConstraints.indexOf(de);for(var pe in ue){var me=ue[pe],ge=me[0];if(ge){var ve=me.length;if("position"===pe){var ye=new Jx(ve,ve,fe);n.push(lw(me,ye,0,de.positionMode==Hb.Fixed?r:1))}else if("spacing"===pe){var xe=new $x(ve,ve,fe);n.push(lw(me,xe,0,de.spacingMode==Xb.Length||de.spacingMode==Xb.Fixed?r:1))}else if("mix"===pe){for(var be=new Qx(ve,3*ve,fe),_e=dw(ge,"time",0),we=dw(ge,"mixRotate",1),Te=dw(ge,"mixX",1),Ee=dw(ge,"mixY",Te),Se=0,Ie=0;;Se++){be.setFrame(Se,_e,we,Te,Ee);var Ae=me[Se+1];if(!Ae){be.shrink(Ie);break}var Ce=dw(Ae,"time",0),Pe=dw(Ae,"mixRotate",1),Me=dw(Ae,"mixX",1),Re=dw(Ae,"mixY",Me),Oe=ge.curve;Oe&&(Ie=uw(Oe,be,Ie,Se,0,_e,Ce,we,Pe,1),Ie=uw(Oe,be,Ie,Se,1,_e,Ce,Te,Me,1),Ie=uw(Oe,be,Ie,Se,2,_e,Ce,Ee,Re,1)),_e=Ce,we=Pe,Te=Me,Ee=Re,ge=Ae}n.push(be)}}}}if(t.physics)for(var De in t.physics){var ke=t.physics[De],Le=-1;if(De.length>0){var Fe=i.findPhysicsConstraint(De);if(!Fe)throw new Error("Physics constraint not found: "+De);Le=i.physicsConstraints.indexOf(Fe)}for(var Ne in ke){var Be=ke[Ne],ze=Be[0];if(ze){var Ue=Be.length;if("reset"!=Ne){var Ve=void 0;if("inertia"==Ne)Ve=new eb(Ue,Ue,Le);else if("strength"==Ne)Ve=new ib(Ue,Ue,Le);else if("damping"==Ne)Ve=new rb(Ue,Ue,Le);else if("mass"==Ne)Ve=new nb(Ue,Ue,Le);else if("wind"==Ne)Ve=new sb(Ue,Ue,Le);else if("gravity"==Ne)Ve=new ob(Ue,Ue,Le);else{if("mix"!=Ne)continue;Ve=new ab(Ue,Ue,Le)}n.push(lw(Be,Ve,0,1))}else{for(var Ge=new hb(Ue,Le),je=0;null!=ze;ze=Be[je+1],je++)Ge.setFrame(je,dw(ze,"time",0));n.push(Ge)}}}}if(t.attachments)for(var He in t.attachments){var We=t.attachments[He],Xe=i.findSkin(He);if(!Xe)throw new Error("Skin not found: "+He);for(var Ye in We){var qe=We[Ye],Ke=i.findSlot(Ye);if(!Ke)throw new Error("Slot not found: "+Ye);var Ze=Ke.index;for(var Je in qe){var $e=qe[Je],Qe=Xe.getAttachment(Ze,Je);for(var ti in $e){var ei=$e[ti],ii=ei[0];if(ii)if("deform"==ti){for(var ri=Qe.bones,ni=Qe.vertices,si=ri?ni.length/3*2:ni.length,oi=new Xx(ei.length,ei.length,Ze,Qe),ai=dw(ii,"time",0),hi=0,li=0;;hi++){var ci=void 0,ui=dw(ii,"vertices",null);if(ui){ci=cx.newFloatArray(si);var di=dw(ii,"offset",0);if(cx.arrayCopy(ui,0,ci,di,ui.length),1!=r)for(var fi=di,pi=fi+ui.length;fi<pi;fi++)ci[fi]*=r;if(!ri)for(var mi=0;mi<si;mi++)ci[mi]+=ni[mi]}else ci=ri?cx.newFloatArray(si):ni;oi.setFrame(hi,ai,ci);var gi=ei[hi+1];if(!gi){oi.shrink(li);break}var vi=dw(gi,"time",0),yi=ii.curve;yi&&(li=uw(yi,oi,li,hi,0,ai,vi,0,1,1)),ai=vi,ii=gi}n.push(oi)}else if("sequence"==ti){for(var xi=new lb(ei.length,Ze,Qe),bi=0,_i=0;_i<ei.length;_i++){var wi=dw(ii,"delay",bi),Ti=dw(ii,"time",0),Ei=mx[dw(ii,"mode","hold")],Si=dw(ii,"index",0);xi.setFrame(_i,Ti,Ei,Si,wi),bi=wi,ii=ei[_i+1]}n.push(xi)}}}}}if(t.drawOrder){for(var Ii=new qx(t.drawOrder.length),Ai=i.slots.length,Ci=0,Pi=0;Pi<t.drawOrder.length;Pi++,Ci++){var Mi=t.drawOrder[Pi],Ri=null,Oi=dw(Mi,"offsets",null);if(Oi){Ri=cx.newArray(Ai,-1);for(var Di=cx.newArray(Ai-Oi.length,0),ki=0,Li=0,Fi=0;Fi<Oi.length;Fi++){var Ni=Oi[Fi],Bi=i.findSlot(Ni.slot);if(!Bi)throw new Error("Slot not found: "+Bi);for(var zi=Bi.index;ki!=zi;)Di[Li++]=ki++;Ri[ki+Ni.offset]=ki++}for(;ki<Ai;)Di[Li++]=ki++;for(var Ui=Ai-1;Ui>=0;Ui--)-1==Ri[Ui]&&(Ri[Ui]=Di[--Li])}Ii.setFrame(Ci,dw(Mi,"time",0),Ri)}n.push(Ii)}if(t.events){for(var Vi=new Yx(t.events.length),Gi=0,ji=0;ji<t.events.length;ji++,Gi++){var Hi=t.events[ji],Wi=i.findEvent(Hi.name);if(!Wi)throw new Error("Event not found: "+Hi.name);var Xi=new $b(cx.toSinglePrecision(dw(Hi,"time",0)),Wi);Xi.intValue=dw(Hi,"int",Wi.intValue),Xi.floatValue=dw(Hi,"float",Wi.floatValue),Xi.stringValue=dw(Hi,"string",Wi.stringValue),Xi.data.audioPath&&(Xi.volume=dw(Hi,"volume",1),Xi.balance=dw(Hi,"balance",0)),Vi.setFrame(Gi,Xi)}n.push(Vi)}for(var Yi=0,qi=0,Ki=n.length;qi<Ki;qi++)Yi=Math.max(Yi,n[qi].getDuration());i.animations.push(new Tx(e,n,Yi))},t}(),hw=function(t,e,i,r,n){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=r,this.inheritTimeline=n};function lw(t,e,i,r){for(var n=t[0],s=dw(n,"time",0),o=dw(n,"value",i)*r,a=0,h=0;;h++){e.setFrame(h,s,o);var l=t[h+1];if(!l)return e.shrink(a),e;var c=dw(l,"time",0),u=dw(l,"value",i)*r;n.curve&&(a=uw(n.curve,e,a,h,0,s,c,o,u,r)),s=c,o=u,n=l}}function cw(t,e,i,r,n,s){for(var o=t[0],a=dw(o,"time",0),h=dw(o,i,n)*s,l=dw(o,r,n)*s,c=0,u=0;;u++){e.setFrame(u,a,h,l);var d=t[u+1];if(!d)return e.shrink(c),e;var f=dw(d,"time",0),p=dw(d,i,n)*s,m=dw(d,r,n)*s,g=o.curve;g&&(c=uw(g,e,c,u,0,a,f,h,p,s),c=uw(g,e,c,u,1,a,f,l,m,s)),a=f,h=p,l=m,o=d}}function uw(t,e,i,r,n,s,o,a,h,l){if("stepped"==t)return e.setStepped(r),i;var c=n<<2,u=t[c],d=t[c+1]*l,f=t[c+2],p=t[c+3]*l;return e.setBezier(i,r,n,s,a,u,d,f,p,o,h),i+1}function dw(t,e,i){return void 0!==t[e]?t[e]:i}function fw(t){if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-8").decode(t);for(var e="",i=0,r=t.length;i<r;i++)e+=String.fromCharCode(t[i]);return decodeURIComponent(encodeURIComponent(e))}function pw(t,e){for(var i=new Ob(fw(t)),r=i.pages.length,n=0;n<r;n++){var s=i.pages[n],o=e[n];if(!o)throw new Error("Can not find page "+s.name+"'s texture, check the texture name.");s.texture=o}return i}function mw(){return mw=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},mw.apply(this,arguments)}function gw(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}void 0===Math.fround&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var vw=1,yw=function(){function t(t){this.verticesLength=0,this.indicesLength=0;var e=t.blendMode,i=t.texture,r=t.priority,n=t.renderOptions,s=void 0===n?{}:n,o=t.name,a=void 0===o?"MSpine":o,h=t.engine,l=s.mask,c=void 0===l?0:l,u=s.maskMode,d=void 0===u?0:u;this.blendMode=e,this.lastTexture=i,this.priority=r,this.engine=h,this.geometry=this.createGeometry(),this.material=this.createMaterial(d,c),this.mesh=El.create(h,{name:a+vw++,priority:this.priority,material:this.material,geometry:this.geometry}),this.vertices=new Float32Array(xw.MAX_VERTICES*xw.VERTEX_SIZE),this.indices=new Uint16Array(xw.MAX_VERTICES)}var e=t.prototype;return e.createGeometry=function(){var t=Float32Array.BYTES_PER_ELEMENT,e=t*xw.VERTEX_SIZE,i={aPosition:{size:2,offset:0,stride:e,data:new Float32Array(0)},aColor:{size:4,offset:2*t,stride:e,dataSource:"aPosition"},aTexCoords:{size:2,offset:6*t,stride:e,dataSource:"aPosition"},aColor2:{size:4,offset:8*t,stride:e,dataSource:"aPosition"}};return wl.create(this.engine,{attributes:i,indices:{data:new Uint16Array(0),releasable:!0},mode:Ys.TRIANGLES,maxVertex:xw.MAX_VERTICES})},e.createMaterial=function(t,e){var i,r,n,s=Lo.create(this.engine,{shader:(i=this.engine,r=i.env,n=[["ENV_EDITOR",r===Xo]],{fragment:"precision mediump float;varying mediump vec4 vLight;varying mediump vec4 vDark;varying vec2 vTexCoords;uniform sampler2D uTexture;void main(){vec4 texColor=texture2D(uTexture,vTexCoords);gl_FragColor.a=texColor.a*vLight.a;gl_FragColor.rgb=((texColor.a-1.0)*vDark.a+1.0-texColor.rgb)*vDark.rgb+texColor.rgb*vLight.rgb;gl_FragColor.rgb*=gl_FragColor.a;}",vertex:"attribute vec2 aPosition;attribute vec4 aColor;attribute vec4 aColor2;attribute vec2 aTexCoords;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec2 _Size;varying vec4 vLight;varying vec4 vDark;varying vec2 vTexCoords;void main(){vLight=aColor;vDark=aColor2;vTexCoords=aTexCoords;gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(aPosition*_Size,0.0,1.0);}",glslVersion:fl.GLSL1,macros:n,shared:!0})});return s.setTexture("uTexture",this.lastTexture),s.blending=!0,s.culling=!1,s.depthTest=!1,s.depthMask=!1,function(t,e){switch(t.blendEquation=[Ys.FUNC_ADD,Ys.FUNC_ADD],e){case c_.Multiply:t.blendFunction=[Ys.DST_COLOR,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA];break;case c_.Screen:t.blendFunction=[Ys.ONE,Ys.ONE_MINUS_SRC_COLOR,Ys.ONE,Ys.ONE_MINUS_SRC_COLOR];break;case c_.Additive:t.blendFunction=[Ys.ONE,Ys.ONE,Ys.ONE,Ys.ONE];break;case c_.Normal:t.blendFunction=[Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA,Ys.ONE,Ys.ONE_MINUS_SRC_ALPHA];break;default:throw new Error("Unknown blend mode: "+e+".")}}(s,this.blendMode),s},e.updateMesh=function(t,e,i){if(!this.vertices||!this.indices)throw new Error("Can not update SpineMesh after dispose.");var r=this.verticesLength,n=this.indicesLength,s=this.verticesLength/xw.VERTEX_SIZE;this.vertices.set(t,r),this.verticesLength+=i;for(var o=0,a=n;o<e.length;o++,a++)this.indices[a]=e[o]+s;this.indicesLength+=e.length},e.endUpdate=function(t){if(!this.vertices||!this.indices)throw new Error("Can not update SpineMesh after dispose.");for(var e=this.verticesLength;e<this.vertices.length;e++)this.vertices[e]=0;for(var i=this.indicesLength;i<this.indices.length;i++)this.indices[i]=0;this.geometry.setAttributeData("aPosition",this.vertices),this.geometry.setIndexData(this.indices),this.geometry.setDrawCount(this.indicesLength)},e.startUpdate=function(){this.verticesLength=0,this.indicesLength=0},e.dispose=function(){this.geometry.dispose(),this.vertices=null,this.indices=null},ub(t,[{key:"blending",get:function(){return this.blendMode}},{key:"texture",get:function(){return this.lastTexture}},{key:"indicesNum",get:function(){return this.indicesLength}}]),t}();var xw=function(){function t(t,e){this.slotList=[],this.vertices=[],this.clipper=new ow,this.tempColor=new hx,this.tempDark=new hx,this.wm=oa.Matrix4.fromIdentity(),this.meshGroups=[],this.meshToAdd=[],this.slotList=t,this.meshName=e.meshName,this.transform=e.transform,this.listIndex=e.listIndex,this.pma=e.pma,this.renderOptions=e.renderOptions,this.engine=e.engine}var e=t.prototype;return e.resetMeshes=function(){this.meshToAdd.length=0},e.update=function(){var e,i=this,r=this.clipper,n=this.pma,s=this.vertices,o=[],a=[],h=0,l=[],c=0,u=0;this.currentMesh=this.meshGroups[u],this.meshGroups.map(function(t){return t.startUpdate()});for(var d,f=nx(this.slotList);!(d=f()).done;){var p=d.value,m=r.isClipping()?2:t.VERTEX_SIZE,g=p.getAttachment(),v=void 0,y=void 0,x=0;if(a=[],l=[],h=0,c=0,p.bone.active){if(sx(g,zb)){var b=g;v=b.color,s=this.vertices,x=m<<2,b.computeWorldVertices(p,s,0,m),o=t.QUAD_TRIANGLES,e=b.uvs,y=b.region.page.texture}else{if(!sx(g,Fb)){if(sx(g,Mb)){r.clipStart(p,g);continue}r.clipEndWithSlot(p);continue}var _=g;v=_.color,s=this.vertices,x=(_.worldVerticesLength>>1)*m,_.computeWorldVertices(p,0,_.worldVerticesLength,s,0,m),o=_.triangles,e=_.uvs,y=_.region.page.texture}if(y){var w=p.bone.skeleton.color,T=p.color,E=this.tempColor,S=this.tempDark;if(E.set(w.r*T.r*v.r,w.g*T.g*v.g,w.b*T.b*v.b,w.a*T.a*v.a),n&&(E.r*=E.a,E.g*=E.a,E.b*=E.a),p.darkColor?n?(S.r=p.darkColor.r*E.a,S.g=p.darkColor.g*E.a,S.b=p.darkColor.b*E.a,S.a=1):(S.setFromColor(p.darkColor),S.a=0):S.set(0,0,0,1),r.isClipping())r.clipTriangles(s,x,o,o.length,e,E,S,!0),h=(a=r.clippedVertices).length,c=(l=r.clippedTriangles).length;else{for(var I=2,A=0,C=x;I<C;I+=m,A+=2)s[I]=E.r,s[I+1]=E.g,s[I+2]=E.b,s[I+3]=E.a,s[I+4]=e[A],s[I+5]=e[A+1],s[I+6]=S.r,s[I+7]=S.g,s[I+8]=S.b,s[I+9]=S.a;a=s.slice(0,x),h=x,l=o,c=o.length}if(0==h||0==c){r.clipEndWithSlot(p);continue}var P=this.findMeshIndex(u,p.data.blendMode,y,c);if(-1===P){var M=this.currentMesh=new yw({blendMode:p.data.blendMode,texture:y,name:this.meshName,priority:this.listIndex+=.01,renderOptions:this.renderOptions,engine:this.engine});u=this.meshGroups.length,this.meshGroups.push(M),this.meshToAdd.push(M.mesh)}else u=P,this.currentMesh=this.meshGroups[P];this.currentMesh.updateMesh(a,l,h)}r.clipEndWithSlot(p)}else r.clipEndWithSlot(p)}r.clipEnd(),this.wm=this.transform.getWorldMatrix(),this.meshGroups.map(function(t,e){t.endUpdate(i.wm)})},e.render=function(t){var e=this.transform.getWorldMatrix();this.meshGroups.forEach(function(i){var r=i.mesh;r.worldMatrix=e,r.render(t)})},e.findMeshIndex=function(e,i,r,n){for(var s=-1,o=e;o<this.meshGroups.length;o++){var a=this.meshGroups[o];if(a&&a.blending===i&&a.texture===r&&n+a.indicesNum<t.MAX_VERTICES){s=o;break}}return s},t}();xw.QUAD_TRIANGLES=[0,1,2,2,3,0],xw.VERTEX_SIZE=12,xw.MAX_VERTICES=10920;var bw=oa.Vector2,_w=oa.Vector3,ww=function(t){function e(e){var i;return(i=t.call(this,e)||this).offset=new bw,i.size=new bw,i}$y(e,t);var i=e.prototype;return i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.options=e.options,this.rendererOptions=mw({renderMode:en.RenderMode.MESH},e.renderer||{},{mask:0,maskMode:Bs.NONE}),this.item.getHitTestParams=this.getHitTestParams.bind(this),e.mask&&this.maskManager.setMaskOptions(this.engine,e.mask),this.rendererOptions.maskMode=this.maskManager.maskMode,this.rendererOptions.mask=this.maskManager.getRefValue(),this.resource&&Object.keys(this.resource).length){var i=this.resource,r=i.images,n=i.skeletonType,s=i.atlas,o=i.skeleton,a=i.editorResourceID;if(!this.cache){var h=s.source,l=h[0],c=h[1],u=pw(c?new Uint8Array(s.bins.buffer,l,c):new Uint8Array(s.bins.buffer,l),r),d=o.bins.buffer,f=o.source,p=f[0],m=f[1],g=function(t,e){var i=new Uint8Array(t);return"json"===e?fw(i):new DataView(i.buffer)}(m?d.slice(p,p+m):d.slice(p),n),v=function(t,e,i){var r,n=new Gb(t);if("skel"===i){r=new b_(n);var s=new __(e);s.readInt32(),s.readInt32();var o=s.readString();if(!o)throw new Error("Spine version information not retrieved. Please export binary data using Spine 4.2.");if(o&&"2"!==o.split(".")[1])throw new Error("Please export binary data using Spine 4.2, current version: "+o+".")}else r=new aw(n);return r.readSkeletonData(e)}(u,g,n);this.cache={atlas:u,skeletonData:v},a&&(this.cache.editorResourceID=a)}}},i.onAwake=function(){var t,e;this.cache&&(this.initContent(this.cache.atlas,this.cache.skeletonData,this.options),this.startSize=this.options.startSize,this.state&&this.skeleton&&(this.state.apply(this.skeleton),this.onUpdate(0),this.resize(),this.materials=null!=(e=null==(t=this.content)?void 0:t.meshGroups.map(function(t){return t.mesh.material}))?e:[]))},i.onUpdate=function(t){this.state&&this.skeleton&&(this.state.update(t/1e3),this.state.apply(this.skeleton),this.skeleton.update(t/1e3),this.skeleton.updateWorldTransform(n_.update),this.content&&this.content.update())},i.render=function(t){if(this.content){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.content.meshGroups.length;e++){this.content.meshGroups[e].mesh.material.setVector2("_Size",new bw(this.startSize*this.scaleFactor,this.startSize*this.scaleFactor))}this.content.render(t)}},i.drawStencilMask=function(t){var e=this;if(this.isActiveAndEnabled&&this.content){var i=this.content.transform.getWorldMatrix();this.content.meshGroups.forEach(function(r){var n=r.mesh;n.worldMatrix=i,e.maskManager.drawGeometryMask(e.engine.renderer,n.geometry,i,n.material,t)})}},i.onDestroy=function(){this.item.endBehavior===en.EndBehavior.destroy&&this.state&&(this.state.clearListeners(),this.state.clearTracks())},i.initContent=function(t,e,i){var r="string"==typeof i.activeAnimation?[i.activeAnimation]:i.activeAnimation;if(this.skeleton=new l_(e),this.skeletonData=e,this.animationStateData=new Cb(this.skeletonData),this.animationStateData.defaultMix=i.mixDuration||0,this.skinList=function(t){return t.skins.filter(function(t){return"default"!==t.name}).map(function(t){return t.name})}(e),this.animationList=function(t){return t.animations.map(function(t){return t.name})}(e),this.resizeRule=i.resizeRule,this.setSkin(i.activeSkin||(this.skinList.length?this.skinList[0]:"default")),this.state=new db(this.animationStateData),1===r.length)if(isNaN(i.speed)){var n=Number((function(t,e){var i=t.findAnimation(e);return Be(i),i.duration}(this.skeletonData,r[0])/this.item.duration).toFixed(2));this.setAnimation(r[0],n)}else this.setAnimation(r[0],i.speed);else i.loopEnd?this.setAnimationListLoopEnd(r,i.speed):this.setAnimationList(r,i.speed);this.cache=mw({},this.cache,{skinList:this.skinList,animationList:this.animationList}),this.pma=t.pages[0].pma,this._priority=this.item.renderOrder,this.content=new xw(this.skeleton.drawOrder,{listIndex:this.item.renderOrder,meshName:this.name,transform:this.transform,pma:this.pma,renderOptions:this.rendererOptions,engine:this.engine})},i.getBoundingBox=function(){var t=this.getBounds(),e={type:Oo.triangle,area:[]};if(!t)return e;var i=t.x,r=t.y,n=t.width,s=t.height,o=this.transform.getWorldMatrix(),a=i+n/2,h=r+s/2,l=new _w(a-n/2,h-s/2,0),c=new _w(a+n/2,h-s/2,0),u=new _w(a+n/2,h+s/2,0),d=new _w(a-n/2,h+s/2,0),f=this.startSize*this.scaleFactor;return l.multiply(f),c.multiply(f),u.multiply(f),d.multiply(f),o.projectPoint(l),o.projectPoint(c),o.projectPoint(u),o.projectPoint(d),e.area=[{p0:l,p1:c,p2:u},{p0:l,p1:u,p2:d}],e},i.getHitTestParams=function(t){var e=this.getBoundingBox(),i=this.engine.env;if(e.area.length)return t&&i===Xo?{type:Oo.triangle,triangles:e.area,backfaceCulling:!1,behavior:en.InteractBehavior.NOTIFY}:void 0},i.setAnimation=function(t,e){var i;if(!this.skeleton||!this.state)throw new Error("Set animation before skeleton create.");if(!this.animationList.length)throw new Error("animationList is empty, check your spine file.");var r=this.item.endBehavior===en.EndBehavior.restart,n=null==(i=this.state.tracks[0])?void 0:i.listener;n&&(n.end=function(){}),this.state.setEmptyAnimation(0),this.animationList.includes(t)?(this.state.setAnimation(0,t,r),this.activeAnimation=[t]):(console.warn("Animation "+JSON.stringify(t)+" not exists in animationList: "+this.animationList+", set to "+this.animationList[0]+"."),this.state.setAnimation(0,this.animationList[0],r),this.activeAnimation=[this.animationList[0]]),void 0===e||Number.isNaN(e)||this.setSpeed(e)},i.setAnimationList=function(t,e){var i,r,n=function(e){var r=t[e],n=void 0;if(n=0===e?i.state.setAnimation(0,r,!1):i.state.addAnimation(0,r,!1),i.item.endBehavior===en.EndBehavior.restart){var o={end:function(){s.state.addAnimation(0,r,!1).listener=o}};n.listener=o}},s=this;if(!this.skeleton||!this.state)throw new Error("Set animation before skeleton create.");if(!this.animationList.length)throw new Error("animationList is empty, please check your setting.");if(1!==t.length){var o=null==(r=this.state.tracks[0])?void 0:r.listener;o&&(o.end=function(){});for(var a=0;a<t.length;a++)i=this,n(a);this.activeAnimation=t,void 0===e||isNaN(e)||this.setSpeed(e)}else this.setAnimation(t[0],e)},i.setAnimationListLoopEnd=function(t,e){var i,r=this;if(!this.skeleton||!this.state)throw new Error("Set animation before skeleton create.");if(!this.animationList.length)throw new Error("animationList is empty, please check your setting.");if(1!==t.length){var n=null==(i=this.state.tracks[0])?void 0:i.listener;n&&(n.end=function(){});for(var s=0;s<t.length-1;s++){var o=t[s],a=void 0;a=0===s?this.state.setAnimation(0,o,!1):this.state.addAnimation(0,o,!1),s===t.length-2&&(a.listener={complete:function(){r.state.addAnimation(0,t[t.length-1],!0)}})}isNaN(e)||this.setSpeed(e)}else this.setAnimation(t[0],e)},i.setSpeed=function(t){this.state&&(this.state.timeScale=t)},i.getSpeed=function(){return this.state.timeScale||1},i.getActiveAnimation=function(){return this.activeAnimation},i.getAnimationState=function(){return this.state},i.setMixDuration=function(t,e,i){this.animationStateData&&this.animationStateData.setMix(t,e,i)},i.setDefaultMixDuration=function(t){this.state&&(this.animationStateData.defaultMix=t,this.state.tracks[0]&&(this.state.tracks[0].mixDuration=t))},i.deleteMixForLoop=function(){var t=this.activeAnimation[this.activeAnimation.length-1],e=this.activeAnimation[0];this.animationStateData.setMix(t,e,0)},i.setSkin=function(t){if(!this.skeleton)throw new Error("Set skin before skeleton create.");if(!t||"default"!==t&&!this.skinList.includes(t))throw new Error("skin "+t+" not exists in skinList: "+this.skinList+".");this.skeleton.setSkinByName(t),this.skeleton.setToSetupPose()},i.resize=function(){var t=this.getBounds();if(t&&this.item.composition){var e,i=t.width;if(this.resizeRule){var r=this.item.composition.camera,n=this.transform.getWorldPosition().z,s=r.getInverseVPRatio(n),o=s.x,a=s.y;e=r.clipMode===en.CameraClipMode.portrait?o/1500:a/3248}else e=1/i;this.scaleFactor=e,this.transform.setScale(1,1,this.transform.scale.z)}},i.convertSizeToOldRule=function(){var t=this.getBounds();if(!t||!this.item.composition||!this.resizeRule)return 1;var e=t.width,i=this.scaleFactor;return this.startSize*i*e},i.getBounds=function(){if(this.state&&this.skeleton)return this.skeleton.updateWorldTransform(n_.update),this.skeleton.getBounds(this.offset,this.size),{x:this.offset.x,y:this.offset.y,width:this.size.x,height:this.size.y}},e}(Ho);gw([cn()],ww.prototype,"resource",void 0),gw([cn()],ww.prototype,"cache",void 0),ww=gw([ln(en.DataType.SpineComponent)],ww),oi("spine",function(t){function e(){return t.apply(this,arguments)}return $y(e,t),e}(ix(Bi)));var Tw="2.9.0-alpha.1";function Ew(t,e){return(Ew=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Sw(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ew(t,e)}function Iw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Iw=function(){return!!t})()}function Aw(t,e,i){return(Aw=Iw()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Ew(n,i.prototype),n}).apply(null,arguments)}function Cw(t){return(Cw=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Pw(t){var e="function"==typeof Map?new Map:void 0;return Pw=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return Aw(t,arguments,Cw(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ew(r,t)},Pw(t)}He.info("Plugin spine version: "+Tw+".");var Mw=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="ffd",e}return Sw(e,t),e}(Pw(Bi));function Rw(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):Rw(t,e)}var Ow=function(t){function e(e){var i;return(i=t.call(this,e)||this).enableFFD=!0,i.rowNum=5,i.colNum=5,i.controlPoints=[],i.boundMin=new oa.Vector3(-.5,-.5,0),i.boundMax=new oa.Vector3(.5,.5,0),e.gpuCapability.detail.maxVertexUniforms<256&&(i.enableFFD=!1),i}Sw(e,t);var i=e.prototype;return i.onStart=function(){this.collectSpriteComponents()},i.onUpdate=function(t){this.updateShaderUniform()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.data=e,this.initData()},i.collectSpriteComponents=function(){if(this.item){var t=this.item.getComponent(Yd);if(t){if(this.enableFFD){var e=new bl(this.engine);e.fromData({vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;\n#define MAX_BLOCK_NUM 13\n#define EPSILON 1e-6\n#define MAX_K 9\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec3 _ControlPoints[MAX_BLOCK_NUM*MAX_BLOCK_NUM];uniform vec3 _BoundMin;uniform vec3 _BoundMax;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform int _ColNum;uniform int _RowNum;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nfloat binomialCoefficient(int n,int k){if(k>n-k)k=n-k;float result=1.0;for(int i=1;i<=MAX_K;++i){if(i>k)break;result*=float(n-i+1)/float(i);}return result;}float bernstein(int n,int k,float t){t=clamp(t,0.0,1.0);if(k<0||k>n)return 0.0;if(abs(t)<EPSILON&&k==0)return 1.0;else if(abs(t-1.0)<EPSILON&&k==n)return 1.0;float coeff=binomialCoefficient(n,k);float tk=(k==0)? 1.0 : pow(t,float(k));float tnk=((n-k)==0)? 1.0 : pow(1.0-t,float(n-k));return coeff*tk*tnk;}vec3 bezierSurface(vec3 originalPos){bool isInBoundingBox=originalPos.x>=_BoundMin.x-EPSILON&&originalPos.x<=_BoundMax.x+EPSILON&&originalPos.y>=_BoundMin.y-EPSILON&&originalPos.y<=_BoundMax.y+EPSILON&&originalPos.z>=_BoundMin.z-EPSILON&&originalPos.z<=_BoundMax.z+EPSILON;if(!isInBoundingBox){return originalPos;}float u=(originalPos.x-_BoundMin.x)/(_BoundMax.x-_BoundMin.x);float v=(originalPos.y-_BoundMin.y)/(_BoundMax.y-_BoundMin.y);vec3 newPos=vec3(0.0);for(int row=0;row<MAX_BLOCK_NUM;++row){if(row>=_RowNum)break;float bv=bernstein(_RowNum-1,row,v);for(int col=0;col<MAX_BLOCK_NUM;++col){if(col>=_ColNum)break;float bu=bernstein(_ColNum-1,col,u);int idx=row*_ColNum+col;newPos+=_ControlPoints[idx]*bu*bv;}}return newPos;}void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec3 pos=vec3(aPos.xy*_Size,aPos.z);vec3 newPos=bezierSurface(pos);gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(newPos,1.0);}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;vec3 newPos=bezierSurface(vertexPosition);gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(newPos,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",fragment:"precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",id:ei(),dataType:en.DataType.Shader}),t.material.shader=e}this.currentSpriteComponent=t}}},i.initData=function(){if(this.data&&this.data.controlPoints){this.boundMax=this.data.boundMax,this.boundMin=this.data.boundMin,this.rowNum=this.data.rowNum,this.colNum=this.data.colNum;var t=this.rowNum*this.colNum,e=Math.min(this.data.controlPoints.length,t);this.controlPoints.length=0;for(var i=0;i<e;i++){var r,n,s,o=this.data.controlPoints[i];this.controlPoints.push(Rw(o,oa.Vector3)?o:new oa.Vector3(null!=(r=null==o?void 0:o.x)?r:0,null!=(n=null==o?void 0:o.y)?n:0,null!=(s=null==o?void 0:o.z)?s:0))}for(var a=e;a<t;a++)this.controlPoints.push(new oa.Vector3(0,0,0));this.updateShaderUniform()}},i.updateShaderUniform=function(){if(this.currentSpriteComponent){var t=this.currentSpriteComponent.material;if(t){t.setVector3("_BoundMin",this.boundMin),t.setVector3("_BoundMax",this.boundMax),t.setInt("_RowNum",this.rowNum),t.setInt("_ColNum",this.colNum);for(var e=0;e<this.colNum;e++)for(var i=0;i<this.rowNum;i++){var r=e*this.rowNum+i;if(r<this.controlPoints.length){var n=this.controlPoints[r];t.setVector3("_ControlPoints["+r+"]",n)}}}}},e}(Ls);Ow=function(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}([ln("FFDComponent")],Ow);var Dw="2.9.0-alpha.1";oi("ffd",Mw),He.info("Plugin ffd version: "+Dw+".");var kw=(t=>(t.SPRITE="sprite",t.TEXT="text",t.VIDEO="video",t.GROUP="group",t.GENERATOR="generator",t.EFFECTS="effects",t.FRAME="frame",t))(kw||{}),Lw=(en.ItemType.sprite,en.ItemType.text,en.ItemType.video,en.ItemType.null,en.ItemType.composition,en.ItemType.composition,en.ItemType.sprite,class t extends oa.Vector2{subtract(t){return this.x-=t.x,this.y-=t.y,this}toViewCoordinate(t,e){return this.x=(this.x+1)/2*t,this.y=(1-(this.y+1)/2)*e,this}clone(){return new t(this.x,this.y)}distanceTo(t){const e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)}scaleByCenter(e,i=new t){const r=(new t).subtractVectors(i,this).multiply(e);return this.subtractVectors(i,r)}round(t=0){const e=Math.pow(10,t);return this.x=Math.round(this.x*e)/e,this.y=Math.round(this.y*e)/e,this}distanceToLine(e){const i=Math.pow(e.length(),2),{start:r,end:n}=e;if(0===i)return{d:(new t).subtractVectors(this,r).length(),t:0};const s=Nw(((this.x-r.x)*(n.x-r.x)+(this.y-r.y)*(n.y-r.y))/i,0,1);return{d:(new t).subtractVectors(this,e.at(s)).length(),t:s}}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}rotateAround(t,e){const i=Math.cos(e),r=Math.sin(e),n=this.x-t.x,s=this.y-t.y;return this.x=n*i-s*r+t.x,this.y=n*r+s*i+t.y,this}}),Fw=1e-6;function Nw(t,e,i){const r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,s=Math.min(r,n),o=Math.max(r,n);return Math.min(Math.max(t,s),o)}var Bw=Math.PI/180,zw=180/Math.PI;function Uw(t){return Math.atan2(-t.y,-t.x)+Math.PI}function Vw(t,e){const i=Math.min(Math.max(t.dot(e)/t.length()/e.length(),-1),1);let r=Math.acos(i);return r=t.x*e.y-t.y*e.x>0?r:-r,r}function Gw(t,e,i=Math.round){if(Number.isInteger(t))return t;const r=Math.pow(10,e);return i(t*r)/r}function jw(t){let e,i=0;return t.forEach((t,r)=>{if(0===r)e=Math.abs(t);else{const n=Math.abs(t);e<n&&(e=n,i=r)}}),i}function Hw(t,e){return Math.abs(t-e)<Fw||t===1/0&&e===1/0||t===-1/0&&e===-1/0}function Ww(t){return isNaN(t)||Math.abs(t)<Fw}function Xw(t,e){const i=new Kw,{min:r,max:n}=t,{min:s,max:o}=e,a=r.clone().add((new Lw).subtractVectors(n,r).multiply(s)),h=r.clone().add((new Lw).subtractVectors(n,r).multiply(o));return i.setFromVec2ArrayWithOutCorners([a,h]),i}function Yw(t,e){const i=new Kw,{min:r,max:n}=t,{min:s,max:o}=e,a=(new Lw).subtractVectors(s,r).divide((new Lw).subtractVectors(n,r)),h=(new Lw).subtractVectors(o,r).divide((new Lw).subtractVectors(n,r));return i.setFromVec2ArrayWithOutCorners([a,h]),i}var qw=class t{constructor(t=new Lw,e=new Lw){A(this,"start",new Lw),A(this,"end",new Lw),this.start.copyFrom(t),this.end.copyFrom(e)}set(t,e){return this.start.copyFrom(t),this.end.copyFrom(e),this}copyFrom(t){return this.start.copyFrom(t.start),this.end.copyFrom(t.end),this}direction(){return(new Lw).subtractVectors(this.end,this.start).normalize()}getCenter(t=new Lw){return t.addVectors(this.start,this.end).multiply(.5)}delta(t=new Lw){return t.subtractVectors(this.end,this.start)}distanceSq(){return this.start.distanceSquared(this.end)}distance(){return this.start.distance(this.end)}at(t,e=new Lw){return this.delta(e).multiply(t).add(this.start)}closestPointToPointParameter(t,e){const i=new Lw,r=new Lw;i.subtractVectors(t,this.start),r.subtractVectors(this.end,this.start);const n=r.dot(r);let s=r.dot(i)/n;return e&&(s=Nw(s,0,1)),s}closestPointToPoint(t,e,i=new Lw){const r=this.closestPointToPointParameter(t,e);return this.delta(i).multiply(r).add(this.start)}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new t).copyFrom(this)}length(){return(new Lw).subtractVectors(this.end,this.start).length()}crossWithLine(t){const e=this.delta(),i=t.delta(),r=(new Lw).subtractVectors(t.start,this.start),n=(new Lw).subtractVectors(t.end,this.start),s=(new Lw).subtractVectors(this.start,t.start),o=(new Lw).subtractVectors(this.end,t.start),a=r.cross(e),h=n.cross(e),l=s.cross(i),c=o.cross(i);return a*h<0&&l*c<0}},Kw=class t{constructor(t=new Lw(1/0,1/0),e=new Lw(-1/0,-1/0)){A(this,"corners",[]),A(this,"min",new Lw(1/0,1/0)),A(this,"max",new Lw(-1/0,-1/0)),this.min=t.clone(),this.max=e.clone(),this.isEmpty()?this.corners=[]:this.corners=[new Lw(e.x,t.y),e.clone(),new Lw(t.x,e.y),t.clone()]}set(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this.corners=[new Lw(e.x,t.y),e.clone(),new Lw(t.x,e.y),t.clone()],this}setFromVec2Array(t){return this.min=(new Lw).copyFrom(t[0]),this.max=(new Lw).copyFrom(t[0]),t.forEach(t=>{this.min.min(t),this.max.max(t),this.corners.push(t.clone())}),this}setFromVec2ArrayWithOutCorners(t){return this.min=(new Lw).copyFrom(t[0]),this.max=(new Lw).copyFrom(t[0]),t.forEach(t=>{this.min=this.min.min(t),this.max=this.max.max(t)}),this.corners.push(new Lw(this.max.x,this.min.y)),this.corners.push(new Lw(this.max.x,this.max.y)),this.corners.push(new Lw(this.min.x,this.max.y)),this.corners.push(new Lw(this.min.x,this.min.y)),this}setFromCenterAndSize(t,e){const i=(new Lw).copyFrom(e).multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this.corners=[new Lw(this.max.x,this.min.y),this.max.clone(),new Lw(this.min.x,this.max.y),this.min.clone()],this}clone(){return(new t).copyFrom(this)}copyFrom(t){return this.corners=[],this.min.copyFrom(t.min),this.max.copyFrom(t.max),t.corners.forEach(t=>{this.corners.push(t.clone())}),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this.corners=[],this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCorners(){const t=[];return this.corners.forEach(e=>{t.push(e.clone())}),t}getCenter(t=new Lw){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiply(.5)}getSize(t=new Lw){return this.isEmpty()?t.set(0,0):t.subtractVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.subtract(t),this.max.add(t),this}expandByScalar(t){return this.min.add(-t),this.max.add(t),this}containsPoint(t,e=!0){if(e)return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y);if(this.isEmpty())return!1;for(let e=0;e<this.corners.length;e++){const i=this.corners[e],r=this.corners[(e+1)%4],n=new Lw(r.x-i.x,r.y-i.y),s=new Lw(t.x-i.x,t.y-i.y);if(n.cross(s)<0)return!1}return!0}containsBox(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}getParameter(t,e=new Lw){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}clampPoint(t,e=new Lw){return e.copyFrom(t).clamp(this.min,this.max)}distanceToPoint(t){return(new Lw).copyFrom(t).clamp(this.min,this.max).subtract(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.min.x>this.max.x||this.min.y>this.max.y?this.makeEmpty():this}union(e){return e instanceof t?(this.min.min(e.min),this.max.max(e.max)):(this.min.min(e),this.max.max(e)),this.corners=[new Lw(this.max.x,this.min.y),this.max.clone(),new Lw(this.min.x,this.max.y),this.min.clone()],this}translate(t){return this.min.add(t),this.max.add(t),this.corners.forEach(e=>{e.add(t)}),this}scale(t,e){e??(e=this.getCenter());const i="number"==typeof t?new Lw(t,t):new Lw(t.x,t.y);return this.min.scaleByCenter(i,e),this.max.scaleByCenter(i,e),this.corners.forEach(t=>{t.scaleByCenter(i,e)}),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}intersectsBox(t,e=!0){if(e)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);if(!this.isEmpty())for(let e=0;e<this.corners.length;e++){const i=new qw(this.corners[e],this.corners[(e+1)%4]);if(t.containsPoint(this.corners[e],!1))return!0;for(let e=0;e<t.corners.length;e++){const r=new qw(t.corners[e],t.corners[(e+1)%4]);if(this.containsPoint(t.corners[e],!1))return!0;if(i.crossWithLine(r))return!0}}for(let e=0;e<t.corners.length;e++){const i=this.containsPoint(t.corners[e],!1),r=t.containsPoint(this.corners[e],!1);if(i||r)return!0}return!1}rotate(t,e){e??(e=this.getCenter());const i=this.corners.map(i=>i.rotateAround(e,t));return this.makeEmpty(),this.setFromVec2Array(i),this}},Zw=class t{constructor(t=new Lw,e=0){A(this,"center"),A(this,"radius"),this.center=t.clone(),this.radius=e}set(t,e){return this.center=(new Lw).copyFrom(t),this.radius=e,this}clone(){return(new t).copy(this)}copy(t){return this.center.copyFrom(t.center),this.radius=t.radius,this}makeEmpty(){return this.center=new Lw,this.radius=0,this}isEmpty(){return this.radius<=0}getCenter(t=new Lw){return t.copyFrom(this.center),t}getRadius(){return this.radius}expandByPoint(t){return this.radius=this.center.distanceTo(t),this}expandByScalar(t){return this.radius+=t,this}containsPoint(t){return this.center.distanceTo(t)<this.radius}containsBox(t){for(let e=0;e<4;e++)if(!this.containsPoint(t.corners[e]))return!1;return!0}intersectsBox(t){for(let e=0;e<4;e++)if(this.containsPoint(t.corners[e]))return!0;return!1}distanceToPoint(t){return this.center.distanceTo(t)-this.radius}},Jw=class extends oa.Quaternion{},$w=class t extends oa.Vector3{clone(){return new t(this.x,this.y,this.z)}setFromMatrixColumn(t,e){return this.set(...t.elements.slice(4*e))}applyEuler(t,e){return this.applyQuaternion((new Jw).setFromEuler(t))}applyQuaternion(e,i=new t){const{x:r,y:n,z:s,w:o}=e,{x:a,y:h,z:l}=this.subtract(i),c=o*a+n*l-s*h,u=o*h+s*a-r*l,d=o*l+r*h-n*a,f=-r*a-n*h-s*l;return this.x=c*o+f*-r+u*-s-d*-n+i.x,this.y=u*o+f*-n+d*-r-c*-s+i.y,this.z=d*o+f*-s+c*-n-u*-r+i.z,this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}applyMatrix(e,i=new t){const r=e.elements,{x:n,y:s,z:o}=this.subtract(i);let a=1/(r[3]*n+r[7]*s+r[11]*o+r[15]);return a=isNaN(a)?1:a,this.x=(r[0]*n+r[4]*s+r[8]*o+r[12])*a+i.x,this.y=(r[1]*n+r[5]*s+r[9]*o+r[13])*a+i.y,this.z=(r[2]*n+r[6]*s+r[10]*o+r[14])*a+i.z,this}},Qw=class t extends oa.Matrix4{static fromArray(e,i=0){return(new t).setFromArray(e,i)}clone(){const e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}compose(t,e,i,r=$w.ZERO){const n=this.elements,{x:s,y:o,z:a,w:h}=e,l=-r.x,c=-r.y,u=-r.z,d=s+s,f=o+o,p=a+a,m=s*d,g=s*f,v=s*p,y=o*f,x=o*p,b=a*p,_=h*d,w=h*f,T=h*p,{x:E,y:S,z:I}=i;return n[0]=(1-(y+b))*E,n[1]=(g+T)*E,n[2]=(v-w)*E,n[3]=0,n[4]=(g-T)*S,n[5]=(1-(m+b))*S,n[6]=(x+_)*S,n[7]=0,n[8]=(v+w)*I,n[9]=(x-_)*I,n[10]=(1-(m+y))*I,n[11]=0,n[12]=l*n[0]+c*n[4]+u*n[8]-l+t.x,n[13]=l*n[1]+c*n[5]+u*n[9]-c+t.y,n[14]=l*n[2]+c*n[6]+u*n[10]-u+t.z,this}extractRotation(t){const e=new $w,i=t.elements,r=this.elements,n=1/e.setFromMatrixColumn(t,0).length(),s=1/e.setFromMatrixColumn(t,1).length(),o=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]*s,r[5]=i[5]*s,r[6]=i[6]*s,r[7]=0,r[8]=i[8]*o,r[9]=i[9]*o,r[10]=i[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,r=t.y,n=t.z,s=Math.cos(i),o=Math.sin(i),a=Math.cos(r),h=Math.sin(r),l=Math.cos(n),c=Math.sin(n);if(t.order===oa.EulerOrder.XYZ){const t=s*l,i=s*c,r=o*l,n=o*c;e[0]=a*l,e[4]=-a*c,e[8]=h,e[1]=i+r*h,e[5]=t-n*h,e[9]=-o*a,e[2]=n-t*h,e[6]=r+i*h,e[10]=s*a}else if(t.order===oa.EulerOrder.YXZ){const t=a*l,i=a*c,r=h*l,n=h*c;e[0]=t+n*o,e[4]=r*o-i,e[8]=s*h,e[1]=s*c,e[5]=s*l,e[9]=-o,e[2]=i*o-r,e[6]=n+t*o,e[10]=s*a}else if(t.order===oa.EulerOrder.ZXY){const t=a*l,i=a*c,r=h*l,n=h*c;e[0]=t-n*o,e[4]=-s*c,e[8]=r+i*o,e[1]=i+r*o,e[5]=s*l,e[9]=n-t*o,e[2]=-s*h,e[6]=o,e[10]=s*a}else if(t.order===oa.EulerOrder.ZYX){const t=s*l,i=s*c,r=o*l,n=o*c;e[0]=a*l,e[4]=r*h-i,e[8]=t*h+n,e[1]=a*c,e[5]=n*h+t,e[9]=i*h-r,e[2]=-h,e[6]=o*a,e[10]=s*a}else if(t.order===oa.EulerOrder.YZX){const t=s*a,i=s*h,r=o*a,n=o*h;e[0]=a*l,e[4]=n-t*c,e[8]=r*c+i,e[1]=c,e[5]=s*l,e[9]=-o*l,e[2]=-h*l,e[6]=i*c+r,e[10]=t-n*c}else if(t.order===oa.EulerOrder.XZY){const t=s*a,i=s*h,r=o*a,n=o*h;e[0]=a*l,e[4]=-c,e[8]=h*l,e[1]=t*c+n,e[5]=s*l,e[9]=i*c-r,e[2]=r*c-i,e[6]=o*l,e[10]=n*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}setPosition(t){return this.elements[12]=t.x,this.elements[13]=t.y,this.elements[14]=t.z,this}},tT=class extends oa.Euler{constructor(t=0,e=0,i=0,r=oa.EulerOrder.XYZ){super(t,e,i,r)}getInvertMatrixByEuler(){return(new Qw).makeRotationFromEuler(this).invert()}toDegreeVector3(t){return t?t.set(this.x*zw,this.y*zw,this.z*zw):new $w(this.x*zw,this.y*zw,this.z*zw)}setFromDegreeVector3(t,e){return this.set(t.x*Bw,t.y*Bw,t.z*Bw,e??this.order)}},eT=class t{constructor(t=0,e=new $w(0,0,1)){A(this,"distance"),A(this,"normal");const i=e.length();0===i&&(this.normal=new $w(0,0,1)),this.distance=t/(i??1),this.normal=e.normalize()}static set(e,i){return new t(e,i)}set(t,e){const i=e.length();return 0===i&&(this.normal=new $w(0,0,1)),this.distance=t/i,this.normal=e.normalize(),this}static copy(e){return new t(e.distance,e.normal.clone())}copy(t){return this.distance=t.distance,this.normal.copyFrom(t.normal),this}static setFromNormalAndCoplanarPoint(e,i){const r=-e.dot(i);return new t(r,i)}setFromNormalAndCoplanarPoint(t,e){return this.normal.copyFrom(e),this.distance=-t.dot(this.normal),this}clone(){return new t(this.distance,this.normal.clone())}distanceToPoint(t){return this.normal.dot(t)+this.distance}},iT=class t extends oa.Ray{constructor(t=new $w,e=new $w(1,0,0)){super(t,e),A(this,"origin"),A(this,"direction"),this.origin=t.clone(),this.direction=e.clone()}clone(){return new t(this.origin,this.direction)}rayCastPlane(t,e){const i=this.distanceToPlane(t);return isNaN(i)||this.at(i),i}at(t){return this.direction.clone().normalize().multiply(t).add(this.origin)}distanceToPlane(t){const e=t.normal.dot(this.direction);if(Ww(e))return Ww(t.distanceToPoint(this.origin))?0:NaN;const i=(-this.origin.dot(t.normal)-t.distance)/e;return i>0?i:NaN}},rT=class{constructor(t=new iT){A(this,"ray"),this.ray=t.clone()}setFromCamera(t,e){const i=e.position,r=new $w(t.x,t.y,.5).applyMatrix(e.inverseViewProjectMatrix).subtract(i).normalize();return this.ray.set(i,r),this}rayCastPlane(t){const e=new $w,i=this.ray.rayCastPlane(t,e);if(!isNaN(i))return{distance:i,point:this.ray.at(i)}}};function nT(t,e){t.includes(e)||t.push(e)}function sT(t){return"object"==typeof t&&!!t}function oT(t,e){if(sT(t)&&sT(e)){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((t,i)=>oT(t,e[i]));const i=[];for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(!oT(t[r],e[r]))return!1;i.push(r)}return Object.getOwnPropertyNames(e).length===i.length}return t===e}function aT(t){if(void 0!==t)return JSON.parse(JSON.stringify(t))}function hT(t){return t.map((t,e)=>e<3?Gw(255*t,0):t)}function lT(t){return t.map((t,e)=>e<3?Gw(t/255,4):t)}var cT=class{constructor(t){A(this,"id"),A(this,"name"),A(this,"parentId"),A(this,"duration"),A(this,"delay"),A(this,"endBehavior"),A(this,"visible"),A(this,"isLocked"),A(this,"isCoreEditable"),A(this,"extension",new Map),this.id=t.id,this.name=t.name,this.parentId=t.parentId,this.duration=t.duration??999,this.delay=t.delay??0,this.endBehavior=t.endBehavior??en.EndBehavior.freeze,this.visible=t.visible??!0,this.isLocked=t.isLocked??!1,this.isCoreEditable=t.isCoreEditable,t.extension&&Object.entries(t.extension).forEach(([t,e])=>{this.extension.set(t,e)})}setExtension(t,e){this.extension.set(t,e)}getExtension(t){return this.extension.get(t)}hasExtension(t){return this.extension.has(t)}deleteExtension(t){return this.extension.delete(t)}getExtensionKeys(){return Array.from(this.extension.keys())}getAllExtension(){return aT(Object.fromEntries(this.extension.entries()))}setExtensions(t){Object.entries(t).forEach(([t,e])=>{this.extension.set(t,e)})}clearExtension(){this.extension.clear()}toJSON(){return{id:this.id,name:this.name,type:this.type,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,property:aT(this.property),extension:this.getAllExtension()}}};function uT(t){return t instanceof cT}var dT=class t extends cT{constructor(t){super(t),A(this,"type","sprite"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],image:t.property?.image??""}}get image(){return this.property.image}set image(t){this.property.image=t}get position(){return this.property.position}set position(t){this.property.position=t}get width(){return this.property.width}set width(t){this.property.width=t}get height(){return this.property.height}set height(t){this.property.height=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}get keyPropertyEditing(){return this.isCoreEditable}set keyPropertyEditing(t){this.isCoreEditable=t}toCreateInfo(t){const e=this.getAllExtension(),i=aT(this.property);return Object.assign(i,{width:i.size[0],height:i.size[1]}),delete i.size,{type:"sprite",id:this.id,name:this.name,parentId:t?this.parentId:void 0,extension:Object.keys(e).length>0?e:void 0,property:i}}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}toCreateInfoWithExtensions(t,e){const i=this.toCreateInfo(t);return e&&Object.assign(i,e),i}};function fT(t){return t instanceof dT}var pT=class t extends cT{constructor(t){super(t),A(this,"type","text"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],fontFamily:t.property?.fontFamily??"",color:t.property?.color??[0,0,0,1],fontWeight:t.property?.fontWeight??en.TextWeight.normal,text:t.property?.text??"",textAlign:t.property?.textAlign??en.TextAlignment.left,fontSize:t.property?.fontSize??24,fontStyle:t.property?.fontStyle??en.FontStyle.normal,lineHeight:t.property?.lineHeight??24,outlineColor:t.property?.outlineColor,outlineWidth:t.property?.outlineWidth,outlineEnabled:t.property?.outlineEnabled??!1,fontUrl:t.property?.fontUrl}}get text(){return this.property.text}set text(t){this.property.text=t}get fontFamily(){return this.property.fontFamily}set fontFamily(t){this.property.fontFamily=t}get fontSize(){return this.property.fontSize}set fontSize(t){this.property.fontSize=t}get fontWeight(){return this.property.fontWeight}set fontWeight(t){this.property.fontWeight=t}get fontStyle(){return this.property.fontStyle}set fontStyle(t){this.property.fontStyle=t}get textAlign(){return this.property.textAlign}set textAlign(t){this.property.textAlign=t}get color(){return this.property.color}set color(t){this.property.color=t}get width(){return this.property.width}set width(t){this.property.width=t}get lineHeight(){return this.property.lineHeight}set lineHeight(t){this.property.lineHeight=t}get height(){return this.property.height}set height(t){this.property.height=t}get outlineColor(){return this.property.outlineColor}set outlineColor(t){this.property.outlineColor=t}get outlineWidth(){return this.property.outlineWidth}set outlineWidth(t){this.property.outlineWidth=t}get outlineEnabled(){return this.property.outlineEnabled??!1}set outlineEnabled(t){this.property.outlineEnabled=t}get position(){return this.property.position}set position(t){this.property.position=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}toCreateInfo(t){const e=this.getAllExtension();return{type:"text",id:this.id,name:this.name,parentId:t?this.parentId:void 0,extension:Object.keys(e).length>0?e:void 0,property:aT(this.property)}}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function mT(t){return t instanceof pT}var gT=class t extends cT{constructor(t){super(t),A(this,"type","video"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],video:t.property?.video??"",muted:t.property?.muted??!0,transparent:t.property?.transparent??!0,playbackRate:t.property?.playbackRate??1,volume:t.property?.volume??0}}get video(){return this.property.video}set video(t){this.property.video=t}get position(){return this.property.position}set position(t){this.property.position=t}get width(){return this.property.width}set width(t){this.property.width=t}get height(){return this.property.height}set height(t){this.property.height=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}get keyPropertyEditing(){return this.isCoreEditable}set keyPropertyEditing(t){this.isCoreEditable=t}get muted(){return this.property.muted??!0}set muted(t){this.property.muted=t}get transparent(){return this.property.transparent??!0}set transparent(t){this.property.transparent=t}get volume(){return this.property.volume??0}set volume(t){this.property.volume=t}get playbackRate(){return this.property.playbackRate??1}set playbackRate(t){this.property.playbackRate=t}toCreateInfo(t){const e=this.getAllExtension();return{type:"video",id:this.id,name:this.name,parentId:t?this.parentId:void 0,extension:Object.keys(e).length>0?e:void 0,property:aT(this.property)}}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function vT(t){return t instanceof gT}var yT=class t extends cT{constructor(t){super(t),A(this,"type","group"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,children:[...t.children??[]],scale:t.property?.scale??[1,1]}}get position(){return this.property.position}set position(t){this.property.position=t}get scale(){return this.property.scale}set scale(t){this.property.scale=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}get keyPropertyEditing(){return this.isCoreEditable}set keyPropertyEditing(t){this.isCoreEditable=t}toCreateInfo(t){const e=this.getAllExtension();return{type:this.type,id:this.id,name:this.name,parentId:t?this.parentId:void 0,extension:Object.keys(e).length>0?e:void 0,property:aT(this.property)}}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function xT(t){return t instanceof yT}var bT=class t extends cT{constructor(t){super(t),A(this,"type","generator"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],generatorType:t.property?.generatorType??"video"}}get generatorType(){return this.property.generatorType}set generatorType(t){this.property.generatorType=t}get image(){return""}set image(t){}get position(){return this.property.position}set position(t){this.property.position=t}get width(){return this.property.width}set width(t){this.property.width=t}get height(){return this.property.height}set height(t){this.property.height=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}get keyPropertyEditing(){return this.isCoreEditable}set keyPropertyEditing(t){this.isCoreEditable=t}toCreateInfo(t){const e=this.getAllExtension();return{type:"generator",id:this.id,name:this.name,parentId:t?this.parentId:void 0,extension:Object.keys(e).length>0?e:void 0,property:aT(this.property)}}toVideoCreateInfo(t,e){const i=this.getAllExtension(),r=aT(this.property);return delete r.generatorType,{type:"video",id:this.id,name:this.name,parentId:e?this.parentId:void 0,extension:Object.keys(i).length>0?i:void 0,property:{video:t,...r}}}toSpriteCreateInfo(t,e){const i=this.getAllExtension(),r=aT(this.property);return delete r.generatorType,{type:"sprite",id:this.id,name:this.name,parentId:e?this.parentId:void 0,extension:Object.keys(i).length>0?i:void 0,property:{image:t,...r}}}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function _T(t){return t instanceof bT}var wT=class t extends cT{constructor(t){super(t),A(this,"type","effects"),A(this,"property"),this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],effects:t.property?.effects??"",children:t.property?.children??[]}}get effects(){return this.property.effects}set effects(t){this.property.effects=t}get position(){return this.property.position}set position(t){this.property.position=t}get width(){return this.property.width}set width(t){this.property.width=t}get height(){return this.property.height}set height(t){this.property.height=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}get keyPropertyEditing(){return this.isCoreEditable}set keyPropertyEditing(t){this.isCoreEditable=t}toCreateInfo(t){const e={type:"effects",id:this.id,name:this.name,property:aT(this.property)};t&&this.parentId&&(e.parentId=this.parentId);const i=this.getAllExtension();return Object.keys(i).length>0&&(e.extension=i),e}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function TT(t){return t instanceof wT}var ET=(t=>(t[t.BringToFront=0]="BringToFront",t[t.SendToBack=1]="SendToBack",t[t.BringForward=2]="BringForward",t[t.SendBackward=3]="SendBackward",t))(ET||{}),ST=class t extends cT{constructor(t){super(t),A(this,"type","frame"),A(this,"subCompositionId"),A(this,"property"),this.subCompositionId="",this.property={position:t.property?.position??[0,0],rotation:t.property?.rotation??[0,0,0],width:t.property?.width??0,height:t.property?.height??0,scale:t.property?.scale??[1,1],layoutMode:t.property?.layoutMode??"free",children:[...t.children??[]]}}get children(){return this.property.children}get layoutMode(){return this.property.layoutMode}set layoutMode(t){this.property.layoutMode=t}get position(){return this.property.position}set position(t){this.property.position=t}get width(){return this.property.width}set width(t){this.property.width=t}get height(){return this.property.height}set height(t){this.property.height=t}get scale(){return this.property.scale}set scale(t){this.property.scale=t}get rotation(){return this.property.rotation[2]}set rotation(t){this.property.rotation[2]=t}get fullRotation(){return this.property.rotation}set fullRotation(t){this.property.rotation=t}addChild(t){return!this.property.children.includes(t)&&(this.property.children.push(t),!0)}addChildren(t){t.map(t=>this.addChild(t))}removeChild(t){const e=this.property.children.indexOf(t);return-1!==e&&(this.property.children.splice(e,1),!0)}removeChildren(t){this.property.children=this.property.children.filter(e=>!t.includes(e))}hasChild(t){return this.property.children.includes(t)}clearChildren(){this.property.children=[]}toCreateInfo(t){const e={type:"frame",id:this.id,name:this.name,property:aT(this.property)};t&&this.parentId&&(e.parentId=this.parentId);const i=this.getAllExtension();return Object.keys(i).length>0&&(e.extension=i),e}clone(){return new t({id:ei(),name:this.name,parentId:this.parentId,duration:this.duration,delay:this.delay,endBehavior:this.endBehavior,isLocked:this.isLocked,isCoreEditable:this.isCoreEditable,property:aT(this.property),extension:this.getAllExtension()})}};function IT(t){return t instanceof ST}function AT(t,e){switch(t){case en.ItemType.sprite:return new dT(e);case en.ItemType.null:return new yT(e);case en.ItemType.text:return new pT(e);case en.ItemType.video:return new gT(e);default:return console.warn(`SDKItem type ${t} not implemented, falling back to GroupItem`),new yT(e)}}var CT="object"==typeof global&&global&&global.Object===Object&&global,PT="object"==typeof self&&self&&self.Object===Object&&self,MT=CT||PT||Function("return this")(),RT=MT.Symbol,OT=Object.prototype,DT=OT.hasOwnProperty,kT=OT.toString,LT=RT?RT.toStringTag:void 0;var FT=function(t){var e=DT.call(t,LT),i=t[LT];try{t[LT]=void 0;var r=!0}catch(t){}var n=kT.call(t);return r&&(e?t[LT]=i:delete t[LT]),n},NT=Object.prototype.toString;var BT=function(t){return NT.call(t)},zT=RT?RT.toStringTag:void 0;var UT=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":zT&&zT in Object(t)?FT(t):BT(t)};var VT=function(t){return null!=t&&"object"==typeof t},GT=Array.isArray;var jT=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var HT=function(t){return t};var WT,XT=function(t){if(!jT(t))return!1;var e=UT(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},YT=MT["__core-js_shared__"],qT=(WT=/[^.]+$/.exec(YT&&YT.keys&&YT.keys.IE_PROTO||""))?"Symbol(src)_1."+WT:"";var KT=function(t){return!!qT&&qT in t},ZT=Function.prototype.toString;var JT=function(t){if(null!=t){try{return ZT.call(t)}catch(t){}try{return t+""}catch(t){}}return""},$T=/^\[object .+?Constructor\]$/,QT=Function.prototype,tE=Object.prototype,eE=QT.toString,iE=tE.hasOwnProperty,rE=RegExp("^"+eE.call(iE).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var nE=function(t){return!(!jT(t)||KT(t))&&(XT(t)?rE:$T).test(JT(t))};var sE=function(t,e){return null==t?void 0:t[e]};var oE=function(t,e){var i=sE(t,e);return nE(i)?i:void 0},aE=Object.create,hE=function(){function t(){}return function(e){if(!jT(e))return{};if(aE)return aE(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();var lE=function(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)};var cE=function(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i<r;)e[i]=t[i];return e},uE=Date.now;var dE=function(t){var e=0,i=0;return function(){var r=uE(),n=16-(r-i);if(i=r,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}};var fE=function(t){return function(){return t}},pE=function(){try{var t=oE(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),mE=dE(pE?function(t,e){return pE(t,"toString",{configurable:!0,enumerable:!1,value:fE(e),writable:!0})}:HT),gE=/^(?:0|[1-9]\d*)$/;var vE=function(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&gE.test(t))&&t>-1&&t%1==0&&t<e};var yE=function(t,e,i){"__proto__"==e&&pE?pE(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i};var xE=function(t,e){return t===e||t!=t&&e!=e},bE=Object.prototype.hasOwnProperty;var _E=function(t,e,i){var r=t[e];bE.call(t,e)&&xE(r,i)&&(void 0!==i||e in t)||yE(t,e,i)};var wE=function(t,e,i,r){var n=!i;i||(i={});for(var s=-1,o=e.length;++s<o;){var a=e[s],h=r?r(i[a],t[a],a,i,t):void 0;void 0===h&&(h=t[a]),n?yE(i,a,h):_E(i,a,h)}return i},TE=Math.max;var EE=function(t,e,i){return e=TE(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,s=TE(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=i(o),lE(t,this,a)}};var SE=function(t,e){return mE(EE(t,e,HT),t+"")};var IE=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var AE=function(t){return null!=t&&IE(t.length)&&!XT(t)};var CE=function(t,e,i){if(!jT(i))return!1;var r=typeof e;return!!("number"==r?AE(i)&&vE(e,i.length):"string"==r&&e in i)&&xE(i[e],t)};var PE=function(t){return SE(function(e,i){var r=-1,n=i.length,s=n>1?i[n-1]:void 0,o=n>2?i[2]:void 0;for(s=t.length>3&&"function"==typeof s?(n--,s):void 0,o&&CE(i[0],i[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=i[r];a&&t(e,a,r,s)}return e})},ME=Object.prototype;var RE=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ME)};var OE=function(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r};var DE=function(t){return VT(t)&&"[object Arguments]"==UT(t)},kE=Object.prototype,LE=kE.hasOwnProperty,FE=kE.propertyIsEnumerable,NE=DE(function(){return arguments}())?DE:function(t){return VT(t)&&LE.call(t,"callee")&&!FE.call(t,"callee")};var BE=function(){return!1},zE="object"==typeof exports&&exports&&!exports.nodeType&&exports,UE=zE&&"object"==typeof module&&module&&!module.nodeType&&module,VE=UE&&UE.exports===zE?MT.Buffer:void 0,GE=(VE?VE.isBuffer:void 0)||BE,jE={};jE["[object Float32Array]"]=jE["[object Float64Array]"]=jE["[object Int8Array]"]=jE["[object Int16Array]"]=jE["[object Int32Array]"]=jE["[object Uint8Array]"]=jE["[object Uint8ClampedArray]"]=jE["[object Uint16Array]"]=jE["[object Uint32Array]"]=!0,jE["[object Arguments]"]=jE["[object Array]"]=jE["[object ArrayBuffer]"]=jE["[object Boolean]"]=jE["[object DataView]"]=jE["[object Date]"]=jE["[object Error]"]=jE["[object Function]"]=jE["[object Map]"]=jE["[object Number]"]=jE["[object Object]"]=jE["[object RegExp]"]=jE["[object Set]"]=jE["[object String]"]=jE["[object WeakMap]"]=!1;var HE=function(t){return VT(t)&&IE(t.length)&&!!jE[UT(t)]};var WE=function(t){return function(e){return t(e)}},XE="object"==typeof exports&&exports&&!exports.nodeType&&exports,YE=XE&&"object"==typeof module&&module&&!module.nodeType&&module,qE=YE&&YE.exports===XE&&CT.process,KE=function(){try{var t=YE&&YE.require&&YE.require("util").types;return t||qE&&qE.binding&&qE.binding("util")}catch(t){}}(),ZE=KE&&KE.isTypedArray,JE=ZE?WE(ZE):HE,$E=Object.prototype.hasOwnProperty;var QE=function(t,e){var i=GT(t),r=!i&&NE(t),n=!i&&!r&&GE(t),s=!i&&!r&&!n&&JE(t),o=i||r||n||s,a=o?OE(t.length,String):[],h=a.length;for(var l in t)!e&&!$E.call(t,l)||o&&("length"==l||n&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||vE(l,h))||a.push(l);return a};var tS=function(t,e){return function(i){return t(e(i))}};var eS=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},iS=Object.prototype.hasOwnProperty;var rS=function(t){if(!jT(t))return eS(t);var e=RE(t),i=[];for(var r in t)("constructor"!=r||!e&&iS.call(t,r))&&i.push(r);return i};var nS=function(t){return AE(t)?QE(t,!0):rS(t)},sS=oE(Object,"create");var oS=function(){this.__data__=sS?sS(null):{},this.size=0};var aS=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},hS=Object.prototype.hasOwnProperty;var lS=function(t){var e=this.__data__;if(sS){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return hS.call(e,t)?e[t]:void 0},cS=Object.prototype.hasOwnProperty;var uS=function(t){var e=this.__data__;return sS?void 0!==e[t]:cS.call(e,t)};var dS=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=sS&&void 0===e?"__lodash_hash_undefined__":e,this};function fS(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}fS.prototype.clear=oS,fS.prototype.delete=aS,fS.prototype.get=lS,fS.prototype.has=uS,fS.prototype.set=dS;var pS=fS;var mS=function(){this.__data__=[],this.size=0};var gS=function(t,e){for(var i=t.length;i--;)if(xE(t[i][0],e))return i;return-1},vS=Array.prototype.splice;var yS=function(t){var e=this.__data__,i=gS(e,t);return!(i<0)&&(i==e.length-1?e.pop():vS.call(e,i,1),--this.size,!0)};var xS=function(t){var e=this.__data__,i=gS(e,t);return i<0?void 0:e[i][1]};var bS=function(t){return gS(this.__data__,t)>-1};var _S=function(t,e){var i=this.__data__,r=gS(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this};function wS(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}wS.prototype.clear=mS,wS.prototype.delete=yS,wS.prototype.get=xS,wS.prototype.has=bS,wS.prototype.set=_S;var TS=wS,ES=oE(MT,"Map");var SS=function(){this.size=0,this.__data__={hash:new pS,map:new(ES||TS),string:new pS}};var IS=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var AS=function(t,e){var i=t.__data__;return IS(e)?i["string"==typeof e?"string":"hash"]:i.map};var CS=function(t){var e=AS(this,t).delete(t);return this.size-=e?1:0,e};var PS=function(t){return AS(this,t).get(t)};var MS=function(t){return AS(this,t).has(t)};var RS=function(t,e){var i=AS(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this};function OS(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}OS.prototype.clear=SS,OS.prototype.delete=CS,OS.prototype.get=PS,OS.prototype.has=MS,OS.prototype.set=RS;var DS=OS,kS=tS(Object.getPrototypeOf,Object),LS=Function.prototype,FS=Object.prototype,NS=LS.toString,BS=FS.hasOwnProperty,zS=NS.call(Object);var US=function(t){if(!VT(t)||"[object Object]"!=UT(t))return!1;var e=kS(t);if(null===e)return!0;var i=BS.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&NS.call(i)==zS};var VS=function(){this.__data__=new TS,this.size=0};var GS=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var jS=function(t){return this.__data__.get(t)};var HS=function(t){return this.__data__.has(t)};var WS=function(t,e){var i=this.__data__;if(i instanceof TS){var r=i.__data__;if(!ES||r.length<199)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new DS(r)}return i.set(t,e),this.size=i.size,this};function XS(t){var e=this.__data__=new TS(t);this.size=e.size}XS.prototype.clear=VS,XS.prototype.delete=GS,XS.prototype.get=jS,XS.prototype.has=HS,XS.prototype.set=WS;var YS=XS,qS="object"==typeof exports&&exports&&!exports.nodeType&&exports,KS=qS&&"object"==typeof module&&module&&!module.nodeType&&module,ZS=KS&&KS.exports===qS?MT.Buffer:void 0,JS=ZS?ZS.allocUnsafe:void 0;var $S=function(t,e){if(e)return t.slice();var i=t.length,r=JS?JS(i):new t.constructor(i);return t.copy(r),r},QS=MT.Uint8Array;var tI=function(t){var e=new t.constructor(t.byteLength);return new QS(e).set(new QS(t)),e};var eI=function(t,e){var i=e?tI(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)};var iI=function(t){return"function"!=typeof t.constructor||RE(t)?{}:hE(kS(t))};var rI=function(t){return function(e,i,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var h=o[t?a:++n];if(!1===i(s[h],h,s))break}return e}}();var nI=function(t,e,i){(void 0!==i&&!xE(t[e],i)||void 0===i&&!(e in t))&&yE(t,e,i)};var sI=function(t){return VT(t)&&AE(t)};var oI=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]};var aI=function(t){return wE(t,nS(t))};var hI=function(t,e,i,r,n,s,o){var a=oI(t,i),h=oI(e,i),l=o.get(h);if(l)nI(t,i,l);else{var c=s?s(a,h,i+"",t,e,o):void 0,u=void 0===c;if(u){var d=GT(h),f=!d&&GE(h),p=!d&&!f&&JE(h);c=h,d||f||p?GT(a)?c=a:sI(a)?c=cE(a):f?(u=!1,c=$S(h,!0)):p?(u=!1,c=eI(h,!0)):c=[]:US(h)||NE(h)?(c=a,NE(a)?c=aI(a):jT(a)&&!XT(a)||(c=iI(h))):u=!1}u&&(o.set(h,c),n(c,h,r,s,o),o.delete(h)),nI(t,i,c)}};var lI,cI,uI,dI,fI,pI,mI,gI,vI,yI,xI,bI,_I,wI,TI,EI,SI,II,AI,CI,PI,MI,RI,OI,DI,kI,LI,FI,NI,BI,zI,UI,VI,GI,jI,HI,WI,XI,YI,qI,KI=function t(e,i,r,n,s){e!==i&&rI(i,function(o,a){if(s||(s=new YS),jT(o))hI(e,i,a,r,t,n,s);else{var h=n?n(oI(e,a),o,a+"",e,i,s):void 0;void 0===h&&(h=o),nI(e,a,h)}},nS)},ZI=PE(function(t,e,i){KI(t,e,i)});(cI=lI||(lI={}))[cI.WEBGL_LEGACY=0]="WEBGL_LEGACY",cI[cI.WEBGL=1]="WEBGL",cI[cI.WEBGL2=2]="WEBGL2",(dI=uI||(uI={}))[dI.UNKNOWN=0]="UNKNOWN",dI[dI.WEBGL=1]="WEBGL",dI[dI.CANVAS=2]="CANVAS",(pI=fI||(fI={}))[pI.COLOR=16384]="COLOR",pI[pI.DEPTH=256]="DEPTH",pI[pI.STENCIL=1024]="STENCIL",(gI=mI||(mI={}))[gI.NORMAL=0]="NORMAL",gI[gI.ADD=1]="ADD",gI[gI.MULTIPLY=2]="MULTIPLY",gI[gI.SCREEN=3]="SCREEN",gI[gI.OVERLAY=4]="OVERLAY",gI[gI.DARKEN=5]="DARKEN",gI[gI.LIGHTEN=6]="LIGHTEN",gI[gI.COLOR_DODGE=7]="COLOR_DODGE",gI[gI.COLOR_BURN=8]="COLOR_BURN",gI[gI.HARD_LIGHT=9]="HARD_LIGHT",gI[gI.SOFT_LIGHT=10]="SOFT_LIGHT",gI[gI.DIFFERENCE=11]="DIFFERENCE",gI[gI.EXCLUSION=12]="EXCLUSION",gI[gI.HUE=13]="HUE",gI[gI.SATURATION=14]="SATURATION",gI[gI.COLOR=15]="COLOR",gI[gI.LUMINOSITY=16]="LUMINOSITY",gI[gI.NORMAL_NPM=17]="NORMAL_NPM",gI[gI.ADD_NPM=18]="ADD_NPM",gI[gI.SCREEN_NPM=19]="SCREEN_NPM",gI[gI.NONE=20]="NONE",gI[gI.SRC_OVER=0]="SRC_OVER",gI[gI.SRC_IN=21]="SRC_IN",gI[gI.SRC_OUT=22]="SRC_OUT",gI[gI.SRC_ATOP=23]="SRC_ATOP",gI[gI.DST_OVER=24]="DST_OVER",gI[gI.DST_IN=25]="DST_IN",gI[gI.DST_OUT=26]="DST_OUT",gI[gI.DST_ATOP=27]="DST_ATOP",gI[gI.ERASE=26]="ERASE",gI[gI.SUBTRACT=28]="SUBTRACT",gI[gI.XOR=29]="XOR",(yI=vI||(vI={}))[yI.POINTS=0]="POINTS",yI[yI.LINES=1]="LINES",yI[yI.LINE_LOOP=2]="LINE_LOOP",yI[yI.LINE_STRIP=3]="LINE_STRIP",yI[yI.TRIANGLES=4]="TRIANGLES",yI[yI.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",yI[yI.TRIANGLE_FAN=6]="TRIANGLE_FAN",(bI=xI||(xI={}))[bI.RGBA=6408]="RGBA",bI[bI.RGB=6407]="RGB",bI[bI.RG=33319]="RG",bI[bI.RED=6403]="RED",bI[bI.RGBA_INTEGER=36249]="RGBA_INTEGER",bI[bI.RGB_INTEGER=36248]="RGB_INTEGER",bI[bI.RG_INTEGER=33320]="RG_INTEGER",bI[bI.RED_INTEGER=36244]="RED_INTEGER",bI[bI.ALPHA=6406]="ALPHA",bI[bI.LUMINANCE=6409]="LUMINANCE",bI[bI.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",bI[bI.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",bI[bI.DEPTH_STENCIL=34041]="DEPTH_STENCIL",(wI=_I||(_I={}))[wI.TEXTURE_2D=3553]="TEXTURE_2D",wI[wI.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",wI[wI.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",wI[wI.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",wI[wI.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",wI[wI.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",wI[wI.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",wI[wI.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",wI[wI.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",(EI=TI||(TI={}))[EI.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",EI[EI.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",EI[EI.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",EI[EI.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",EI[EI.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",EI[EI.UNSIGNED_INT=5125]="UNSIGNED_INT",EI[EI.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",EI[EI.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",EI[EI.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",EI[EI.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",EI[EI.BYTE=5120]="BYTE",EI[EI.SHORT=5122]="SHORT",EI[EI.INT=5124]="INT",EI[EI.FLOAT=5126]="FLOAT",EI[EI.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",EI[EI.HALF_FLOAT=36193]="HALF_FLOAT",(II=SI||(SI={}))[II.FLOAT=0]="FLOAT",II[II.INT=1]="INT",II[II.UINT=2]="UINT",(CI=AI||(AI={}))[CI.NEAREST=0]="NEAREST",CI[CI.LINEAR=1]="LINEAR",(MI=PI||(PI={}))[MI.CLAMP=33071]="CLAMP",MI[MI.REPEAT=10497]="REPEAT",MI[MI.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",(OI=RI||(RI={}))[OI.OFF=0]="OFF",OI[OI.POW2=1]="POW2",OI[OI.ON=2]="ON",OI[OI.ON_MANUAL=3]="ON_MANUAL",(kI=DI||(DI={}))[kI.NPM=0]="NPM",kI[kI.UNPACK=1]="UNPACK",kI[kI.PMA=2]="PMA",kI[kI.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",kI[kI.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",kI[kI.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",kI[kI.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",(FI=LI||(LI={}))[FI.NO=0]="NO",FI[FI.YES=1]="YES",FI[FI.AUTO=2]="AUTO",FI[FI.BLEND=0]="BLEND",FI[FI.CLEAR=1]="CLEAR",FI[FI.BLIT=2]="BLIT",(BI=NI||(NI={}))[BI.AUTO=0]="AUTO",BI[BI.MANUAL=1]="MANUAL",(UI=zI||(zI={})).LOW="lowp",UI.MEDIUM="mediump",UI.HIGH="highp",(GI=VI||(VI={}))[GI.NONE=0]="NONE",GI[GI.SCISSOR=1]="SCISSOR",GI[GI.STENCIL=2]="STENCIL",GI[GI.SPRITE=3]="SPRITE",GI[GI.COLOR=4]="COLOR",(HI=jI||(jI={}))[HI.RED=1]="RED",HI[HI.GREEN=2]="GREEN",HI[HI.BLUE=4]="BLUE",HI[HI.ALPHA=8]="ALPHA",(XI=WI||(WI={}))[XI.NONE=0]="NONE",XI[XI.LOW=2]="LOW",XI[XI.MEDIUM=4]="MEDIUM",XI[XI.HIGH=8]="HIGH",(qI=YI||(YI={}))[qI.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",qI[qI.ARRAY_BUFFER=34962]="ARRAY_BUFFER",qI[qI.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER";var JI={createCanvas:function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var t;return null!==(t=document.baseURI)&&void 0!==t?t:window.location.href},fetch:function(t,e){return fetch(t,e)}},$I=/iPhone/i,QI=/iPod/i,tA=/iPad/i,eA=/\biOS-universal(?:.+)Mac\b/i,iA=/\bAndroid(?:.+)Mobile\b/i,rA=/Android/i,nA=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,sA=/Silk/i,oA=/Windows Phone/i,aA=/\bWindows(?:.+)ARM\b/i,hA=/BlackBerry/i,lA=/BB10/i,cA=/Opera Mini/i,uA=/\b(CriOS|Chrome)(?:.+)Mobile/i,dA=/Mobile(?:.+)Firefox\b/i,fA=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};var pA=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=e.userAgent,r=i.split("[FBAN");void 0!==r[1]&&(i=r[0]),void 0!==(r=i.split("Twitter"))[1]&&(i=r[0]);var n=function(t){return function(e){return e.test(t)}}(i),s={apple:{phone:n($I)&&!n(oA),ipod:n(QI),tablet:!n($I)&&(n(tA)||fA(e))&&!n(oA),universal:n(eA),device:(n($I)||n(QI)||n(tA)||n(eA)||fA(e))&&!n(oA)},amazon:{phone:n(nA),tablet:!n(nA)&&n(sA),device:n(nA)||n(sA)},android:{phone:!n(oA)&&n(nA)||!n(oA)&&n(iA),tablet:!n(oA)&&!n(nA)&&!n(iA)&&(n(sA)||n(rA)),device:!n(oA)&&(n(nA)||n(sA)||n(iA)||n(rA))||n(/\bokhttp\b/i)},windows:{phone:n(oA),tablet:n(aA),device:n(oA)||n(aA)},other:{blackberry:n(hA),blackberry10:n(lA),opera:n(cA),firefox:n(dA),chrome:n(uA),device:n(hA)||n(lA)||n(cA)||n(dA)||n(uA)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}(globalThis.navigator);var mA={ADAPTER:JI,MIPMAP_TEXTURES:RI.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:WI.NONE,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(pA.tablet||pA.phone){var i;if(pA.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(e=!1);if(pA.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:NI.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:PI.CLAMP,SCALE_MODE:AI.LINEAR,PRECISION_VERTEX:zI.HIGH,PRECISION_FRAGMENT:pA.apple.device?zI.HIGH:zI.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!pA.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},gA=I(O(),1),vA=I(D(),1),yA=I(At(),1),xA={parse:yA.parse,format:yA.format,resolve:yA.resolve};mA.RETINA_PREFIX=/@([0-9\.]+)x/,mA.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var bA,_A=!1,wA="6.5.10";var TA={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function EA(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function SA(t){var e=t.toString(16);return"#"+(e="000000".substring(0,6-e.length)+e)}function IA(t){return"string"==typeof t&&"#"===(t=TA[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),parseInt(t,16)}var AA=function(){for(var t=[],e=[],i=0;i<32;i++)t[i]=i,e[i]=i;t[mI.NORMAL_NPM]=mI.NORMAL,t[mI.ADD_NPM]=mI.ADD,t[mI.SCREEN_NPM]=mI.SCREEN,e[mI.NORMAL]=mI.NORMAL_NPM,e[mI.ADD]=mI.ADD_NPM,e[mI.SCREEN]=mI.SCREEN_NPM;var r=[];return r.push(e),r.push(t),r}();function CA(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var i=t>>16&255,r=t>>8&255,n=255&t;return(255*e<<24)+((i=i*e+.5|0)<<16)+((r=r*e+.5|0)<<8)+(n=n*e+.5|0)}function PA(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}function MA(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function RA(t){return!(t&t-1||!t)}function OA(t){var e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return e|=i,e|=i=((t>>>=i)>15?1:0)<<2,(e|=i=((t>>>=i)>3?1:0)<<1)|(t>>>=i)>>1}function DA(t,e,i){var r,n=t.length;if(!(e>=n||0===i)){var s=n-(i=e+i>n?n-e:i);for(r=e;r<s;++r)t[r]=t[r+i];t.length=s}}function kA(t){return 0===t?0:t<0?-1:1}var LA=0;function FA(){return++LA}var NA={};function BA(t,e,i){if(void 0===i&&(i=3),!NA[e]){var r=(new Error).stack;void 0===r?console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t):(r=r.split("\n").splice(i).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+"\nDeprecated since v"+t),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t),console.warn(r))),NA[e]=!0}}var zA,UA={},VA=Object.create(null),GA=Object.create(null);!function(){function t(t,e,i){this.canvas=mA.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=i||mA.RESOLUTION,this.resize(t,e)}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=Math.round(t*this.resolution),this.canvas.height=Math.round(e*this.resolution)},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=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0})}();function jA(t,e){var i=mA.RETINA_PREFIX.exec(t);return i?parseFloat(i[1]):void 0!==e?e:1}var HA,WA,XA=function(){return XA=Object.assign||function(t){for(var e,i=arguments,r=1,n=arguments.length;r<n;r++)for(var s in e=i[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},XA.apply(this,arguments)};(WA=HA||(HA={})).Application="application",WA.RendererPlugin="renderer-webgl-plugin",WA.CanvasRendererPlugin="renderer-canvas-plugin",WA.Loader="loader",WA.LoadParser="load-parser",WA.ResolveParser="resolve-parser",WA.CacheParser="cache-parser",WA.DetectionParser="detection-parser";var YA,qA,KA=function(t){if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");var e="object"!=typeof t.extension?{type:t.extension}:t.extension;t=XA(XA({},e),{ref:t})}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t=XA({},t)).type&&(t.type=[t.type]),t},ZA={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var t=arguments,e=this,i=[],r=0;r<arguments.length;r++)i[r]=t[r];return i.map(KA).forEach(function(t){t.type.forEach(function(i){var r,n;return null===(n=(r=e._removeHandlers)[i])||void 0===n?void 0:n.call(r,t)})}),this},add:function(){for(var t=arguments,e=this,i=[],r=0;r<arguments.length;r++)i[r]=t[r];return i.map(KA).forEach(function(t){t.type.forEach(function(i){var r=e._addHandlers,n=e._queue;r[i]?r[i](t):(n[i]=n[i]||[],n[i].push(t))})}),this},handle:function(t,e,i){var r=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(r[t]||n[t])throw new Error("Extension type "+t+" already has a handler");r[t]=e,n[t]=i;var s=this._queue;return s[t]&&(s[t].forEach(function(t){return e(t)}),delete s[t]),this},handleByMap:function(t,e){return this.handle(t,function(t){e[t.name]=t.ref},function(t){delete e[t.name]})},handleByList:function(t,e){return this.handle(t,function(i){var r,n;e.includes(i.ref)||(e.push(i.ref),t===HA.Loader&&(null===(n=(r=i.ref).add)||void 0===n||n.call(r)))},function(t){var i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)})}},JA=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,r,n,s,o,a){if(arguments.length>8)throw new Error("max arguments reached");var h=this.name,l=this.items;this._aliasCount++;for(var c=0,u=l.length;c<u;c++)l[c][h](t,e,i,r,n,s,o,a);return l===this.items&&this._aliasCount--,this},t.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(JA.prototype,{dispatch:{value:JA.prototype.emit},run:{value:JA.prototype.emit}}),mA.TARGET_FPMS=.06,(qA=YA||(YA={}))[qA.INTERACTION=50]="INTERACTION",qA[qA.HIGH=25]="HIGH",qA[qA.NORMAL=0]="NORMAL",qA[qA.LOW=-25]="LOW",qA[qA.UTILITY=-50]="UTILITY";var $A,QA,tC=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=0),void 0===r&&(r=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),eC=function(){function t(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new tC(null,null,1/0),this.deltaMS=1/mA.TARGET_FPMS,this.elapsedMS=1/mA.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return t.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},t.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},t.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},t.prototype.add=function(t,e,i){return void 0===i&&(i=YA.NORMAL),this._addListener(new tC(t,e,i))},t.prototype.addOnce=function(t,e,i){return void 0===i&&(i=YA.NORMAL),this._addListener(new tC(t,e,i,!0))},t.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},t.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var i=t-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=t-i%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*mA.TARGET_FPMS;for(var r=this._head,n=r.next;n;)n=n.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(t.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,mA.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){if(0===t)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"shared",{get:function(){if(!t._shared){var e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared},enumerable:!1,configurable:!0}),Object.defineProperty(t,"system",{get:function(){if(!t._system){var e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system},enumerable:!1,configurable:!0}),t}(),iC=function(){function t(){}return t.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,YA.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?eC.shared:new eC,t.autoStart&&this.start()},t.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},t.extension=HA.Application,t}(),rC=2*Math.PI,nC=180/Math.PI,sC=Math.PI/180;(QA=$A||($A={}))[QA.POLY=0]="POLY",QA[QA.RECT=1]="RECT",QA[QA.CIRC=2]="CIRC",QA[QA.ELIP=3]="ELIP",QA[QA.RREC=4]="RREC";var oC=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},t}(),aC=[new oC,new oC,new oC,new oC],hC=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=$A.RECT}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EMPTY",{get:function(){return new t(0,0,0,0)},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},t.prototype.contains=function(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)},t.prototype.intersects=function(t,e){if(!e){var i=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=i)return!1;var r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}var n=this.left,s=this.right,o=this.top,a=this.bottom;if(s<=n||a<=o)return!1;var h=aC[0].set(t.left,t.top),l=aC[1].set(t.left,t.bottom),c=aC[2].set(t.right,t.top),u=aC[3].set(t.right,t.bottom);if(c.x<=h.x||l.y<=h.y)return!1;var d=Math.sign(e.a*e.d-e.b*e.c);if(0===d)return!1;if(e.apply(h,h),e.apply(l,l),e.apply(c,c),e.apply(u,u),Math.max(h.x,l.x,c.x,u.x)<=n||Math.min(h.x,l.x,c.x,u.x)>=s||Math.max(h.y,l.y,c.y,u.y)<=o||Math.min(h.y,l.y,c.y,u.y)>=a)return!1;var f=d*(l.y-h.y),p=d*(h.x-l.x),m=f*n+p*o,g=f*s+p*o,v=f*n+p*a,y=f*s+p*a;if(Math.max(m,g,v,y)<=f*h.x+p*h.y||Math.min(m,g,v,y)>=f*u.x+p*u.y)return!1;var x=d*(h.y-c.y),b=d*(c.x-h.x),_=x*n+b*o,w=x*s+b*o,T=x*n+b*a,E=x*s+b*a;return!(Math.max(_,w,T,E)<=x*h.x+b*h.y||Math.min(_,w,T,E)>=x*u.x+b*u.y)},t.prototype.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},t.prototype.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},t.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},t.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},t.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),lC=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.radius=i,this.type=$A.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},t.prototype.getBounds=function(){return new hC(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},t}(),cC=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.width=i,this.height=r,this.type=$A.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return(i*=i)+(r*=r)<=1},t.prototype.getBounds=function(){return new hC(this.x-this.width,this.y-this.height,this.width,this.height)},t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),uC=function(){function t(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=Array.isArray(e[0])?e[0]:e;if("number"!=typeof r[0]){for(var n=[],s=0,o=r.length;s<o;s++)n.push(r[s].x,r[s].y);r=n}this.points=r,this.type=$A.POLY,this.closeStroke=!0}return t.prototype.clone=function(){var e=new t(this.points.slice());return e.closeStroke=this.closeStroke,e},t.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var o=this.points[2*n],a=this.points[2*n+1],h=this.points[2*s],l=this.points[2*s+1];a>e!=l>e&&t<(e-a)/(l-a)*(h-o)+o&&(i=!i)}return i},t.prototype.toString=function(){return"[@pixi/math:PolygoncloseStroke="+this.closeStroke+"points="+this.points.reduce(function(t,e){return t+", "+e},"")+"]"},t}(),dC=function(){function t(t,e,i,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=20),this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=$A.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;var r=t-(this.x+i),n=e-(this.y+i),s=i*i;if(r*r+n*n<=s)return!0;if((r=t-(this.x+this.width-i))*r+n*n<=s)return!0;if(r*r+(n=e-(this.y+this.height-i))*n<=s)return!0;if((r=t-(this.x+i))*r+n*n<=s)return!0}return!1},t.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"},t}(),fC=function(){function t(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0),this._x=i,this._y=r,this.cb=t,this.scope=e}return t.prototype.clone=function(e,i){return void 0===e&&(e=this.cb),void 0===i&&(i=this.scope),new t(e,i,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=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},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},t.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(t.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(t.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}),t}(),pC=function(){function t(t,e,i,r,n,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,i,r,n,s){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},t.prototype.apply=function(t,e){e=e||new oC;var i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new oC;var i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,s=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=s*e-this.ty*i,this.ty=s*i+this.ty*e,this},t.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,i=this.b,r=this.c,n=this.d,s=t.pivot,o=-Math.atan2(-r,n),a=Math.atan2(i,e),h=Math.abs(o+a);return h<1e-5||Math.abs(rC-h)<1e-5?(t.rotation=a,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+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(s.x*e+s.y*r),t.position.y=this.ty+(s.x*i+s.y*n),t},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,s=t*r-e*i;return this.a=r/s,this.b=-e/s,this.c=-i/s,this.d=t/s,this.tx=(i*this.ty-r*n)/s,this.ty=-(t*this.ty-e*n)/s,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=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},t.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),mC=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],gC=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vC=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],yC=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xC=[],bC=[],_C=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];xC.push(e);for(var i=0;i<16;i++)for(var r=_C(mC[t]*mC[i]+vC[t]*gC[i]),n=_C(gC[t]*mC[i]+yC[t]*gC[i]),s=_C(mC[t]*vC[i]+vC[t]*yC[i]),o=_C(gC[t]*vC[i]+yC[t]*yC[i]),a=0;a<16;a++)if(mC[a]===r&&gC[a]===n&&vC[a]===s&&yC[a]===o){e.push(a);break}}for(t=0;t<16;t++){var h=new pC;h.set(mC[t],gC[t],vC[t],yC[t],0,0),bC.push(h)}}();var wC={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return mC[t]},uY:function(t){return gC[t]},vX:function(t){return vC[t]},vY:function(t){return yC[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return xC[t][e]},sub:function(t,e){return xC[t][wC.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?wC.S:wC.N:2*Math.abs(e)<=Math.abs(t)?t>0?wC.E:wC.W:e>0?t>0?wC.SE:wC.SW:t>0?wC.NE:wC.NW},matrixAppendRotationInv:function(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=bC[wC.inv(e)];n.tx=i,n.ty=r,t.append(n)}},TC=function(){function t(){this.worldTransform=new pC,this.localTransform=new pC,this.position=new fC(this.onChange,this,0,0),this.scale=new fC(this.onChange,this,1,1),this.pivot=new fC(this.onChange,this,0,0),this.skew=new fC(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.toString=function(){return"[@pixi/math:Transform position=("+this.position.x+", "+this.position.y+") rotation="+this.rotation+" scale=("+this.scale.x+", "+this.scale.y+") skew=("+this.skew.x+", "+this.skew.y+") ]"},t.prototype.updateLocalTransform=function(){var t=this.localTransform;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.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;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.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var i=t.worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();mA.PREFER_ENV=pA.any?lI.WEBGL:lI.WEBGL2,mA.STRICT_TEXTURE_CACHE=!1;var EC=[];function SC(t,e){if(!t)return null;var i="";if("string"==typeof t){var r=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);r&&(i=r[1].toLowerCase())}for(var n=EC.length-1;n>=0;--n){var s=EC[n];if(s.test&&s.test(t,i))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var IC=function(t,e){return IC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},IC(t,e)};function AC(t,e){function i(){this.constructor=t}IC(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var CC=function(){return CC=Object.assign||function(t){for(var e,i=arguments,r=1,n=arguments.length;r<n;r++)for(var s in e=i[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},CC.apply(this,arguments)};var PC=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new JA("setRealSize"),this.onUpdate=new JA("update"),this.onError=new JA("onError")}return t.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},t.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(t,e,i){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(t,e){return!1},t}(),MC=function(t){function e(e,i){var r=this,n=i||{},s=n.width,o=n.height;if(!s||!o)throw new Error("BufferResource width or height invalid");return(r=t.call(this,s,o)||this).data=e,r}return AC(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===DI.UNPACK);var n=e.realWidth,s=e.realHeight;return i.width===n&&i.height===s?r.texSubImage2D(e.target,0,0,0,n,s,e.format,i.type,this.data):(i.width=n,i.height=s,r.texImage2D(e.target,0,i.internalFormat,n,s,0,e.format,i.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(PC),RC={scaleMode:AI.NEAREST,format:xI.RGBA,alphaMode:DI.NPM},OC=function(t){function e(e,i){void 0===e&&(e=null),void 0===i&&(i=null);var r=t.call(this)||this,n=(i=i||{}).alphaMode,s=i.mipmap,o=i.anisotropicLevel,a=i.scaleMode,h=i.width,l=i.height,c=i.wrapMode,u=i.format,d=i.type,f=i.target,p=i.resolution,m=i.resourceOptions;return!e||e instanceof PC||((e=SC(e,m)).internal=!0),r.resolution=p||mA.RESOLUTION,r.width=Math.round((h||0)*r.resolution)/r.resolution,r.height=Math.round((l||0)*r.resolution)/r.resolution,r._mipmap=void 0!==s?s:mA.MIPMAP_TEXTURES,r.anisotropicLevel=void 0!==o?o:mA.ANISOTROPIC_LEVEL,r._wrapMode=c||mA.WRAP_MODE,r._scaleMode=void 0!==a?a:mA.SCALE_MODE,r.format=u||xI.RGBA,r.type=d||TI.UNSIGNED_BYTE,r.target=f||_I.TEXTURE_2D,r.alphaMode=void 0!==n?n:DI.UNPACK,r.uid=FA(),r.touched=0,r.isPowerOfTwo=!1,r._refreshPOT(),r._glTextures={},r.dirtyId=0,r.dirtyStyleId=0,r.cacheId=null,r.valid=h>0&&l>0,r.textureCacheIds=[],r.destroyed=!1,r.resource=null,r._batchEnabled=0,r._batchLocation=0,r.parentTextureArray=null,r.setResource(e),r}return AC(e,t),Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,e){var i;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)},e.prototype.setRealSize=function(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=RA(this.realWidth)&&RA(this.realHeight)},e.prototype.setResolution=function(t){var e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this},e.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete GA[this.cacheId],delete VA[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,i,r){void 0===r&&(r=mA.STRICT_TEXTURE_CACHE);var n="string"==typeof t,s=null;if(n)s=t;else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+FA()}s=t._pixiId}var a=GA[s];if(n&&r&&!a)throw new Error('The cacheId "'+s+'" does not exist in BaseTextureCache.');return a||((a=new e(t,i)).cacheId=s,e.addToCache(a,s)),a},e.fromBuffer=function(t,i,r,n){t=t||new Float32Array(i*r*4);var s=new MC(t,{width:i,height:r}),o=t instanceof Float32Array?TI.FLOAT:TI.UNSIGNED_BYTE;return new e(s,Object.assign({},RC,n||{width:i,height:r,type:o}))},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),GA[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),GA[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=GA[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete GA[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)delete GA[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(gA.default),DC=function(t){function e(e,i){var r=this,n=i||{},s=n.width,o=n.height;(r=t.call(this,s,o)||this).items=[],r.itemDirtyIds=[];for(var a=0;a<e;a++){var h=new OC;r.items.push(h),r.itemDirtyIds.push(-2)}return r.length=e,r._load=null,r.baseTexture=null,r}return AC(e,t),e.prototype.initFromArray=function(t,e){for(var i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof PC?this.addResourceAt(t[i],i):this.addResourceAt(SC(t[i],e),i))},e.prototype.dispose=function(){for(var t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(t,e){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this},e.prototype.bind=function(e){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");t.prototype.bind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=e,this.items[i].on("update",e.update,e)},e.prototype.unbind=function(e){t.prototype.unbind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",e.update,e)},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.items.map(function(t){return t.resource}).filter(function(t){return t}).map(function(t){return t.load()});return this._load=Promise.all(e).then(function(){var e=t.items[0],i=e.realWidth,r=e.realHeight;return t.resize(i,r),Promise.resolve(t)}),this._load},e}(PC),kC=function(t){function e(e,i){var r,n,s=this,o=i||{},a=o.width,h=o.height;return Array.isArray(e)?(r=e,n=e.length):n=e,s=t.call(this,n,{width:a,height:h})||this,r&&s.initFromArray(r,i),s}return AC(e,t),e.prototype.addBaseTextureAt=function(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this},e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=_I.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,e,i){var r=this,n=r.length,s=r.itemDirtyIds,o=r.items,a=t.gl;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,n,0,e.format,i.type,null);for(var h=0;h<n;h++){var l=o[h];s[h]<l.dirtyId&&(s[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0},e}(DC),LC=function(t){function e(e){var i=this,r=e,n=r.naturalWidth||r.videoWidth||r.width,s=r.naturalHeight||r.videoHeight||r.height;return(i=t.call(this,n,s)||this).source=e,i.noSubImage=!1,i}return AC(e,t),e.crossOrigin=function(t,e,i){void 0===i&&0!==e.indexOf("data:")?t.crossOrigin=function(t,e){if(void 0===e&&(e=globalThis.location),0===t.indexOf("data:"))return"";e=e||globalThis.location,zA||(zA=document.createElement("a")),zA.href=t;var i=xA.parse(zA.href),r=!i.port&&""===e.port||i.port===e.port;return i.hostname===e.hostname&&r&&i.protocol===e.protocol?"":"anonymous"}(e):!1!==i&&(t.crossOrigin="string"==typeof i?i:"anonymous")},e.prototype.upload=function(t,e,i,r){var n=t.gl,s=e.realWidth,o=e.realHeight;if((r=r||this.source)instanceof HTMLImageElement){if(!r.complete||0===r.naturalWidth)return!1}else if(r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===DI.UNPACK),this.noSubImage||e.target!==n.TEXTURE_2D||i.width!==s||i.height!==o?(i.width=s,i.height=o,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)):n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r),!0},e.prototype.update=function(){if(!this.destroyed){var e=this.source,i=e.naturalWidth||e.videoWidth||e.width,r=e.naturalHeight||e.videoHeight||e.height;this.resize(i,r),t.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(PC),FC=function(t){function e(e){return t.call(this,e)||this}return AC(e,t),e.test=function(t){var e=globalThis.OffscreenCanvas;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement},e}(LC),NC=function(t){function e(i,r){var n=this,s=r||{},o=s.width,a=s.height,h=s.autoLoad,l=s.linkBaseTexture;if(i&&i.length!==e.SIDES)throw new Error("Invalid length. Got "+i.length+", expected 6");n=t.call(this,6,{width:o,height:a})||this;for(var c=0;c<e.SIDES;c++)n.items[c].target=_I.TEXTURE_CUBE_MAP_POSITIVE_X+c;return n.linkBaseTexture=!1!==l,i&&n.initFromArray(i,r),!1!==h&&n.load(),n}return AC(e,t),e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=_I.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(t,e,i){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=_I.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this},e.prototype.upload=function(t,i,r){for(var n=this.itemDirtyIds,s=0;s<e.SIDES;s++){var o=this.items[s];(n[s]<o.dirtyId||r.dirtyId<i.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,r),n[s]=o.dirtyId):n[s]<-1&&(t.gl.texImage2D(o.target,0,r.internalFormat,i.realWidth,i.realHeight,0,i.format,r.type,null),n[s]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(DC),BC=function(t){function e(e,i){var r=this;if(i=i||{},!(e instanceof HTMLImageElement)){var n=new Image;LC.crossOrigin(n,e,i.crossorigin),n.src=e,e=n}return r=t.call(this,e)||this,!e.complete&&r._width&&r._height&&(r._width=0,r._height=0),r.url=e.src,r._process=null,r.preserveBitmap=!1,r.createBitmap=(void 0!==i.createBitmap?i.createBitmap:mA.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,r.alphaMode="number"==typeof i.alphaMode?i.alphaMode:null,r.bitmap=null,r._load=null,!1!==i.autoLoad&&r.load(),r}return AC(e,t),e.prototype.load=function(t){var e=this;return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(function(t,i){var r=e.source;e.url=r.src;var n=function(){e.destroyed||(r.onload=null,r.onerror=null,e.resize(r.width,r.height),e._load=null,e.createBitmap?t(e.process()):t(e))};r.complete&&r.src?n():(r.onload=n,r.onerror=function(t){i(t),e.onError.emit(t)})})),this._load},e.prototype.process=function(){var t=this,e=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);var i=globalThis.createImageBitmap,r=!e.crossOrigin||"anonymous"===e.crossOrigin;return this._process=fetch(e.src,{mode:r?"cors":"no-cors"}).then(function(t){return t.blob()}).then(function(r){return i(r,0,0,e.width,e.height,{premultiplyAlpha:null===t.alphaMode||t.alphaMode===DI.UNPACK?"premultiply":"none"})}).then(function(e){return t.destroyed?Promise.reject():(t.bitmap=e,t.update(),t._process=null,Promise.resolve(t))}),this._process},e.prototype.upload=function(e,i,r){if("number"==typeof this.alphaMode&&(i.alphaMode=this.alphaMode),!this.createBitmap)return t.prototype.upload.call(this,e,i,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(t.prototype.upload.call(this,e,i,r,this.bitmap),!this.preserveBitmap){var n=!0,s=i._glTextures;for(var o in s){var a=s[o];if(a!==r&&a.dirtyId!==i.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,t.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(t){return"string"==typeof t||t instanceof HTMLImageElement},e}(LC),zC=function(t){function e(e,i){var r=this;return i=i||{},(r=t.call(this,mA.ADAPTER.createCanvas())||this)._width=0,r._height=0,r.svg=e,r.scale=i.scale||1,r._overrideWidth=i.width,r._overrideHeight=i.height,r._resolve=null,r._crossorigin=i.crossorigin,r._load=null,!1!==i.autoLoad&&r.load(),r}return AC(e,t),e.prototype.load=function(){var t=this;return this._load||(this._load=new Promise(function(i){if(t._resolve=function(){t.resize(t.source.width,t.source.height),i(t)},e.SVG_XML.test(t.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");t.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t.svg)))}t._loadSvg()})),this._load},e.prototype._loadSvg=function(){var t=this,e=new Image;LC.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=function(i){t._resolve&&(e.onerror=null,t.onError.emit(i))},e.onload=function(){if(t._resolve){var i=e.width,r=e.height;if(!i||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var n=i*t.scale,s=r*t.scale;(t._overrideWidth||t._overrideHeight)&&(n=t._overrideWidth||t._overrideHeight/r*i,s=t._overrideHeight||t._overrideWidth/i*r),n=Math.round(n),s=Math.round(s);var o=t.source;o.width=n,o.height=s,o._pixiId="canvas_"+FA(),o.getContext("2d").drawImage(e,0,0,i,r,0,0,n,s),t._resolve(),t._resolve=null}}},e.getSize=function(t){var i=e.SVG_SIZE.exec(t),r={};return i&&(r[i[1]]=Math.round(parseFloat(i[3])),r[i[5]]=Math.round(parseFloat(i[7]))),r},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(t,i){return"svg"===i||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&e.SVG_XML.test(t)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(LC),UC=function(t){function e(i,r){var n=this;if(r=r||{},!(i instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),"string"==typeof i&&(i=[i]);var o=i[0].src||i[0];LC.crossOrigin(s,o,r.crossorigin);for(var a=0;a<i.length;++a){var h=document.createElement("source"),l=i[a],c=l.src,u=l.mime,d=(c=c||i[a]).split("?").shift().toLowerCase(),f=d.slice(d.lastIndexOf(".")+1);u=u||e.MIME_TYPES[f]||"video/"+f,h.src=c,h.type=u,s.appendChild(h)}i=s}return(n=t.call(this,i)||this).noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=r.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=!1!==r.autoPlay,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),!1!==r.autoLoad&&n.load(),n}return AC(e,t),e.prototype.update=function(e){if(!this.destroyed){var i=eC.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(t.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise(function(i){t.valid?i(t):(t._resolve=i,e.load())}),this._load},e.prototype._onError=function(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)},e.prototype._isSourcePlaying=function(){var t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()},e.prototype._isSourceReady=function(){return this.source.readyState>2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(eC.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(eC.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(eC.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(eC.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(eC.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,i){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(LC),VC=function(t){function e(e){return t.call(this,e)||this}return AC(e,t),e.test=function(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap},e}(LC);EC.push(BC,VC,FC,UC,zC,MC,NC,kC);var GC={__proto__:null,Resource:PC,BaseImageResource:LC,INSTALLED:EC,autoDetectResource:SC,AbstractMultiResource:DC,ArrayResource:kC,BufferResource:MC,CanvasResource:FC,CubeResource:NC,ImageResource:BC,SVGResource:zC,VideoResource:UC,ImageBitmapResource:VC},jC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return AC(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===DI.UNPACK);var n=e.realWidth,s=e.realHeight;return i.width===n&&i.height===s?r.texSubImage2D(e.target,0,0,0,n,s,e.format,i.type,this.data):(i.width=n,i.height=s,r.texImage2D(e.target,0,i.internalFormat,n,s,0,e.format,i.type,this.data)),!0},e}(MC),HC=function(){function t(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new JA("disposeFramebuffer"),this.multisample=WI.NONE}return Object.defineProperty(t.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),t.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new OC(null,{scaleMode:AI.NEAREST,resolution:1,mipmap:RI.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.addDepthTexture=function(t){return this.depthTexture=t||new OC(new jC(null,{width:this.width,height:this.height}),{scaleMode:AI.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:RI.OFF,format:xI.DEPTH_COMPONENT,type:TI.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.resize=function(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){n=this.depthTexture.resolution;this.depthTexture.setSize(t/n,e/n)}}},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},t}(),WC=function(t){function e(e){void 0===e&&(e={});var i=this;"number"==typeof e&&(e={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]});return e.width=e.width||100,e.height=e.height||100,e.multisample=void 0!==e.multisample?e.multisample:WI.NONE,(i=t.call(this,null,e)||this).mipmap=RI.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new HC(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=e.multisample,i.maskStack=[],i.filterStack=[{}],i}return AC(e,t),e.prototype.resize=function(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),t.prototype.dispose.call(this)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(OC),XC=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.uvsFloat32=new Float32Array(8)}return t.prototype.set=function(t,e,i){var r=e.width,n=e.height;if(i){var s=t.width/2/r,o=t.height/2/n,a=t.x/r+s,h=t.y/n+o;i=wC.add(i,wC.NW),this.x0=a+s*wC.uX(i),this.y0=h+o*wC.uY(i),i=wC.add(i,2),this.x1=a+s*wC.uX(i),this.y1=h+o*wC.uY(i),i=wC.add(i,2),this.x2=a+s*wC.uX(i),this.y2=h+o*wC.uY(i),i=wC.add(i,2),this.x3=a+s*wC.uX(i),this.y3=h+o*wC.uY(i)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;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.prototype.toString=function(){return"[@pixi/core:TextureUvs x0="+this.x0+" y0="+this.y0+" x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" y2="+this.y2+" x3="+this.x3+" y3="+this.y3+"]"},t}(),YC=new XC;function qC(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}var KC=function(t){function e(i,r,n,s,o,a){var h=t.call(this)||this;if(h.noFrame=!1,r||(h.noFrame=!0,r=new hC(0,0,1,1)),i instanceof e&&(i=i.baseTexture),h.baseTexture=i,h._frame=r,h.trim=s,h.valid=!1,h._uvs=YC,h.uvMatrix=null,h.orig=n||r,h._rotate=Number(o||0),!0===o)h._rotate=2;else if(h._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=a?new oC(a.x,a.y):new oC(0,0),h._updateID=0,h.textureCacheIds=[],i.valid?h.noFrame?i.valid&&h.onBaseTextureUpdated(i):h.frame=r:i.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&i.on("update",h.onBaseTextureUpdated,h),h}return AC(e,t),e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},e.prototype.destroy=function(t){if(this.baseTexture){if(t){var i=this.baseTexture.resource;i&&i.url&&VA[i.url]&&e.removeFromCache(i.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,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(){var t=this._frame.clone(),i=this._frame===this.orig?t:this.orig.clone(),r=new e(this.baseTexture,!this.noFrame&&t,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(r._frame=t),r},e.prototype.updateUvs=function(){this._uvs===YC&&(this._uvs=new XC),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(t,i,r){void 0===i&&(i={}),void 0===r&&(r=mA.STRICT_TEXTURE_CACHE);var n="string"==typeof t,s=null;if(n)s=t;else if(t instanceof OC){if(!t.cacheId){var o=i&&i.pixiIdPrefix||"pixiid";t.cacheId=o+"-"+FA(),OC.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+FA()}s=t._pixiId}var a=VA[s];if(n&&r&&!a)throw new Error('The cacheId "'+s+'" does not exist in TextureCache.');return a||t instanceof OC?!a&&t instanceof OC&&(a=new e(t),e.addToCache(a,s)):(i.resolution||(i.resolution=jA(t)),(a=new e(new OC(t,i))).baseTexture.cacheId=s,OC.addToCache(a.baseTexture,s),e.addToCache(a,s)),a},e.fromURL=function(t,i){var r=Object.assign({autoLoad:!1},null==i?void 0:i.resourceOptions),n=e.from(t,Object.assign({resourceOptions:r},i),!1),s=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):s.load().then(function(){return Promise.resolve(n)})},e.fromBuffer=function(t,i,r,n){return new e(OC.fromBuffer(t,i,r,n))},e.fromLoader=function(t,i,r,n){var s=new OC(t,Object.assign({scaleMode:mA.SCALE_MODE,resolution:jA(i)},n)),o=s.resource;o instanceof BC&&(o.url=i);var a=new e(s);return r||(r=i),OC.addToCache(a.baseTexture,r),e.addToCache(a,r),r!==i&&(OC.addToCache(a.baseTexture,i),e.addToCache(a,i)),a.baseTexture.valid?Promise.resolve(a):new Promise(function(t){a.baseTexture.once("loaded",function(){return t(a)})})},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),VA[e]&&console.warn("Texture added to the cache with an id ["+e+"] that already had an entry"),VA[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=VA[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete VA[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)VA[t.textureCacheIds[r]]===t&&delete VA[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var e=t.x,i=t.y,r=t.width,n=t.height,s=e+r>this.baseTexture.width,o=i+n>this.baseTexture.height;if(s||o){var a=s&&o?"and":"or",h="X: "+e+" + "+r+" = "+(e+r)+" > "+this.baseTexture.width,l="Y: "+i+" + "+n+" = "+(i+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+l)}this.valid=r&&n&&this.baseTexture.valid,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},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},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.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new OC),qC(e._EMPTY),qC(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=mA.ADAPTER.createCanvas(16,16),i=t.getContext("2d");t.width=16,t.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),e._WHITE=new e(OC.from(t)),qC(e._WHITE),qC(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(gA.default),ZC=function(t){function e(e,i){var r=t.call(this,e,i)||this;return r.valid=!0,r.filterFrame=null,r.filterPoolKey=null,r.updateUvs(),r}return AC(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,i){void 0===i&&(i=!0);var r=this.baseTexture.resolution,n=Math.round(t*r)/r,s=Math.round(e*r)/r;this.valid=n>0&&s>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=s,i&&this.baseTexture.resize(n,s),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){for(var i=arguments,r=[],n=1;n<arguments.length;n++)r[n-1]=i[n];return"number"==typeof t&&(BA("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),t={width:t,height:r[0],scaleMode:r[1],resolution:r[2]}),new e(new WC(t))},e}(KC),JC=function(){function t(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(t,e,i){void 0===i&&(i=WI.NONE);var r=new WC(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new ZC(r)},t.prototype.getOptimalTexture=function(t,e,i,r){var n;void 0===i&&(i=1),void 0===r&&(r=WI.NONE),t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=r>1?-r:-1:(n=((65535&(t=MA(t)))<<16|65535&(e=MA(e)))>>>0,r>1&&(n+=4294967296*r)),this.texturePool[n]||(this.texturePool[n]=[]);var s=this.texturePool[n].pop();return s||(s=this.createTexture(t,e,r)),s.filterPoolKey=n,s.setResolution(i),s},t.prototype.getFilterTexture=function(t,e,i){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||WI.NONE);return r.filterFrame=t.filterFrame,r},t.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},t.prototype.returnFilterTexture=function(t){this.returnTexture(t)},t.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0)}this.texturePool={}},t.prototype.setScreenSize=function(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){for(var e in this.enableFullScreen=t.width>0&&t.height>0,this.texturePool)if(Number(e)<0){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},t.SCREEN_KEY=-1,t}(),$C=function(){function t(t,e,i,r,n,s,o){void 0===e&&(e=0),void 0===i&&(i=!1),void 0===r&&(r=TI.FLOAT),this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=s,this.instance=o}return t.prototype.destroy=function(){this.buffer=null},t.from=function(e,i,r,n,s){return new t(e,i,r,n,s)},t}(),QC=0,tP=function(){function t(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=QC++,this.disposeRunner=new JA("disposeBuffer")}return t.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(t.prototype,"index",{get:function(){return this.type===YI.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?YI.ELEMENT_ARRAY_BUFFER:YI.ARRAY_BUFFER},enumerable:!1,configurable:!0}),t.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)},t}(),eP={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var iP={5126:4,5123:2,5121:1},rP=0,nP={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},sP=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=rP++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new JA("disposeGeometry"),this.refCount=0}return t.prototype.addAttribute=function(t,e,i,r,n,s,o,a){if(void 0===i&&(i=0),void 0===r&&(r=!1),void 0===a&&(a=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof tP||(e instanceof Array&&(e=new Float32Array(e)),e=new tP(e));var h=t.split("|");if(h.length>1){for(var l=0;l<h.length;l++)this.addAttribute(h[l],e,i,r,n);return this}var c=this.buffers.indexOf(e);return-1===c&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new $C(c,i,r,n,s,o,a),this.instanced=this.instanced||a,this},t.prototype.getAttribute=function(t){return this.attributes[t]},t.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},t.prototype.addIndex=function(t){return t instanceof tP||(t instanceof Array&&(t=new Uint16Array(t)),t=new tP(t)),t.type=YI.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,-1===this.buffers.indexOf(t)&&this.buffers.push(t),this},t.prototype.getIndex=function(){return this.indexBuffer},t.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var t,e=[],i=[],r=new tP;for(t in this.attributes){var n=this.attributes[t],s=this.buffers[n.buffer];e.push(s.data),i.push(n.size*iP[n.type]/4),n.buffer=0}for(r.data=function(t,e){for(var i=0,r=0,n={},s=0;s<t.length;s++)r+=e[s],i+=t[s].length;var o=new ArrayBuffer(4*i),a=null,h=0;for(s=0;s<t.length;s++){var l=e[s],c=t[s],u=PA(c);n[u]||(n[u]=new eP[u](o)),a=n[u];for(var d=0;d<c.length;d++)a[(d/l|0)*r+h+d%l]=c[d];h+=l}return new Float32Array(o)}(e,i),t=0;t<this.buffers.length;t++)this.buffers[t]!==this.indexBuffer&&this.buffers[t].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},t.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},t.prototype.clone=function(){for(var e=new t,i=0;i<this.buffers.length;i++)e.buffers[i]=new tP(this.buffers[i].data.slice(0));for(var i in this.attributes){var r=this.attributes[i];e.attributes[i]=new $C(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=YI.ELEMENT_ARRAY_BUFFER),e},t.merge=function(e){for(var i,r=new t,n=[],s=[],o=[],a=0;a<e.length;a++){i=e[a];for(var h=0;h<i.buffers.length;h++)s[h]=s[h]||0,s[h]+=i.buffers[h].data.length,o[h]=0}for(a=0;a<i.buffers.length;a++)n[a]=new(nP[PA(i.buffers[a].data)])(s[a]),r.buffers[a]=new tP(n[a]);for(a=0;a<e.length;a++){i=e[a];for(h=0;h<i.buffers.length;h++)n[h].set(i.buffers[h].data,o[h]),o[h]+=i.buffers[h].data.length}if(r.attributes=i.attributes,i.indexBuffer){r.indexBuffer=r.buffers[i.buffers.indexOf(i.indexBuffer)],r.indexBuffer.type=YI.ELEMENT_ARRAY_BUFFER;var l=0,c=0,u=0,d=0;for(a=0;a<i.buffers.length;a++)if(i.buffers[a]!==i.indexBuffer){d=a;break}for(var a in i.attributes){var f=i.attributes[a];(0|f.buffer)===d&&(c+=f.size*iP[f.type]/4)}for(a=0;a<e.length;a++){var p=e[a].indexBuffer.data;for(h=0;h<p.length;h++)r.indexBuffer.data[h+u]+=l;l+=e[a].buffers[d].data.length/c,u+=p.length}}return r},t}(),oP=function(t){function e(){var e=t.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return AC(e,t),e}(sP),aP=function(t){function e(){var e=t.call(this)||this;return e.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.uvs=new Float32Array([0,0,1,0,1,1,0,1]),e.vertexBuffer=new tP(e.vertices),e.uvBuffer=new tP(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return AC(e,t),e.prototype.map=function(t,e){var i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(sP),hP=0,lP=function(){function t(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=hP++,this.static=!!e,this.ubo=!!i,t instanceof tP?(this.buffer=t,this.buffer.type=YI.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new tP(new Float32Array(1)),this.buffer.type=YI.UNIFORM_BUFFER,this.autoManage=!0))}return t.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},t.prototype.add=function(e,i,r){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[e]=new t(i,r)},t.from=function(e,i,r){return new t(e,i,r)},t.uboFrom=function(e,i){return new t(e,null==i||i,!0)},t}(),cP=function(){function t(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=WI.NONE,this.sourceFrame=new hC,this.destinationFrame=new hC,this.bindingSourceFrame=new hC,this.bindingDestinationFrame=new hC,this.filters=[],this.transform=null}return t.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},t}(),uP=[new oC,new oC,new oC,new oC],dP=new pC,fP=function(){function t(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new JC,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new oP,this.quadUv=new aP,this.tempRect=new hC,this.activeState={},this.globalUniforms=new lP({outputFrame:new hC,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return t.prototype.push=function(t,e){for(var i,r,n=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new cP,a=this.renderer.renderTexture,h=e[0].resolution,l=e[0].multisample,c=e[0].padding,u=e[0].autoFit,d=null===(i=e[0].legacy)||void 0===i||i,f=1;f<e.length;f++){var p=e[f];h=Math.min(h,p.resolution),l=Math.min(l,p.multisample),c=this.useMaxPadding?Math.max(c,p.padding):c+p.padding,u=u&&p.autoFit,d=d||null===(r=p.legacy)||void 0===r||r}1===s.length&&(this.defaultFilterStack[0].renderTexture=a.current),s.push(o),o.resolution=h,o.multisample=l,o.legacy=d,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(c);var m=this.tempRect.copyFrom(a.sourceFrame);n.projection.transform&&this.transformAABB(dP.copyFrom(n.projection.transform).invert(),m),u?(o.sourceFrame.fit(m),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(m)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,h,l),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;var g=this.tempRect;g.x=0,g.y=0,g.width=o.sourceFrame.width,g.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(a.sourceFrame),o.bindingDestinationFrame.copyFrom(a.destinationFrame),o.transform=n.projection.transform,n.projection.transform=null,a.bind(o.renderTexture,o.sourceFrame,g),n.framebuffer.clear(0,0,0,0)},t.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;var r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;var n=r.inputSize,s=r.inputPixel,o=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],s[0]=Math.round(n[0]*e.resolution),s[1]=Math.round(n[1]*e.resolution),s[2]=1/s[0],s[3]=1/s[1],o[0]=.5*s[2],o[1]=.5*s[3],o[2]=e.sourceFrame.width*n[2]-.5*s[2],o[3]=e.sourceFrame.height*n[3]-.5*s[3],e.legacy){var a=r.filterArea;a[0]=e.destinationFrame.width,a[1]=e.destinationFrame.height,a[2]=e.sourceFrame.x,a[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();var h=t[t.length-1];if(this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,e.renderTexture,h.renderTexture,LI.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;var u=0;for(u=0;u<i.length-1;++u){1===u&&e.multisample>1&&((c=this.getOptimalFilterTexture(l.width,l.height,e.resolution)).filterFrame=l.filterFrame),i[u].apply(this,l,c,LI.CLEAR,e);var d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,LI.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)},t.prototype.bindAndClear=function(t,e){void 0===e&&(e=LI.CLEAR);var i=this.renderer,r=i.renderTexture,n=i.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=t.filterFrame.width,s.height=t.filterFrame.height,r.bind(t,t.filterFrame,s)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=1&n.stateId||this.forceClear;(e===LI.CLEAR||e===LI.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},t.prototype.applyFilter=function(t,e,i,r){var n=this.renderer;n.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(vI.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(vI.TRIANGLE_STRIP))},t.prototype.calculateSpriteMatrix=function(t,e){var i=this.activeState,r=i.sourceFrame,n=i.destinationFrame,s=e._texture.orig,o=t.set(n.width,0,0,n.height,r.x,r.y),a=e.worldTransform.copyTo(pC.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/s.width,1/s.height),o.translate(e.anchor.x,e.anchor.y),o},t.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},t.prototype.getOptimalFilterTexture=function(t,e,i,r){return void 0===i&&(i=1),void 0===r&&(r=WI.NONE),this.texturePool.getOptimalTexture(t,e,i,r)},t.prototype.getFilterTexture=function(t,e,i){if("number"==typeof t){var r=t;t=e,e=r}t=t||this.activeState.renderTexture;var n=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||WI.NONE);return n.filterFrame=t.filterFrame,n},t.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},t.prototype.emptyPool=function(){this.texturePool.clear(!0)},t.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},t.prototype.transformAABB=function(t,e){var i=uP[0],r=uP[1],n=uP[2],s=uP[3];i.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),s.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(n,n),t.apply(s,s);var o=Math.min(i.x,r.x,n.x,s.x),a=Math.min(i.y,r.y,n.y,s.y),h=Math.max(i.x,r.x,n.x,s.x),l=Math.max(i.y,r.y,n.y,s.y);e.x=o,e.y=a,e.width=h-o,e.height=l-a},t.prototype.roundFrame=function(t,e,i,r,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){var s=n.a,o=n.b,a=n.c,h=n.d;if((Math.abs(o)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(s)>1e-4||Math.abs(h)>1e-4))return}(n=n?dP.copyFrom(n):dP.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}},t}(),pP=function(){function t(t){this.renderer=t}return t.prototype.flush=function(){},t.prototype.destroy=function(){this.renderer=null},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.render=function(t){},t}(),mP=function(){function t(t){this.renderer=t,this.emptyRenderer=new pP(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.prototype.copyBoundTextures=function(t,e){for(var i=this.renderer.texture.boundTextures,r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)},t.prototype.boundArray=function(t,e,i,r){for(var n=t.elements,s=t.ids,o=t.count,a=0,h=0;h<o;h++){var l=n[h],c=l._batchLocation;if(c>=0&&c<r&&e[c]===l)s[h]=c;else for(;a<r;){var u=e[a];if(!u||u._batchEnabled!==i||u._batchLocation!==a){s[h]=a,l._batchLocation=a,e[a]=l;break}a++}}},t.prototype.destroy=function(){this.renderer=null},t}(),gP=0,vP=function(){function t(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),t.view.addEventListener("webglcontextlost",this.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(t.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),t.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=gP++},t.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=gP++,this.renderer.runners.contextChange.emit(t)},t.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},t.prototype.createContext=function(t,e){var i;if(mA.PREFER_ENV>=lI.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},t.prototype.getExtensions=function(){var t=this.gl,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},t.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},t.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},t.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},t.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},t.prototype.validateContext=function(t){var e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},t}(),yP=function(){return function(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=WI.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}(),xP=new hC,bP=function(){function t(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new HC(10,10),this.msaaSamples=null}return t.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new hC,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){var e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;mA.PREFER_ENV===lI.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=function(t){return e.drawBuffersWEBGL(t)}:(this.hasMRT=!1,t.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},t.prototype.bind=function(t,e,i){void 0===i&&(i=0);var r=this.gl;if(t){var n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var s=0;s<t.colorTextures.length;s++){var o=t.colorTextures[s];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var a=e.width>>i,h=e.height>>i,l=a/e.width;this.setViewport(e.x*l,e.y*l,a,h)}else{a=t.width>>i,h=t.height>>i;this.setViewport(0,0,a,h)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},t.prototype.setViewport=function(t,e,i,r){var n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),n.width===i&&n.height===r&&n.x===t&&n.y===e||(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,r))},Object.defineProperty(t.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),t.prototype.clear=function(t,e,i,r,n){void 0===n&&(n=fI.COLOR|fI.DEPTH);var s=this.gl;s.clearColor(t,e,i,r),s.clear(n)},t.prototype.initFramebuffer=function(t){var e=this.gl,i=new yP(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i},t.prototype.resizeFramebuffer=function(t){var e=this.gl,i=t.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.RGBA8,t.width,t.height)),i.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,i.stencil),i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var r=t.colorTextures,n=r.length;e.drawBuffers||(n=Math.min(n,1));for(var s=0;s<n;s++){var o=r[s],a=o.parentTextureArray||o;this.renderer.texture.bind(a,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},t.prototype.updateFramebuffer=function(t,e){var i=this.gl,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures,s=n.length;i.drawBuffers||(s=Math.min(s,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?(r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.RGBA8,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));for(var o=[],a=0;a<s;a++){var h=n[a],l=h.parentTextureArray||h;this.renderer.texture.bind(l,0),0===a&&r.msaaBuffer||(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,h.target,l._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+a))}if((o.length>1&&i.drawBuffers(o),t.depthTexture)&&this.writeDepthTexture){var c=t.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null):(r.stencil=r.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.DEPTH24_STENCIL8,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,r.stencil))},t.prototype.canMultisampleFramebuffer=function(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture},t.prototype.detectSamples=function(t){var e=this.msaaSamples,i=WI.NONE;if(t<=1||null===e)return i;for(var r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return 1===i&&(i=WI.NONE),i},t.prototype.blit=function(t,e,i){var r=this,n=r.current,s=r.renderer,o=r.gl,a=r.CONTEXT_UID;if(2===s.context.webGLVersion&&n){var h=n.glFramebuffers[a];if(h){if(!t){if(!h.msaaBuffer)return;var l=n.colorTextures[0];if(!l)return;h.blitFramebuffer||(h.blitFramebuffer=new HC(n.width,n.height),h.blitFramebuffer.addColorTexture(0,l)),(t=h.blitFramebuffer).colorTextures[0]!==l&&(t.colorTextures[0]=l,t.dirtyId++,t.dirtyFormat++),t.width===n.width&&t.height===n.height||(t.width=n.width,t.height=n.height,t.dirtyId++,t.dirtySize++)}e||((e=xP).width=n.width,e.height=n.height),i||(i=e);var c=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,c?o.NEAREST:o.LINEAR)}}},t.prototype.disposeFramebuffer=function(t,e){var i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(i){delete t.glFramebuffers[this.CONTEXT_UID];var n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},t.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)},t.prototype.forceStencil=function(){var t=this.current;if(t){var e=t.glFramebuffers[this.CONTEXT_UID];if(e&&!e.stencil){t.stencil=!0;var i=t.width,r=t.height,n=this.gl,s=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,s),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,n.DEPTH24_STENCIL8,i,r):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,i,r),e.stencil=s,n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,s)}}},t.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new hC},t.prototype.destroy=function(){this.renderer=null},t}(),_P={5126:4,5123:2,5121:1},wP=function(){function t(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return t.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){var i=this.renderer.context.extensions.vertexArrayObject;mA.PREFER_ENV===lI.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=function(){return i.createVertexArrayOES()},t.bindVertexArray=function(t){return i.bindVertexArrayOES(t)},t.deleteVertexArray=function(t){return i.deleteVertexArrayOES(t)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(2!==e.webGLVersion){var r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=function(t,e){return r.vertexAttribDivisorANGLE(t,e)},t.drawElementsInstanced=function(t,e,i,n,s){return r.drawElementsInstancedANGLE(t,e,i,n,s)},t.drawArraysInstanced=function(t,e,i,n){return r.drawArraysInstancedANGLE(t,e,i,n)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex},t.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var i=this.gl,r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);var s=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==s&&(this._activeVao=s,this.hasVao?i.bindVertexArray(s):this.activateVao(t,e.program)),this.updateBuffers()},t.prototype.reset=function(){this.unbind()},t.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,i=0;i<t.buffers.length;i++){var r=t.buffers[i];e.update(r)}},t.prototype.checkCompatibility=function(t,e){var i=t.attributes,r=e.attributeData;for(var n in r)if(!i[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},t.prototype.getSignature=function(t,e){var i=t.attributes,r=e.attributeData,n=["g",t.id];for(var s in i)r[s]&&n.push(s,r[s].location);return n.join("-")},t.prototype.initGeometryVao=function(t,e,i){void 0===i&&(i=!0);var r=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);var a=this.getSignature(t,o),h=t.glVertexArrayObjects[this.CONTEXT_UID],l=h[a];if(l)return h[o.id]=l,l;var c=t.buffers,u=t.attributes,d={},f={};for(var p in c)d[p]=0,f[p]=0;for(var p in u)!u[p].size&&o.attributeData[p]?u[p].size=o.attributeData[p].size:u[p].size||console.warn("PIXI Geometry attribute '"+p+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[u[p].buffer]+=u[p].size*_P[u[p].type];for(var p in u){var m=u[p],g=m.size;void 0===m.stride&&(d[m.buffer]===g*_P[m.type]?m.stride=0:m.stride=d[m.buffer]),void 0===m.start&&(m.start=f[m.buffer],f[m.buffer]+=g*_P[m.type])}l=r.createVertexArray(),r.bindVertexArray(l);for(var v=0;v<c.length;v++){var y=c[v];s.bind(y),i&&y._glBuffers[n].refCount++}return this.activateVao(t,o),this._activeVao=l,h[o.id]=l,h[a]=l,l},t.prototype.disposeGeometry=function(t,e){var i;if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,s=t.buffers,o=null===(i=this.renderer)||void 0===i?void 0:i.buffer;if(t.disposeRunner.remove(this),r){if(o)for(var a=0;a<s.length;a++){var h=s[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,0!==h.refCount||e||o.dispose(s[a],e))}if(!e)for(var l in r)if("g"===l[0]){var c=r[l];this._activeVao===c&&this.unbind(),n.deleteVertexArray(c)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)},t.prototype.activateVao=function(t,e){var i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,s=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);var a=null;for(var h in o){var l=o[h],c=s[l.buffer],u=c._glBuffers[r];if(e.attributeData[h]){a!==u&&(n.bind(c),a=u);var d=e.attributeData[h].location;if(i.enableVertexAttribArray(d),i.vertexAttribPointer(d,l.size,l.type||i.FLOAT,l.normalized,l.stride,l.start),l.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");i.vertexAttribDivisor(d,1)}}}},t.prototype.draw=function(t,e,i,r){var n=this.gl,s=this._activeGeometry;if(s.indexBuffer){var o=s.indexBuffer.data.BYTES_PER_ELEMENT,a=2===o?n.UNSIGNED_SHORT:n.UNSIGNED_INT;2===o||4===o&&this.canUseUInt32ElementIndex?s.instanced?n.drawElementsInstanced(t,e||s.indexBuffer.data.length,a,(i||0)*o,r||1):n.drawElements(t,e||s.indexBuffer.data.length,a,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else s.instanced?n.drawArraysInstanced(t,i,e||s.getSize(),r||1):n.drawArrays(t,i,e||s.getSize());return this},t.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},t.prototype.destroy=function(){this.renderer=null},t}(),TP=function(){function t(t){void 0===t&&(t=null),this.type=VI.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=mA.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(t.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=VI.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},t.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},t}();function EP(t,e,i){var r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}function SP(t,e){var i=t.getShaderSource(e).split("\n").map(function(t,e){return e+": "+t}),r=t.getShaderInfoLog(e),n=r.split("\n"),s={},o=n.map(function(t){return parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(t){return!(!t||s[t])&&(s[t]=!0,!0)}),a=[""];o.forEach(function(t){i[t-1]="%c"+i[t-1]+"%c",a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=i.join("\n");a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,a),console.groupEnd()}function IP(t){for(var e=new Array(t),i=0;i<e.length;i++)e[i]=!1;return e}function AP(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":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"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return IP(2*e);case"bvec3":return IP(3*e);case"bvec4":return IP(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])}return null}var CP,PP={},MP=PP;function RP(){if(!CP){CP=zI.MEDIUM;var t=function(){if(MP===PP||MP&&MP.isContextLost()){var t=mA.ADAPTER.createCanvas(),e=void 0;mA.PREFER_ENV>=lI.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),MP=e}return MP}();if(t&&t.getShaderPrecisionFormat){var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);CP=e.precision?zI.HIGH:zI.MEDIUM}}return CP}function OP(t,e,i){if("precision"!==t.substring(0,9)){var r=e;return e===zI.HIGH&&i!==zI.HIGH&&(r=zI.MEDIUM),"precision "+r+" float;\n"+t}return i!==zI.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}var DP={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function kP(t){return DP[t]}var LP=null,FP={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function NP(t,e){if(!LP){var i=Object.keys(FP);LP={};for(var r=0;r<i.length;++r){var n=i[r];LP[t[n]]=FP[n]}}return LP[e]}var BP=[{test:function(t){return"float"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n if(uv["'+t+'"] !== ud["'+t+'"].value)\n {\n ud["'+t+'"].value = uv["'+t+'"]\n gl.uniform1f(ud["'+t+'"].location, uv["'+t+'"])\n }\n '}},{test:function(t,e){return!("sampler2D"!==t.type&&"samplerCube"!==t.type&&"sampler2DArray"!==t.type||1!==t.size||t.isArray||null!=e&&void 0===e.castToBaseTexture)},code:function(t){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+t+'"], t);\n\n if(ud["'+t+'"].value !== t)\n {\n ud["'+t+'"].value = t;\n gl.uniform1i(ud["'+t+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(t,e){return"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a},code:function(t){return'\n gl.uniformMatrix3fv(ud["'+t+'"].location, false, uv["'+t+'"].toArray(true));\n '},codeUbo:function(t){return"\n var "+t+"_matrix = uv."+t+".toArray(true);\n\n data[offset] = "+t+"_matrix[0];\n data[offset+1] = "+t+"_matrix[1];\n data[offset+2] = "+t+"_matrix[2];\n \n data[offset + 4] = "+t+"_matrix[3];\n data[offset + 5] = "+t+"_matrix[4];\n data[offset + 6] = "+t+"_matrix[5];\n \n data[offset + 8] = "+t+"_matrix[6];\n data[offset + 9] = "+t+"_matrix[7];\n data[offset + 10] = "+t+"_matrix[8];\n "}},{test:function(t,e){return"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+t+'"].location, v.x, v.y);\n }'},codeUbo:function(t){return"\n v = uv."+t+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "}},{test:function(t){return"vec2"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+t+'"].location, v[0], v[1]);\n }\n '}},{test:function(t,e){return"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+t+'"].location, v.x, v.y, v.width, v.height)\n }'},codeUbo:function(t){return"\n v = uv."+t+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "}},{test:function(t){return"vec4"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+t+'"].location, v[0], v[1], v[2], v[3])\n }'}}],zP={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",samplerCube:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",sampler2DArray:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }"},UP={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var VP,GP=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function jP(t){for(var e="",i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+="if(test == "+i+".0){}");return e}var HP=0,WP={},XP=function(){function t(e,i,r){void 0===r&&(r="pixi-shader"),this.id=HP++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=i||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),WP[r]?(WP[r]++,r+="-"+WP[r]):WP[r]=1,this.vertexSrc="#define SHADER_NAME "+r+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+r+"\n"+this.fragmentSrc,this.vertexSrc=OP(this.vertexSrc,mA.PRECISION_VERTEX,zI.HIGH),this.fragmentSrc=OP(this.fragmentSrc,mA.PRECISION_FRAGMENT,RP())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(t,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),t.from=function(e,i,r){var n=e+i,s=UA[n];return s||(UA[n]=s=new t(e,i,r)),s},t}(),YP=function(){function t(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof lP?e:new lP(e):new lP({}),this.disposeRunner=new JA("disposeShader")}return t.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var i in e.uniforms){var r=e.uniforms[i];if(r.group&&this.checkUniformExists(t,r))return!0}return!1},t.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(t.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),t.from=function(e,i,r){return new t(XP.from(e,i),r)},t}(),qP=function(){function t(){this.data=0,this.blendMode=mI.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(t.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(t){!!(1&this.data)!==t&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(t){!!(2&this.data)!==t&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(t){!!(4&this.data)!==t&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(t){!!(8&this.data)!==t&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{get:function(){return!!(32&this.data)},set:function(t){!!(32&this.data)!==t&&(this.data^=32)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(t){!!(16&this.data)!==t&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==mI.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[@pixi/core:State blendMode="+this.blendMode+" clockwiseFrontFace="+this.clockwiseFrontFace+" culling="+this.culling+" depthMask="+this.depthMask+" polygonOffset="+this.polygonOffset+"]"},t.for2d=function(){var e=new t;return e.depthTest=!1,e.blend=!0,e},t}(),KP=function(t){function e(i,r,n){var s=this,o=XP.from(i||e.defaultVertexSrc,r||e.defaultFragmentSrc);return(s=t.call(this,o,n)||this).padding=0,s.resolution=mA.FILTER_RESOLUTION,s.multisample=mA.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new qP,s}return AC(e,t),e.prototype.apply=function(t,e,i,r,n){t.applyFilter(this,e,i,r)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),e}(YP),ZP=new pC,JP=function(){function t(t,e){this._texture=t,this.mapCoord=new pC,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}return Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),t.prototype.multiplyUvs=function(t,e){void 0===e&&(e=t);for(var i=this.mapCoord,r=0;r<t.length;r+=2){var n=t[r],s=t[r+1];e[r]=n*i.a+s*i.c+i.tx,e[r+1]=n*i.b+s*i.d+i.ty}return e},t.prototype.update=function(t){var e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var r=e.orig,n=e.trim;n&&(ZP.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(ZP));var s=e.baseTexture,o=this.uClampFrame,a=this.clampMargin/s.resolution,h=this.clampOffset;return o[0]=(e._frame.x+a+h)/s.width,o[1]=(e._frame.y+a+h)/s.height,o[2]=(e._frame.x+e._frame.width-a+h)/s.width,o[3]=(e._frame.y+e._frame.height-a+h)/s.height,this.uClampOffset[0]=h/s.realWidth,this.uClampOffset[1]=h/s.realHeight,this.isSimple=e._frame.width===s.width&&e._frame.height===s.height&&0===e.rotate,!0},t}(),$P=function(t){function e(e,i,r){var n=this,s=null;return"string"!=typeof e&&void 0===i&&void 0===r&&(s=e,e=void 0,i=void 0,r=void 0),(n=t.call(this,e||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n",i||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n",r)||this).maskSprite=s,n.maskMatrix=new pC,n}return AC(e,t),Object.defineProperty(e.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,e,i,r){var n=this._maskSprite,s=n._texture;s.valid&&(s.uvMatrix||(s.uvMatrix=new JP(s,0)),s.uvMatrix.update(),this.uniforms.npmAlpha=s.baseTexture.alphaMode?0:1,this.uniforms.mask=s,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(s.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=s.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))},e}(KP),QP=function(){function t(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return t.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},t.prototype.push=function(t,e){var i=e;if(!i.isMaskData){var r=this.maskDataPool.pop()||new TP;r.pooled=!0,r.maskObject=e,i=r}var n=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(n),i._colorMask=n?n._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==VI.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case VI.SCISSOR:this.renderer.scissor.push(i);break;case VI.STENCIL:this.renderer.stencil.push(i);break;case VI.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case VI.COLOR:this.pushColorMask(i)}i.type===VI.SPRITE&&this.maskStack.push(i)},t.prototype.pop=function(t){var e=this.maskStack.pop();if(e&&e._target===t){if(e.enabled)switch(e.type){case VI.SCISSOR:this.renderer.scissor.pop(e);break;case VI.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case VI.SPRITE:this.popSpriteMask(e);break;case VI.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){var i=this.maskStack[this.maskStack.length-1];i.type===VI.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},t.prototype.detect=function(t){var e=t.maskObject;e?e.isSprite?t.type=VI.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=VI.SCISSOR:t.type=VI.STENCIL:t.type=VI.COLOR},t.prototype.pushSpriteMask=function(t){var e,i,r=t.maskObject,n=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex])||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new $P]);var o,a,h=this.renderer,l=h.renderTexture;if(l.current){var c=l.current;o=t.resolution||c.resolution,a=null!==(e=t.multisample)&&void 0!==e?e:c.multisample}else o=t.resolution||h.resolution,a=null!==(i=t.multisample)&&void 0!==i?i:h.multisample;s[0].resolution=o,s[0].multisample=a,s[0].maskSprite=r;var u=n.filterArea;n.filterArea=r.getBounds(!0),h.filter.push(n,s),n.filterArea=u,t._filters||this.alphaMaskIndex++},t.prototype.popSpriteMask=function(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},t.prototype.pushColorMask=function(t){var e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask(!!(1&i),!!(2&i),!!(4&i),!!(8&i))},t.prototype.popColorMask=function(t){var e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask(!!(1&i),!!(2&i),!!(4&i),!!(8&i))},t.prototype.destroy=function(){this.renderer=null},t}(),tM=function(){function t(t){this.renderer=t,this.maskStack=[],this.glConst=0}return t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(t){var e=this.renderer.gl,i=this.getStackLength();this.maskStack=t;var r=this.getStackLength();r!==i&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){this.renderer=null,this.maskStack=null},t}(),eM=new pC,iM=[],rM=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=mA.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return AC(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var e;if(!t._scissorRectLocal){var i=t._scissorRect,r=t.maskObject,n=this.renderer,s=n.renderTexture,o=r.getBounds(!0,null!==(e=iM.pop())&&void 0!==e?e:new hC);this.roundFrameToPixels(o,s.current?s.current.resolution:n.resolution,s.sourceFrame,s.destinationFrame,n.projection.transform),i&&o.fit(i),t._scissorRectLocal=o}},e.isMatrixRotated=function(t){if(!t)return!1;var e=t.a,i=t.b,r=t.c,n=t.d;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)},e.prototype.testScissor=function(t){var i=t.maskObject;if(!i.isFastRect||!i.isFastRect())return!1;if(e.isMatrixRotated(i.worldTransform))return!1;if(e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var r=t._scissorRectLocal;return r.width>0&&r.height>0},e.prototype.roundFrameToPixels=function(t,i,r,n,s){e.isMatrixRotated(s)||((s=s?eM.copyFrom(s):eM.identity()).translate(-r.x,-r.y).scale(n.width/r.width,n.height/r.height).translate(n.x,n.y),this.renderer.filter.transformAABB(s,t),t.fit(n),t.x=Math.round(t.x*i),t.y=Math.round(t.y*i),t.width=Math.round(t.width*i),t.height=Math.round(t.height*i))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var e=this.renderer.gl;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;t&&iM.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t,e=this.maskStack[this.maskStack.length-1]._scissorRect;t=this.renderer.renderTexture.current?e.y:this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)},e}(tM),nM=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=mA.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return AC(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,i=this.renderer.gl,r=t._stencilCounter;0===r&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;var n=t._colorMask;0!==n&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==n&&(t._colorMask=n,i.colorMask(!!(1&n),!!(2&n),!!(4&n),!!(8&n))),this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{var i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;0!==r&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==r&&(i._colorMask=r,e.colorMask(!!(1&r),!!(2&r),!!(4&r),!!(8&r))),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(tM),sM=function(){function t(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new pC,this.transform=null}return t.prototype.update=function(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(t,e,i,r){var n=this.projectionMatrix,s=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=s*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-s-e.y*n.d},t.prototype.setTransform=function(t){},t.prototype.destroy=function(){this.renderer=null},t}(),oM=new hC,aM=new hC,hM=function(){function t(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new hC,this.destinationFrame=new hC,this.viewportFrame=new hC}return t.prototype.bind=function(t,e,i){void 0===t&&(t=null);var r,n,s,o=this.renderer;this.current=t,t?(s=(r=t.baseTexture).resolution,e||(oM.width=t.frame.width,oM.height=t.frame.height,e=oM),i||(aM.x=t.frame.x,aM.y=t.frame.y,aM.width=e.width,aM.height=e.height,i=aM),n=r.framebuffer):(s=o.resolution,e||(oM.width=o.screen.width,oM.height=o.screen.height,e=oM),i||((i=oM).width=e.width,i.height=e.height));var a=this.viewportFrame;a.x=i.x*s,a.y=i.y*s,a.width=i.width*s,a.height=i.height*s,t||(a.y=o.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(i,e,s,!n),t?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)},t.prototype.clear=function(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.clearColor;var i=this.destinationFrame,r=this.current?this.current.baseTexture:this.renderer.screen,n=i.width!==r.width||i.height!==r.height;if(n){var s=this.viewportFrame,o=s.x,a=s.y,h=s.width,l=s.height;o=Math.round(o),a=Math.round(a),h=Math.round(h),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,a,h,l)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),n&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t.prototype.destroy=function(){this.renderer=null},t}();function lM(t,e,i,r,n){i.buffer.update(n)}var cM={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},uM={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function dM(t,e){if(!t.autoManage)return{size:0,syncFunc:lM};for(var i=function(t,e){var i=[];for(var r in t)e[r]&&i.push(e[r]);return i.sort(function(t,e){return t.index-e.index}),i}(t.uniforms,e),r=function(t){for(var e=t.map(function(t){return{data:t,offset:0,dataLen:0,dirty:0}}),i=0,r=0,n=0,s=0;s<e.length;s++){var o=e[s];if(i=uM[o.data.type],o.data.size>1&&(i=Math.max(i,16)*o.data.size),o.dataLen=i,r%i!==0&&r<16){var a=r%i%16;r+=a,n+=a}r+i>16?(n=16*Math.ceil(n/16),o.offset=n,n+=i,r=i):(o.offset=n,r+=i,n+=i)}return{uboElements:e,size:n=16*Math.ceil(n/16)}}(i),n=r.uboElements,s=r.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],a=0;a<n.length;a++){for(var h=n[a],l=t.uniforms[h.data.name],c=h.data.name,u=!1,d=0;d<BP.length;d++){var f=BP[d];if(f.codeUbo&&f.test(h.data,l)){o.push("offset = "+h.offset/4+";",BP[d].codeUbo(h.data.name,l)),u=!0;break}}if(!u)if(h.data.size>1){var p=kP(h.data.type),m=Math.max(uM[h.data.type]/16,1),g=p/m,v=(4-g%4)%4;o.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+h.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+h.data.size*m+"; i++)\n {\n for(var j = 0; j < "+g+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+v+";\n }\n\n ")}else{var y=cM[h.data.type];o.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+h.offset/4+";\n "+y+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var fM=function(){function t(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return t.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},t}();function pM(t,e){var i=EP(t,t.VERTEX_SHADER,e.vertexSrc),r=EP(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();if(t.attachShader(n,i),t.attachShader(n,r),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,i,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||SP(t,i),t.getShaderParameter(r,t.COMPILE_STATUS)||SP(t,r),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,i,r),e.attributeData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=e.getActiveAttrib(t,n);if(0!==s.name.indexOf("gl_")){var o=NP(e,s.type),a={type:o,name:s.name,size:kP(o),location:e.getAttribLocation(t,s.name)};i[s.name]=a}}return i}(n,t),e.uniformData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n<r;n++){var s=e.getActiveUniform(t,n),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),h=NP(e,s.type);i[o]={name:o,index:n,type:h,size:s.size,isArray:a,value:AP(h,s.size)}}return i}(n,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){var s=Object.keys(e.attributeData);s.sort(function(t,e){return t>e?1:-1});for(var o=0;o<s.length;o++)e.attributeData[s[o]].location=o,t.bindAttribLocation(n,o,s[o]);t.linkProgram(n)}t.deleteShader(i),t.deleteShader(r);var a={};for(var o in e.uniformData){var h=e.uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:AP(h.type,h.size)}}return new fM(n,a)}var mM=0,gM={textureCount:0,uboCount:0},vM=function(){function t(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=mM++}return t.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof VP)return VP;try{var t=new Function("param1","param2","param3","return param1[param2] === param3;");VP=!0===t({a:"b"},"a","b")}catch(t){VP=!1}return VP}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},t.prototype.contextChange=function(t){this.gl=t,this.reset()},t.prototype.bind=function(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;var i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(gM.textureCount=0,gM.uboCount=0,this.syncUniformGroup(t.uniformGroup,gM)),r},t.prototype.setUniforms=function(t){var e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)},t.prototype.syncUniformGroup=function(t,e){var i=this.getGlProgram();t.static&&t.dirtyId===i.uniformDirtyGroups[t.id]||(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))},t.prototype.syncUniforms=function(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)},t.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){var i,r=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(var n in t.uniforms){var s=e[n];if(s){for(var o=t.uniforms[n],a=!1,h=0;h<BP.length;h++)if(BP[h].test(s,o)){r.push(BP[h].code(n,o)),a=!0;break}if(!a){var l=(1!==s.size||s.isArray?UP:zP)[s.type].replace("location",'ud["'+n+'"].location');r.push('\n cu = ud["'+n+'"];\n cv = cu.value;\n v = uv["'+n+'"];\n '+l+";")}}else(null===(i=t.uniforms[n])||void 0===i?void 0:i.group)&&(t.uniforms[n].ubo?r.push("\n renderer.shader.syncUniformBufferGroup(uv."+n+", '"+n+"');\n "):r.push("\n renderer.shader.syncUniformGroup(uv."+n+", syncData);\n "))}return new Function("ud","uv","renderer","syncData",r.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},t.prototype.syncUniformBufferGroup=function(t,e){var i=this.getGlProgram();if(!t.static||0!==t.dirtyId||!i.uniformGroups[t.id]){t.dirtyId=0;var r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,gM,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])},t.prototype.createSyncBufferGroup=function(t,e,i){var r=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;var s=this.getSignature(t,this.shader.program.uniformData,"ubo"),o=this._uboCache[s];if(o||(o=this._uboCache[s]=dM(t,this.shader.program.uniformData)),t.autoManage){var a=new Float32Array(o.size/4);t.buffer.update(a)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]},t.prototype.getSignature=function(t,e,i){var r=t.uniforms,n=[i+"-"];for(var s in r)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")},t.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},t.prototype.generateProgram=function(t){var e=this.gl,i=t.program,r=pM(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r},t.prototype.reset=function(){this.program=null,this.shader=null},t.prototype.disposeShader=function(t){this.shader===t&&(this.shader=null)},t.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},t}();var yM=function(){function t(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=mI.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new qP,this.defaultState.blend=!0}return t.prototype.contextChange=function(t){this.gl=t,this.blendModes=function(t,e){return void 0===e&&(e=[]),e[mI.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.ADD]=[t.ONE,t.ONE],e[mI.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.NONE]=[0,0],e[mI.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[mI.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[mI.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[mI.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[mI.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[mI.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[mI.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[mI.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[mI.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[mI.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[mI.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()},t.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,i=0;e;)1&e&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(i=0;i<this.checks.length;i++)this.checks[i](this,t)},t.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},t.prototype.setBlend=function(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},t.prototype.setOffset=function(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},t.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},t.prototype.setDepthMask=function(t){this.gl.depthMask(t)},t.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},t.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},t.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],i=this.gl;2===e.length?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},t.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},t.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},t.prototype.updateCheck=function(t,e){var i=this.checks.indexOf(t);e&&-1===i?this.checks.push(t):e||-1===i||this.checks.splice(i,1)},t.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},t.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},t.prototype.destroy=function(){this.gl=null},t}(),xM=function(){function t(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=mA.GC_MAX_IDLE,this.checkCountMax=mA.GC_MAX_CHECK_COUNT,this.mode=mA.GC_MODE}return t.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==NI.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,i=!1,r=0;r<e.length;r++){var n=e[r];!n.framebuffer&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,i=!0)}if(i){var s=0;for(r=0;r<e.length;r++)null!==e[r]&&(e[s++]=e[r]);e.length=s}},t.prototype.unload=function(t){var e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(var r=t.children.length-1;r>=0;r--)this.unload(t.children[r])},t.prototype.destroy=function(){this.renderer=null},t}();var bM=function(){return function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=TI.UNSIGNED_BYTE,this.internalFormat=xI.RGBA,this.samplerType=0}}(),_M=function(){function t(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new OC,this.hasIntegerTextures=!1}return t.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){var e,i,r,n,s,o,a,h,l,c,u,d,f,p,m,g,v,y,x,b,_,w,T;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?((e={})[TI.UNSIGNED_BYTE]=((i={})[xI.RGBA]=t.RGBA8,i[xI.RGB]=t.RGB8,i[xI.RG]=t.RG8,i[xI.RED]=t.R8,i[xI.RGBA_INTEGER]=t.RGBA8UI,i[xI.RGB_INTEGER]=t.RGB8UI,i[xI.RG_INTEGER]=t.RG8UI,i[xI.RED_INTEGER]=t.R8UI,i[xI.ALPHA]=t.ALPHA,i[xI.LUMINANCE]=t.LUMINANCE,i[xI.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,i),e[TI.BYTE]=((r={})[xI.RGBA]=t.RGBA8_SNORM,r[xI.RGB]=t.RGB8_SNORM,r[xI.RG]=t.RG8_SNORM,r[xI.RED]=t.R8_SNORM,r[xI.RGBA_INTEGER]=t.RGBA8I,r[xI.RGB_INTEGER]=t.RGB8I,r[xI.RG_INTEGER]=t.RG8I,r[xI.RED_INTEGER]=t.R8I,r),e[TI.UNSIGNED_SHORT]=((n={})[xI.RGBA_INTEGER]=t.RGBA16UI,n[xI.RGB_INTEGER]=t.RGB16UI,n[xI.RG_INTEGER]=t.RG16UI,n[xI.RED_INTEGER]=t.R16UI,n[xI.DEPTH_COMPONENT]=t.DEPTH_COMPONENT16,n),e[TI.SHORT]=((s={})[xI.RGBA_INTEGER]=t.RGBA16I,s[xI.RGB_INTEGER]=t.RGB16I,s[xI.RG_INTEGER]=t.RG16I,s[xI.RED_INTEGER]=t.R16I,s),e[TI.UNSIGNED_INT]=((o={})[xI.RGBA_INTEGER]=t.RGBA32UI,o[xI.RGB_INTEGER]=t.RGB32UI,o[xI.RG_INTEGER]=t.RG32UI,o[xI.RED_INTEGER]=t.R32UI,o[xI.DEPTH_COMPONENT]=t.DEPTH_COMPONENT24,o),e[TI.INT]=((a={})[xI.RGBA_INTEGER]=t.RGBA32I,a[xI.RGB_INTEGER]=t.RGB32I,a[xI.RG_INTEGER]=t.RG32I,a[xI.RED_INTEGER]=t.R32I,a),e[TI.FLOAT]=((h={})[xI.RGBA]=t.RGBA32F,h[xI.RGB]=t.RGB32F,h[xI.RG]=t.RG32F,h[xI.RED]=t.R32F,h[xI.DEPTH_COMPONENT]=t.DEPTH_COMPONENT32F,h),e[TI.HALF_FLOAT]=((l={})[xI.RGBA]=t.RGBA16F,l[xI.RGB]=t.RGB16F,l[xI.RG]=t.RG16F,l[xI.RED]=t.R16F,l),e[TI.UNSIGNED_SHORT_5_6_5]=((c={})[xI.RGB]=t.RGB565,c),e[TI.UNSIGNED_SHORT_4_4_4_4]=((u={})[xI.RGBA]=t.RGBA4,u),e[TI.UNSIGNED_SHORT_5_5_5_1]=((d={})[xI.RGBA]=t.RGB5_A1,d),e[TI.UNSIGNED_INT_2_10_10_10_REV]=((f={})[xI.RGBA]=t.RGB10_A2,f[xI.RGBA_INTEGER]=t.RGB10_A2UI,f),e[TI.UNSIGNED_INT_10F_11F_11F_REV]=((p={})[xI.RGB]=t.R11F_G11F_B10F,p),e[TI.UNSIGNED_INT_5_9_9_9_REV]=((m={})[xI.RGB]=t.RGB9_E5,m),e[TI.UNSIGNED_INT_24_8]=((g={})[xI.DEPTH_STENCIL]=t.DEPTH24_STENCIL8,g),e[TI.FLOAT_32_UNSIGNED_INT_24_8_REV]=((v={})[xI.DEPTH_STENCIL]=t.DEPTH32F_STENCIL8,v),T=e):((y={})[TI.UNSIGNED_BYTE]=((x={})[xI.RGBA]=t.RGBA,x[xI.RGB]=t.RGB,x[xI.ALPHA]=t.ALPHA,x[xI.LUMINANCE]=t.LUMINANCE,x[xI.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,x),y[TI.UNSIGNED_SHORT_5_6_5]=((b={})[xI.RGB]=t.RGB,b),y[TI.UNSIGNED_SHORT_4_4_4_4]=((_={})[xI.RGBA]=t.RGBA,_),y[TI.UNSIGNED_SHORT_5_5_5_1]=((w={})[xI.RGBA]=t.RGBA,w),T=y),T}(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};var r=new bM(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new bM(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(i=0;i<this.boundTextures.length;i++)this.bind(null,i)},t.prototype.bind=function(t,e){void 0===e&&(e=0);var i=this.gl;if((t=null==t?void 0:t.castToBaseTexture())&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null},t.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},t.prototype.unbind=function(t){var e=this.gl,i=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)},t.prototype.ensureSamplerType=function(t){var e=this,i=e.boundTextures,r=e.hasIntegerTextures,n=e.CONTEXT_UID;if(r)for(var s=t-1;s>=0;--s){var o=i[s];if(o)o._glTextures[n].samplerType!==SI.FLOAT&&this.renderer.texture.unbind(o)}},t.prototype.initTexture=function(t){var e=new bM(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},t.prototype.initTextureType=function(t,e){var i,r;e.internalFormat=null!==(r=null===(i=this.internalFormats[t.type])||void 0===i?void 0:i[t.format])&&void 0!==r?r:t.format,2===this.webGLVersion&&t.type===TI.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},t.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(e){var i=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(i,t,e))e.samplerType!==SI.FLOAT&&(this.hasIntegerTextures=!0);else{var r=t.realWidth,n=t.realHeight,s=i.gl;(e.width!==r||e.height!==n||e.dirtyId<0)&&(e.width=r,e.height=n,s.texImage2D(t.target,0,e.internalFormat,r,n,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},t.prototype.destroyTexture=function(t,e){var i=this.gl;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var r=this.managedTextures.indexOf(t);-1!==r&&DA(this.managedTextures,r,1)}},t.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==RI.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=PI.CLAMP,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},t.prototype.setStyle=function(t,e){var i=this.gl;if(e.mipmap&&t.mipmap!==RI.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===AI.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===AI.LINEAR){var n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===AI.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===AI.LINEAR?i.LINEAR:i.NEAREST)},t.prototype.destroy=function(){this.renderer=null},t}(),wM={__proto__:null,FilterSystem:fP,BatchSystem:mP,ContextSystem:vP,FramebufferSystem:bP,GeometrySystem:wP,MaskSystem:QP,ScissorSystem:rM,StencilSystem:nM,ProjectionSystem:sM,RenderTextureSystem:hM,ShaderSystem:vM,StateSystem:yM,TextureGCSystem:xM,TextureSystem:_M},TM=new pC,EM=function(t){function e(e,i){void 0===e&&(e=uI.UNKNOWN);var r=t.call(this)||this;return i=Object.assign({},mA.RENDER_OPTIONS,i),r.options=i,r.type=e,r.screen=new hC(0,0,i.width,i.height),r.view=i.view||mA.ADAPTER.createCanvas(),r.resolution=i.resolution||mA.RESOLUTION,r.useContextAlpha=i.useContextAlpha,r.autoDensity=!!i.autoDensity,r.preserveDrawingBuffer=i.preserveDrawingBuffer,r.clearBeforeRender=i.clearBeforeRender,r._backgroundColor=0,r._backgroundColorRgba=[0,0,0,1],r._backgroundColorString="#000000",r.backgroundColor=i.backgroundColor||r._backgroundColor,r.backgroundAlpha=i.backgroundAlpha,void 0!==i.transparent&&(BA("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),r.useContextAlpha=i.transparent,r.backgroundAlpha=i.transparent?0:1),r._lastObjectRendered=null,r.plugins={},r}return AC(e,t),e.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(e*this.resolution);var i=this.view.width/this.resolution,r=this.view.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=r+"px"),this.emit("resize",i,r)},e.prototype.generateTexture=function(t,e,i,r){void 0===e&&(e={}),"number"==typeof e&&(BA("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),e={scaleMode:e,resolution:i,region:r});var n=e.region,s=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i}(e,["region"]);0===(r=n||t.getLocalBounds(null,!0)).width&&(r.width=1),0===r.height&&(r.height=1);var o=ZC.create(CC({width:r.width,height:r.height},s));return TM.tx=-r.x,TM.ty=-r.y,this.render(t,{renderTexture:o,clear:!1,transform:TM,skipUpdateTransform:!!t.parent}),o},e.prototype.destroy=function(t){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=uI.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=SA(t),EA(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(gA.default),SM=function(){return function(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}(),IM=function(){function t(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}return t.prototype.destroy=function(){this.renderer=null},t.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},t.prototype.bind=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)},t.prototype.bindBufferBase=function(t,e){var i=this.gl,r=this.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}},t.prototype.bindBufferRange=function(t,e,i){var r=this.gl,n=this.CONTEXT_UID;i=i||0;var s=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,s.buffer,256*i,256)},t.prototype.update=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i];if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{var n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}},t.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)},t.prototype.createGLBuffer=function(t){var e=this.CONTEXT_UID,i=this.gl;return t._glBuffers[e]=new SM(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]},t}(),AM=function(t){function e(i){var r=t.call(this,uI.WEBGL,i)||this;return i=r.options,r.gl=null,r.CONTEXT_UID=0,r.runners={destroy:new JA("destroy"),contextChange:new JA("contextChange"),reset:new JA("reset"),update:new JA("update"),postrender:new JA("postrender"),prerender:new JA("prerender"),resize:new JA("resize")},r.runners.contextChange.add(r),r.globalUniforms=new lP({projectionMatrix:new pC},!0),r.addSystem(QP,"mask").addSystem(vP,"context").addSystem(yM,"state").addSystem(vM,"shader").addSystem(_M,"texture").addSystem(IM,"buffer").addSystem(wP,"geometry").addSystem(bP,"framebuffer").addSystem(rM,"scissor").addSystem(nM,"stencil").addSystem(sM,"projection").addSystem(xM,"textureGC").addSystem(fP,"filter").addSystem(hM,"renderTexture").addSystem(mP,"batch"),r.initPlugins(e.__plugins),r.multisample=void 0,i.context?r.context.initFromContext(i.context):r.context.initFromOptions({alpha:!!r.useContextAlpha,antialias:i.antialias,premultipliedAlpha:r.useContextAlpha&&"notMultiplied"!==r.useContextAlpha,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:r.options.powerPreference}),r.renderingToScreen=!0,function(t){var e;if(!_A){if(mA.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var i=["\n %c %c %c PixiJS "+wA+" - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,i)}else globalThis.console&&globalThis.console.log("PixiJS "+wA+" - "+t+" - http://www.pixijs.com/");_A=!0}}(2===r.context.webGLVersion?"WebGL 2":"WebGL 1"),r.resize(r.options.width,r.options.height),r}return AC(e,t),e.create=function(t){if(void 0===bA&&(bA=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:mA.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!mA.ADAPTER.getWebGLRenderingContext())return!1;var e=mA.ADAPTER.createCanvas(),i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),r=!(!i||!i.getContextAttributes().stencil);if(i){var n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch(t){return!1}}()),bA)return new e(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var t,e=this.gl;if(1===this.context.webGLVersion){var i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=WI.HIGH?this.multisample=WI.HIGH:t>=WI.MEDIUM?this.multisample=WI.MEDIUM:t>=WI.LOW?this.multisample=WI.LOW:this.multisample=WI.NONE},e.prototype.addSystem=function(t,e){var i=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var r in this[e]=i,this.runners)this.runners[r].add(i);return this},e.prototype.render=function(t,e){var i,r,n,s;if(e&&(e instanceof ZC?(BA("6.0.0","Renderer#render arguments changed, use options instead."),i=e,r=arguments[2],n=arguments[3],s=arguments[4]):(i=e.renderTexture,r=e.clear,n=e.transform,s=e.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(i||(this._lastObjectRendered=t),!s){var o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(e,i,r,n){void 0===i&&(i={});var s=t.prototype.generateTexture.call(this,e,i,r,n);return this.framebuffer.blit(),s},e.prototype.resize=function(e,i){t.prototype.resize.call(this,e,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(e){for(var i in this.runners.destroy.emit(),this.runners)this.runners[i].destroy();t.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return BA("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,e){BA("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ZA.add({name:t,type:HA.RendererPlugin,ref:e})},e.__plugins={},e}(EM);ZA.handleByMap(HA.RendererPlugin,AM.__plugins);!function(){function t(t){BA("6.1.0","System class is deprecated, implemement ISystem interface instead."),this.renderer=t}t.prototype.destroy=function(){this.renderer=null}}();var CM=function(){return function(){this.texArray=null,this.blend=0,this.type=vI.TRIANGLES,this.start=0,this.size=0,this.data=null}}(),PM=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},t}(),MM=function(){function t(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(t.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),t.prototype.view=function(t){return this[t+"View"]},t.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},t.sizeOf=function(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(t+" isn't a valid view type")}},t}(),RM=function(t){function e(e){var i=t.call(this,e)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=qP.for2d(),i.size=4*mA.SPRITE_BATCH_SIZE,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),e.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return AC(e,t),e.prototype.contextChange=function(){var t=this.renderer.gl;mA.PREFER_ENV===lI.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),mA.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=function(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var i=e.createShader(e.FRAGMENT_SHADER);;){var r=GP.replace(/%forloop%/gi,jP(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var t=e._drawCallPool,i=e._textureArrayPool,r=this.size/4,n=Math.floor(r/this.MAX_TEXTURES)+1;t.length<r;)t.push(new CM);for(;i.length<n;)i.push(new PM);for(var s=0;s<this.MAX_TEXTURES;s++)this._tempBoundTextures[s]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,i=this.MAX_TEXTURES,r=e._textureArrayPool,n=this.renderer.batch,s=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++OC._globalBatch,h=0,l=r[0],c=0;n.copyBoundTextures(s,i);for(var u=0;u<this._bufferSize;++u){var d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=i&&(n.boundArray(l,s,a,i),this.buildDrawCalls(l,c,u),c=u,l=r[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(n.boundArray(l,s,a,i),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(u=0;u<s.length;u++)s[u]=null;OC._globalBatch=a},e.prototype.buildDrawCalls=function(t,i,r){var n=this,s=n._bufferedElements,o=n._attributeBuffer,a=n._indexBuffer,h=n.vertexSize,l=e._drawCallPool,c=this._dcIndex,u=this._aIndex,d=this._iIndex,f=l[c];f.start=this._iIndex,f.texArray=t;for(var p=i;p<r;++p){var m=s[p],g=m._texture.baseTexture,v=AA[g.alphaMode?1:0][m.blendMode];s[p]=null,i<p&&f.blend!==v&&(f.size=d-f.start,i=p,(f=l[++c]).texArray=t,f.start=d),this.packInterleavedGeometry(m,o,a,u,d),u+=m.vertexData.length/2*h,d+=m.indices.length,f.blend=v}i<r&&(f.size=d-f.start,++c),this._dcIndex=c,this._aIndex=u,this._iIndex=d},e.prototype.bindAndClearTexArray=function(t){for(var e=this.renderer.texture,i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0},e.prototype.updateGeometry=function(){var t=this,e=t._packedGeometries,i=t._attributeBuffer,r=t._indexBuffer;mA.CAN_UPLOAD_SAME_BUFFER?(e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var t=this._dcIndex,i=this.renderer,r=i.gl,n=i.state,s=e._drawCallPool,o=null,a=0;a<t;a++){var h=s[a],l=h.texArray,c=h.type,u=h.size,d=h.start,f=h.blend;o!==l&&(o=l,this.bindAndClearTexArray(l)),this.state.blendMode=f,n.set(this.state),r.drawElements(c,u,r.UNSIGNED_SHORT,2*d)}},e.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),mA.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),t.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(t){var e=MA(Math.ceil(t/8)),i=OA(e),r=8*e;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new MM(r*this.vertexSize*4)),n},e.prototype.getIndexBuffer=function(t){var e=MA(Math.ceil(t/12)),i=OA(e),r=12*e;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(r)),n},e.prototype.packInterleavedGeometry=function(t,e,i,r,n){for(var s=e.uint32View,o=e.float32View,a=r/this.vertexSize,h=t.uvs,l=t.indices,c=t.vertexData,u=t._texture.baseTexture._batchLocation,d=Math.min(t.worldAlpha,1),f=d<1&&t._texture.baseTexture.alphaMode?CA(t._tintRGB,d):t._tintRGB+(255*d<<24),p=0;p<c.length;p+=2)o[r++]=c[p],o[r++]=c[p+1],o[r++]=h[p],o[r++]=h[p+1],s[r++]=f,o[r++]=u;for(p=0;p<l.length;p++)i[n++]=a+l[p]},e._drawCallPool=[],e._textureArrayPool=[],e}(pP),OM=function(){function t(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return t.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=lP.from({uSamplers:e},!0);var r=this.fragTemplate;r=(r=r.replace(/%count%/gi,""+t)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new XP(this.vertexSrc,r)}var n={tint:new Float32Array([1,1,1,1]),translationMatrix:new pC,default:this.defaultGroupCache[t]};return new YP(this.programCache[t],n)},t.prototype.generateSampleSrc=function(t){var e="";e+="\n",e+="\n";for(var i=0;i<t;i++)i>0&&(e+="\nelse "),i<t-1&&(e+="if(vTextureId < "+i+".5)"),e+="\n{",e+="\n\tcolor = texture2D(uSamplers["+i+"], vTextureCoord);",e+="\n}";return e+="\n",e+="\n"},t}(),DM=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._buffer=new tP(null,e,!1),i._indexBuffer=new tP(null,e,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,TI.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,TI.FLOAT).addAttribute("aColor",i._buffer,4,!0,TI.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,TI.FLOAT).addIndex(i._indexBuffer),i}return AC(e,t),e}(sP),kM="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",LM="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n",FM=function(){function t(){}return t.create=function(t){var e=Object.assign({vertex:kM,fragment:LM,geometryClass:DM,vertexSize:6},t),i=e.vertex,r=e.fragment,n=e.vertexSize,s=e.geometryClass;return function(t){function e(e){var o=t.call(this,e)||this;return o.shaderGenerator=new OM(i,r),o.geometryClass=s,o.vertexSize=n,o}return AC(e,t),e}(RM)},Object.defineProperty(t,"defaultVertexSrc",{get:function(){return kM},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentTemplate",{get:function(){return LM},enumerable:!1,configurable:!0}),t}().create();Object.assign(FM,{extension:{name:"batch",type:HA.RendererPlugin}});var NM={},BM=function(t){Object.defineProperty(NM,t,{get:function(){return BA("6.0.0","PIXI.systems."+t+" has moved to PIXI."+t),GC[t]}})};for(zM in GC)BM(zM);var zM,UM={},VM=function(t){Object.defineProperty(UM,t,{get:function(){return BA("6.0.0","PIXI.resources."+t+" has moved to PIXI."+t),wM[t]}})};for(zM in wM)VM(zM);mA.SORTABLE_CHILDREN=!1;var GM=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?hC.EMPTY:((t=t||new hC(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var i=t.a,r=t.b,n=t.c,s=t.d,o=t.tx,a=t.ty,h=i*e.x+n*e.y+o,l=r*e.x+s*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,s=t[0],o=t[1];e=s<e?s:e,i=o<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[2])<e?s:e,i=(o=t[3])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[4])<e?s:e,i=(o=t[5])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[6])<e?s:e,i=(o=t[7])<i?o:i,r=s>r?s:r,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},t.prototype.addFrame=function(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)},t.prototype.addFrameMatrix=function(t,e,i,r,n){var s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty,u=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=s*e+a*i+l,g=o*e+h*i+c;u=m<u?m:u,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,u=(m=s*r+a*i+l)<u?m:u,d=(g=o*r+h*i+c)<d?g:d,f=m>f?m:f,p=g>p?g:p,u=(m=s*e+a*n+l)<u?m:u,d=(g=o*e+h*n+c)<d?g:d,f=m>f?m:f,p=g>p?g:p,u=(m=s*r+a*n+l)<u?m:u,d=(g=o*r+h*n+c)<d?g:d,f=m>f?m:f,p=g>p?g:p,this.minX=u,this.minY=d,this.maxX=f,this.maxY=p},t.prototype.addVertexData=function(t,e,i){for(var r=this.minX,n=this.minY,s=this.maxX,o=this.maxY,a=e;a<i;a+=2){var h=t[a],l=t[a+1];r=h<r?h:r,n=l<n?l:n,s=h>s?h:s,o=l>o?l:o}this.minX=r,this.minY=n,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)},t.prototype.addVerticesMatrix=function(t,e,i,r,n,s){void 0===n&&(n=0),void 0===s&&(s=n);for(var o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=i;g<r;g+=2){var v=e[g],y=e[g+1],x=o*v+h*y+c,b=l*y+a*v+u;d=Math.min(d,x-n),p=Math.max(p,x+n),f=Math.min(f,b-s),m=Math.max(m,b+s)}this.minX=d,this.minY=f,this.maxX=p,this.maxY=m},t.prototype.addBounds=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,s=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>l?s:l}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,s=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>l?s:l}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,r,n,s){t-=n,e-=s,i+=n,r+=s,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r},t}(),jM=function(t,e){return jM=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},jM(t,e)};function HM(t,e){function i(){this.constructor=t}jM(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var WM=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new TC,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new GM,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return HM(e,t),e.mixin=function(t){for(var i=Object.keys(t),r=0;r<i.length;++r){var n=i[r];Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t,n))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new hC),e=this._boundsRect),this._bounds.getRectangle(e)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new hC),t=this._localBoundsRect),this._localBounds||(this._localBounds=new GM);var e=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;var s=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,s},e.prototype.toGlobal=function(t,e,i){return void 0===i&&(i=!1),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)},e.prototype.toLocal=function(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new XM),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},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,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*nC},set:function(t){this.transform.rotation=t*sC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},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){if(this._mask!==t){var e;if(this._mask)(e=this._mask.isMaskData?this._mask.maskObject:this._mask)&&(e._maskRefCount--,0===e._maskRefCount&&(e.renderable=!0,e.isMask=!1));if(this._mask=t,this._mask)(e=this._mask.isMaskData?this._mask.maskObject:this._mask)&&(0===e._maskRefCount&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}},enumerable:!1,configurable:!0}),e}(gA.default),XM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.sortDirty=null,e}return HM(e,t),e}(WM);function YM(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}WM.prototype.displayObjectUpdateTransform=WM.prototype.updateTransform;var qM=function(t){function e(){var e=t.call(this)||this;return e.children=[],e.sortableChildren=mA.SORTABLE_CHILDREN,e.sortDirty=!1,e}return HM(e,t),e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.addChild(e[r]);else{var n=e[0];n.parent&&n.parent.removeChild(n),n.parent=this,this.sortDirty=!0,n.transform._parentID=-1,this.children.push(n),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this)}return e[0]},e.prototype.addChildAt=function(t,e){if(e<0||e>this.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}},e.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);DA(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.removeChild(e[r]);else{var n=e[0],s=this.children.indexOf(n);if(-1===s)return null;n.parent=null,n.transform._parentID=-1,DA(this.children,s,1),this._boundsID++,this.onChildrenChange(s),n.emit("removed",this),this.emit("childRemoved",n,this,s)}return e[0]},e.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,DA(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e},e.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i,r=t,n=e-r;if(n>0&&n<=e){i=this.children.splice(r,n);for(var s=0;s<i.length;++s)i[s].parent=null,i[s].transform&&(i[s].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(s=0;s<i.length;++s)i[s].emit("removed",this),this.emit("childRemoved",i[s],this,s);return i}if(0===n&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,e=0,i=this.children.length;e<i;++e){var r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(YM),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t<e;++t){var i=this.children[t];i.visible&&i.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){var i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(e,i){void 0===i&&(i=!1);var r=t.prototype.getLocalBounds.call(this,e);if(!i)for(var n=0,s=this.children.length;n<s;++n){var o=this.children[n];o.visible&&o.updateTransform()}return r},e.prototype._calculateBounds=function(){},e.prototype._renderWithCulling=function(t){var i=t.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var r,n;if(this.cullArea?(r=this.cullArea,n=this.worldTransform):this._render!==e.prototype._render&&(r=this.getBounds(!0)),r&&i.intersects(r,n))this._render(t);else if(this.cullArea)return;for(var s=0,o=this.children.length;s<o;++s){var a=this.children[s],h=a.cullable;a.cullable=h||!this.cullArea,a.render(t),a.cullable=h}}},e.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(var e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}},e.prototype.renderAdvanced=function(t){var e=this.filters,i=this._mask;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])}var n=e&&this._enabledFilters&&this._enabledFilters.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==VI.NONE));if(n&&t.batch.flush(),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);r=0;for(var s=this.children.length;r<s;++r)this.children[r].render(t)}n&&t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(e){t.prototype.destroy.call(this),this.sortDirty=!1;var i="boolean"==typeof e?e:e&&e.children,r=this.removeChildren(0,this.children.length);if(i)for(var n=0;n<r.length;++n)r[n].destroy(e)},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}(WM);qM.prototype.containerUpdateTransform=qM.prototype.updateTransform;var KM=function(){function t(){}return t.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){var t,i;if(e.cancelResize(),e._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{var r=e._resizeTo;t=r.clientWidth,i=r.clientHeight}e.renderer.resize(t,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},t.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},t.extension=HA.Application,t}(),ZM=function(){function t(e){var i=this;this.stage=new qM,e=Object.assign({forceCanvas:!1},e),this.renderer=function(t){return AM.create(t)}(e),t._plugins.forEach(function(t){t.init.call(i,e)})}return t.registerPlugin=function(t){BA("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),ZA.add({type:HA.Application,ref:t})},t.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(t.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e,i){var r=this,n=t._plugins.slice(0);n.reverse(),n.forEach(function(t){t.destroy.call(r)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null},t._plugins=[],t}();ZA.handleByList(HA.Application,ZM._plugins),ZA.add(KM);var JM,$M,QM,tR,eR=class{constructor(){A(this,"type"),A(this,"active"),this.type="null",this.active=!1}get interactive(){return this.active}set interactive(t){this.active=t}},iR=class extends eR{constructor(t){super(),A(this,"type","control"),A(this,"_interactionType","mouse"),A(this,"active",!1),A(this,"lastPoint",new Lw),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"SDKUtils"),this.SDKUtils=t}get interactive(){return Lk.config.gestureHandlerConfig.controlGizmoEnabled}set interactive(t){Lk.config.gestureHandlerConfig.controlGizmoEnabled=!0}get interactionType(){return this._interactionType}set interactionType(t){t===this._interactionType&&(this._interactionType=t,this.refreshCursorResult())}get useCameraControl(){return"editor"===Lk.config.mode}preparationAction(){}cancelPreparation(){}refreshResults(){}preAction(t){return"mouse"===this.interactionType&&(this.active=!0,this.lastPoint=new Lw(t.clientX,t.clientY)),this.refreshCursorResult(),"mouse"===this.interactionType?this.type:void 0}action(t){if(!Lk.config.gestureHandlerConfig.controlGizmoEnabled)return void console.warn("Control gizmo is not opened, use #SDK.setControlConfig() open this feature.");const{metaKey:e,ctrlKey:i,shiftKey:r}=t;if(0===t.buttons){const{deltaX:n,deltaY:s,offsetX:o,offsetY:a}=t,h=new Lw(n,s);if(e||i){const t=this.useCameraControl?new Lw(o,a):new Lw,e=-h.y*Lk.config.gestureHandlerConfig.controlGizmoConfig.zoomStep;this.SDKUtils.pageZoom(e,t)}else h.x=r&&0!==h.y?Math.sqrt(h.x**2+h.y**2)*h.y/Math.abs(h.y):h.x,h.y=r?0:h.y,this.SDKUtils.pageMove(h.negate())}else if(this.active&&t instanceof MouseEvent&&[1,4].includes(t.buttons)){const{clientX:e,clientY:i}=t,n=new Lw(e,i),s=(new Lw).subtractVectors(n,this.lastPoint);s.x=r&&0!==s.y?Math.sqrt(s.x**2+s.y**2)*s.y/Math.abs(s.y):s.x,s.y=r?0:s.y,this.SDKUtils.pageMove(s),this.lastPoint.copyFrom(n)}}endAction(){return this.active=!1,this.refreshCursorResult(),"mouse"===this.interactionType?this.type:void 0}interruption(){return this.type}actionKey(){}endActionKey(){}refreshCursorResult(){"mouse"===this.interactionType?this.cursorResult={type:this.active?"active-hand":"hand",angle:0}:this.cursorResult={type:"normal",angle:0}}getRenderObjects(){return[]}};($M=JM||(JM={})).MITER="miter",$M.BEVEL="bevel",$M.ROUND="round",(tR=QM||(QM={})).BUTT="butt",tR.ROUND="round",tR.SQUARE="square";var rR={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},nR=function(){function t(){this.color=16777215,this.alpha=1,this.texture=KC.WHITE,this.matrix=null,this.visible=!1,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},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=KC.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),sR=function(t,e){return sR=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},sR(t,e)};function oR(t,e){function i(){this.constructor=t}sR(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function aR(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,o=0,a=t[n-2],h=t[n-1];o<n;o+=2){var l=t[o],c=t[o+1];s+=(l-a)*(c+h),a=l,h=c}if(!e&&s>0||e&&s<=0){var u=n/2;for(o=u+u%2;o<n;o+=2){var d=n-o-2,f=n-o-1,p=o,m=o+1;i=[t[p],t[d]],t[d]=i[0],t[p]=i[1],r=[t[m],t[f]],t[f]=r[0],t[m]=r[1]}}}}var hR={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){aR(i,!1);for(var o=[],a=0;a<r.length;a++){var h=r[a];aR(h.points,!0),o.push(i.length/2),i=i.concat(h.points)}var l=(0,vA.default)(i,o,2);if(!l)return;var c=n.length/2;for(a=0;a<l.length;a+=3)s.push(l[a]+c),s.push(l[a+1]+c),s.push(l[a+2]+c);for(a=0;a<i.length;a++)n.push(i[a])}}},lR={build:function(t){var e,i,r,n,s,o,a=t.points;if(t.type===$A.CIRC){var h=t.shape;e=h.x,i=h.y,s=o=h.radius,r=n=0}else if(t.type===$A.ELIP){var l=t.shape;e=l.x,i=l.y,s=l.width,o=l.height,r=n=0}else{var c=t.shape,u=c.width/2,d=c.height/2;e=c.x+u,i=c.y+d,r=u-(s=o=Math.max(0,Math.min(c.radius,Math.min(u,d)))),n=d-o}if(s>=0&&o>=0&&r>=0&&n>=0){var f=Math.ceil(2.3*Math.sqrt(s+o)),p=8*f+(r?4:0)+(n?4:0);if(a.length=p,0!==p){if(0===f)return a.length=8,a[0]=a[6]=e+r,a[1]=a[3]=i+n,a[2]=a[4]=e-r,void(a[5]=a[7]=i-n);var m=0,g=4*f+(r?2:0)+2,v=g,y=p,x=e+(S=r+s),b=e-S,_=i+(I=n);if(a[m++]=x,a[m++]=_,a[--g]=_,a[--g]=b,n){var w=i-I;a[v++]=b,a[v++]=w,a[--y]=w,a[--y]=x}for(var T=1;T<f;T++){var E=Math.PI/2*(T/f);x=e+(S=r+Math.cos(E)*s),b=e-S,_=i+(I=n+Math.sin(E)*o),w=i-I;a[m++]=x,a[m++]=_,a[--g]=_,a[--g]=b,a[v++]=b,a[v++]=w,a[--y]=w,a[--y]=x}var S,I;x=e+(S=r),b=e-S,_=i+(I=n+o),w=i-I;a[m++]=x,a[m++]=_,a[--y]=w,a[--y]=x,r&&(a[m++]=b,a[m++]=_,a[--y]=w,a[--y]=b)}}else a.length=0},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices;if(0!==i.length){var s,o,a=r.length/2,h=a;if(t.type!==$A.RREC){var l=t.shape;s=l.x,o=l.y}else{var c=t.shape;s=c.x+c.width/2,o=c.y+c.height/2}var u=t.matrix;r.push(t.matrix?u.a*s+u.c*o+u.tx:s,t.matrix?u.b*s+u.d*o+u.ty:o),a++,r.push(i[0],i[1]);for(var d=2;d<i.length;d+=2)r.push(i[d],i[d+1]),n.push(a++,h,a);n.push(h+1,h,a)}}};function cR(t,e,i){return t+(e-t)*i}function uR(t,e,i,r,n,s,o){void 0===o&&(o=[]);for(var a=o,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;p<=20;++p)h=cR(t,i,m=p/20),l=cR(e,r,m),c=cR(i,n,m),u=cR(r,s,m),d=cR(h,c,m),f=cR(l,u,m),0===p&&a[a.length-2]===d&&a[a.length-1]===f||a.push(d,f);return a}var dR={build:function(t){if(MR.nextRoundedRectBehavior)lR.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,o=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,o)/2));i.length=0,a?(uR(r,n+a,r,n,r+a,n,i),uR(r+s-a,n,r+s,n,r+s,n+a,i),uR(r+s,n+o-a,r+s,n+o,r+s-a,n+o,i),uR(r+a,n+o,r,n+o,r,n+o-a,i)):i.push(r,n,r+s,n,r+s,n+o,r,n+o)}},triangulate:function(t,e){if(MR.nextRoundedRectBehavior)lR.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,o=(0,vA.default)(i,null,2),a=0,h=o.length;a<h;a+=3)n.push(o[a]+s),n.push(o[a+1]+s),n.push(o[a+2]+s);for(a=0,h=i.length;a<h;a++)r.push(i[a],i[++a])}}};function fR(t,e,i,r,n,s,o,a){var h,l;o?(h=r,l=-i):(h=-r,l=i);var c=t-i*n+h,u=e-r*n+l,d=t+i*s+h,f=e+r*s+l;return a.push(c,u),a.push(d,f),2}function pR(t,e,i,r,n,s,o,a){var h=i-t,l=r-e,c=Math.atan2(h,l),u=Math.atan2(n-t,s-e);a&&c<u?c+=2*Math.PI:!a&&c>u&&(u+=2*Math.PI);var d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=1+(15*p*Math.sqrt(m)/Math.PI|0),v=f/g;if(d+=v,a){o.push(t,e),o.push(i,r);for(var y=1,x=d;y<g;y++,x+=v)o.push(t,e),o.push(t+Math.sin(x)*m,e+Math.cos(x)*m);o.push(t,e),o.push(n,s)}else{o.push(i,r),o.push(t,e);for(y=1,x=d;y<g;y++,x+=v)o.push(t+Math.sin(x)*m,e+Math.cos(x)*m),o.push(t,e);o.push(n,s),o.push(t,e)}return 2*g}function mR(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==$A.POLY||r.closeStroke;if(0!==n.length){var o=e.points,a=e.indices,h=n.length/2,l=o.length/2,c=l;for(o.push(n[0],n[1]),i=1;i<h;i++)o.push(n[2*i],n[2*i+1]),a.push(c,c+1),c++;s&&a.push(c,l)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,o=new oC(r[0],r[1]),a=new oC(r[r.length-2],r[r.length-1]),h=i.type!==$A.POLY||i.closeStroke,l=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(h){r=r.slice(),l&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var c=.5*(o.x+a.x),u=.5*(a.y+o.y);r.unshift(c,u),r.push(c,u)}var d=e.points,f=r.length/2,p=r.length,m=d.length/2,g=s.width/2,v=g*g,y=s.miterLimit*s.miterLimit,x=r[0],b=r[1],_=r[2],w=r[3],T=0,E=0,S=-(b-w),I=x-_,A=0,C=0,P=Math.sqrt(S*S+I*I);S/=P,I/=P,S*=g,I*=g;var M=s.alignment,R=2*(1-M),O=2*M;h||(s.cap===QM.ROUND?p+=pR(x-S*(R-O)*.5,b-I*(R-O)*.5,x-S*R,b-I*R,x+S*O,b+I*O,d,!0)+2:s.cap===QM.SQUARE&&(p+=fR(x,b,S,I,R,O,!0,d))),d.push(x-S*R,b-I*R),d.push(x+S*O,b+I*O);for(var D=1;D<f-1;++D){x=r[2*(D-1)],b=r[2*(D-1)+1],_=r[2*D],w=r[2*D+1],T=r[2*(D+1)],E=r[2*(D+1)+1],S=-(b-w),I=x-_,S/=P=Math.sqrt(S*S+I*I),I/=P,S*=g,I*=g,A=-(w-E),C=_-T,A/=P=Math.sqrt(A*A+C*C),C/=P,A*=g,C*=g;var k=_-x,L=b-w,F=_-T,N=E-w,B=k*F+L*N,z=L*F-N*k,U=z<0;if(Math.abs(z)<.001*Math.abs(B))d.push(_-S*R,w-I*R),d.push(_+S*O,w+I*O),B>=0&&(s.join===JM.ROUND?p+=pR(_,w,_-S*R,w-I*R,_-A*R,w-C*R,d,!1)+4:p+=2,d.push(_-A*O,w-C*O),d.push(_+A*R,w+C*R));else{var V=(-S+x)*(-I+w)-(-S+_)*(-I+b),G=(-A+T)*(-C+w)-(-A+_)*(-C+E),j=(k*G-F*V)/z,H=(N*V-L*G)/z,W=(j-_)*(j-_)+(H-w)*(H-w),X=_+(j-_)*R,Y=w+(H-w)*R,q=_-(j-_)*O,K=w-(H-w)*O,Z=U?R:O;W<=Math.min(k*k+L*L,F*F+N*N)+Z*Z*v?s.join===JM.BEVEL||W/v>y?(U?(d.push(X,Y),d.push(_+S*O,w+I*O),d.push(X,Y),d.push(_+A*O,w+C*O)):(d.push(_-S*R,w-I*R),d.push(q,K),d.push(_-A*R,w-C*R),d.push(q,K)),p+=2):s.join===JM.ROUND?U?(d.push(X,Y),d.push(_+S*O,w+I*O),p+=pR(_,w,_+S*O,w+I*O,_+A*O,w+C*O,d,!0)+4,d.push(X,Y),d.push(_+A*O,w+C*O)):(d.push(_-S*R,w-I*R),d.push(q,K),p+=pR(_,w,_-S*R,w-I*R,_-A*R,w-C*R,d,!1)+4,d.push(_-A*R,w-C*R),d.push(q,K)):(d.push(X,Y),d.push(q,K)):(d.push(_-S*R,w-I*R),d.push(_+S*O,w+I*O),s.join===JM.ROUND?p+=U?pR(_,w,_+S*O,w+I*O,_+A*O,w+C*O,d,!0)+2:pR(_,w,_-S*R,w-I*R,_-A*R,w-C*R,d,!1)+2:s.join===JM.MITER&&W/v<=y&&(U?(d.push(q,K),d.push(q,K)):(d.push(X,Y),d.push(X,Y)),p+=2),d.push(_-A*R,w-C*R),d.push(_+A*O,w+C*O),p+=2)}}x=r[2*(f-2)],b=r[2*(f-2)+1],_=r[2*(f-1)],S=-(b-(w=r[2*(f-1)+1])),I=x-_,S/=P=Math.sqrt(S*S+I*I),I/=P,S*=g,I*=g,d.push(_-S*R,w-I*R),d.push(_+S*O,w+I*O),h||(s.cap===QM.ROUND?p+=pR(_-S*(R-O)*.5,w-I*(R-O)*.5,_-S*R,w-I*R,_+S*O,w+I*O,d,!1)+2:s.cap===QM.SQUARE&&(p+=fR(_,w,S,I,R,O,!1,d)));var J=e.indices,$=rR.epsilon*rR.epsilon;for(D=m;D<p+m-2;++D)x=d[2*D],b=d[2*D+1],_=d[2*(D+1)],w=d[2*(D+1)+1],T=d[2*(D+2)],E=d[2*(D+2)+1],Math.abs(x*(w-E)+_*(E-b)+T*(b-w))<$||J.push(D,D+1,D+2)}}(t,e)}var gR,vR=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var o=s[s.length-2],a=s[s.length-1]-e,h=o-t,l=r-e,c=i-t,u=Math.abs(a*c-h*l);if(u<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var d=a*a+h*h,f=l*l+c*c,p=a*l+h*c,m=n*Math.sqrt(d)/u,g=n*Math.sqrt(f)/u,v=m*p/d,y=g*p/f,x=m*c+g*h,b=m*l+g*a,_=h*(g+v),w=a*(g+v),T=c*(m+y),E=l*(m+y);return{cx:x+t,cy:b+e,radius:n,startAngle:Math.atan2(w-b,_-x),endAngle:Math.atan2(E-b,T-x),anticlockwise:h*l>c*a}},t.arc=function(t,e,i,r,n,s,o,a,h){for(var l=o-s,c=rR._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/rC)),u=l/(2*c),d=2*u,f=Math.cos(u),p=Math.sin(u),m=c-1,g=m%1/m,v=0;v<=m;++v){var y=u+s+d*(v+g*v),x=Math.cos(y),b=-Math.sin(y);h.push((f*x+p*b)*n+i,(f*-b+p*x)*n+r)}},t}(),yR=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,o,a){for(var h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=t,b=e,_=1;_<=10;++_)v=x-(m=(p=(f=(d=1-(l=_/10))*d)*d)*t+3*f*l*i+3*d*(c=l*l)*n+(u=c*l)*o),y=b-(g=p*e+3*f*l*r+3*d*c*s+u*a),x=m,b=g,h+=Math.sqrt(v*v+y*y);return h},t.curveTo=function(e,i,r,n,s,o,a){var h=a[a.length-2],l=a[a.length-1];a.length-=2;var c=rR._segmentsCount(t.curveLength(h,l,e,i,r,n,s,o)),u=0,d=0,f=0,p=0,m=0;a.push(h,l);for(var g=1,v=0;g<=c;++g)f=(d=(u=1-(v=g/c))*u)*u,m=(p=v*v)*v,a.push(f*h+3*d*v*e+3*u*p*r+m*s,f*l+3*d*v*i+3*u*p*n+m*o)},t}(),xR=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var o=t-2*i+n,a=e-2*r+s,h=2*i-2*t,l=2*r-2*e,c=4*(o*o+a*a),u=4*(o*h+a*l),d=h*h+l*l,f=2*Math.sqrt(c+u+d),p=Math.sqrt(c),m=2*c*p,g=2*Math.sqrt(d),v=u/p;return(m*f+p*u*(f-g)+(4*d*c-u*u)*Math.log((2*p+v+f)/(v+g)))/(4*m)},t.curveTo=function(e,i,r,n,s){for(var o=s[s.length-2],a=s[s.length-1],h=rR._segmentsCount(t.curveLength(o,a,e,i,r,n)),l=0,c=0,u=1;u<=h;++u){var d=u/h;l=o+(e-o)*d,c=a+(i-a)*d,s.push(l+(e+(r-e)*d-l)*d,c+(i+(n-i)*d-c)*d)}},t}(),bR=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),_R=((gR={})[$A.POLY]=hR,gR[$A.CIRC]=lR,gR[$A.ELIP]=lR,gR[$A.RECT]={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,o=t.points;o.length=0,o.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},gR[$A.RREC]=dR,gR),wR=[],TR=[],ER=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.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},t}(),SR=new oC,IR=function(t){function e(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new GM,e.boundsDirty=-1,e}return oR(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),TR.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),wR.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new ER(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new ER(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,SR):SR.copyFrom(t),r.shape.contains(SR.x,SR.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(SR.x,SR.y)){n=!0;break}}if(!n)return!0}}return!1},e.prototype.updateBatches=function(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<e.length;n++){this.shapeIndex++;var s=e[n],o=s.fillStyle,a=s.lineStyle;_R[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix),(o.visible||a.visible)&&this.processHoles(s.holes);for(var h=0;h<2;h++){var l=0===h?o:a;if(l.visible){var c=l.texture.baseTexture,u=this.indices.length,d=this.points.length/2;c.wrapMode=PI.REPEAT,0===h?this.processFill(s):this.processLine(s);var f=this.points.length/2-d;0!==f&&(i&&!this._compareStyles(r,l)&&(i.end(u,d),i=null),i||((i=wR.pop()||new bR).begin(l,u,d),this.batches.push(i),r=l),this.addUvs(this.points,t,l.texture,d,f,l.matrix))}}}var p=this.indices.length,m=this.points.length/2;if(i&&i.end(p,m),0!==this.batches.length){var g=m>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},e.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++OC._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),TR.push(this.drawCalls[e]);this.drawCalls.length=0;var i=this.colors,r=this.textureIds,n=TR.pop();n||((n=new CM).texArray=new PM),n.texArray.count=0,n.start=0,n.size=0,n.type=vI.TRIANGLES;var s=0,o=null,a=0,h=!1,l=vI.TRIANGLES,c=0;this.drawCalls.push(n);for(e=0;e<this.batches.length;e++){var u=this.batches[e],d=u.style,f=d.texture.baseTexture;h!==!!d.native&&(l=(h=!!d.native)?vI.LINES:vI.TRIANGLES,o=null,s=8,t++),o!==f&&(o=f,f._batchEnabled!==t&&(8===s&&(t++,s=0,n.size>0&&((n=TR.pop())||((n=new CM).texArray=new PM),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=l),f.touched=1,f._batchEnabled=t,f._batchLocation=s,f.wrapMode=PI.REPEAT,n.texArray.elements[n.texArray.count++]=f,s++)),n.size+=u.size,c+=u.size,a=f._batchLocation,this.addColors(i,d.color,d.alpha,u.attribSize,u.attribStart),this.addTextureIds(r,a,u.attribSize,u.attribStart)}OC._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),o=new Uint32Array(n),a=0,h=0;h<t.length/2;h++)s[a++]=t[2*h],s[a++]=t[2*h+1],s[a++]=e[2*h],s[a++]=e[2*h+1],o[a++]=i[h],s[a++]=r[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?hR.triangulate(t,this):_R[t.type].triangulate(t,this)},e.prototype.processLine=function(t){mR(t,this);for(var e=0;e<t.holes.length;e++)mR(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];_R[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},e.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var s=CA((e>>16)+(65280&e)+((255&e)<<16),i);t.length=Math.max(t.length,n+r);for(var o=0;o<r;o++)t[n+o]=s},e.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},e.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var o=0,a=e.length,h=i.frame;o<n;){var l=t[2*(r+o)],c=t[2*(r+o)+1];if(s){var u=s.a*l+s.c*c+s.tx;c=s.b*l+s.d*c+s.ty,l=u}o++,e.push(l/h.width,c/h.height)}var d=i.baseTexture;(h.width<d.width||h.height<d.height)&&this.adjustUvs(e,i,a,n)},e.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,o=i+2*r,a=e.frame,h=a.width/n.width,l=a.height/n.height,c=a.x/a.width,u=a.y/a.height,d=Math.floor(t[i]+s),f=Math.floor(t[i+1]+s),p=i+2;p<o;p+=2)d=Math.min(d,Math.floor(t[p]+s)),f=Math.min(f,Math.floor(t[p+1]+s));c-=d,u-=f;for(p=i;p<o;p+=2)t[p]=(t[p]+c)*h,t[p+1]=(t[p+1]+u)*l},e.BATCHABLE_SIZE=100,e}(DM),AR=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=QM.BUTT,e.join=JM.MITER,e.miterLimit=10,e}return oR(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.alignment=.5,this.width=0,this.native=!1},e}(nR),CR=new Float32Array(3),PR={},MR=function(t){function e(e){void 0===e&&(e=null);var i=t.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new nR,i._lineStyle=new AR,i._matrix=null,i._holeMode=!1,i.state=qP.for2d(),i._geometry=e||new IR,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=mI.NORMAL,i}return oR(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},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,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:KC.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:QM.BUTT,join:JM.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):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 uC,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new uC,this.currentPath.closeStroke=!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 i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.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,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),xR.curveTo(t,e,i,r,n),this},e.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),yR.curveTo(t,e,i,r,n,s,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,o=vR.curveTo(t,e,i,r,n,s);if(o){var a=o.cx,h=o.cy,l=o.radius,c=o.startAngle,u=o.endAngle,d=o.anticlockwise;this.arc(a,h,l,c,u,d)}return this},e.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=rC:s&&r<=n&&(r+=rC),0===n-r)return this;var o=t+Math.cos(r)*i,a=e+Math.sin(r)*i,h=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var c=Math.abs(l[l.length-2]-o),u=Math.abs(l[l.length-1]-a);c<h&&u<h||l.push(o,a)}else this.moveTo(o,a),l=this.currentPath.points;return vR.arc(o,a,t,e,i,r,n,s,l),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:KC.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:KC.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,r){return this.drawShape(new hC(t,e,i,r))},e.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new dC(t,e,i,r,n))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new lC(t,e,i))},e.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new cC(t,e,i,r))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var o=new uC(t);return o.closeStroke=n,this.drawShape(o),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==$A.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,o=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),h={vertexData:o,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:EA(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=h}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,o=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,o=i.count,a=0;a<o;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},e.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!PR[i]){for(var r=t.plugins[i].MAX_TEXTURES,n=new Int32Array(r),s=0;s<r;s++)n[s]=s;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new pC,default:lP.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;PR[i]=new YP(a,o)}e=PR[i]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=EA(this.tint,CR),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this._geometry.points,l=this.vertexData,c=0,u=0;u<h.length;u+=2){var d=h[u],f=h[u+1];l[c++]=i*d+n*f+o,l[c++]=s*f+r*d+a}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,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.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new oC,e}(qM),RR=class extends eR{constructor(t){super(),A(this,"result",{type:"null",box:new Kw}),A(this,"selectedItemIds",[]),A(this,"activeParentIds",[]),A(this,"cursorPoint",new Lw),A(this,"startPoint",new Lw),A(this,"firstClickPoint",new Lw),A(this,"graphics",new MR),A(this,"pageDataUtils"),A(this,"clearResult",!1),A(this,"type","selector"),this.pageDataUtils=t}get interactive(){return Lk.config.gestureHandlerConfig.selectorGizmoEnabled}set interactive(t){Lk.config.gestureHandlerConfig.selectorGizmoEnabled=!0}actionKey(){}endActionKey(){}getRenderObjects(){return this.interactive?this.clearResult?(this.result={type:"null",box:new Kw},this.clearResult=!1,[]):(this.refreshResults(),[this.graphics]):[]}cancelPreparation(){this.result.type="null"}preparationAction(t,e){if(this.result.box=new Kw,!this.interactive)return void console.warn("Selector gizmo is not opened, use #SDK.setSelectorConfig() open this feature.");const i=new Lw(t.offsetX,t.offsetY),r=this.hitTest(i);this.selectedItemIds=this.filterSelectedItems(r);const n=this.selectedItemIds[0]??"",s=[...this.pageDataUtils.getPageData().activeData.selectedItems,...this.pageDataUtils.getPageData().activeData.selectedItems.flatMap(t=>this.pageDataUtils.getChildrenIds(t))],o=this.pageDataUtils.getPageData()?.activeData.preSelectedItem;return n.length&&e&&!s.includes(n)||!e?(!n.length||this.pageDataUtils.isItemSelected(n)||s.includes(n)?(this.pageDataUtils.pauseVideoItem(o),this.pageDataUtils.pauseEffectsItem(o),this.pageDataUtils.clearPreSelectedItem()):(this.pageDataUtils.addPreSelectedItem(n),n!==o&&(this.pageDataUtils.playVideoItem(n),this.pageDataUtils.playEffectsItem(n),this.pageDataUtils.pauseVideoItem(o),this.pageDataUtils.pauseEffectsItem(o))),this.type):(this.pageDataUtils.pauseVideoItem(o),this.pageDataUtils.pauseEffectsItem(o),this.pageDataUtils.clearPreSelectedItem(),e)}preAction(t,e=!1,i){if(!this.interactive)return void console.warn("Selector gizmo is not opened, use #SDK.setSelectorConfig() open this feature.");const r=this.pageDataUtils.getPageData()?.activeData.preSelectedItem;switch(this.pageDataUtils.pauseVideoItem(r),this.pageDataUtils.pauseEffectsItem(r),this.pageDataUtils.clearPreSelectedItem(),t.buttons){case 1:{const r=new Lw(t.offsetX,t.offsetY);if(i??(i=this.firstClickPoint),e&&r.distanceTo(i)<4){const e=new Lw(t.offsetX,t.offsetY),i=this.hitTest(e);this.selectedItemIds=this.filterSelectedItems(i)}if(e||this.firstClickPoint.set(t.offsetX,t.offsetY),t.shiftKey){if(e){const t=this.selectedItemIds[0];if(t){const e=this.pageDataUtils.getSDKItem(t);e?.parentId&&this.pageDataUtils.removeSelectedItems([e.parentId])}}}else this.pageDataUtils.clearSelectedItems(0===this.selectedItemIds.length);if(0===this.selectedItemIds.length)return this.startPoint=new Lw(t.clientX,t.clientY),this.cursorPoint=new Lw(t.offsetX,t.offsetY),this.activeParentIds=[],this.active=!0,this.type;{const t=this.addSelectedItem(this.selectedItemIds[0]);return 1===t?.length&&"text"===this.pageDataUtils.getSDKItem(t[0])?.type?"text":"transform"}}case 2:{const e=[...this.pageDataUtils.getPageData().activeData.selectedItems,...this.pageDataUtils.getPageData().activeData.selectedItems.flatMap(t=>this.pageDataUtils.getChildrenIds(t))];return this.selectedItemIds.length&&!e.includes(this.selectedItemIds[0])&&(t.shiftKey||this.pageDataUtils.clearSelectedItems(),this.pageDataUtils.addSelectedItems([this.selectedItemIds[0]]),this.clearResult=!0),void this.pageDataUtils.saveUndoRedoOldData()}default:return}}action(t){const e=(new Lw).addVectors(this.cursorPoint,(new Lw).subtractVectors(new Lw(t.clientX,t.clientY),this.startPoint)),i=(new Lw).subtractVectors(this.cursorPoint,e),r=(new Lw).addVectors(this.cursorPoint,e).multiply(.5);i.x=Math.abs(i.x),i.y=Math.abs(i.y);const n=(new Kw).setFromCenterAndSize(r,i);this.result.type="region",this.result.box=n,this.pageDataUtils.clearSelectedItems();const s=this.pageDataUtils.getPageData().items?.filter(t=>this.pageDataUtils.getItemEditEnable(t.id)),o=[];i.length()>0&&s?.forEach(t=>{n.intersectsBox(this.pageDataUtils.getViewBoxById(t.id),!1)&&o.push(t.id)});const a=this.filterSelectedItems(o);this.pageDataUtils.addSelectedItems(a)}endAction(){this.active=!1,this.result.type="null"}addSelectedItem(t){this.pageDataUtils.addSelectedItems([t]);const e=this.pageDataUtils.getPageData()?.activeData?.selectedItems;return this.addActiveParentIds(e),this.clearResult=!0,this.pageDataUtils.saveUndoRedoOldData(),e}interruption(){this.active=!1,this.result.type="null"}hitTest(t){const e=this.pageDataUtils.getCurrentComposition();if(!e?.items)return[];const{x:i,y:r}=this.pageDataUtils.getViewportByViewPoint(t),n={ray:new iT,regions:[]};try{n.regions=e.hitTest(i,r,!0),n.ray=e.getHitTestRay(i,r)}catch(t){console.warn(t)}this.refreshResultRegions(n);return this.reorderHitTestResult(n,e).filter(t=>"extra-camera"!==t&&this.pageDataUtils.getItemEditEnable(t))}refreshResultRegions(t){const e=this.pageDataUtils.getPageData()?.items.filter(t=>TT(t)),i=new Map;e?.forEach(t=>{t.property.children?.forEach(e=>{i.set(e,t.id)})}),t.regions.forEach(t=>{t.id=i.get(t.id)??t.id})}reorderHitTestResult(t,e){if(0===t.regions.length||!e)return[];const{ray:i}=t,r=t.regions.reverse(),n=[];return r.forEach(t=>{let r;const s=(t,e)=>{for(const i of t){if(i.getInstanceId()===e&&(r=i),r)return;s(i.children,e)}};if(s(e.items,t.id),void 0===r)return;const o=r.getInstanceId(),a=i.origin.clone().distance(t.position.clone());if((r.type===en.ItemType.mesh||r.getComponent(Yd)?.renderer?.occlusion||r.getComponent(ef)?.renderer?.occlusion||r.getComponent(Yy)?.renderer?.occlusion||r.getComponent(cg)?.renderer?.occlusion)&&n.length>0){let t=!0;n.forEach((e,i)=>{if(t)return a<=e[1]?(n.splice(i,0,[o,a]),void(t=!1)):void(i===n.length-1&&n.push([o,a]))})}else n.push([o,a])}),n.map(t=>t[0])}filterSelectedItems(t){const e=[],i=t=>{const e=this.pageDataUtils.getSDKItem(t);return!e.parentId||this.activeParentIds.includes(e.parentId)?e.id:i(e.parentId)},r=this.pageDataUtils.getPageData()?.activeData.loadingItems??[];return t.forEach(t=>{const n=i(t);r.includes(n)||nT(e,n)}),e}addActiveParentIds(t){this.activeParentIds=[],t?.forEach(t=>{if(!this.pageDataUtils.getSDKItem(t))return;const e=t=>{this.activeParentIds.push(t);const i=this.pageDataUtils.getSDKItem(t);i.parentId&&e(i.parentId)};e(t)})}resetActiveParentIds(t){const e=this.pageDataUtils.getSDKItem(t);e&&(this.activeParentIds=this.activeParentIds.filter(t=>t===e.parentId))}refreshResults(){const{box:t}=this.result;this.graphics.clear();const e=this.pageDataUtils.getPreSelectedItem(),i=this.pageDataUtils.getViewBoxById(e?.id??""),{regionBoxColor:r,regionBoxAlpha:n,preSelectedWidth:s,preSelectedColor:o,regionWireframeWidth:a,regionWireframeColor:h,regionWireframeAlpha:l}=Lk.config.gestureHandlerConfig.selectorGizmoConfig;if(i?.isEmpty()||(this.graphics.lineStyle(s,o),this.graphics.drawBox(i)),!t.isEmpty()&&"region"===this.result.type)this.graphics.lineStyle(a,h,l),this.graphics.drawBox(t),this.graphics.beginFill(r,n),this.graphics.fillBox(t),this.graphics.endFill()}};var OR=function(t){var e=this.constructor;return this.then(function(i){return e.resolve(t()).then(function(){return i})},function(i){return e.resolve(t()).then(function(){return e.reject(i)})})};var DR=function(t){return new this(function(e,i){if(!t||void 0===t.length)return i(new TypeError(typeof t+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var n=r.length;function s(t,i){if(i&&("object"==typeof i||"function"==typeof i)){var o=i.then;if("function"==typeof o)return void o.call(i,function(e){s(t,e)},function(i){r[t]={status:"rejected",reason:i},0===--n&&e(r)})}r[t]={status:"fulfilled",value:i},0===--n&&e(r)}for(var o=0;o<r.length;o++)s(o,r[o])})};function kR(t,e){this.name="AggregateError",this.errors=t,this.message=e||""}kR.prototype=Error.prototype;var LR=function(t){var e=this;return new e(function(i,r){if(!t||void 0===t.length)return r(new TypeError("Promise.any accepts an array"));var n=Array.prototype.slice.call(t);if(0===n.length)return r();for(var s=[],o=0;o<n.length;o++)try{e.resolve(n[o]).then(i).catch(function(t){s.push(t),s.length===n.length&&r(new kR(s,"All promises were rejected"))})}catch(t){r(t)}})},FR=setTimeout;function NR(t){return Boolean(t&&void 0!==t.length)}function BR(){}function zR(t){if(!(this instanceof zR))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],WR(t,this)}function UR(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,zR._immediateFn(function(){var i=1===t._state?e.onFulfilled:e.onRejected;if(null!==i){var r;try{r=i(t._value)}catch(t){return void GR(e.promise,t)}VR(e.promise,r)}else(1===t._state?VR:GR)(e.promise,t._value)})):t._deferreds.push(e)}function VR(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var i=e.then;if(e instanceof zR)return t._state=3,t._value=e,void jR(t);if("function"==typeof i)return void WR((r=i,n=e,function(){r.apply(n,arguments)}),t)}t._state=1,t._value=e,jR(t)}catch(e){GR(t,e)}var r,n}function GR(t,e){t._state=2,t._value=e,jR(t)}function jR(t){2===t._state&&0===t._deferreds.length&&zR._immediateFn(function(){t._handled||zR._unhandledRejectionFn(t._value)});for(var e=0,i=t._deferreds.length;e<i;e++)UR(t,t._deferreds[e]);t._deferreds=null}function HR(t,e,i){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=i}function WR(t,e){var i=!1;try{t(function(t){i||(i=!0,VR(e,t))},function(t){i||(i=!0,GR(e,t))})}catch(t){if(i)return;i=!0,GR(e,t)}}zR.prototype.catch=function(t){return this.then(null,t)},zR.prototype.then=function(t,e){var i=new this.constructor(BR);return UR(this,new HR(t,e,i)),i},zR.prototype.finally=OR,zR.all=function(t){return new zR(function(e,i){if(!NR(t))return i(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var n=r.length;function s(t,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var a=o.then;if("function"==typeof a)return void a.call(o,function(e){s(t,e)},i)}r[t]=o,0===--n&&e(r)}catch(t){i(t)}}for(var o=0;o<r.length;o++)s(o,r[o])})},zR.any=LR,zR.allSettled=DR,zR.resolve=function(t){return t&&"object"==typeof t&&t.constructor===zR?t:new zR(function(e){e(t)})},zR.reject=function(t){return new zR(function(e,i){i(t)})},zR.race=function(t){return new zR(function(e,i){if(!NR(t))return i(new TypeError("Promise.race accepts an array"));for(var r=0,n=t.length;r<n;r++)zR.resolve(t[r]).then(e,i)})},zR._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){FR(t,0)},zR._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var XR=zR,YR=I(Ct(),1);"undefined"==typeof globalThis&&("undefined"!=typeof self?self.globalThis=self:"undefined"!=typeof global&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=XR),Object.assign||(Object.assign=YR.default);var qR;Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),globalThis.performance&&globalThis.performance.now||(qR=Date.now(),globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-qR});var KR,ZR,JR=Date.now(),$R=["ms","moz","webkit","o"];for(ZR=0;ZR<$R.length&&!globalThis.requestAnimationFrame;++ZR)KR=$R[ZR],globalThis.requestAnimationFrame=globalThis[KR+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[KR+"CancelAnimationFrame"]||globalThis[KR+"CancelRequestAnimationFrame"];globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(t){if("function"!=typeof t)throw new TypeError(t+"is not a function");var e=Date.now(),i=16+JR-e;return i<0&&(i=0),JR=e,globalThis.self.setTimeout(function(){JR=Date.now(),t(performance.now())},i)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(t){return clearTimeout(t)}),Math.sign||(Math.sign=function(t){return 0===(t=Number(t))||isNaN(t)?t:t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var QR=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new oC,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),tO=function(t,e){return tO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},tO(t,e)};var eO=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),iO=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!==(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!==(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!==(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),rO=function(){function t(){this._tempPoint=new oC}return t.prototype.recursiveFindHit=function(t,e,i,r,n){var s;if(!e||!e.visible)return!1;var o=t.data.global,a=!1,h=n=e.interactive||n,l=!0;if(e.hitArea)r&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?a=!0:(r=!1,l=!1)),h=!1;else if(e._mask&&r){var c=e._mask.isMaskData?e._mask.maskObject:e._mask;c&&!(null===(s=c.containsPoint)||void 0===s?void 0:s.call(c,o))&&(r=!1)}if(l&&e.interactiveChildren&&e.children)for(var u=e.children,d=u.length-1;d>=0;d--){var f=u[d],p=this.recursiveFindHit(t,f,i,r,h);if(p){if(!f.parent)continue;h=!1,p&&(t.target&&(r=!1),a=!0)}}return n&&(r&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(a=!0),e.interactive&&(a&&!t.target&&(t.target=e),i&&i(t,e,!!a))),a},t.prototype.findHit=function(t,e,i,r){this.recursiveFindHit(t,e,i,r,!1)},t}(),nO={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};WM.mixin(nO);var sO={target:null,data:{global:null}},oO=function(t){function e(e,i){var r=t.call(this)||this;return i=i||{},r.renderer=e,r.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,r.interactionFrequency=i.interactionFrequency||10,r.mouse=new QR,r.mouse.identifier=1,r.mouse.global.set(-999999),r.activeInteractionData={},r.activeInteractionData[1]=r.mouse,r.interactionDataPool=[],r.eventData=new eO,r.interactionDOMElement=null,r.moveWhenInside=!1,r.eventsAdded=!1,r.tickerAdded=!1,r.mouseOverRenderer=!("PointerEvent"in globalThis),r.supportsTouchEvents="ontouchstart"in globalThis,r.supportsPointerEvents=!!globalThis.PointerEvent,r.onPointerUp=r.onPointerUp.bind(r),r.processPointerUp=r.processPointerUp.bind(r),r.onPointerCancel=r.onPointerCancel.bind(r),r.processPointerCancel=r.processPointerCancel.bind(r),r.onPointerDown=r.onPointerDown.bind(r),r.processPointerDown=r.processPointerDown.bind(r),r.onPointerMove=r.onPointerMove.bind(r),r.processPointerMove=r.processPointerMove.bind(r),r.onPointerOut=r.onPointerOut.bind(r),r.processPointerOverOut=r.processPointerOverOut.bind(r),r.onPointerOver=r.onPointerOver.bind(r),r.cursorStyles={default:"inherit",pointer:"pointer"},r.currentCursorMode=null,r.cursor=null,r.resolution=1,r.delayedEvents=[],r.search=new rO,r._tempDisplayObject=new XM,r._eventListenerOptions={capture:!0,passive:!1},r._useSystemTicker=void 0===i.useSystemTicker||i.useSystemTicker,r.setTargetElement(r.renderer.view,r.renderer.resolution),r}return function(t,e){function i(){this.constructor=t}tO(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,e){return sO.target=null,sO.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(sO,e,null,!0),sO.target},e.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(eC.system.add(this.tickerUpdate,this,YA.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(eC.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var e=this.activeInteractionData[t];if(e.originalEvent&&"touch"!==e.pointerType){var i=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(e=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.interactionDOMElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,e,i){i.stopPropagationHint&&t!==i.stopsPropagatingAt||(i.currentTarget=t,i.type=e,t.emit(e,i),t[e]&&t[e](i))},e.prototype.delayDispatchEvent=function(t,e,i){this.delayedEvents.push({displayObject:t,eventString:e,eventData:i})},e.prototype.mapPositionToPoint=function(t,e,i){var r;r=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var n=1/this.resolution;t.x=(e-r.left)*(this.interactionDOMElement.width/r.width)*n,t.y=(i-r.top)*(this.interactionDOMElement.height/r.height)*n},e.prototype.processInteractive=function(t,e,i,r){var n=this.search.findHit(t,e,i,r),s=this.delayedEvents;if(!s.length)return n;t.stopPropagationHint=!1;var o=s.length;this.delayedEvents=[];for(var a=0;a<o;a++){var h=s[a],l=h.displayObject,c=h.eventString,u=h.eventData;u.stopsPropagatingAt===l&&(u.stopPropagationHint=!0),this.dispatchEvent(l,c,u)}return n},e.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var i=e.length,r=0;r<i;r++){var n=e[r],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);if(o.data.originalEvent=t,this.processInteractive(o,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",o),"touch"===n.pointerType)this.emit("touchstart",o);else if("mouse"===n.pointerType||"pen"===n.pointerType){var a=2===n.button;this.emit(a?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,e,i){var r=t.data,n=t.data.identifier;if(i)if(e.trackedPointers[n]||(e.trackedPointers[n]=new iO(n)),this.dispatchEvent(e,"pointerdown",t),"touch"===r.pointerType)this.dispatchEvent(e,"touchstart",t);else if("mouse"===r.pointerType||"pen"===r.pointerType){var s=2===r.button;s?e.trackedPointers[n].rightDown=!0:e.trackedPointers[n].leftDown=!0,this.dispatchEvent(e,s?"rightdown":"mousedown",t)}},e.prototype.onPointerComplete=function(t,e,i){var r=this.normalizeToPointerData(t),n=r.length,s=t.target;t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0]);for(var o=s!==this.interactionDOMElement?"outside":"",a=0;a<n;a++){var h=r[a],l=this.getInteractionDataForPointerId(h),c=this.configureInteractionEventForDOMEvent(this.eventData,h,l);if(c.data.originalEvent=t,this.processInteractive(c,this.lastObjectRendered,i,e||!o),this.emit(e?"pointercancel":"pointerup"+o,c),"mouse"===h.pointerType||"pen"===h.pointerType){var u=2===h.button;this.emit(u?"rightup"+o:"mouseup"+o,c)}else"touch"===h.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,c),this.releaseInteractionDataForPointerId(h.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,e){var i=t.data,r=t.data.identifier;void 0!==e.trackedPointers[r]&&(delete e.trackedPointers[r],this.dispatchEvent(e,"pointercancel",t),"touch"===i.pointerType&&this.dispatchEvent(e,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,e,i){var r=t.data,n=t.data.identifier,s=e.trackedPointers[n],o="touch"===r.pointerType,a="mouse"===r.pointerType||"pen"===r.pointerType,h=!1;if(a){var l=2===r.button,c=iO.FLAGS,u=l?c.RIGHT_DOWN:c.LEFT_DOWN,d=void 0!==s&&s.flags&u;i?(this.dispatchEvent(e,l?"rightup":"mouseup",t),d&&(this.dispatchEvent(e,l?"rightclick":"click",t),h=!0)):d&&this.dispatchEvent(e,l?"rightupoutside":"mouseupoutside",t),s&&(l?s.rightDown=!1:s.leftDown=!1)}i?(this.dispatchEvent(e,"pointerup",t),o&&this.dispatchEvent(e,"touchend",t),s&&(a&&!h||this.dispatchEvent(e,"pointertap",t),o&&(this.dispatchEvent(e,"tap",t),s.over=!1))):s&&(this.dispatchEvent(e,"pointerupoutside",t),o&&this.dispatchEvent(e,"touchendoutside",t)),s&&s.none&&delete e.trackedPointers[n]},e.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var i=e.length,r=0;r<i;r++){var n=e[r],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=t,this.processInteractive(o,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",o),"touch"===n.pointerType&&this.emit("touchmove",o),"mouse"!==n.pointerType&&"pen"!==n.pointerType||this.emit("mousemove",o)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,e,i){var r=t.data,n="touch"===r.pointerType,s="mouse"===r.pointerType||"pen"===r.pointerType;s&&this.processPointerOverOut(t,e,i),this.moveWhenInside&&!i||(this.dispatchEvent(e,"pointermove",t),n&&this.dispatchEvent(e,"touchmove",t),s&&this.dispatchEvent(e,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0];"mouse"===e.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,this.processInteractive(r,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",r),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",r):this.releaseInteractionDataForPointerId(i.identifier)}},e.prototype.processPointerOverOut=function(t,e,i){var r=t.data,n=t.data.identifier,s="mouse"===r.pointerType||"pen"===r.pointerType,o=e.trackedPointers[n];i&&!o&&(o=e.trackedPointers[n]=new iO(n)),void 0!==o&&(i&&this.mouseOverRenderer?(o.over||(o.over=!0,this.delayDispatchEvent(e,"pointerover",t),s&&this.delayDispatchEvent(e,"mouseover",t)),s&&null===this.cursor&&(this.cursor=e.cursor)):o.over&&(o.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),s&&this.dispatchEvent(e,"mouseout",t),o.none&&delete e.trackedPointers[n]))},e.prototype.onPointerOver=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0],i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,"mouse"===e.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",r),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",r)}},e.prototype.getInteractionDataForPointerId=function(t){var e,i=t.pointerId;return 1===i||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[i]?e=this.activeInteractionData[i]:((e=this.interactionDataPool.pop()||new QR).identifier=i,this.activeInteractionData[i]=e),e.copyEvent(t),e},e.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},e.prototype.configureInteractionEventForDOMEvent=function(t,e,i){return t.data=i,this.mapPositionToPoint(i.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=i.global.x,e.globalY=i.global.y),i.originalEvent=e,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var i=0,r=t.changedTouches.length;i<r;i++){var n=t.changedTouches[i];void 0===n.button&&(n.button=t.touches.length?1:0),void 0===n.buttons&&(n.buttons=t.touches.length?1:0),void 0===n.isPrimary&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===n.width&&(n.width=n.radiusX||1),void 0===n.height&&(n.height=n.radiusY||1),void 0===n.tiltX&&(n.tiltX=0),void 0===n.tiltY&&(n.tiltY=0),void 0===n.pointerType&&(n.pointerType="touch"),void 0===n.pointerId&&(n.pointerId=n.identifier||0),void 0===n.pressure&&(n.pressure=n.force||.5),void 0===n.twist&&(n.twist=0),void 0===n.tangentialPressure&&(n.tangentialPressure=0),void 0===n.layerX&&(n.layerX=n.offsetX=n.clientX),void 0===n.layerY&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,e.push(n)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var s=t;void 0===s.isPrimary&&(s.isPrimary=!0),void 0===s.width&&(s.width=1),void 0===s.height&&(s.height=1),void 0===s.tiltX&&(s.tiltX=0),void 0===s.tiltY&&(s.tiltY=0),void 0===s.pointerType&&(s.pointerType="mouse"),void 0===s.pointerId&&(s.pointerId=1),void 0===s.pressure&&(s.pressure=.5),void 0===s.twist&&(s.twist=0),void 0===s.tangentialPressure&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}return e},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e.extension={name:"interaction",type:[HA.RendererPlugin,HA.CanvasRendererPlugin]},e}(gA.default),aO=function(){function t(t,e,i){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=i,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function hO(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var lO,cO=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var i=[];e;)i.push(e),e=e._next;return i},t.prototype.has=function(t){if(!(t instanceof aO))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=this._head;if(!r)return!1;for(;r;)r._once&&this.detach(r),r._fn.apply(r._thisArg,e),r=r._next;return!0},t.prototype.add=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#add(): First arg must be a Function.");return hO(this,new aO(t,!1,e))},t.prototype.once=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#once(): First arg must be a Function.");return hO(this,new aO(t,!0,e))},t.prototype.detach=function(t){if(!(t instanceof aO))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return t._owner!==this||(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,null===t._next&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=this._tail=null;t;)t._owner=null,t=t._next;return this},t}();function uO(t,e){e=e||{};for(var i={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},r=i.parser[e.strictMode?"strict":"loose"].exec(t),n={},s=14;s--;)n[i.key[s]]=r[s]||"";return n[i.q.name]={},n[i.key[12]].replace(i.q.parser,function(t,e,r){e&&(n[i.q.name][e]=r)}),n}var dO=null;function fO(){}function pO(t,e,i){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=i)}function mO(t){return t.toString().replace("object ","")}var gO,vO,yO,xO,bO,_O=function(){function t(e,i,r){if(this._dequeue=fO,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,"string"!=typeof e||"string"!=typeof i)throw new Error("Both name and url are required for constructing a resource.");r=r||{},this._flags=0,this._setFlag(t.STATUS_FLAGS.DATA_URL,0===i.indexOf("data:")),this.name=e,this.url=i,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===r.crossOrigin?"anonymous":r.crossOrigin,this.timeout=r.timeout||0,this.loadType=r.loadType||this._determineLoadType(),this.xhrType=r.xhrType,this.metadata=r.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=t.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=fO,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new cO,this.onProgress=new cO,this.onComplete=new cO,this.onAfterMiddleware=new cO}return t.setExtensionLoadType=function(e,i){pO(t._loadTypeMap,e,i)},t.setExtensionXhrType=function(e,i){pO(t._xhrTypeMap,e,i)},Object.defineProperty(t.prototype,"isDataUrl",{get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),t.prototype.complete=function(){this._clearEvents(),this._finish()},t.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=t.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},t.prototype.load=function(e){var i=this;if(!this.isLoading)if(this.isComplete)e&&setTimeout(function(){return e(i)},1);else switch(e&&this.onComplete.once(e),this._setFlag(t.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case t.LOAD_TYPE.IMAGE:this.type=t.TYPE.IMAGE,this._loadElement("image");break;case t.LOAD_TYPE.AUDIO:this.type=t.TYPE.AUDIO,this._loadSourceElement("audio");break;case t.LOAD_TYPE.VIDEO:this.type=t.TYPE.VIDEO,this._loadSourceElement("video");break;case t.LOAD_TYPE.XHR:default:void 0===lO&&(lO=!(!globalThis.XDomainRequest||"withCredentials"in new XMLHttpRequest)),lO&&this.crossOrigin?this._loadXdr():this._loadXhr()}},t.prototype._hasFlag=function(t){return 0!==(this._flags&t)},t.prototype._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},t.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},t.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(t.STATUS_FLAGS.COMPLETE,!0),this._setFlag(t.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},t.prototype._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===t&&void 0!==globalThis.Image?this.data=new Image:this.data=document.createElement(t),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},t.prototype._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===t&&void 0!==globalThis.Audio?this.data=new Audio:this.data=document.createElement(t),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var e=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(t,this.url[i],Array.isArray(e)?e[i]:e));else{e=this.metadata.mimeType;this.data.appendChild(this._createSource(t,this.url,Array.isArray(e)?e[0]:e))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+t)},t.prototype._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;"use-credentials"===this.crossOrigin&&(e.withCredentials=!0),e.open("GET",this.url,!0),e.timeout=this.timeout,this.xhrType===t.XHR_RESPONSE_TYPE.JSON||this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=t.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("timeout",this._boundXhrOnTimeout,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},t.prototype._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var t=this.xhr=new globalThis.XDomainRequest;t.timeout=this.timeout||5e3,t.onerror=this._boundXhrOnError,t.ontimeout=this._boundXhrOnTimeout,t.onprogress=this._boundOnProgress,t.onload=this._boundXhrOnLoad,t.open("GET",this.url,!0),setTimeout(function(){return t.send()},1)},t.prototype._createSource=function(t,e,i){i||(i=t+"/"+this._getExtension(e));var r=document.createElement("source");return r.src=e,r.type=i,r},t.prototype._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},t.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},t.prototype._onTimeout=function(){this.abort("Load timed out.")},t.prototype._xhrOnError=function(){var t=this.xhr;this.abort(mO(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},t.prototype._xhrOnTimeout=function(){var t=this.xhr;this.abort(mO(t)+" Request timed out.")},t.prototype._xhrOnAbort=function(){var t=this.xhr;this.abort(mO(t)+" Request was aborted by the user.")},t.prototype._xhrOnLoad=function(){var e=this.xhr,i="",r=void 0===e.status?200:e.status;if(""!==e.responseType&&"text"!==e.responseType&&void 0!==e.responseType||(i=e.responseText),0===r&&(i.length>0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?r=200:1223===r&&(r=204),2===(r/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=i,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(i),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var n=new DOMParser;this.data=n.parseFromString(i,"text/xml")}else{var s=document.createElement("div");s.innerHTML=i,this.data=s}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||i;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,dO||(dO=document.createElement("a")),dO.href=t;var i=uO(dO.href,{strictMode:!0}),r=!i.port&&""===e.port||i.port===e.port,n=i.protocol?i.protocol+":":"";return i.host===e.hostname&&r&&n===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var i=t.indexOf("/");e=t.substring(i+1,t.indexOf(";",i))}else{var r=t.indexOf("?"),n=t.indexOf("#"),s=Math.min(r>-1?r:t.length,n>-1?n:t.length);e=(t=t.substring(0,s)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}();function wO(){}function TO(t){return function(){for(var e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];if(null===t)throw new Error("Callback was already called.");var n=t;t=null,n.apply(this,i)}}gO=_O||(_O={}),(vO=gO.STATUS_FLAGS||(gO.STATUS_FLAGS={}))[vO.NONE=0]="NONE",vO[vO.DATA_URL=1]="DATA_URL",vO[vO.COMPLETE=2]="COMPLETE",vO[vO.LOADING=4]="LOADING",(yO=gO.TYPE||(gO.TYPE={}))[yO.UNKNOWN=0]="UNKNOWN",yO[yO.JSON=1]="JSON",yO[yO.XML=2]="XML",yO[yO.IMAGE=3]="IMAGE",yO[yO.AUDIO=4]="AUDIO",yO[yO.VIDEO=5]="VIDEO",yO[yO.TEXT=6]="TEXT",(xO=gO.LOAD_TYPE||(gO.LOAD_TYPE={}))[xO.XHR=1]="XHR",xO[xO.IMAGE=2]="IMAGE",xO[xO.AUDIO=3]="AUDIO",xO[xO.VIDEO=4]="VIDEO",(bO=gO.XHR_RESPONSE_TYPE||(gO.XHR_RESPONSE_TYPE={})).DEFAULT="text",bO.BUFFER="arraybuffer",bO.BLOB="blob",bO.DOCUMENT="document",bO.JSON="json",bO.TEXT="text",gO._loadTypeMap={gif:gO.LOAD_TYPE.IMAGE,png:gO.LOAD_TYPE.IMAGE,bmp:gO.LOAD_TYPE.IMAGE,jpg:gO.LOAD_TYPE.IMAGE,jpeg:gO.LOAD_TYPE.IMAGE,tif:gO.LOAD_TYPE.IMAGE,tiff:gO.LOAD_TYPE.IMAGE,webp:gO.LOAD_TYPE.IMAGE,tga:gO.LOAD_TYPE.IMAGE,avif:gO.LOAD_TYPE.IMAGE,svg:gO.LOAD_TYPE.IMAGE,"svg+xml":gO.LOAD_TYPE.IMAGE,mp3:gO.LOAD_TYPE.AUDIO,ogg:gO.LOAD_TYPE.AUDIO,wav:gO.LOAD_TYPE.AUDIO,mp4:gO.LOAD_TYPE.VIDEO,webm:gO.LOAD_TYPE.VIDEO},gO._xhrTypeMap={xhtml:gO.XHR_RESPONSE_TYPE.DOCUMENT,html:gO.XHR_RESPONSE_TYPE.DOCUMENT,htm:gO.XHR_RESPONSE_TYPE.DOCUMENT,xml:gO.XHR_RESPONSE_TYPE.DOCUMENT,tmx:gO.XHR_RESPONSE_TYPE.DOCUMENT,svg:gO.XHR_RESPONSE_TYPE.DOCUMENT,tsx:gO.XHR_RESPONSE_TYPE.DOCUMENT,gif:gO.XHR_RESPONSE_TYPE.BLOB,png:gO.XHR_RESPONSE_TYPE.BLOB,bmp:gO.XHR_RESPONSE_TYPE.BLOB,jpg:gO.XHR_RESPONSE_TYPE.BLOB,jpeg:gO.XHR_RESPONSE_TYPE.BLOB,tif:gO.XHR_RESPONSE_TYPE.BLOB,tiff:gO.XHR_RESPONSE_TYPE.BLOB,webp:gO.XHR_RESPONSE_TYPE.BLOB,tga:gO.XHR_RESPONSE_TYPE.BLOB,avif:gO.XHR_RESPONSE_TYPE.BLOB,json:gO.XHR_RESPONSE_TYPE.JSON,text:gO.XHR_RESPONSE_TYPE.TEXT,txt:gO.XHR_RESPONSE_TYPE.TEXT,ttf:gO.XHR_RESPONSE_TYPE.BUFFER,otf:gO.XHR_RESPONSE_TYPE.BUFFER},gO.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var EO=function(){return function(t,e){this.data=t,this.callback=e}}(),SO=function(){function t(t,e){var i=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=wO,this.unsaturated=wO,this.empty=wO,this.drain=wO,this.error=wO,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,r){if(r&&"function"!=typeof r)throw new Error("task callback must be a function");if(i.started=!0,null==t&&i.idle())setTimeout(function(){return i.drain()},1);else{var n=new EO(t,"function"==typeof r?r:wO);e?i._tasks.unshift(n):i._tasks.push(n),setTimeout(i.process,1)}},this.process=function(){for(;!i.paused&&i.workers<i.concurrency&&i._tasks.length;){var t=i._tasks.shift();0===i._tasks.length&&i.empty(),i.workers+=1,i.workers===i.concurrency&&i.saturated(),i._worker(t.data,TO(i._next(t)))}},this._worker=t,0===e)throw new Error("Concurrency must not be zero");this.concurrency=e,this.buffer=e/4}return t.prototype._next=function(t){var e=this;return function(){for(var i=arguments,r=[],n=0;n<arguments.length;n++)r[n]=i[n];e.workers-=1,t.callback.apply(t,r),null!=r[0]&&e.error(r[0],t.data),e.workers<=e.concurrency-e.buffer&&e.unsaturated(),e.idle()&&e.drain(),e.process()}},t.prototype.push=function(t,e){this._insert(t,!1,e)},t.prototype.kill=function(){this.workers=0,this.drain=wO,this.started=!1,this._tasks=[]},t.prototype.unshift=function(t,e){this._insert(t,!0,e)},t.prototype.length=function(){return this._tasks.length},t.prototype.running=function(){return this.workers},t.prototype.idle=function(){return this._tasks.length+this.workers===0},t.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},t.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},t.eachSeries=function(t,e,i,r){var n=0,s=t.length;!function o(a){a||n===s?i&&i(a):r?setTimeout(function(){e(t[n++],o)},1):e(t[n++],o)}()},t.queue=function(e,i){return new t(e,i)},t}(),IO=/(#[\w-]+)?$/,AO=function(){function t(e,i){var r=this;void 0===e&&(e=""),void 0===i&&(i=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this.resources={},this.baseUrl=e,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this._queue=SO.queue(this._boundLoadResource,i),this._queue.pause(),this.resources={},this.onProgress=new cO,this.onError=new cO,this.onLoad=new cO,this.onStart=new cO,this.onComplete=new cO;for(var n=0;n<t._plugins.length;++n){var s=t._plugins[n],o=s.pre,a=s.use;o&&this.pre(o),a&&this.use(a)}this._protected=!1}return t.prototype._add=function(t,e,i,r){if(this.loading&&(!i||!i.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[t])throw new Error('Resource named "'+t+'" already exists.');if(e=this._prepareUrl(e),this.resources[t]=new _O(t,e,i),"function"==typeof r&&this.resources[t].onAfterMiddleware.once(r),this.loading){for(var n=i.parentResource,s=[],o=0;o<n.children.length;++o)n.children[o].isComplete||s.push(n.children[o]);var a=n.progressChunk*(s.length+1)/(s.length+2);n.children.push(this.resources[t]),n.progressChunk=a;for(o=0;o<s.length;++o)s[o].progressChunk=a;this.resources[t].progressChunk=a}return this._queue.push(this.resources[t]),this},t.prototype.pre=function(t){return this._beforeMiddleware.push(t),this},t.prototype.use=function(t){return this._afterMiddleware.push(t),this},t.prototype.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort("loader reset")}return this.resources={},this},t.prototype.load=function(t){if(BA("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),"function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue._tasks.length,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=e;this._onStart(),this._queue.resume()}return this},Object.defineProperty(t.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!1,configurable:!0}),t.prototype._prepareUrl=function(t){var e,i=uO(t,{strictMode:!0});if(e=i.protocol||!i.path||0===t.indexOf("//")?t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==t.charAt(0)?this.baseUrl+"/"+t:this.baseUrl+t,this.defaultQueryString){var r=IO.exec(e)[0];-1!==(e=e.slice(0,e.length-r.length)).indexOf("?")?e+="&"+this.defaultQueryString:e+="?"+this.defaultQueryString,e+=r}return e},t.prototype._loadResource=function(t,e){var i=this;t._dequeue=e,SO.eachSeries(this._beforeMiddleware,function(e,r){e.call(i,t,function(){r(t.isComplete?{}:null)})},function(){t.isComplete?i._onLoad(t):(t._onLoadBinding=t.onComplete.once(i._onLoad,i),t.load())},!0)},t.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t.prototype._onLoad=function(t){var e=this;t._onLoadBinding=null,this._resourcesParsing.push(t),t._dequeue(),SO.eachSeries(this._afterMiddleware,function(i,r){i.call(e,t,r)},function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(100,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&0===e._resourcesParsing.length&&e._onComplete()},!0)},t.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(t,"shared",{get:function(){var e=t._shared;return e||((e=new t)._protected=!0,t._shared=e),e},enumerable:!1,configurable:!0}),t.registerPlugin=function(e){return BA("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),ZA.add({type:HA.Loader,ref:e}),t},t._plugins=[],t}();ZA.handleByList(HA.Loader,AO._plugins),AO.prototype.add=function(t,e,i,r){if(Array.isArray(t)){for(var n=0;n<t.length;++n)this.add(t[n]);return this}if("object"==typeof t&&(i=t,r=e||i.callback||i.onComplete,e=i.url,t=i.name||i.key||i.url),"string"!=typeof e&&(r=i,i=e,e=t),"string"!=typeof e)throw new Error("No url passed to add resource to loader.");return"function"==typeof i&&(r=i,i=null),this._add(t,e,i,r)};var CO=function(){function t(){}return t.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?AO.shared:new AO},t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.extension=HA.Application,t}(),PO=function(){function t(){}return t.add=function(){_O.setExtensionLoadType("svg",_O.LOAD_TYPE.XHR),_O.setExtensionXhrType("svg",_O.XHR_RESPONSE_TYPE.TEXT)},t.use=function(t,e){if(!t.data||t.type!==_O.TYPE.IMAGE&&"svg"!==t.extension)e();else{var i=t.data,r=t.url,n=t.name,s=t.metadata;KC.fromLoader(i,r,n,s).then(function(i){t.texture=i,e()}).catch(e)}},t.extension=HA.Loader,t}();function MO(t,e){if(t.data){if(t.xhr&&t.xhrType===_O.XHR_RESPONSE_TYPE.BLOB)if(self.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var i=globalThis.URL||globalThis.webkitURL,r=i.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=_O.TYPE.IMAGE,void(t.data.onload=function(){i.revokeObjectURL(r),t.data.onload=null,e()})}}else{var n=t.xhr.getResponseHeader("content-type");if(n&&0===n.indexOf("image"))return t.data=new Image,t.data.src="data:"+n+";base64,"+function(t){for(var e="",i=0;i<t.length;){for(var r=[0,0,0],n=[0,0,0,0],s=0;s<r.length;++s)i<t.length?r[s]=255&t.charCodeAt(i++):r[s]=0;switch(n[0]=r[0]>>2,n[1]=(3&r[0])<<4|r[1]>>4,n[2]=(15&r[1])<<2|r[2]>>6,n[3]=63&r[2],i-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(s=0;s<n.length;++s)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n[s])}return e}(t.xhr.responseText),t.type=_O.TYPE.IMAGE,void(t.data.onload=function(){t.data.onload=null,e()})}e()}else e()}var RO=function(){function t(){}return t.extension=HA.Loader,t.use=MO,t}();ZA.add(PO,RO);var OO=function(t,e){return OO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},OO(t,e)};var DO,kO,LO=new oC,FO=new Uint16Array([0,1,2,0,2,3]),NO=function(t){function e(e){var i=t.call(this)||this;return i._anchor=new fC(i._onAnchorUpdate,i,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=mI.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=e||KC.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=FO,i.pluginName="batch",i.isSprite=!0,i._roundPixels=mA.ROUND_PIXELS,i}return function(t,e){function i(){this.constructor=t}OO(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=kA(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=kA(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this.vertexData,l=t.trim,c=t.orig,u=this._anchor,d=0,f=0,p=0,m=0;if(l?(d=(f=l.x-u._x*c.width)+l.width,p=(m=l.y-u._y*c.height)+l.height):(d=(f=-u._x*c.width)+c.width,p=(m=-u._y*c.height)+c.height),h[0]=i*f+n*m+o,h[1]=s*m+r*f+a,h[2]=i*d+n*m+o,h[3]=s*m+r*d+a,h[4]=i*d+n*p+o,h[5]=s*p+r*d+a,h[6]=i*f+n*p+o,h[7]=s*p+r*f+a,this._roundPixels)for(var g=mA.RESOLUTION,v=0;v<h.length;++v)h[v]=Math.round((h[v]*g|0)/g)}},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,i=t.orig,r=this._anchor,n=this.transform.worldTransform,s=n.a,o=n.b,a=n.c,h=n.d,l=n.tx,c=n.ty,u=-r._x*i.width,d=u+i.width,f=-r._y*i.height,p=f+i.height;e[0]=s*u+a*f+l,e[1]=h*f+o*u+c,e[2]=s*d+a*f+l,e[3]=h*f+o*d+c,e[4]=s*d+a*p+l,e[5]=h*p+o*d+c,e[6]=s*u+a*p+l,e[7]=h*p+o*u+c},e.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),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(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(e){return 0===this.children.length?(this._localBounds||(this._localBounds=new GM),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new hC),e=this._localBoundsRect),this._localBounds.getRectangle(e)):t.prototype.getLocalBounds.call(this,e)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,LO);var e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,n=0;return LO.x>=r&&LO.x<r+e&&(n=-i*this.anchor.y,LO.y>=n&&LO.y<n+i)},e.prototype.destroy=function(e){if(t.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof e?e:e&&e.texture){var i="boolean"==typeof e?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null},e.from=function(t,i){return new e(t instanceof KC?t:KC.from(t,i))},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var e=kA(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=kA(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||KC.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(qM),BO=function(t,e){return BO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},BO(t,e)};(kO=DO||(DO={}))[kO.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",kO[kO.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL";var zO={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:DO.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},UO=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],VO=function(){function t(t){this.styleID=0,this.reset(),HO(this,t,t)}return t.prototype.clone=function(){var e={};return HO(e,this,zO),new t(e)},t.prototype.reset=function(){HO(this,zO,zO)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=jO(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=jO(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=jO(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&UO.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function GO(t){return"number"==typeof t?SA(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function jO(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=GO(t[e]);return t}return GO(t)}function HO(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var WO={willReadFrequently:!0},XO=function(){function t(t,e,i,r,n,s,o,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var s=i.toFontString(),o=t.measureFont(s);0===o.fontSize&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);var a=n.getContext("2d",WO);a.font=s;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,u=0;u<h.length;u++){var d=a.measureText(h[u]).width+(h[u].length-1)*i.letterSpacing;l[u]=d,c=Math.max(c,d)}var f=c+i.strokeThickness;i.dropShadow&&(f+=i.dropShadowDistance);var p=i.lineHeight||o.fontSize+i.strokeThickness,m=Math.max(p,o.fontSize+i.strokeThickness)+(h.length-1)*(p+i.leading);return i.dropShadow&&(m+=i.dropShadowDistance),new t(e,i,f,m,h,l,p+i.leading,c,o)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d",WO),s=0,o="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,u=t.collapseSpaces(c),d=t.collapseNewlines(c),f=!u,p=i.wordWrapWidth+l,m=t.tokenize(e),g=0;g<m.length;g++){var v=m[g];if(t.isNewline(v)){if(!d){a+=t.addLine(o),f=!u,o="",s=0;continue}v=" "}if(u){var y=t.isBreakingSpace(v),x=t.isBreakingSpace(o[o.length-1]);if(y&&x)continue}var b=t.getFromCache(v,l,h,n);if(b>p)if(""!==o&&(a+=t.addLine(o),o="",s=0),t.canBreakWords(v,i.breakWords))for(var _=t.wordWrapSplit(v),w=0;w<_.length;w++){for(var T=_[w],E=1;_[w+E];){var S=_[w+E],I=T[T.length-1];if(t.canBreakChars(I,S,v,w,i.breakWords))break;T+=S,E++}w+=T.length-1;var A=t.getFromCache(T,l,h,n);A+s>p&&(a+=t.addLine(o),f=!1,o="",s=0),o+=T,s+=A}else{o.length>0&&(a+=t.addLine(o),o="",s=0);var C=g===m.length-1;a+=t.addLine(v,!C),f=!1,o="",s=0}else b+s>p&&(f=!1,a+=t.addLine(o),o="",s=0),(o.length>0||!t.isBreakingSpace(v)||f)&&(o+=v,s+=b)}return a+=t.addLine(o,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var s=t.length*e;n=r.measureText(t).width+s,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var s=e[n],o=e[n+1];t.isBreakingSpace(s,o)||t.isNewline(s)?(""!==r&&(i.push(r),r=""),i.push(s)):r+=s}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var s=t.METRICS_STRING+t.BASELINE_SYMBOL,o=Math.ceil(n.measureText(s).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=o,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,o,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,a);var l=n.getImageData(0,0,o,h).data,c=l.length,u=4*o,d=0,f=0,p=!1;for(d=0;d<a;++d){for(var m=0;m<u;m+=4)if(255!==l[f+m]){p=!0;break}if(p)break;f+=u}for(i.ascent=a-d,f=c-u,p=!1,d=h;d>a;--d){for(m=0;m<u;m+=4)if(255!==l[f+m]){p=!0;break}if(p)break;f-=u}return i.descent=d-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},Object.defineProperty(t,"_canvas",{get:function(){if(!t.__canvas){var e=void 0;try{var i=new OffscreenCanvas(0,0),r=i.getContext("2d",WO);if(r&&r.measureText)return t.__canvas=i,i;e=mA.ADAPTER.createCanvas()}catch(t){e=mA.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_context",{get:function(){return t.__context||(t.__context=t._canvas.getContext("2d",WO)),t.__context},enumerable:!1,configurable:!0}),t}();XO._fonts={},XO.METRICS_STRING="|ÉqÅ",XO.BASELINE_SYMBOL="M",XO.BASELINE_MULTIPLIER=1.4,XO.HEIGHT_MULTIPLIER=2,XO._newlines=[10,13],XO._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var YO={texture:!0,children:!1,baseTexture:!0},qO=function(t){function e(e,i,r){var n=this,s=!1;r||(r=mA.ADAPTER.createCanvas(),s=!0),r.width=3,r.height=3;var o=KC.from(r);return o.orig=new hC,o.trim=new hC,(n=t.call(this,o)||this)._ownCanvas=s,n.canvas=r,n.context=r.getContext("2d",{willReadFrequently:!0}),n._resolution=mA.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=e,n.style=i,n.localStyleID=-1,n}return function(t,e){function i(){this.constructor=t}BO(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,s=this.context,o=XO.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=o.width,h=o.height,l=o.lines,c=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,f=o.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,h)+2*i.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=i.strokeThickness,s.textBaseline=i.textBaseline,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit;for(var p=i.dropShadow?2:1,m=0;m<p;++m){var g=i.dropShadow&&0===m,v=g?Math.ceil(Math.max(1,h)+2*i.padding):0,y=v*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";var x=i.dropShadowColor,b=EA("number"==typeof x?x:IA(x)),_=i.dropShadowBlur*this._resolution,w=i.dropShadowDistance*this._resolution;s.shadowColor="rgba("+255*b[0]+","+255*b[1]+","+255*b[2]+","+i.dropShadowAlpha+")",s.shadowBlur=_,s.shadowOffsetX=Math.cos(i.dropShadowAngle)*w,s.shadowOffsetY=Math.sin(i.dropShadowAngle)*w+y}else s.fillStyle=this._generateFillStyle(i,l,o),s.strokeStyle=i.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;var T=(c-f.fontSize)/2;(!e.nextLineHeightBehavior||c-f.fontSize<0)&&(T=0);for(var E=0;E<l.length;E++)r=i.strokeThickness/2,n=i.strokeThickness/2+E*c+f.ascent+T,"right"===i.align?r+=d-u[E]:"center"===i.align&&(r+=(d-u[E])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(l[E],r+i.padding,n+i.padding-v,!0),i.fill&&this.drawLetterSpacing(l[E],r+i.padding,n+i.padding-v)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,i,r,n){void 0===n&&(n=!1);var s=this._style.letterSpacing,o=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(0===s||o)return o&&(this.context.letterSpacing=s,this.context.textLetterSpacing=s),void(n?this.context.strokeText(t,i,r):this.context.fillText(t,i,r));for(var a=i,h=Array.from?Array.from(t):t.split(""),l=this.context.measureText(t).width,c=0,u=0;u<h.length;++u){var d=h[u];n?this.context.strokeText(d,a,r):this.context.fillText(d,a,r);for(var f="",p=u+1;p<h.length;++p)f+=h[p];a+=l-(c=this.context.measureText(f).width)+s,l=c}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=function(t){var e,i,r,n=t.width,s=t.height,o=t.getContext("2d",{willReadFrequently:!0}),a=o.getImageData(0,0,n,s).data,h=a.length,l={top:null,left:null,right:null,bottom:null},c=null;for(e=0;e<h;e+=4)0!==a[e+3]&&(i=e/4%n,r=~~(e/4/n),null===l.top&&(l.top=r),(null===l.left||i<l.left)&&(l.left=i),(null===l.right||l.right<i)&&(l.right=i+1),(null===l.bottom||l.bottom<r)&&(l.bottom=r));return null!==l.top&&(n=l.right-l.left,s=l.bottom-l.top+1,c=o.getImageData(l.left,l.top,n,s)),{height:s,width:n,data:c}}(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,s=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this.dirty=!1},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},e.prototype.updateTransform=function(){this.updateText(!0),t.prototype.updateTransform.call(this)},e.prototype.getBounds=function(e,i){return this.updateText(!0),-1===this._textureID&&(e=!1),t.prototype.getBounds.call(this,e,i)},e.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var s=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,a=this.canvas.width/this._resolution-s-2*o,h=this.canvas.height/this._resolution-s-2*o,l=n.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var u=l.length+1,d=1;d<u;++d)c.push(d/u);if(l.unshift(n[0]),c.unshift(0),l.push(n[n.length-1]),c.push(1),t.fillGradientType===DO.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,o,a/2,h+o);var f=i.fontProperties.fontSize+t.strokeThickness;for(d=0;d<e.length;d++){var p=i.lineHeight*(d-1)+f,m=i.lineHeight*d,g=m;d>0&&p>m&&(g=(m+p)/2);var v=m+f,y=i.lineHeight*(d+1),x=v;d+1<e.length&&y<v&&(x=(v+y)/2);for(var b=(x-g)/h,_=0;_<l.length;_++){var w=0;w="number"==typeof c[_]?c[_]:_/l.length;var T=Math.min(1,Math.max(0,g/h+w*b));T=Number(T.toFixed(5)),r.addColorStop(T,l[_])}}}else{r=this.context.createLinearGradient(o,h/2,a+o,h/2);var E=l.length+1,S=1;for(d=0;d<l.length;d++){var I=void 0;I="number"==typeof c[d]?c[d]:S/E,r.addColorStop(I,l[d]),S++}}return r},e.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},YO,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=kA(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 this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=kA(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof VO?t:new VO(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e.experimentalLetterSpacing=!1,e}(NO);_A=!0,AM.registerPlugin("interaction",oO),AM.registerPlugin("batch",FM),ZM.registerPlugin(iC),ZM.registerPlugin(CO),MR.prototype.drawBox=function(t){const e=t.getCorners();this.beginFill();for(let t=0;t<4;t++){const i=e[t],r=e[(t+1)%4],n=(new Ug).subtractVectors(r,i).normalize();this.moveTo(i.x-n.x,i.y-n.y),this.lineTo(r.x+n.x,r.y-n.y)}this.endFill()},MR.prototype.fillBox=function(t){const e=t.getSize();this.drawRect(t.min.x,t.min.y,e.x,e.y)},MR.prototype.drawLine=function(t){if(this.beginFill(),t instanceof qw)this.moveTo(t.start.x,t.start.y),this.lineTo(t.end.x,t.end.y);else for(let e=0;e<t.length-1;e++)this.moveTo(t[e].x,t[e].y),this.lineTo(t[e+1].x,t[e+1].y);this.endFill()},MR.prototype.drawDashLine=function(t,e,i=16,r=8){const n=this.currentPath.points,s={x:n[n.length-2]||0,y:n[n.length-1]||0},o=Math.abs(t),a=Math.abs(e),h=Math.atan((e-s.y)/(t-s.x));for(;Math.abs(s.x)<o||Math.abs(s.y)<a;)s.x=Math.abs(s.x+i*Math.cos(h))<o?s.x+i*Math.cos(h):t,s.y=Math.abs(s.y+i*Math.sin(h))<a?s.y+i*Math.sin(h):e,this.lineTo(s.x,s.y),s.x=Math.abs(s.x+r*Math.cos(h))<o?s.x+r*Math.cos(h):t,s.y=Math.abs(s.y+r*Math.sin(h))<a?s.y+r*Math.sin(h):e,this.moveTo(s.x,s.y)};var KO=class extends eR{constructor(t,e,i){super(),A(this,"type","transform"),A(this,"wireframe"),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"cursorPoint",new Lw),A(this,"lastPoint",new Lw),A(this,"startPoint",new Lw),A(this,"rotationAngle",0),A(this,"active",!1),A(this,"enableAdsorption",!0),A(this,"scaleParam"),A(this,"activeType","null"),A(this,"lastWorldPosition",new $w),A(this,"_ignoreInteraction",!1),A(this,"firstClickPoint",new Lw),A(this,"_pageDataUtils"),A(this,"adsorptionGizmo"),A(this,"selectorGizmo"),A(this,"onSelectorGizmoTrigger",!1),A(this,"graphics",new MR),A(this,"_isLockScale",!0),A(this,"isShiftDown",!1),A(this,"nameText",new qO("",{fontSize:14,fill:Lk.config.gestureHandlerConfig.transformGizmoConfig.sizeTextColor,align:"left"})),A(this,"imageSprite"),A(this,"groupSprite"),A(this,"textSprite"),A(this,"videoSprite"),this._pageDataUtils=t,this.selectorGizmo=i,this.adsorptionGizmo=e,this.wireframe={edges:[],anchor:new Lw,scaleCorners:[],rotationCorners:[],interactive:!0,cornerEnable:!0,directionEnable:!0,rotationEnabled:!0,scaleEnabled:!0,box:new Kw,totalBox:new Kw,childrenBoxes:[],activeType:"null",interactiveDirection:new Lw,scaleCorner:new Lw,scaleEdgeCorners:[]},this.imageSprite=NO.from(Lk.config.gestureHandlerConfig.transformGizmoConfig.pictureLogoUrl),this.imageSprite.width=15,this.imageSprite.height=15,this.groupSprite=NO.from(Lk.config.gestureHandlerConfig.transformGizmoConfig.groupLogoUrl),this.groupSprite.width=15,this.groupSprite.height=15,this.textSprite=NO.from(Lk.config.gestureHandlerConfig.transformGizmoConfig.textLogoUrl),this.textSprite.width=15,this.textSprite.height=15,this.videoSprite=NO.from(Lk.config.gestureHandlerConfig.transformGizmoConfig.videoLogoUrl),this.videoSprite.width=15,this.videoSprite.height=15}get interactive(){return Lk.config.gestureHandlerConfig.transformGizmoEnabled}set interactive(t){Lk.config.gestureHandlerConfig.transformGizmoEnabled=t,this.ignoreInteraction=t}get isLockScale(){return this._isLockScale}set isLockScale(t){t!==this.isLockScale&&(this._isLockScale=t)}get infoType(){const t=this._pageDataUtils.getSelectedItems();return 1===t.length?t[0].type:en.ItemType.base}get ignoreInteraction(){return this._ignoreInteraction}set ignoreInteraction(t){t!==this._ignoreInteraction&&(this._ignoreInteraction=t,this.wireframe.cornerEnable=t)}actionKey(t){this.isShiftDown=t.shiftKey}endActionKey(t){this.isShiftDown=t.shiftKey}getRenderObjects(){const t=[];if(!this.interactive)return t;if(this.refreshRenderObject(),t.push(this.graphics),this.infoType!==en.ItemType.base&&Lk.config.gestureHandlerConfig.transformGizmoConfig.infoShowEnabled)switch(t.push(this.nameText),this.infoType){case"sprite":t.push(this.imageSprite);break;case"group":t.push(this.groupSprite);break;case"text":Lk.config.gestureHandlerConfig.textGizmoEnbaled||t.push(this.textSprite);break;case"video":t.push(this.videoSprite)}return t}cancelPreparation(){this.active=!1,this.wireframe.activeType="null"}preparationAction(t){if(!this.interactive)return void console.warn("Transform gizmo is not opened, use #SDK.openTransformGizmo() open this feature.");const e=new Lw(t.offsetX,t.offsetY),i=this.wireframe;this.refreshTransformType(e);const{interactiveDirection:r}=i;return this.refreshCursorResult(this.activeType,Uw(r)),"translation"===this.activeType&&(this.onSelectorGizmoTrigger="selector"===this.selectorGizmo.preparationAction(t,"transform")),this.active="null"!==this.activeType,this.active?this.type:void 0}preAction(t,e=!1){if(this._pageDataUtils.saveUndoRedoOldData(),this.active=1===t.buttons,this.startPoint=new Lw(t.clientX,t.clientY),this.lastPoint=new Lw(t.clientX,t.clientY),this.cursorPoint=new Lw(t.offsetX,t.offsetY),1!==t.buttons)return;if(e)return this.selectorGizmo.preAction(t,e,new Lw(t.offsetX,t.offsetY));this.active=!0,"null"===this.wireframe.activeType&&(this.wireframe.activeType="translation");const i=this.cursorPoint.clone().subtract(this._pageDataUtils.getViewportLeftTopPosition());return this.initInteractionPlane(i),this.lastWorldPosition=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(i)??new $w,this.activeType=e?"null":this.activeType,this.type}action(t){if(!this.interactive)return void console.warn("Transform gizmo is not opened, use #SDK.openTransformGizmo() open this feature.");if(!this.active){this.active=!0,this.refreshWireframeBySelectedItems(),this.wireframe.activeType="translation",this.lastPoint.set(t.clientX,t.clientY),this.cursorPoint.set(t.offsetX,t.offsetY);const e=this.cursorPoint.clone().subtract(this._pageDataUtils.getViewportLeftTopPosition());this.initInteractionPlane(e),this.lastWorldPosition=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(e)??new $w}const e=new Lw(t.clientX,t.clientY),i=(new Lw).subtractVectors(e,this.lastPoint);if(!this.wireframe.interactive||i.length()<=0)return;const r=this._pageDataUtils.getSelectedItems(),{anchor:n,activeType:s,interactiveDirection:o,scaleCorner:a}=this.wireframe,h=this._pageDataUtils.getPageData();Be(h);let l=0;switch(s){case"rotation":{const t=n.clone(),e=new $w,s=Gw(Vw((new Lw).subtractVectors(this.cursorPoint,t),(new Lw).subtractVectors(this.cursorPoint.add(i),t))*zw,3);e.z=s,this.rotationAngle+=s,l=Uw(o)+this.rotationAngle*Bw,r.forEach(t=>{this._pageDataUtils.rotateItem(t.id,e)});break}case"translation":{const t=i.clone();if(this.enableAdsorption){const e=h.items.map(t=>r.find(e=>e.id===t.id)||0!==r.filter(e=>t.parentId&&t.parentId===e.id).length||!this._pageDataUtils.getItemEditEnable(t.id)||r.find(e=>e.parentId===t.id)?new Kw:this._pageDataUtils.getViewBoxById(t.id)).filter(t=>!t.isEmpty()),i=new Lw(this.adsorptionGizmo.absorptionResult.x??0,this.adsorptionGizmo.absorptionResult.y??0);this.adsorptionGizmo.boxTranslationAdsorption(t,this.wireframe.box,e);const n=new Lw(this.adsorptionGizmo.absorptionResult.x??0,this.adsorptionGizmo.absorptionResult.y??0);t.add(i).subtract(n)}const e=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(this.cursorPoint.add(t).clone().subtract(this._pageDataUtils.getViewportLeftTopPosition()));if(e){const t=e.clone().subtract(this.lastWorldPosition);r.forEach(e=>{t.x=Gw(t.x,5),t.y=Gw(t.y,5),t.z=Gw(t.z,5),this._pageDataUtils.moveItem(e.id,t)}),this.lastWorldPosition.copyFrom(e)}break}case"scale":{const t=this.cursorPoint.add(i).clone().subtract(this._pageDataUtils.getViewportLeftTopPosition());if(!a||!this.scaleParam)return;const e=this.scaleParam.farthestCorner;(a.x-e.x)*(this.cursorPoint.x-e.x)>0&&(a.y-e.y)*(this.cursorPoint.y-e.y)>0||!this.isLockScale||this.isShiftDown||(t.x=e.x+(a.x-e.x)/Math.abs(a.x-e.x)*4,t.y=e.y+(a.y-e.y)/Math.abs(a.y-e.y)*4);const n=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t);if(n){const t=this._pageDataUtils.getSelectedItems()[0]??void 0,e=this._pageDataUtils.getItemTransformById(t?.id??""),i=(new Qw).extractRotation(e.matrix).invert(),{corner:s,center:o,shift:a,lastScalar:h}=this.scaleParam,l=(new $w).subtractVectors(s,o).applyMatrix(i),c=l.clone().multiply(h),u=n.clone().subtract(a).subtract(o).applyMatrix(i),d=new $w(1,1,1);if(!this.isLockScale||this.isShiftDown)d.x=Hw(c.x,0)?1:u.x/c.x,d.y=Hw(c.y,0)?1:u.y/c.y,d.z=Hw(c.z,0)?1:u.z/c.z;else{const t=jw([Hw(l.x,0)?1:Math.abs(u.x/l.x),Hw(l.y,0)?1:Math.abs(u.y/l.y)]),e=u.toArray()[t],i=c.toArray()[t];if(Hw(h.x,h.y)&&Hw(h.z,h.x)){const t=Hw(i,0)?1:Math.abs(e/i);d.set(t,t,t)}else if(0===t){d.x=Hw(i,0)?1:Math.abs(e/i);const t=l.y*e/l.x;d.y=Hw(c.y,0)?1:t/c.y;const r=l.z*e/l.x;d.z=Hw(c.z,0)?1:r/c.z}else if(1===t){d.y=Hw(i,0)?1:Math.abs(e/i);const t=l.x*e/l.y;d.x=Hw(c.x,0)?1:t/c.x;const r=l.z*e/l.y;d.z=Hw(c.z,0)?1:r/c.z}else{d.z=Hw(i,0)?1:Math.abs(e/i);const t=l.x*e/l.z;d.x=Hw(c.x,0)?1:t/c.x;const r=l.y*e/l.z;d.y=Hw(c.y,0)?1:r/c.y}}const f=d.clone().subtract(new $w(1,1,0)).divide(2).add(new $w(1,1,.5)),p=o.clone().add((new $w).subtractVectors(s,o).multiply(new $w(h.x,h.y,1)));this.scaleParam.lastScalar.multiply(f);const m=o.clone().add((new $w).subtractVectors(s,o).multiply(new $w(this.scaleParam.lastScalar.x,this.scaleParam.lastScalar.y,1))),g=(new $w).subtractVectors(m,p);g.x=Gw(g.x,5),g.y=Gw(g.y,5),g.z=Gw(g.z,5),this.scaleParam.center.add(g),this.scaleParam.corner.add(g),r.forEach(t=>{this._pageDataUtils.scaleItem(t.id,f),this._pageDataUtils.moveItem(t.id,g)}),this.lastWorldPosition.copyFrom(n)}l=Uw(o);break}}this.refreshCursorResult(s,l),this.lastPoint.copyFrom(e)}endAction(t){this._pageDataUtils.pushUndoRedoData(),this.active=!1;const{clientX:e,clientY:i,offsetX:r,offsetY:n}=t,s=new Lw(e,i);if(s.distanceTo(this.startPoint)<4&&this.onSelectorGizmoTrigger){const t=this.selectorGizmo.hitTest(new Lw(r,n));this.isShiftDown||this._pageDataUtils.clearSelectedItems(0===t.length),this.selectorGizmo.addSelectedItem(t[0])}else{const t=(new Lw).subtractVectors(s,this.lastPoint);this.cursorPoint.add(t);const e=this.wireframe;this.refreshTransformType(this.cursorPoint);const{activeType:i,interactiveDirection:r}=e;this.refreshCursorResult(i,Uw(r)),this.adsorptionGizmo.clearAbsorptionResult()}this.onSelectorGizmoTrigger=!1,this.rotationAngle=0,this.lastPoint=new Lw,this.startPoint=new Lw,this.cursorPoint=new Lw}interruption(){this.active=!1,this.cursorResult.type="normal",this.adsorptionGizmo.clearAbsorptionResult()}refreshCursorResult(t,e=0){switch(t){case"scale":this.cursorResult={type:"scale",angle:(e+Math.PI/4)*zw};break;case"rotation":this.cursorResult={type:"rotation",angle:(e+Math.PI/4)*zw};break;case"translation":case"null":this.cursorResult={type:"normal",angle:0}}}refreshResults(){const t=this.wireframe.activeType;this.refreshWireframeBySelectedItems(),t!==this.wireframe.activeType&&this.refreshCursorResult(this.wireframe.activeType)}initInteractionPlane(t){const e=this._pageDataUtils.getSelectedItems();switch(this.wireframe.activeType){case"scale":{const i=1==e.length?e[0]:void 0;let r,n,s;if(i){const t=this._pageDataUtils.getItemTransformById(i.id);r=(new $w).copyFrom(this._pageDataUtils.getPlayerItemById(i.id).transform.anchor).applyMatrix(t.matrix),n=(new $w).setFromMatrixPosition(t.matrix),s=(new tT).setFromQuaternion((new Jw).setFromRotationMatrix(t.matrix))}this._pageDataUtils.interactionUtils.initInteractionPlane(n,s);const{scaleCorner:o,box:a}=this.wireframe,h=a.corners[0].clone();let l=h.distanceTo(o);a.corners.forEach(t=>{t.distanceTo(o)>l&&(h.copyFrom(t),l=t.distanceTo(o))}),this.scaleParam={shift:new $w,center:new $w,corner:new $w,lastScalar:new $w(1,1,1),farthestCorner:h},this.scaleParam.center=r??n;const c=this._pageDataUtils.getViewportLeftTopPosition();if(["scale"].includes(this.wireframe.activeType)&&this.wireframe.scaleCorner){const t=this.wireframe.scaleCorner.clone().subtract(c);this.scaleParam.corner=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t)??new $w}this.scaleParam.shift=(this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t)??new $w).subtract(this.scaleParam.corner);break}case"translation":case"rotation":this._pageDataUtils.interactionUtils.initInteractionPlane()}}refreshRenderObject(){this.graphics.clear(),this.nameText.text="";const{wireframeAlpha:t,wireframeColor:e,wireframeWidth:i,cornerFillColor:r,cornerLineWidth:n,cornerLineColor:s,cornerLineAlpha:o,infoShowEnabled:a}=Lk.config.gestureHandlerConfig.transformGizmoConfig;if(!this.wireframe.box.isEmpty()){this.graphics.lineStyle(i,e,t),this.wireframe.edges.forEach(t=>{this.graphics.drawLine(t)});const h=t=>{t.corners.forEach((e,i)=>{const r=new qw(e,t.corners[(i+1)%4]);this.graphics.drawLine(r)})};if(this.wireframe.childrenBoxes.forEach(t=>{h(t)}),this.wireframe.cornerEnable&&(this.graphics.beginFill(r),this.graphics.lineStyle(n,s,o),this.wireframe.scaleCorners.forEach(t=>{this.graphics.drawCircle(t.center.x,t.center.y,t.radius)}),this.graphics.endFill()),this.infoType!==en.ItemType.base&&a){const t=this._pageDataUtils.getSelectedItems()[0],e="group"===t.type?"编组":"sprite"===t.type?"图片":"text"===t.type?"文本":"video"===t.type?"视频":"图片",{width:i,height:r,rotation:n}=t.property,s=[i,r],o="sprite"===this.infoType?this.imageSprite:"group"===this.infoType?this.groupSprite:"text"===this.infoType?this.textSprite:"video"===this.infoType?this.videoSprite:this.imageSprite,a=this.wireframe.box.corners[3],h=n[2]*Bw;o.anchor.set(0,1),o.x=a.x,o.y=a.y-5,o.rotation=-h;const l=a.clone().add(new Lw(20,0)).rotateAround(a,-h),c=new Lw(0,4).rotateAround(new Lw,h);this.nameText.text=` ${e} ${s.map(t=>Gw(t,0)).join(" * ")}`,this.nameText.anchor.set(0,1),this.nameText.x=l.x+c.x,this.nameText.y=l.y-c.y,this.nameText.rotation=-h}}}refreshTransformType(t){this.activeType="null";let e=!0;if(this.wireframe.interactiveDirection=new Lw,this.wireframe.scaleCorner=void 0,this.wireframe.scaleEdgeCorners=void 0,this.wireframe.interactive&&e&&this.wireframe.totalBox.containsPoint(t)){if(this.wireframe.scaleEnabled)for(let i=0,r=this.wireframe.scaleCorners.length;i<r;i++){if(this.wireframe.scaleCorners[i].containsPoint(t)){e=!1,this.activeType="scale",this.wireframe.activeType="scale",this.wireframe.scaleCorner=this.wireframe.scaleCorners[i].center.clone(),this.wireframe.interactiveDirection.copyFrom(this.wireframe.scaleCorners[i].center).subtract(this.wireframe.box.getCenter());break}}if(e&&this.wireframe.box.containsPoint(t,!1)&&(e=!1,this.activeType="translation",this.wireframe.activeType="translation"),this.wireframe.rotationEnabled)for(let i=0,r=this.wireframe.scaleCorners.length;i<r;i++){if(this.wireframe.rotationCorners[i].containsPoint(t)&&e){e=!1,this.activeType="rotation",this.wireframe.activeType="rotation",this.wireframe.interactiveDirection.copyFrom(this.wireframe.rotationCorners[i].center).subtract(this.wireframe.box.getCenter());break}}}}refreshWireframeBySelectedItems(){const t=this._pageDataUtils.getSelectedItems(),e=new Kw;if(this.wireframe.edges=[],this.wireframe.scaleCorners=[],this.wireframe.childrenBoxes=[],this.wireframe.rotationCorners=[],this.wireframe.rotationEnabled="template"===Lk.config.mode,this.wireframe.scaleEnabled=1===t.length&&"group"!==t[0].type||"template"===Lk.config.mode,this.wireframe.cornerEnable=1===t.length&&"group"!==t[0].type||"template"===Lk.config.mode,t.length>1)t.forEach(t=>{if(this._pageDataUtils.getItemShow(t.id)){const i=this._pageDataUtils.getViewBoxById(t.id);e.union(i),this.wireframe.childrenBoxes.push((new Kw).copyFrom(i).expandByScalar(1))}}),this.wireframe.anchor=e.getCenter(),this.wireframe.interactive=!0;else if(1===t.length){const i=t[0];if("text"!==i.type&&this._pageDataUtils.getItemShow(i.id)){const t=this._pageDataUtils.getViewBoxById(i.id);e.copyFrom(t),this.wireframe.anchor=this._pageDataUtils.getItemViewAnchor(i.id)??e.getCenter(),this.wireframe.interactive=this._pageDataUtils.getItemEditEnable(i.id)}}const i=e.isEmpty(),r=i?0:1,n=i?0:16;this.wireframe.activeType=t.length?this.wireframe.activeType:"null",this.wireframe.box.copyFrom(e).expandByScalar(r),this.wireframe.totalBox.copyFrom(e).expandByScalar(n);const s=this.wireframe.box.corners;s.forEach((t,e)=>{this.wireframe.edges.push(new qw((new Lw).copyFrom(t),(new Lw).copyFrom(s[(e+1)%4])))});const{scaleCircleSize:o,rotationCircleSize:a}=Lk.config.gestureHandlerConfig.transformGizmoConfig;1===t.length&&this.wireframe.box.corners.forEach(t=>{this.wireframe.scaleCorners.push(new Zw(t,o));const e=(new Lw).subtractVectors(t,this.wireframe.box.getCenter()),i=(new Lw).copyFrom(this.wireframe.box.getCenter()).add((new Lw).copyFrom(e).normalize().multiply(e.length()+a-o));this.wireframe.rotationCorners.push(new Zw(i,a))})}setAdsorptionEnabled(t){this.enableAdsorption=t}},ZO=class extends eR{constructor(){super(...arguments),A(this,"results",[]),A(this,"graphics",new MR),A(this,"absorptionResult",{}),A(this,"type","adsorption")}get interactive(){return Lk.config.gestureHandlerConfig.adsorptionGizmoEnabled}set interactive(t){Lk.config.gestureHandlerConfig.adsorptionGizmoEnabled=t}preparationAction(){}getCursorState(){}preAction(){}action(){}cancelPreparation(){}actionKey(){}endActionKey(){}endAction(){}interruption(){}boxTranslationAdsorption(t,e,i,r=!0,n=!0){if(this.results=[],!this.interactive)return void console.warn("Adsorption gizmo is not opened, use #SDK.setAdsorptionConfig() open this feature.");if(e.isEmpty())return;const s=new Lw(this.absorptionResult?.x??0,this.absorptionResult?.y??0).add(t),o=e.clone().translate(s),a=o.getCenter();this.absorptionResult={},i.forEach(t=>{if(t.isEmpty())return;t.corners.forEach(t=>{o.corners.forEach(e=>{this.getPointAbsorption(e,t,r,n)}),this.getPointAbsorption(a,t,r,n)});const e=t.getCenter();this.getPointAbsorption(a,e,r,n),o.corners.forEach(t=>{this.getPointAbsorption(t,e,r,n)})})}pointTranslationAdsorption(t,e,i,r=!0,n=!0){if(this.results=[],!this.interactive)return void console.warn("Adsorption is not opened, use #SDK.setAdsorptionConfig() open this feature.");const s=new Lw(this.absorptionResult?.x??0,this.absorptionResult?.y??0).add(t),o=e.clone().add(s);this.absorptionResult={},i.forEach(t=>{this.getPointAbsorption(o,t,r,n)})}getPointAbsorption(t,e,i=!0,r=!0){i&&Math.abs(t.x-e.x)<Lk.config.gestureHandlerConfig.adsorptionGizmoConfig.distance&&this.refreshPointAbsorptionResult(t,e,"x"),r&&Math.abs(t.y-e.y)<Lk.config.gestureHandlerConfig.adsorptionGizmoConfig.distance&&this.refreshPointAbsorptionResult(t,e,"y")}refreshPointAbsorptionResult(t,e,i){const r=t[i]-e[i],n="x"===i?"xPoints":"yPoints";if(this.absorptionResult&&void 0===this.absorptionResult[i])this.absorptionResult[i]=r,this.absorptionResult[n]=[{point:t,targets:[e]}];else if(Math.abs(r)-Math.abs(this.absorptionResult[i]??0)<=.005)if(Math.abs(Math.abs(r)-Math.abs(this.absorptionResult[i]??0))<.05&&r*(this.absorptionResult[i]??0)>0)if(void 0===this.absorptionResult[n])this.absorptionResult[i]=r,this.absorptionResult[n]=[{point:t,targets:[e]}];else{const i=this.absorptionResult[n].filter(e=>e.point.equals(t));void 0===i||0===i.length?this.absorptionResult[n]?.push({point:t,targets:[e]}):i[0]?.targets.push(e)}else this.absorptionResult[i]=r,this.absorptionResult[n]=[{point:t,targets:[e]}]}refreshResults(){if(void 0===this.absorptionResult)return;const{x:t,y:e,xPoints:i,yPoints:r}=this.absorptionResult,n=new Lw(t??0,e??0);void 0!==t&&void 0!==i&&i.forEach(t=>{const e=t.point.clone().subtract(n),i=e.clone(),r=e.clone();t.targets.forEach(t=>{i.x=t.x,i.y=Math.min(i.y,t.y),r.x=t.x,r.y=Math.max(r.y,t.y)}),this.results.push(new qw(i,r))}),void 0!==e&&void 0!==r&&r.forEach(t=>{const e=t.point.clone().subtract(n),i=e.clone(),r=e.clone();t.targets.forEach(t=>{i.y=t.y,i.x=Math.min(i.x,t.x),r.y=t.y,r.x=Math.max(r.x,t.x)}),this.results.push(new qw(i,r))})}refreshRenderObject(){this.graphics.clear();const{lineWidth:t,lineColor:e}=Lk.config.gestureHandlerConfig.adsorptionGizmoConfig;this.results.forEach(i=>{this.graphics.lineStyle(t,e),this.graphics.drawLine(i)})}getRenderObjects(){return this.interactive?(this.refreshResults(),this.refreshRenderObject(),[this.graphics]):[]}clearAbsorptionResult(){this.results=[],this.absorptionResult={}}},JO=class extends eR{constructor(t){super(),A(this,"safeAreaSprites",new Map),A(this,"box",new Kw),A(this,"graphics",new MR),A(this,"PageDataUtils"),A(this,"type","preference"),this.PageDataUtils=t}preparationAction(){}preAction(){}action(){}endAction(){}interruption(){}actionKey(){}endActionKey(){}cancelPreparation(){}refreshResults(){if(this.box=new Kw,!this.interactive)return void console.warn("Preference gizmo is not opened, use #SDK.setAdsorptionConfig() open this feature.");if("editor"===Lk.config.mode)return;const t=this.PageDataUtils.getPageData();Be(t);const{container:e}=this.PageDataUtils;if(e){const{zoom:i}=t.property,{offsetWidth:r,offsetHeight:n}=e,s=new Lw(r,n).multiply(i),o=this.PageDataUtils.getViewportLeftTopPosition().add(s.clone().divide(2));this.box=(new Kw).setFromCenterAndSize(o,s)}}refreshRenderObjects(){if("editor"===Lk.config.mode)return;const{boxWidth:t,boxColor:e,markColor:i,markAlpha:r,safeAreaEnabled:n,safeAreaBoxColor:s,safeAreaBoxAlpha:o}=Lk.config.gestureHandlerConfig.preferenceGizmoConfig;this.graphics=new MR;const{offsetWidth:a,offsetHeight:h}=this.PageDataUtils.container.parentElement,l=new Kw(new Lw(0,0),new Lw(a,this.box.min.y)),c=new Kw(new Lw(0,this.box.min.y),new Lw(this.box.min.x,h)),u=new Kw(new Lw(this.box.min.x,this.box.max.y),new Lw(a,h)),d=new Kw(new Lw(this.box.max.x,this.box.min.y),new Lw(a,this.box.max.y));if(this.graphics.beginFill(i,r),this.graphics.fillBox(l),this.graphics.fillBox(c),this.graphics.fillBox(u),this.graphics.fillBox(d),this.graphics.endFill(),n){const t=this.PageDataUtils.getViewProperty();if(t){const{size:e,safeArea:i,previewSafeAreas:r}=t,[n,a,h,l]=i,c=this.box.getSize(),u=n/e[1]*c.y,d=h/e[0]*c.x,f=l/e[0]*c.x,p=a/e[1]*c.y,{min:m,max:g}=this.box;this.graphics.beginFill(s,o);const v=new Kw(m,new Lw(g.x,m.y+u)),y=new Kw(new Lw(m.x,m.y+u),new Lw(m.x+d,g.y)),x=new Kw(new Lw(g.x-f,m.y+u),new Lw(g.x,g.y)),b=new Kw(new Lw(m.x+d,g.y-p),new Lw(g.x-f,g.y));this.graphics.fillBox(v),this.graphics.fillBox(y),this.graphics.fillBox(x),this.graphics.fillBox(b),this.graphics.endFill(),r.forEach(t=>{const{box:[i,r,n,s],color:o,url:a,visible:h}=t;if(!1===h)return;const l=this.box.getSize(),c=new Lw(n/e[0]*l.x,s/e[1]*l.y),u=new Lw(i/e[0]*l.x+c.x/2,r/e[1]*l.y+c.y/2).add(m),d=(new Kw).setFromCenterAndSize(u,c);if(a){let t=this.safeAreaSprites.get(a);t||(t=NO.from(a),t.anchor.set(.5,.5),this.safeAreaSprites.set(a,t)),t.x=u.x,t.y=u.y,t.width=c.x,t.height=c.y,this.graphics.addChild(t)}else{const t=o?.[3]??.3,e=o?.slice(0,3)??[255,0,0],i=e[0]<<16|e[1]<<8|e[2];this.graphics.beginFill(i,t),this.graphics.fillBox(d),this.graphics.endFill()}})}}this.graphics.lineStyle(t,e),this.graphics.drawBox(this.box)}getRenderObjects(){return Lk.config.gestureHandlerConfig.preferenceGizmoEnabled&&"editor"!==Lk.config.mode?(this.refreshRenderObjects(),[this.graphics]):[]}get interactive(){return Lk.config.gestureHandlerConfig.preferenceGizmoEnabled}set interactive(t){Lk.config.gestureHandlerConfig.preferenceGizmoEnabled=t}},$O="https://mdn.alipayobjects.com/rms/uri/file/as/0.0.6",QO={normal:{type:"preset",content:"default"},rotation:{type:"svg",content:"default",url:`${$O}/icons/cursor-rotate-32.svg`},circle:{type:"svg",content:"default",url:`${$O}/icons/cursor-rotate-32.svg`},scale:{type:"svg",content:"default",url:`${$O}/icons/cursor-scale-32.svg`},hand:{type:"preset",content:"grab"},pointer:{type:"preset",content:"pointer"},"text-create":{type:"preset",content:"text"},"active-hand":{type:"preset",content:"grabbing"},"frame-create":{type:"preset",content:"crosshair"},"text-rotation":{type:"svg",content:"default",url:"https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*R722QoloC44AAAAAKkAAAAgAev-aAQ/original"}};var tD=class{constructor(){A(this,"index",-1),A(this,"operations",[])}get canUndo(){return this.index>-1}get canRedo(){return this.index<this.operations.length-1}push(t){this.index++,this.operations[this.index]=t,this.operations.length=this.index+1}undo(){if(this.index<0)return;const t=this.operations[this.index];return this.index--,t}redo(){if(!(this.index>=this.operations.length-1))return this.index++,this.operations[this.index]}clear(){this.operations=[],this.index=-1}},eD=class{constructor(){A(this,"index",-1),A(this,"operations",[]),A(this,"oldData")}get canUndo(){return this.index>-1}get canRedo(){return this.index<this.operations.length-1}push(t){this.index++,this.operations[this.index]=t,this.operations.length=this.index+1}undo(){if(this.index<0)return;const t=this.operations[this.index];return this.index--,t}redo(){if(!(this.index>=this.operations.length-1))return this.index++,this.operations[this.index]}clear(){this.operations=[],this.index=-1}};function iD(t,e="item doesn't exist"){if(null==t)throw new Error(e)}function rD(t,e="asserts failed"){if(!t)throw new Error(e)}function nD(t,e,...i){const r=e.reduce((t,e)=>t?`${t} ${e}`:e,""),n="color: #108ee9;";switch(t){case"error":console.error(`%c[${r}]`,n,...i);break;case"info":console.info(`%c[${r}]`,n,...i);break;case"debug":console.debug(`%c[${r}]`,n,...i);break;case"warn":console.warn(`%c[${r}]`,n,...i);break;default:console.log(`%c[${r}]`,n,...i)}}function sD(t,e){if(Object.is(t,e))return!0;if(typeof t!=typeof e)return!1;if(null===t||"object"!=typeof t)return!1;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.toString()===e.toString();if(Array.isArray(t)!==Array.isArray(e))return!1;const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(const r of i){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!sD(t[r],e[r]))return!1}return!0}var oD=class extends eR{constructor(t,e){super(),A(this,"result",{type:"invalid"}),A(this,"interactionParam",{type:"none"}),A(this,"graphics",new MR),A(this,"isShiftDown",!1),A(this,"_isLockScale",!1),A(this,"_pageDataUtils"),A(this,"_eventEmitter"),A(this,"type","picture-cut"),A(this,"_undoRedo",new tD),A(this,"_oldNormalizeCutBox"),A(this,"cursorResult",{type:"normal",angle:0}),this._pageDataUtils=t,this._eventEmitter=e}get undoRedo(){return this._undoRedo}get interactive(){return Lk.config.gestureHandlerConfig.pictureCutGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.pictureCutGizmoEnabled&&(1!==this._pageDataUtils.getPageData()?.activeData.selectedItems?.length?console.warn("Selected items` length is not one, Picture cut gizmo can not open."):Lk.config.gestureHandlerConfig.pictureCutGizmoEnabled=t)}get isLockScale(){return this._isLockScale}set isLockScale(t){t!==this.isLockScale&&(this._isLockScale=t)}preparationAction(t){if(!this.interactive)return;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);return this.refreshInteractionType(e,i),this.type}preAction(t,e){if(this.interactive&&"none"!==this.interactionParam.type)return"valid"===this.result.type&&(this._oldNormalizeCutBox={normalizeCutBox:this.result.normalizeCutBox.clone()}),this.type}action(t){var e;if(!this.interactive||"none"===this.interactionParam.type||"invalid"===this.result.type)return;const i=new Lw(t.clientX,t.clientY),{startMouse:r,box:n}=this.interactionParam,s=(new Lw).subtractVectors(i,r),{itemBox:o}=this.result,{min:a,max:h}=o;switch(this.interactionParam.type){case"move":{const{min:t,max:e}=n,i=a.x-t.x,r=h.x-e.x,l=a.y-t.y,c=h.y-e.y;s.x=Math.min(Math.max(s.x,i),r),s.y=Math.min(Math.max(s.y,l),c);const u=n.clone().translate(s);this.result.normalizeCutBox=Yw(o,u),this._eventEmitter.emit("cutBoxChange",this.getCutBox());break}case"scale":{const{startCorner:t,anchor:i}=this.interactionParam,r=new Lw;if(r.x=Math.min(Math.max(t.x+s.x,a.x),h.x),r.y=Math.min(Math.max(t.y+s.y,a.y),h.y),this.isShiftDown||this.isLockScale){const s=this.getCutBox(),{x:o,y:l}=s.getSize(),{x:c,y:u}=n.getSize();if((e=this.interactionParam).lockedAspect??(e.lockedAspect=o/l),Math.abs(r.x-i.x)/c>Math.abs(r.y-i.y)/u){const e=Math.abs(r.x-i.x)/this.interactionParam.lockedAspect;Hw(t.y,i.y)?r.y=t.y:r.y=(t.y-i.y)/Math.abs(t.y-i.y)*e+i.y,r.y=Math.min(Math.max(r.y,a.y),h.y)}else{const e=Math.abs(r.y-i.y)*this.interactionParam.lockedAspect;Hw(t.x,i.x)?r.x=t.x:r.x=(t.x-i.x)/Math.abs(t.x-i.x)*e+i.x,r.x=Math.min(Math.max(r.x,a.x),h.x)}}if(Hw(t.x,i.x)||Hw(t.y,i.y)){const e=n.corners[0].clone();let i=e.distanceTo(t);n.corners.forEach(r=>{r.distanceTo(t)>i&&(e.copyFrom(r),i=r.distanceTo(t))}),this.result.normalizeCutBox=Yw(o,(new Kw).setFromVec2Array([e,r]))}else{const e=(r.x-i.x)/(t.x-i.x),s=(r.y-i.y)/(t.y-i.y),a=new Lw(e,s);this.result.normalizeCutBox=Yw(o,n.clone().scale(a,i))}this._eventEmitter.emit("cutBoxChange",this.getCutBox());break}case"direction-scale":{const{index:t}=this.interactionParam,e=n.corners[t].clone();t%2==0?(s.x=Math.min(Math.max(e.x+s.x,a.x),h.x)-e.x,s.y=0):(s.x=0,s.y=Math.min(Math.max(e.y+s.y,a.y),h.y)-e.y);const i=n.corners.map((e,i)=>[t,(t+1)%4].includes(i)?e.clone().add(s):e.clone());this.result.normalizeCutBox=Yw(o,(new Kw).setFromVec2Array(i)),this._eventEmitter.emit("cutBoxChange",this.getCutBox());break}}}endAction(t){if(!this.interactive||"none"===this.interactionParam.type)return;this._oldNormalizeCutBox&&"valid"===this.result.type&&this._undoRedo.push({type:"update",oldData:this._oldNormalizeCutBox,newData:{normalizeCutBox:this.result.normalizeCutBox.clone()}}),this._oldNormalizeCutBox=void 0;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);return this.refreshInteractionType(e,i),this.type}interruption(){this.interactionParam={type:"none"}}actionKey(t){this.isShiftDown=t.shiftKey}endActionKey(t){this.isShiftDown=t.shiftKey,"lockedAspect"in this.interactionParam&&delete this.interactionParam.lockedAspect}cancelPreparation(){this.interactionParam={type:"none"}}refreshResults(){if(this.interactive){const t=this._pageDataUtils.getPageData();if(iD(t,"You must call SDK#run() first"),1!==t.activeData.selectedItems.length)console.warn("Picture Cut Gizmo can edit one picture at a time.");else if("invalid"===this.result.type){const e=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]);this.result={type:"valid",itemBox:e.clone(),normalizeCutBox:new Kw(new Lw,new Lw(1,1))}}else{const e=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]),i=e.getCenter().subtract(this.result.itemBox.getCenter()),r=e.getSize().x/this.result.itemBox.getSize().x;this.result.itemBox.translate(i),this.result.itemBox.scale(r)}}else this.result={type:"invalid"}}refreshRenderObjects(){if(this.graphics.clear(),!this.interactive||"invalid"===this.result.type)return[];const{maskColor:t,maskAlpha:e,cutBoxLineWidth:i,cutBoxLineColor:r,cutBoxLineAlpha:n,itemBoxLineWidth:s,itemBoxLineColor:o,itemBoxLineAlpha:a,cutBoxCornerRadius:h,cutBoxCornerFillColor:l,cutBoxCornerLineWidth:c,cutBoxCornerLineColor:u,cutBoxCornerLineAlpha:d,gridLineWidth:f,gridLineColor:p,gridLineAlpha:m,gridCount:g}=Lk.config.gestureHandlerConfig.pictureCutGizmoConfig,{normalizeCutBox:v,itemBox:y}=this.result,x=Xw(y,v),{min:b,max:_}=x,{min:w,max:T}=y,E=new Kw(w.clone(),new Lw(T.x,b.y)),S=new Kw(new Lw(w.x,b.y),new Lw(b.x,T.y)),I=new Kw(new Lw(_.x,b.y),new Lw(T.x,_.y)),A=new Kw(new Lw(b.x,_.y),T.clone());this.graphics.beginFill(t,e),this.graphics.fillBox(E),this.graphics.fillBox(S),this.graphics.fillBox(I),this.graphics.fillBox(A),this.graphics.endFill();const C=x.getSize().x/(g+1),P=x.getSize().y/(g+1);this.graphics.lineStyle(f,p,m);for(let t=1;t<=g;t++){const e=new qw(new Lw(b.x+C*t,b.y),new Lw(b.x+C*t,_.y)),i=new qw(new Lw(b.x,b.y+P*t),new Lw(_.x,b.y+P*t));this.graphics.drawLine(e),this.graphics.drawLine(i)}return this.graphics.lineStyle(s,o,a),this.graphics.drawBox(y),this.graphics.lineStyle(i,r,n),this.graphics.drawBox(x),this.graphics.beginFill(l),this.graphics.lineStyle(c,u,d),x.corners.forEach(t=>{this.graphics.drawCircle(t.x,t.y,h)}),this.graphics.endFill(),[this.graphics]}refreshCursorResult(t,e=0){switch(t){case"scale":case"direction-scale":this.cursorResult={type:"scale",angle:e};break;case"move":case"none":this.cursorResult={type:"normal",angle:0}}}getRenderObjects(){return this.interactive?this.refreshRenderObjects():[]}refreshInteractionType(t,e){if(this.interactionParam={type:"none"},!this.interactive||"invalid"===this.result.type)return;const{normalizeCutBox:i,itemBox:r}=this.result,n=Xw(r,i);let s=!1,o=0;n.corners.forEach((i,r)=>{s||i.distanceTo(t)<Lk.config.gestureHandlerConfig.pictureCutGizmoConfig.scaleInteractionDistance&&(s=!0,this.interactionParam={type:"scale",box:n.clone(),startMouse:e,startCorner:i.clone(),anchor:n.corners[(r+2)%4]},o=Math.PI/2*r)}),n.corners.forEach((i,r)=>{if(s)return;const a=new qw(i.clone(),n.corners[(r+1)%4]),h=t.distanceToLine(a);if(h.d>=0&&h.d<=8&&h.t>=0&&h.t<=1){s=!0;const t=a.at(h.t);this.interactionParam={type:"direction-scale",index:r,point:t,box:n.clone(),startMouse:e},o=Math.PI/2*r+Math.PI/4}}),n.containsPoint(t)&&!s&&(this.interactionParam={type:"move",point:t.clone(),box:n.clone(),startMouse:e},s=!0),this.refreshCursorResult(this.interactionParam.type,o*zw)}getCutInfo(){const[t]=this._pageDataUtils.getSelectedItems();if(this.interactive&&"invalid"!==this.result.type&&t)return{cutBox:this.getCutBox(),itemBox:this._pageDataUtils.getItemBoxById(t.id)}}getCutBox(){const[t]=this._pageDataUtils.getSelectedItems();if(!this.interactive||"invalid"===this.result.type||!t)return;const e=this._pageDataUtils.getItemBoxById(t.id),{normalizeCutBox:i}=this.result;return Xw(e,i)}setCutBox(t,e){const[i]=this._pageDataUtils.getSelectedItems();if(!this.interactive||"invalid"===this.result.type||!i)return;const r=this.result.normalizeCutBox.clone(),n=new Kw(t,e),s=this._pageDataUtils.getItemBoxById(i.id),{min:o,max:a}=Yw(s,n);this.result.normalizeCutBox.set(new Lw(Math.max(o.x,0),Math.max(o.y,0)),new Lw(Math.min(a.x,1),Math.min(a.y,1))),this._undoRedo.push({type:"update",oldData:{normalizeCutBox:r},newData:{normalizeCutBox:this.result.normalizeCutBox.clone()}});const h=this.getCutBox();return this._eventEmitter.emit("cutBoxChange",h),h}undo(){const t=this._undoRedo.undo();return!(!t||"valid"!==this.result.type)&&(this.result.normalizeCutBox=t.oldData.normalizeCutBox.clone(),this._eventEmitter.emit("cutBoxChange",this.getCutBox()),!0)}redo(){const t=this._undoRedo.redo();return!(!t||"valid"!==this.result.type)&&(this.result.normalizeCutBox=t.newData.normalizeCutBox.clone(),this._eventEmitter.emit("cutBoxChange",this.getCutBox()),!0)}get canUndo(){return this._undoRedo.canUndo}get canRedo(){return this._undoRedo.canRedo}clearUndoRedo(){this._undoRedo.clear()}};var aD=class extends eR{constructor(t,e,i,r,n){super(),A(this,"type","text"),A(this,"_eventEmitter"),A(this,"textAreaElement"),A(this,"graphics",new MR),A(this,"_pageDataUtils"),A(this,"result"),A(this,"interactionParam"),A(this,"_adsorptionGizmo"),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"ignoreInteraction",!1),A(this,"scaleParam"),A(this,"rotationSprite",new NO),A(this,"cursorPoint",new Lw),A(this,"_selectorGizmo"),A(this,"handleInput",async t=>{const e=t.target,i=this._pageDataUtils.getSelectedItems()[0].id;await this._pageDataUtils.setItemProperty({itemId:i,type:"text",propertyName:"text",propertyValue:e.value}),this._eventEmitter.emit("textInput",{itemId:i,text:e.value,fontFamily:e.style.fontFamily})}),A(this,"handleBlur",()=>{this.interactionParam.type="scale",this.textAreaElement.style.display="none",this.textAreaElement.removeEventListener("input",this.handleInput),this.textAreaElement.removeEventListener("blur",this.handleBlur)}),this._pageDataUtils=t,this._adsorptionGizmo=e,this._selectorGizmo=i,this._eventEmitter=r,this.textAreaElement=document.createElement("textarea"),this.textAreaElement.style.display="none",n?.appendChild(this.textAreaElement),function(t,e,i){const r=i.replace(/&/g,`.${e}`),n=document.createElement("style");n.textContent=`\n .${e} {\n ${r}\n }\n `,document.head.appendChild(n),t.classList.add(e)}(this.textAreaElement,"text-gizmo-custom-style","\n word-break: break-all;\n position: absolute;\n border: none;\n margin: 0;\n padding: 0;\n outline: none !important;\n overflow: hidden;\n resize: none;\n display: none;\n background: transparent;\n opacity: .8;\n color: transparent;\n caret-color: #000000;\n field-sizing: content;\n -webkit-text-fill-color: transparent;\n text-fill-color: transparent;\n"),this.result={type:"empty"},this.interactionParam={active:!1,type:"none",anchor:new Lw,lastPoint:new Lw,startPoint:new Lw,lastWorldPosition:new $w}}get interactive(){return Lk.config.gestureHandlerConfig.textGizmoEnbaled}set interactive(t){Lk.config.gestureHandlerConfig.textGizmoEnbaled=t}preparationAction(t){if(!this.interactive)return void console.warn("Text gizmo is not opened, use #SDK.openTextGizmo() open this feature.");if("empty"===this.result.type)return;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);this.refreshInteractionParam(e,i);const r=e.subtract(this._pageDataUtils.getViewportLeftTopPosition());if(this.initInteractionPlane(r),this.cursorPoint.set(t.offsetX,t.offsetY),this.refreshCursorResult(),"none"!==this.interactionParam.type){const e="translation"===this.interactionParam.type?this._selectorGizmo.preparationAction(t,"text"):this.type;return this.interactionParam.active="text"===e,this.interactionParam.active?e:void 0}}preAction(t,e){if(1!==t.buttons)return this.type;const{offsetX:i,offsetY:r}=t,n=new Lw(i,r);if(e){if("empty"===this.result.type||this.result.box.containsPoint(n))this._pageDataUtils.saveUndoRedoOldData(),this.interactionParam.type="edit";else if("none"===this.interactionParam.type)return this.result={type:"empty"},void this._pageDataUtils.clearSelectedItems(!0)}else if("empty"===this.result.type||this.result.box.containsPoint(n)){this._pageDataUtils.saveUndoRedoOldData();const t=n.subtract(this._pageDataUtils.getViewportLeftTopPosition());this.initInteractionPlane(t),this.interactionParam.lastWorldPosition=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t)??new $w,this.refreshCursorResult()}else if("edit"===this.interactionParam.type)this.interactionParam.type="none",this.ignoreInteraction=!0;else if("none"===this.interactionParam.type)return void(this.result={type:"empty"});return this.type}action(t){if(!this.interactive)return void console.warn("Text gizmo is not opened, use #SDK.setTextConfig() open this feature.");if("edit"===this.interactionParam.type||"empty"===this.result.type||this.ignoreInteraction)return;if(!this.interactionParam.active){this.interactionParam.active=!0,this.interactionParam.type="translation",this.interactionParam.lastPoint=new Lw(t.clientX,t.clientY),this.interactionParam.startPoint=new Lw(t.offsetX,t.offsetY);const e=new Lw(t.offsetX,t.offsetY).subtract(this._pageDataUtils.getViewportLeftTopPosition());this.initInteractionPlane(e),this.interactionParam.lastWorldPosition=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(e)??new $w}const e=new Lw(t.clientX,t.clientY),{type:i,lastPoint:r,startPoint:n,anchor:s}=this.interactionParam,o=(new Lw).subtractVectors(e,r),a=this._pageDataUtils.getSelectedItems();switch(i){case"rotation":{const t=new $w,i=Gw(Vw((new Lw).subtractVectors(n,s),(new Lw).subtractVectors(n.add(o),s))*zw,3);t.z=i,a.forEach(e=>{this._pageDataUtils.rotateItem(e.id,t)}),this.interactionParam.lastPoint.copyFrom(e);break}case"translation":{const t=o.clone();if(this._adsorptionGizmo.interactive){const e=this._pageDataUtils.getPageData();Be(e);const i=e.items.map(t=>a.find(e=>e.id===t.id)||0!==a.filter(e=>t.parentId&&t.parentId===e.id).length||!this._pageDataUtils.getItemEditEnable(t.id)||a.find(e=>e.parentId===t.id)?new Kw:this._pageDataUtils.getViewBoxById(t.id)).filter(t=>!t.isEmpty()),r=new Lw(this._adsorptionGizmo.absorptionResult.x??0,this._adsorptionGizmo.absorptionResult.y??0);this._adsorptionGizmo.boxTranslationAdsorption(t,this.result.box,i);const n=new Lw(this._adsorptionGizmo.absorptionResult.x??0,this._adsorptionGizmo.absorptionResult.y??0);t.add(r).subtract(n)}const i=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(n.add(t).clone().subtract(this._pageDataUtils.getViewportLeftTopPosition()));if(i){const t=i.clone().subtract(this.interactionParam.lastWorldPosition);a.forEach(e=>{t.x=Gw(t.x,5),t.y=Gw(t.y,5),t.z=Gw(t.z,5),this._pageDataUtils.moveItem(e.id,t)}),this.interactionParam.lastWorldPosition.copyFrom(i),this.interactionParam.lastPoint.copyFrom(e)}break}case"scale":if(o.length()){const t=this.cursorPoint.add(o).clone().subtract(this._pageDataUtils.getViewportLeftTopPosition());if(!n||!this.scaleParam||!o.length())return;const e=this.scaleParam.farthestCorner;(n.x-e.x)*(this.cursorPoint.x-e.x)>0&&(n.y-e.y)*(this.cursorPoint.y-e.y)>0||(t.x=e.x+(n.x-e.x)/Math.abs(n.x-e.x)*4,t.y=e.y+(n.y-e.y)/Math.abs(n.y-e.y)*4);const i=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t);if(i){const t=this._pageDataUtils.getSelectedItems()[0]??void 0,e=this._pageDataUtils.getItemTransformById(t?.id??""),r=(new Qw).extractRotation(e.matrix).invert(),{corner:n,center:s,shift:o,lastScalar:h}=this.scaleParam,l=(new $w).subtractVectors(n,s).applyMatrix(r),c=l.clone().multiply(h),u=i.clone().subtract(o).subtract(s).applyMatrix(r),d=new $w(1,1,1),f=jw([Hw(l.x,0)?1:Math.abs(u.x/l.x),Hw(l.y,0)?1:Math.abs(u.y/l.y)]),p=u.toArray()[f],m=c.toArray()[f];if(Hw(h.x,h.y)&&Hw(h.z,h.x)){const t=Hw(m,0)?1:Math.abs(p/m);d.set(t,t,t)}else if(0===f){d.x=Hw(m,0)?1:Math.abs(p/m);const t=l.y*p/l.x;d.y=Hw(c.y,0)?1:t/c.y;const e=l.z*p/l.x;d.z=Hw(c.z,0)?1:e/c.z}else if(1===f){d.y=Hw(m,0)?1:Math.abs(p/m);const t=l.x*p/l.y;d.x=Hw(c.x,0)?1:t/c.x;const e=l.z*p/l.y;d.z=Hw(c.z,0)?1:e/c.z}else{d.z=Hw(m,0)?1:Math.abs(p/m);const t=l.x*p/l.z;d.x=Hw(c.x,0)?1:t/c.x;const e=l.y*p/l.z;d.y=Hw(c.y,0)?1:e/c.y}const g=d.clone().subtract(new $w(1,1,0)).divide(2).add(new $w(1,1,.5)),v=s.clone().add((new $w).subtractVectors(n,s).multiply(new $w(h.x,h.y,1)));this.scaleParam.lastScalar.multiply(g);const y=s.clone().add((new $w).subtractVectors(n,s).multiply(new $w(this.scaleParam.lastScalar.x,this.scaleParam.lastScalar.y,1))),x=(new $w).subtractVectors(y,v);x.x=Gw(x.x,5),x.y=Gw(x.y,5),x.z=Gw(x.z,5),this.scaleParam.center.add(x),this.scaleParam.corner.add(x),a.forEach(t=>{this._pageDataUtils.scaleTextItem(t.id,g.x),this._pageDataUtils.moveItem(t.id,x)}),this.interactionParam.lastWorldPosition.copyFrom(i)}}break;case"width-scale":{const t=n.clone(),e=n.clone().add(o);if(o.length()){const i=(new Lw).subtractVectors(t,s),r=(new Lw).subtractVectors(e,s),o=Math.max(r.dot(i)/i.length(),1),h=i.length(),l=(o/h-1)/2+1,c=s.clone().add(i.clone().normalize().scale(h*l)),u=(new Lw).subtractVectors(c,t);n.add(u);const d=this._pageDataUtils.interactionUtils.getWorldSizeByViewSize(u);d.x=Gw(d.x,5),d.y=Gw(d.y,5),d.z=Gw(d.z,5),a.forEach(t=>{this._pageDataUtils.moveItem(t.id,d)}),a.forEach(t=>{this._pageDataUtils.scaleTextItemWidth(t.id,l)})}break}}this.interactionParam.lastPoint.copyFrom(e),this.refreshCursorResult()}endAction(t){this.ignoreInteraction=!1;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);return this._pageDataUtils.pushUndoRedoData(),this._adsorptionGizmo.clearAbsorptionResult(),this.refreshInteractionParam(e,i),this.refreshCursorResult(),this.type}interruption(){return this.interactionParam.type="none",this._adsorptionGizmo.clearAbsorptionResult(),this.type}actionKey(t){}endActionKey(t){}cancelPreparation(){}refreshResults(){if(!this.interactive)return;const t=this._pageDataUtils.getPageData()?.activeData?.selectedItems,e=this._pageDataUtils.getSDKItem(t?.[0]??"");if(1!==t?.length||"text"!==e?.type)return void(this.result={type:"empty"});const i=this._pageDataUtils.getViewBoxById(t[0]);if(i.isEmpty())this.result={type:"empty"};else{const t=[new qw(i.corners[0],i.corners[1]).at(.5),new qw(i.corners[2],i.corners[3]).at(.5)],r=new qw(i.getCenter(),new qw(i.corners[0],i.corners[3]).at(.5)),n=r.at((r.length()+22)/r.length());this.result={type:"valid",box:i.clone(),widthScaleCorners:t,rotationCorner:n,rotation:-e.property.rotation[2]*Bw}}}refreshInteractionParam(t,e){if("empty"===this.result.type)return this.interactionParam.active=!1,this.interactionParam.type="none",this.interactionParam.lastPoint=new Lw,this.interactionParam.startPoint=new Lw,void(this.interactionParam.lastWorldPosition=new $w);if("edit"===this.interactionParam.type)return;const{rotateInteractMode:i,scaleInteractionDistance:r,rotationCornerInteractionDistance:n,rotationTopCenterInteractionDistance:s}=Lk.config.gestureHandlerConfig.textGizmoConfig,o=this.result.box.getCenter();for(const e of this.result.widthScaleCorners){if((new Kw).setFromCenterAndSize(e,new Lw(6,18)).containsPoint(t))return this.interactionParam.active=!0,this.interactionParam.type="width-scale",this.interactionParam.anchor=o,this.interactionParam.lastPoint=t.clone(),this.interactionParam.startPoint=e.clone(),void(this.interactionParam.lastWorldPosition=new $w)}const a=this.result.box.corners.findIndex(e=>e.distanceTo(t)<r);if(a>=0){const t=this.result.box.corners[a],i=this.result.box.corners[(a+2)%4];return this.interactionParam.active=!0,this.interactionParam.type="scale",this.interactionParam.anchor=i.clone(),this.interactionParam.lastPoint=e.clone(),void(this.interactionParam.startPoint=t.clone())}if(this.result.box.containsPoint(t,!1))return this.interactionParam.active=!0,this.interactionParam.type="translation",this.interactionParam.lastPoint=e.clone(),this.interactionParam.startPoint=t.clone(),void(this.interactionParam.lastWorldPosition=new $w);switch(i){case"top-center":if(t.distanceTo(this.result.rotationCorner)<s)return this.interactionParam.active=!0,this.interactionParam.type="rotation",this.interactionParam.anchor=o,this.interactionParam.lastPoint=e.clone(),this.interactionParam.startPoint=this.result.rotationCorner.clone(),void(this.interactionParam.lastWorldPosition=new $w);break;case"corner":{const i=this.result.box.corners.find(e=>e.distanceTo(t)<n);if(i)return this.interactionParam.active=!0,this.interactionParam.type="rotation",this.interactionParam.anchor=o,this.interactionParam.lastPoint=e.clone(),this.interactionParam.startPoint=i.clone(),void(this.interactionParam.lastWorldPosition=new $w);break}}this.interactionParam.active=!1,this.interactionParam.type="none",this.interactionParam.lastPoint=new Lw,this.interactionParam.startPoint=new Lw,this.interactionParam.lastWorldPosition=new $w}refreshCursorResult(){const t=(Uw((new Lw).subtractVectors(this.interactionParam.startPoint,this.interactionParam.anchor))+Math.PI/4)*zw;switch(this.interactionParam.type){case"edit":case"none":case"translation":this.cursorResult={type:"normal",angle:0};break;case"scale":case"width-scale":this.cursorResult={type:"scale",angle:t};break;case"rotation":this.cursorResult={type:"rotation",angle:t}}}getRenderObjects(){const t=[];if(!this.interactive||"empty"===this.result.type)return[];this.graphics.clear();const{box:e,widthScaleCorners:i,rotationCorner:r,rotation:n}=this.result,{boxLineWidth:s,boxLineColor:o,rotateInteractMode:a,rotationCornerWidth:h,scaleCornerStrokeWidth:l,scaleCornerStrokeColor:c,rotationCornerRadius:u,rotationCornerFillColor:d,rotationCornerStrokeWidth:f,rotationCornerStrokeColor:p}=Lk.config.gestureHandlerConfig.textGizmoConfig;if(this.graphics.lineStyle(s,o),this.graphics.drawBox(e),"edit"!==this.interactionParam.type)switch(e.getSize().y>25&&i.forEach(t=>{const e=(new Kw).setFromCenterAndSize(t,new Lw(8,15));this.graphics.beginFill(16777215),this.graphics.fillBox(e),this.graphics.endFill(),this.graphics.lineStyle(l,c),this.graphics.drawBox(e)}),a){case"top-center":this.rotationSprite.width=h,this.rotationSprite.height=h,this.rotationSprite.anchor.set(.5,.5),this.rotationSprite.x=r.x,this.rotationSprite.y=r.y,this.rotationSprite.rotation=n,t.push(this.rotationSprite);break;case"corner":e.corners.forEach(t=>{this.graphics.lineStyle(f,p),this.graphics.beginFill(d),this.graphics.drawCircle(t.x,t.y,u),this.graphics.endFill()})}else if("edit"===this.interactionParam.type&&"none"===this.textAreaElement.style.display){const t=this._pageDataUtils.getSelectedItems(),i=this._pageDataUtils.interactionUtils.viewportParam,r=t[0],n=r?.property,s=e.clone().rotate(n.rotation[2]*Bw),o=s.min.clone(),a=s.getSize();this.textAreaElement.value=n.text??"",this.textAreaElement.style.textAlign=this.getTextAlign(n.textAlign),this.textAreaElement.style.fontFamily=n.fontFamily,this.textAreaElement.style.fontSize=n.fontSize*i.scale+"px",this.textAreaElement.style.fontWeight=n.fontWeight,this.textAreaElement.style.display="block",this.textAreaElement.style.wordBreak="break-all",this.textAreaElement.style.whiteSpace="pre-wrap",this.textAreaElement.style.overflowWrap="break-word",this.textAreaElement.style.left=`${o.x}px`,this.textAreaElement.style.top=`${o.y}px`,this.textAreaElement.style.width=`${a.x}px`,this.textAreaElement.style.height=`${a.y}px`,this.textAreaElement.style.lineHeight=n.lineHeight*i.scale+"px",this.textAreaElement.style.transformOrigin="center center",this.textAreaElement.style.paintOrder="stroke fill",void 0!==n.rotation[2]&&(this.textAreaElement.style.transform=`\n rotateZ(${-n.rotation[2]}deg)\n `),this.textAreaElement.addEventListener("input",this.handleInput),this.textAreaElement.addEventListener("blur",this.handleBlur),window.setTimeout(()=>{this.textAreaElement.focus()},50)}else if("edit"===this.interactionParam.type&&"block"===this.textAreaElement.style.display){const t=this._pageDataUtils.getSelectedItems()[0],i=this._pageDataUtils.interactionUtils.viewportParam,r=t.property,n=e.clone().rotate(r.rotation[2]*Bw),s=n.min.clone(),o=n.getSize();switch(this.textAreaElement.style.left=`${s.x}px`,this.textAreaElement.style.top=`${s.y}px`,this.textAreaElement.style.width=`${o.x}px`,this.textAreaElement.style.height=`${o.y}px`,this.textAreaElement.style.fontFamily=r.fontFamily,this.textAreaElement.style.textAlign=this.getTextAlign(r.textAlign),Lk.config.mode){case"editor":this.textAreaElement.style.fontSize=r.fontSize*i.scale+"px",this.textAreaElement.style.lineHeight=r.lineHeight*i.scale+"px",this.textAreaElement.style.transform=`rotateZ(${-r.rotation[2]}deg)`;break;case"template":{const e=this._pageDataUtils.getPlayerItemById(t.id),n=new $w(1,1,1);e?.transform.getMatrix().decompose(new $w,new Jw,n);const a=e.transform.scale,{size:[h,l],isPublishScene:c}=this._pageDataUtils.getTextOriginSize(t.id),u=c?2:0,d=this._pageDataUtils.interactionUtils.getPixelSizeByWorldSize(new $w(0,l,0)).y,f=r.fontSize/(r.lineHeight/d)-u*i.scale,p=new Lw(a.x/h,a.y/l);this.textAreaElement.style.left=`${s.x+(p.x-1)*o.x/p.x/2}px`,this.textAreaElement.style.top=`${s.y+(p.y-1)*o.y/p.y/2}px`,this.textAreaElement.style.width=o.x/p.x+"px",this.textAreaElement.style.height=o.y/p.y+"px",this.textAreaElement.style.transform=`scale(${p.x}, ${p.y}) rotateZ(${-r.rotation[2]}deg)`,this.textAreaElement.style.fontSize=`${f}px`,this.textAreaElement.style.lineHeight=`${d}px`;break}}}return t.push(this.graphics),t}initInteractionPlane(t){switch(this.interactionParam.type){case"scale":{if("empty"===this.result.type)return;const e=1==this._pageDataUtils.getSelectedItems().length?this._pageDataUtils.getSelectedItems()[0]:void 0;let i,r,n;if(e){const t=this._pageDataUtils.getItemTransformById(e.id);i=(new $w).copyFrom(this._pageDataUtils.getPlayerItemById(e.id).transform.anchor).applyMatrix(t.matrix),r=(new $w).setFromMatrixPosition(t.matrix),n=(new tT).setFromQuaternion((new Jw).setFromRotationMatrix(t.matrix))}this._pageDataUtils.interactionUtils.initInteractionPlane(r,n);const s=this.interactionParam.startPoint,{box:o}=this.result,a=o.corners[0].clone();let h=a.distanceTo(s);o.corners.forEach(t=>{t.distanceTo(s)>h&&(a.copyFrom(t),h=t.distanceTo(s))}),this.scaleParam={shift:new $w,center:new $w,corner:new $w,lastScalar:new $w(1,1,1),farthestCorner:a},this.scaleParam.center=i??r;const l=this._pageDataUtils.getViewportLeftTopPosition();if(s){const t=s.clone().subtract(l);this.scaleParam.corner=this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t)??new $w}this.scaleParam.shift=(this._pageDataUtils.interactionUtils.getWorldPositionByViewPoint(t)??new $w).subtract(this.scaleParam.corner);break}case"width-scale":case"translation":case"rotation":this._pageDataUtils.interactionUtils.initInteractionPlane()}}getTextAlign(t){switch(t){case en.TextAlignment.middle:return"center";case en.TextAlignment.right:return"right";default:return"left"}}},hD=class extends eR{constructor(t,e){super(),A(this,"_pageDataUtils"),A(this,"_app"),A(this,"maskRenderTexture",null),A(this,"maskSprite",null),A(this,"_config",{}),A(this,"boxGraphics",new MR),A(this,"type","mask"),A(this,"mode","paint"),A(this,"_undoRedo",new tD),A(this,"_oldLines"),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"result",{status:"init",lines:[]}),this._pageDataUtils=t,this._app=e}get undoRedo(){return this._undoRedo}get interactive(){return Lk.config.gestureHandlerConfig.maskGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.maskGizmoEnabled&&(t||(this.result.status="init"),Lk.config.gestureHandlerConfig.maskGizmoEnabled=t)}get config(){return{...Lk.config.gestureHandlerConfig.maskGizmoConfig,...this._config}}set config(t){this._config={...this._config,...t}}setMode(t){this.mode=t}initialize(){}preparationAction(t){if(this.interactive)return this.result.point=new Lw(t.offsetX,t.offsetY),this.type}preAction(t){if(this.interactive)return this._oldLines={lines:JSON.parse(JSON.stringify(this.result.lines))},this.result.point=new Lw(t.offsetX,t.offsetY),this.result.lines.push({type:this.mode,brushSize:this.config.brushSize,points:[]}),this.type}action(t){if(!this.interactive||"init"===this.result.status)return;const e=this.result.box,i=new Lw((t.offsetX-e.min.x)/(e.max.x-e.min.x),(t.offsetY-e.min.y)/(e.max.y-e.min.y));this.result.lines[this.result.lines.length-1]?.points.push(i)}endAction(){if(!this.interactive)return;const t=this.result.lines[this.result.lines.length-1];return this._oldLines&&t&&t.points.length>0?this._undoRedo.push({type:"update",oldData:this._oldLines,newData:{lines:JSON.parse(JSON.stringify(this.result.lines))}}):0===t?.points.length&&this.result.lines.pop(),this._oldLines=void 0,this.type}interruption(){}actionKey(){}endActionKey(){}cancelPreparation(){}refreshResults(){if(this.interactive){const t=this._pageDataUtils.getPageData();if(iD(t,"You must call SDK#run() first"),1!==t.activeData.selectedItems.length)console.warn("Mask Gizmo can edit one picture at a time.");else{if("init"===this.result.status){const e=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]);this.result={status:"done",box:e.clone(),lines:[]}}else{const e=this.result.box,i=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]),r=i.getCenter().subtract(e.getCenter()),n=i.getSize().x/e.getSize().x;e.translate(r),e.scale(n)}this.refreshCursorResult()}}else this.result={status:"init",lines:[]}}getRenderObjects(){return this.interactive?this.refreshRenderObjects():[]}clearRenderObjects(){this.boxGraphics.clear(),this.maskRenderTexture&&(this.maskRenderTexture.destroy(!0),this.maskRenderTexture=null),this.maskSprite&&(this.maskSprite.destroy(),this.maskSprite=null)}refreshRenderObjects(){if(this.clearRenderObjects(),!this.interactive||"init"===this.result.status)return[];const{maskImage:t,brushColor:e,brushAlpha:i,boxLineWidth:r,boxLineColor:n,boxLineAlpha:s}=this.config,o=this.result.box,{min:a,max:h}=o,l=Math.ceil(h.x-a.x),c=Math.ceil(h.y-a.y);this.maskRenderTexture=ZC.create({width:l,height:c});const u=this._pageDataUtils.interactionUtils.viewportParam;if(this.maskSprite=new NO(this.maskRenderTexture),this.maskSprite.width=l,this.maskSprite.height=c,this.maskSprite.position.set(a.x,a.y),this.maskSprite.alpha=i,t){const i=new qM,r=KC.from(t),n=new NO(r);n.width=l,n.height=c;const s=new MR;s.beginFill(e),s.drawRect(0,0,l,c),s.endFill(),s.mask=n,i.addChild(s),i.addChild(n),this._app.renderer.render(i,{renderTexture:this.maskRenderTexture,clear:!1}),i.destroy(),r.destroy(),n.destroy()}const d=new Kw(new Lw(a.x,a.y),new Lw(h.x,a.y)),f=new Kw(new Lw(a.x,a.y),new Lw(a.x,h.y)),p=new Kw(new Lw(h.x,a.y),new Lw(h.x,a.y)),m=new Kw(new Lw(a.x,h.y),new Lw(h.x,h.y));this.boxGraphics.fillBox(d),this.boxGraphics.fillBox(f),this.boxGraphics.fillBox(p),this.boxGraphics.fillBox(m),this.boxGraphics.lineStyle(r,n,s),this.boxGraphics.drawBox(o),this.boxGraphics.endFill();for(const t of this.result.lines){if(!t)continue;const i=new MR;i.blendMode="paint"===t.type?mI.NORMAL:mI.DST_OUT,i.lineStyle({width:t.brushSize*u.scale,color:e,cap:QM.ROUND,join:JM.ROUND,native:!1,alignment:.5});for(let e=0;e<t.points.length;e++){const r=t.points[e];if(!r)continue;const n=r.x*(o.max.x-o.min.x),s=r.y*(o.max.y-o.min.y);0===e?i.moveTo(n,s):i.lineTo(n,s)}i.endFill(),this._app.renderer.render(i,{renderTexture:this.maskRenderTexture,clear:!1}),i.destroy()}return[this.boxGraphics,this.maskSprite]}refreshCursorResult(){const{point:t,box:e}=this.result;if(this.cursorResult={type:"normal",angle:0},t&&e&&t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y){const t=this._pageDataUtils.interactionUtils.viewportParam;this.cursorResult={type:"circle",angle:0,radius:this.config.brushSize*t.scale/2}}}clearMask(){this.result.lines.length>0&&this._undoRedo.push({type:"update",oldData:{lines:JSON.parse(JSON.stringify(this.result.lines))},newData:{lines:[]}}),this.result.lines=[]}undo(){const t=this._undoRedo.undo();return!!t&&(this.result.lines=JSON.parse(JSON.stringify(t.oldData.lines)),!0)}redo(){const t=this._undoRedo.redo();return!!t&&(this.result.lines=JSON.parse(JSON.stringify(t.newData.lines)),!0)}get canUndo(){return this._undoRedo.canUndo}get canRedo(){return this._undoRedo.canRedo}clearUndoRedo(){this._undoRedo.clear()}loadMaskImage(t){return new Promise((e,i)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{e(r)},r.onerror=t=>{i(new Error("Failed to load mask image."))},r.src=t})}async getMask(){const t=this.result.box;if(!t)return null;const e=Math.ceil(t.max.x-t.min.x),i=Math.ceil(t.max.y-t.min.y),r=document.createElement("canvas");r.width=e,r.height=i;const n=r.getContext("2d");if(!n)return null;const{maskImage:s,maskColor:o}=this.config;if(0===this.result.lines.length&&!s)return null;const a="#"+o.toString(16).padStart(6,"0");if(n.fillStyle="#FFFFFF",n.fillRect(0,0,e,i),s)try{const t=await this.loadMaskImage(s);n.drawImage(t,0,0,e,i);const r=n.getImageData(0,0,e,i),a=r.data,h=o>>16&255,l=o>>8&255,c=255&o;for(let t=0;t<a.length;t+=4){const e=a[t],i=a[t+1],r=a[t+2];(e+i+r)/3>128?(a[t]=h,a[t+1]=l,a[t+2]=c):(a[t]=255,a[t+1]=255,a[t+2]=255)}n.putImageData(r,0,0)}catch(t){console.warn("Failed to load mask image:",t)}const h=this._pageDataUtils.interactionUtils.viewportParam.scale;for(const t of this.result.lines)if(t&&0!==t.points.length){n.lineWidth=t.brushSize*h,n.lineCap="round",n.lineJoin="round",n.globalCompositeOperation="source-over","paint"===t.type?n.strokeStyle=a:n.strokeStyle="#FFFFFF",n.beginPath();for(let r=0;r<t.points.length;r++){const s=t.points[r];if(!s)continue;const o=s.x*e,a=s.y*i;0===r?n.moveTo(o,a):n.lineTo(o,a)}n.stroke()}return r.toDataURL("image/png")}},lD=class extends eR{constructor(t){super(),A(this,"type","loading"),A(this,"_pageDataUtils"),A(this,"_idMap",new Map),A(this,"cursorResult",{type:"normal",angle:0}),this._pageDataUtils=t}add(t,e){const i=this._pageDataUtils.getItemBoxById(t),r=Yw(i,e?.loadingBox??i);if("string"==typeof t){const{tip:i={text:""}}=e??{},n={text:i.text??"",fontFamily:i.fontFamily??"",color:i.color??16777215,fontSize:i.fontSize??16},s=new qO(n.text,{fontSize:n.fontSize,fontFamily:n.fontFamily,fill:n.color,align:"center"}),o=new MR;o.addChild(s),this._idMap.set(t,{status:"init",loadingBox:r,graphics:o,ticker:new eC,tip:n}),this._pageDataUtils.addLoadingItems([t]),e?.clearSelected&&this._pageDataUtils.removeSelectedItems([t])}}delete(t){const e=this._idMap.get(t);if(e){const{graphics:i,ticker:r}=e;i.destroy(),r.destroy(),this._idMap.delete(t),this._pageDataUtils.removeLoadingItems([t])}}update(t,e){const i=this._idMap.get(t);if(!i)return void console.warn(`Loading item ${t} not found.`);const r=i.graphics.children[0];r&&(i.tip={...i.tip,...e.tip},r.text=i.tip.text,i.tip.fontFamily&&(r.style.fontFamily=i.tip.fontFamily),void 0!==i.tip.color&&(r.style.fill=i.tip.color))}initialize(){}preparationAction(){}preAction(){}action(){}endAction(){}interruption(){}actionKey(){}endActionKey(){}cancelPreparation(){}refreshResults(){}getRenderObjects(){return 0===this._idMap.size?[]:this.refreshRenderObjects()}refreshRenderObjects(){if(0===this._idMap.size)return[];const t=[];for(const e of this._idMap.keys()){const i=this._idMap.get(e);if(!i)continue;if(t.push(i.graphics),"done"===i.status){i.ticker.update();continue}i.status="done";let r=.006,n=.5;i.ticker.add(()=>{const t=this._pageDataUtils.getViewBoxById(e),{min:s,max:o}=Xw(t,i.loadingBox),a=o.x-s.x,h=o.y-s.y;if(n>.6?r=-.003:n<.4&&(r=.006),n+=r,i.graphics.clear(),i.graphics.beginFill(0,n),i.graphics.drawRect(s.x,s.y,a,h),i.graphics.endFill(),i.tip?.text){const{scale:t}=this._pageDataUtils.interactionUtils.viewportParam,e=i.tip.fontSize,r=Math.round(e*t),n=i.graphics.children[0];n&&(n.style.fontSize=r,n.x=s.x+(a-n.width)/2,n.y=s.y+(h-n.height)/2)}}),i.ticker.start()}return t}},cD=class extends eR{constructor(t,e){super(),A(this,"result",{type:"invalid"}),A(this,"interactionParam",{type:"none"}),A(this,"graphics",new MR),A(this,"isShiftDown",!1),A(this,"_isLockScale",!1),A(this,"_pageDataUtils"),A(this,"_eventEmitter"),A(this,"type","picture-expand"),A(this,"cursorResult",{type:"normal",angle:0}),this._pageDataUtils=t,this._eventEmitter=e}get interactive(){return Lk.config.gestureHandlerConfig.pictureExpandGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.pictureExpandGizmoEnabled&&(1!==this._pageDataUtils.getPageData()?.activeData.selectedItems?.length?console.warn("Selected items` length is not one, Picture expand gizmo can not open."):Lk.config.gestureHandlerConfig.pictureExpandGizmoEnabled=t)}get isLockScale(){return this._isLockScale}set isLockScale(t){t!==this.isLockScale&&(this._isLockScale=t)}preparationAction(t){if(!this.interactive)return;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);return this.refreshInteractionType(e,i),this.type}preAction(t,e){if(this.interactive&&"none"!==this.interactionParam.type)return this.type}action(t){var e;if(!this.interactive||"none"===this.interactionParam.type||"invalid"===this.result.type)return;const i=new Lw(t.clientX,t.clientY),{startMouse:r,box:n}=this.interactionParam,s=(new Lw).subtractVectors(i,r),{itemBox:o}=this.result,{min:a,max:h}=o;switch(this.interactionParam.type){case"move":{const{min:t,max:e}=n,i=h.x-e.x,r=a.x-t.x,l=h.y-e.y,c=a.y-t.y;s.x=Math.min(Math.max(s.x,i),r),s.y=Math.min(Math.max(s.y,l),c);const u=n.clone().translate(s);this.result.normalizeExpandBox=Yw(o,u),this._eventEmitter.emit("expandBoxChange",this.getExpandBox());break}case"scale":{const{index:t}=this.interactionParam,{min:i,max:r}=n,l=n.corners[t],c=n.corners[(t+2)%4],u=new Lw(l.x+s.x,l.y+s.y);if(l.x>=r.x?u.x=Math.max(u.x,h.x):l.x<=i.x?u.x=Math.min(u.x,a.x):(console.warn("resultCorner has wrong, we have move it to the nearest corner"),u.x=Math.abs(u.x-i.x)>Math.abs(u.x-r.x)?r.x:i.x),l.y>=r.y?u.y=Math.max(u.y,h.y):l.y<=i.y?u.y=Math.min(u.y,a.y):(console.warn("resultCorner has wrong, we have move it to the nearest corner"),u.y=Math.abs(u.y-i.y)>Math.abs(u.y-r.y)?r.y:i.y),this.isShiftDown||this.isLockScale){const t=this.getExpandBox(),{x:s,y:o}=t.getSize(),{x:d,y:f}=n.getSize();if((e=this.interactionParam).lockedAspect??(e.lockedAspect=s/o),Math.abs(u.x-c.x)/d>Math.abs(u.y-c.y)/f){const t=Math.abs(u.x-c.x)/this.interactionParam.lockedAspect;u.y=(l.y-c.y)/Math.abs(l.y-c.y)*t+c.y,l.y>=r.y?u.y=Math.max(u.y,h.y):l.y<=i.y?u.y=Math.min(u.y,a.y):(console.warn("resultCorner has wrong, we have move it to the nearest corner"),u.y=Math.abs(u.y-i.y)>Math.abs(u.y-r.y)?r.y:i.y)}else{const t=Math.abs(u.y-c.y)*this.interactionParam.lockedAspect;u.x=(l.x-c.x)/Math.abs(l.x-c.x)*t+c.x,l.x>=r.x?u.x=Math.max(u.x,h.x):l.x<=i.x?u.x=Math.min(u.x,a.x):(console.warn("resultCorner has wrong, we have move it to the nearest corner"),u.x=Math.abs(u.x-i.x)>Math.abs(u.x-r.x)?r.x:i.x)}}this.result.normalizeExpandBox=Yw(o,(new Kw).setFromVec2ArrayWithOutCorners([u,c])),this._eventEmitter.emit("expandBoxChange",this.getExpandBox());break}case"direction-scale":{const{index:t,point:e}=this.interactionParam,i=n.corners[t].clone();e.x>=h.x?(s.x=Math.max(n.corners[t].x+s.x,h.x)-i.x,s.y=0):e.x<=a.x&&(s.x=Math.min(n.corners[t].x+s.x,a.x)-i.x,s.y=0),e.y>=h.y?(s.y=Math.max(n.corners[t].y+s.y,h.y)-i.y,s.x=0):e.y<=a.y&&(s.y=Math.min(n.corners[t].y+s.y,a.y)-i.y,s.x=0);const r=n.corners.map((e,i)=>[t,(t+1)%4].includes(i)?e.clone().add(s):e.clone());this.result.normalizeExpandBox=Yw(o,(new Kw).setFromVec2Array(r)),this._eventEmitter.emit("expandBoxChange",this.getExpandBox());break}}}endAction(t){if(!this.interactive||"none"===this.interactionParam.type)return;const e=new Lw(t.offsetX,t.offsetY),i=new Lw(t.clientX,t.clientY);return this.refreshInteractionType(e,i),this.type}interruption(){this.interactionParam={type:"none"}}actionKey(t){this.isShiftDown=t.shiftKey}endActionKey(t){this.isShiftDown=t.shiftKey,"lockedAspect"in this.interactionParam&&delete this.interactionParam.lockedAspect}cancelPreparation(){this.interactionParam={type:"none"}}refreshResults(){if(this.interactive){const t=this._pageDataUtils.getPageData();if(iD(t,"You must call SDK#run() first"),1!==t.activeData.selectedItems.length)console.warn("Picture Expand Gizmo can edit one picture at a time.");else if("invalid"===this.result.type){const e=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]);this.result={type:"valid",itemBox:e.clone(),normalizeExpandBox:new Kw(new Lw,new Lw(1,1))}}else{const e=this._pageDataUtils.getViewBoxById(t.activeData.selectedItems[0]),i=e.getCenter().subtract(this.result.itemBox.getCenter()),r=e.getSize().x/this.result.itemBox.getSize().x;this.result.itemBox.translate(i),this.result.itemBox.scale(r)}}else this.result={type:"invalid"}}refreshRenderObjects(){if(this.graphics.clear(),!this.interactive||"invalid"===this.result.type)return[];const{maskColor:t,maskAlpha:e,expandBoxLineWidth:i,expandBoxLineColor:r,expandBoxLineAlpha:n,expandBoxCornerRadius:s,expandBoxCornerFillColor:o,expandBoxCornerLineWidth:a,expandBoxCornerLineColor:h,expandBoxCornerLineAlpha:l,gridLineWidth:c,gridLineColor:u,gridLineAlpha:d,gridCount:f}=Lk.config.gestureHandlerConfig.pictureExpandGizmoConfig,{normalizeExpandBox:p,itemBox:m}=this.result,g=Xw(m,p);this.graphics.beginFill(t,e),this.graphics.fillBox(g),this.graphics.endFill();const{min:v,max:y}=g,x=g.getSize().x/(f+1),b=g.getSize().y/(f+1);this.graphics.lineStyle(c,u,d);for(let t=1;t<=f;t++){const e=new qw(new Lw(v.x+x*t,v.y),new Lw(v.x+x*t,y.y)),i=new qw(new Lw(v.x,v.y+b*t),new Lw(y.x,v.y+b*t));this.graphics.drawLine(e),this.graphics.drawLine(i)}return this.graphics.lineStyle(i,r,n),this.graphics.drawBox(g),this.graphics.beginFill(o),this.graphics.lineStyle(a,h,l),g.corners.forEach(t=>{this.graphics.drawCircle(t.x,t.y,s)}),this.graphics.endFill(),[this.graphics]}refreshCursorResult(t,e=0){switch(t){case"scale":case"direction-scale":this.cursorResult={type:"scale",angle:e};break;case"move":case"none":this.cursorResult={type:"normal",angle:0}}}getRenderObjects(){return this.interactive?this.refreshRenderObjects():[]}refreshInteractionType(t,e){if(this.interactionParam.type="none",!this.interactive||"invalid"===this.result.type)return;const{normalizeExpandBox:i,itemBox:r}=this.result,n=Xw(r,i);let s=!1,o=0;n.corners.forEach((i,r)=>{s||i.distanceTo(t)<Lk.config.gestureHandlerConfig.pictureExpandGizmoConfig.scaleInteractionDistance&&(s=!0,this.interactionParam={type:"scale",index:r,box:n.clone(),startMouse:e},o=Math.PI/2*r)}),n.corners.forEach((i,r)=>{if(s)return;const a=new qw(i.clone(),n.corners[(r+1)%4]),h=t.distanceToLine(a);if(h.d>=0&&h.d<=8&&h.t>=0&&h.t<=1){s=!0;const t=a.at(h.t);this.interactionParam={type:"direction-scale",index:r,point:t,box:n.clone(),startMouse:e},o=Math.PI/2*r+Math.PI/4}}),n.containsPoint(t)&&!s&&(this.interactionParam={type:"move",point:t.clone(),box:n.clone(),startMouse:e},s=!0),this.refreshCursorResult(this.interactionParam.type,o*zw)}getExpandInfo(){const[t]=this._pageDataUtils.getSelectedItems();if(this.interactive&&"invalid"!==this.result.type&&t)return{expandBox:this.getExpandBox(),itemBox:this._pageDataUtils.getItemBoxById(t.id)}}getExpandBox(){const[t]=this._pageDataUtils.getSelectedItems();if(!this.interactive||"invalid"===this.result.type||!t)return;const e=this._pageDataUtils.getItemBoxById(t.id),{normalizeExpandBox:i}=this.result;return Xw(e,i)}setExpandBox(t,e){const[i]=this._pageDataUtils.getSelectedItems();if(!this.interactive||"invalid"===this.result.type||!i)return;const r=new Kw(t,e),n=this._pageDataUtils.getItemBoxById(i.id),{min:s,max:o}=Yw(n,r);this.result.normalizeExpandBox.set(new Lw(Math.min(s.x,0),Math.min(s.y,0)),new Lw(Math.max(o.x,1),Math.max(o.y,1)));const a=this.getExpandBox();return this._eventEmitter.emit("expandBoxChange",a),a}},uD={fontSize:14,fill:16777215,align:"center",lineHeight:16},dD=class extends eR{constructor(t,e){super(),A(this,"type","sprite-text-edit"),A(this,"_pageDataUtils"),A(this,"_eventEmitter"),A(this,"graphics",new MR),A(this,"editGraphics",new MR),A(this,"preSelectedText",new qO("",uD)),A(this,"result",[]),A(this,"interactionParam",{preSelected:-1,selected:-1}),A(this,"clearPreSelected",!1),this._pageDataUtils=t,this._eventEmitter=e,this.preSelectedText.resolution=3}get interactive(){return Lk.config.gestureHandlerConfig.spriteTextEditGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.spriteTextEditGizmoEnabled&&(Lk.config.gestureHandlerConfig.spriteTextEditGizmoEnabled=t)}preparationAction(t){const e=new Lw(t.offsetX,t.offsetY);return this.interactionParam.preSelected=-1,this.result.forEach((t,i)=>{if(this.interactionParam.preSelected>=0)return;Xw(this._pageDataUtils.getViewBoxById(t.id),t.box).containsPoint(e)&&(this.interactionParam.preSelected=i)}),this.type}preAction(){const t=this.result[this.interactionParam.preSelected];if(t){const e=t?{id:t.id,index:t.index,text:t.text}:void 0;this._eventEmitter.emit("spriteTextClick",e)}return this.result.forEach(e=>{e.isEditing=e.id===t?.id&&e.index===t.index}),this.interactionParam.preSelected=-1,this.type}action(t){}endAction(t){return this.type}interruption(){return this.type}actionKey(t){}endActionKey(t){}cancelPreparation(){}initResult(t){t.forEach(t=>{const e=this._pageDataUtils.getItemBoxById(t.id);t.info.forEach((i,r)=>{const{text:n,box:s,hasChanged:o}=i,a=s.map(t=>new Lw(...t).add(e.min)),h=(new Kw).setFromVec2Array(a),l=Yw(e,h);this.result.push({id:t.id,index:r,hasChanged:o,text:n,box:l,isEditing:!1})})})}clearResult(){this.result=[]}setSelected(t,e){const i=this.result.findIndex(i=>i.id===t&&i.index===e);if(i<0)console.warn(`item ${t} does not have index ${e} text info.`);else{this.interactionParam.selected=i;const t=this.result[this.interactionParam.selected],e=t?{id:t.id,index:t.index,text:t.text}:void 0;this._eventEmitter.emit("spriteTextClick",e)}}setText(t,e,i){const r=this.result.find(i=>i.id===t&&i.index===e);r?r.text=i:console.warn(`item ${t} does not have index ${e} text info.`)}setChangedState(t,e,i){const r=this.result.find(i=>i.id===t&&i.index===e);r?r.hasChanged=i:console.warn(`item ${t} does not have index ${e} text info.`)}setEditState(t,e,i){const r=this.result.find(i=>i.id===t&&i.index===e);r?r.isEditing=i:console.warn(`item ${t} does not have index ${e} text info.`)}refreshResults(){if(this.graphics.clear(),this.editGraphics.clear(),this.preSelectedText.text="",!this.interactive||0===this.result.length)return;const{scale:t}=this._pageDataUtils.interactionUtils.viewportParam,{editBoxColor:e,editBoxAlpha:i,editBoxPreSelectedColor:r,editBoxPreSelectedAlpha:n,hasChangedEditBoxColor:s,hasChangedEditBoxAlpha:o,hasChangedEditBoxPreSelectedColor:a,hasChangedEditBoxPreSelectedAlpha:h,editBoxLineColor:l,editBoxLineAlpha:c,editBoxLinePreSelectedAlpha:u,editBoxLinePreSelectedColor:d,hasChangedEditBoxLineColor:f,hasChangedEditBoxLineAlpha:p,hasChangedEditBoxLinePreSelectedColor:m,hasChangedEditBoxLinePreSelectedAlpha:g}=Lk.config.gestureHandlerConfig.spriteTextEditGizmoConfig;this.result.forEach((l,c)=>{const u=c===this.interactionParam.preSelected&&!this.clearPreSelected,{box:d,id:f,hasChanged:p,isEditing:m}=l,g=Xw(this._pageDataUtils.getViewBoxById(f),d);if(p){const t=p?u?a:s:u?r:e,l=p?u?h:o:u?n:i;this.editGraphics.beginFill(t,l),this.editGraphics.fillBox(g),this.editGraphics.endFill()}else{const t=p?u?a:s:u?r:e,l=p?u?h:o:u?n:i;this.graphics.beginFill(t,l),this.graphics.fillBox(g),this.graphics.endFill()}const v=g.getCenter(),y=g.getSize();if(m){const e=this.processText(l.text,uD,y.x/t,Math.floor(y.y/t/16));this.preSelectedText.style.wordWrapWidth=y.x/t,this.preSelectedText.text=e,this.preSelectedText.scale.x=t,this.preSelectedText.scale.y=t,this.preSelectedText.anchor.set(.5,.5),this.preSelectedText.x=v.x,this.preSelectedText.y=v.y}}),this.result.forEach((t,e)=>{const i=e===this.interactionParam.preSelected&&!this.clearPreSelected,{box:r,id:n,hasChanged:s}=t,o=Xw(this._pageDataUtils.getViewBoxById(n),r);if(s){const t=s?i?m:f:i?d:l,e=s?i?g:p:i?u:c;o.corners.forEach((i,r)=>{const n=i.clone(),s=o.corners[(r+1)%4].clone(),a=(new Lw).subtractVectors(s,n).angle()*zw;if([180,270].includes(a)){const t=s.clone();s.copyFrom(n),n.copyFrom(t)}this.editGraphics.lineStyle(1,t,e),this.editGraphics.moveTo(...n.toArray()),this.editGraphics.lineTo(...s.toArray())})}else{const t=s?i?m:f:i?d:l,e=s?i?g:p:i?u:c;o.corners.forEach((i,r)=>{const n=i.clone(),s=o.corners[(r+1)%4].clone(),a=(new Lw).subtractVectors(s,n).angle()*zw;if([180,270].includes(a)){const t=s.clone();s.copyFrom(n),n.copyFrom(t)}this.graphics.lineStyle(1,t,e),this.graphics.moveTo(...n.toArray()),this.graphics.lineTo(...s.toArray())})}})}getRenderObjects(){const t=!!this.result.find(t=>t.isEditing);this.clearPreSelected=!1;const e=[];return this.interactive?(e.push(this.graphics,this.editGraphics),t&&e.push(this.preSelectedText),e):e}processText(t,e,i,r){const n=[];let s="";const o=t.split(""),a=new qO("",e);for(let t=0;t<o.length;t++){const e=o[t],h=s+e;if(a.text=h,a.width>i){if(n.push(s),n.length>=r){const t=n[r-1];t.length>2?n[r-1]=t.slice(0,-2)+"...":n[r-1]="...";break}s=e}else s=h;t===o.length-1&&s&&n.push(s)}return n.slice(0,r).join("\n")}},fD=class extends eR{constructor(t,e){super(),A(this,"type","video-play"),A(this,"result",{id:"",box:new Kw}),A(this,"interactionParam",{type:"none"}),A(this,"logoSprite"),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"_pageDataUtils"),A(this,"_eventEmitter"),this._pageDataUtils=t,this._eventEmitter=e;const{logoUrl:i,width:r,height:n}=Lk.config.gestureHandlerConfig.videoPlayGizmoConfig;this.logoSprite=NO.from(i),this.logoSprite.width=r,this.logoSprite.height=n}get interactive(){return Lk.config.gestureHandlerConfig.videoPlayGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.videoPlayGizmoEnabled&&(Lk.config.gestureHandlerConfig.videoPlayGizmoEnabled=t)}preparationAction(t){if(!this.interactive)return;const e=new Lw(t.offsetX,t.offsetY);return this.result.box.containsPoint(e)?this.interactionParam.type="preSelected":this.interactionParam.type="none",this.refreshCursorResult(),"none"===this.interactionParam.type?void 0:this.type}preAction(t,e){const i=this._pageDataUtils.getVideoItemPlayTime(this.result.id);return this._eventEmitter.emit("videoPlay",{id:this.result.id,time:i}),this.interactionParam.type="none",this.refreshCursorResult(),this.type}action(t){}endAction(t){}interruption(){}actionKey(t){}endActionKey(t){}cancelPreparation(){}refreshCursorResult(){switch(this.interactionParam.type){case"none":this.cursorResult={type:"normal",angle:0};break;case"preSelected":this.cursorResult={type:"pointer",angle:0}}}refreshResults(){if(!this.interactive)return;this.result={id:"",box:new Kw};const t=this._pageDataUtils.getSelectedItems();if(1!==t.length||"video"!==t[0]?.type)return;const e=t[0].id,{width:i,height:r,logoShift:n}=Lk.config.gestureHandlerConfig.videoPlayGizmoConfig,s=this._pageDataUtils.getViewBoxById(e),o=s.getSize();if(o.x<50||o.y<50)this.result.box.makeEmpty();else{const{max:t}=s,o=new Lw(t.x-n[0],t.y-n[1]),a=new Lw(i,r);this.result.id=e,this.result.box.setFromCenterAndSize(o,a)}}getRenderObjects(){if(!this.interactive||this.result.box.isEmpty())return[];const t=this.result.box.getCenter();return this.logoSprite.anchor.set(.5,.5),this.logoSprite.x=t.x,this.logoSprite.y=t.y,[this.logoSprite]}},pD=class extends eR{constructor(t,e){super(),A(this,"type","item-create"),A(this,"_createType","none"),A(this,"cursorResult",{type:"normal",angle:0}),A(this,"_pageDataUtils"),A(this,"_eventEmitter"),A(this,"graphics",new MR),A(this,"dragStartPoint",null),A(this,"dragCurrentPoint",null),A(this,"isDragging",!1),A(this,"frameBox",null),this._pageDataUtils=t,this._eventEmitter=e}get interactive(){return Lk.config.gestureHandlerConfig.itemCreateGizmoEnabled}set interactive(t){t!==Lk.config.gestureHandlerConfig.itemCreateGizmoEnabled&&(t&&this._pageDataUtils.clearSelectedItems(),Lk.config.gestureHandlerConfig.itemCreateGizmoEnabled=t,this._createType=t?this._createType:"none")}get createType(){return this._createType}set createType(t){t!==this._createType&&(this._createType=t,this.refreshCursorResult())}preparationAction(t){return this.interactive?this.type:void 0}preAction(t,e){if(this.interactive)return"frame"===this._createType?(this.dragStartPoint=new Lw(t.offsetX,t.offsetY),this.dragCurrentPoint=this.dragStartPoint.clone(),this.isDragging=!0,this.frameBox=null,this.type):this.type}action(t){if("frame"===this._createType&&this.isDragging&&this.dragStartPoint){this.dragCurrentPoint=new Lw(t.offsetX,t.offsetY);const e=Math.min(this.dragStartPoint.x,this.dragCurrentPoint.x),i=Math.min(this.dragStartPoint.y,this.dragCurrentPoint.y),r=Math.max(this.dragStartPoint.x,this.dragCurrentPoint.x),n=Math.max(this.dragStartPoint.y,this.dragCurrentPoint.y);this.frameBox=new Kw(new Lw(e,i),new Lw(r,n))}}endAction(t){const e=ei();if("frame"===this._createType){let i=!1;if(this.isDragging&&this.dragStartPoint){i=this.dragStartPoint.distanceTo(new Lw(t.offsetX,t.offsetY))>=10}const r=i&&this.frameBox&&!this.frameBox.isEmpty()?this._pageDataUtils.interactionUtils.getPixelPositionByViewPoint(this.frameBox.getCenter()):this._pageDataUtils.interactionUtils.getPixelPositionByViewPoint(new Lw(t.offsetX,t.offsetY));if(i&&this.frameBox&&!this.frameBox.isEmpty()){const t=this.frameBox.getSize(),i=this._pageDataUtils.interactionUtils.getPixelSizeByViewSize(t),n={type:"frame",id:e,name:"画板",property:{width:i.x,height:i.y,position:[r.x,r.y],layoutMode:"free",children:[]}};this._pageDataUtils.addFrameItem(n)}else{const t={type:"frame",id:e,name:"画板",property:{width:1048,height:1048,position:[r.x,r.y],layoutMode:"free",children:[]}};this._pageDataUtils.addFrameItem(t)}return this.resetDragState(),void this._eventEmitter.emit("itemCreate",{type:this._createType,id:e,position:r.toArray()})}if("text"===this._createType){const i=this._pageDataUtils.interactionUtils.getPixelPositionByViewPoint(new Lw(t.offsetX,t.offsetY)).toArray();return void this._eventEmitter.emit("itemCreate",{type:this.createType,id:e,position:i})}if("none"!==this._createType){const i=this._pageDataUtils.interactionUtils.getPixelPositionByViewPoint(new Lw(t.offsetX,t.offsetY)).toArray();this._eventEmitter.emit("itemCreate",{type:this.createType,id:e,position:i})}}interruption(){return this.resetDragState(),this.type}resetDragState(){this.isDragging=!1,this.dragStartPoint=null,this.dragCurrentPoint=null,this.frameBox=null,this.graphics.clear()}actionKey(t){}endActionKey(t){}cancelPreparation(){}refreshResults(){if(this.graphics.clear(),"frame"===this._createType&&this.isDragging&&this.frameBox&&!this.frameBox.isEmpty()){const{min:t,max:e}=this.frameBox,i=e.x-t.x,r=e.y-t.y,{itemCreateGizmoConfig:n}=Lk.config.gestureHandlerConfig;this.graphics.lineStyle(n.frameBorderWidth,n.frameBorderColor,n.frameBorderAlpha),this.graphics.drawRect(t.x,t.y,i,r),this.graphics.beginFill(n.frameFillColor,n.frameFillAlpha),this.graphics.drawRect(t.x,t.y,i,r),this.graphics.endFill()}}getRenderObjects(){return"frame"===this._createType&&this.isDragging?(this.refreshResults(),[this.graphics]):[]}refreshCursorResult(){switch(this._createType){case"text":this.cursorResult={type:"text-create",angle:0};break;case"frame":this.cursorResult={type:"frame-create",angle:0};break;case"none":case"sprite-generator":case"video-generator":this.cursorResult={type:"normal",angle:0}}}},mD=class{constructor(t){A(this,"wireframeApplication"),A(this,"gizmos",[]),A(this,"activeGizmo"),A(this,"selectorGizmo"),A(this,"transformGizmo"),A(this,"controlGizmo"),A(this,"preferenceGizmo"),A(this,"pictureCutGizmo"),A(this,"pictureExpandGizmo"),A(this,"textGizmo"),A(this,"maskGizmo"),A(this,"loadingGizmo"),A(this,"spriteTextEditGizmo"),A(this,"videoPlayGizmo"),A(this,"itemCreateGizmo"),A(this,"_ignoreInteraction",!1),A(this,"clickButtons",0),A(this,"container"),A(this,"_emitter"),A(this,"clickTime",0),A(this,"firstClick",!0),A(this,"dblclickTimeSpan",500),A(this,"spaceEmit",!1),A(this,"interactType","select"),this.gizmos=[];const{width:e,height:i}=t.getBoundingClientRect();this.wireframeApplication=new ZM({backgroundAlpha:0,width:e,height:i,resolution:2,autoDensity:!0,antialias:!0}),this.container=t,this.wireframeApplication.view.style.position="absolute",this.wireframeApplication.view.id="wireframeApplicationCanvas",t.appendChild(this.wireframeApplication.view),this.wireframeApplication.stage.sortableChildren=!0,async function(){await Promise.all(Object.entries(QO).map(([t,e])=>{const{url:i}=e;if(i)return fetch(i).then(t=>t.text()).then(i=>QO[t]={...e,content:i})})).catch(t=>{console.error(t)})}()}set ignoreInteraction(t){t!==this._ignoreInteraction&&(this._ignoreInteraction=t,t&&(this.activeGizmo?.cancelPreparation(),this.activeGizmo=void 0))}get ignoreInteraction(){return this._ignoreInteraction}resize(){this.wireframeApplication&&(this.wireframeApplication.resizeTo=this.container,this.render())}refresh(){this.gizmos.forEach(t=>{t.refreshResults()})}render(){if(this.refresh(),!this.wireframeApplication?.stage)return;this.wireframeApplication?.stage?.removeChildren();const t=(this.ignoreInteraction?[this.preferenceGizmo]:this.gizmos).flatMap(t=>t.getRenderObjects());this.wireframeApplication?.stage?.addChild(...t),this.wireframeApplication?.render();const e=this.activeGizmo instanceof KO||this.activeGizmo instanceof oD||this.activeGizmo instanceof cD||this.activeGizmo instanceof hD||this.activeGizmo instanceof aD||this.activeGizmo instanceof iR||this.activeGizmo instanceof fD||this.activeGizmo instanceof pD?this.activeGizmo.cursorResult:void 0;this.setCursor(e)}async init(t,e){if(null===this.wireframeApplication)return void setTimeout(async()=>{await this.init(t,e)},50);this.gizmos=[],this.controlGizmo=new iR(t),this.selectorGizmo=new RR(t);const i=new ZO;this.transformGizmo=new KO(t,i,this.selectorGizmo),this.preferenceGizmo=new JO(t),this.pictureCutGizmo=new oD(t,e),this.pictureExpandGizmo=new cD(t,e),this.textGizmo=new aD(t,i,this.selectorGizmo,e,this.wireframeApplication?.view.parentElement),this.textGizmo.rotationSprite.texture=await KC.fromURL(Lk.config.gestureHandlerConfig.textGizmoConfig.rotationCornerTexture),this.maskGizmo=new hD(t,this.wireframeApplication),this.loadingGizmo=new lD(t),this.spriteTextEditGizmo=new dD(t,e),this.videoPlayGizmo=new fD(t,e),this.itemCreateGizmo=new pD(t,e),this.gizmos.push(this.itemCreateGizmo,this.maskGizmo,this.spriteTextEditGizmo,this.pictureCutGizmo,this.pictureExpandGizmo,this.loadingGizmo,this.videoPlayGizmo,this.transformGizmo,this.textGizmo,this.selectorGizmo,this.controlGizmo,this.preferenceGizmo,i),this._emitter=e,this.initEvents(),this.registerViewEvent()}initEvents(){this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)}registerViewEvent(){this.wireframeApplication.view.onmousedown=t=>{this.onMouseDown(t)},this.wireframeApplication.view.onmousemove=t=>{0===t.buttons&&this.onMouseMove(t)},this.wireframeApplication.view.onmouseout=()=>{this.selectorGizmo?.cancelPreparation(),this.render()},this.wireframeApplication.view.onwheel=t=>{this.onWheel(t)},this.wireframeApplication.view.oncontextmenu=t=>{t.stopPropagation(),t.preventDefault()}}onMouseDown(t){if(!this.ignoreInteraction){switch(this.clickButtons=t.buttons,this.interactType){case"select":if(4===this.clickButtons&&(this.activeGizmo=this.controlGizmo,this.controlGizmo.preAction(t)),this.firstClick=!!this.firstClick&&Date.now()-this.clickTime<this.dblclickTimeSpan,this.firstClick){if(this.gizmos.forEach(e=>{if(e.interactive)if(void 0===this.activeGizmo){const i=e.preparationAction(t);this.activeGizmo=this.gizmos.find(t=>t.type===i)}else e.cancelPreparation()}),this.activeGizmo&&["transform","text"].includes(this.activeGizmo.type)){const e=this.activeGizmo.preAction(t,!0);this.activeGizmo=this.gizmos.find(t=>t.type===(e??"null"))}else if(this.activeGizmo&&!["picture-cut","picture-expand","mask","sprite-text-edit","video-play"].includes(this.activeGizmo.type)){this.activeGizmo=void 0;const e=this.selectorGizmo?.preAction(t,!0);this.activeGizmo=this.gizmos.find(t=>t.type===(e??"null"))}this.firstClick=!1}else{void 0===this.activeGizmo&&this.gizmos.forEach(e=>{if(!e.interactive||this.activeGizmo)return;const i=e.preparationAction(t);this.activeGizmo=this.gizmos.find(t=>t.type===i)});const e=this.activeGizmo?.preAction(t);e&&!["selector","transform"].includes(e)&&this.selectorGizmo&&(this.selectorGizmo.clearResult=!0),this.activeGizmo=this.gizmos.find(t=>t.type===e),this.clickTime=Date.now(),this.firstClick=!0}break;case"hand":this.activeGizmo=this.controlGizmo,this.activeGizmo.preAction(t)}this.render(),this._emitter?.emit("itemOnDragStart",this.activeGizmo?.type??"null"),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)}}onMouseMove(t){if(!this.ignoreInteraction){if(0!==t.buttons)this.activeGizmo?.action(t),"selector"!==this.activeGizmo?.type&&this.selectorGizmo&&(this.selectorGizmo.clearResult=!0),this._emitter?.emit("itemOnDrag",this.activeGizmo?.type??"null");else switch(this.interactType){case"select":this.activeGizmo=void 0,this.spaceEmit?(this.activeGizmo=this.controlGizmo,this.controlGizmo.interactionType="mouse"):this.gizmos.forEach(e=>{if(e.interactive)if(void 0===this.activeGizmo){const i=e.preparationAction(t);i&&!["selector","transform"].includes(i)&&this.selectorGizmo&&(this.selectorGizmo.clearResult=!0),this.activeGizmo=this.gizmos.find(t=>t.type===i)}else e.cancelPreparation()});break;case"hand":this.activeGizmo=this.controlGizmo,this.activeGizmo.preparationAction(t)}this.render()}}onWheel(t){this.ignoreInteraction||(t.preventDefault(),this.selectorGizmo&&(this.selectorGizmo.clearResult=!0),this.spriteTextEditGizmo&&(this.spriteTextEditGizmo.clearPreSelected=!0),this.controlGizmo?.action(t))}onMouseUp(t){if(this.ignoreInteraction)return;const e=this.activeGizmo?.endAction(t);this.activeGizmo=this.gizmos.find(t=>t.type===e),void 0===this.activeGizmo&&1===this.clickButtons&&this.gizmos.forEach(e=>{if(e.interactive)if(void 0===this.activeGizmo){const i=e.preparationAction(t);this.activeGizmo=this.gizmos.find(t=>t.type===i)}else e.cancelPreparation()}),this.clickButtons=0,this._emitter?.emit("itemOnDragEnd",this.activeGizmo?.type??"null"),this.render(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)}onKeyDown(t){this.ignoreInteraction||("escape"===t.code.toLocaleLowerCase()&&"select"!==this.interactType&&this.setInteractType("select"),"space"!==t.code.toLocaleLowerCase()||this.activeGizmo?.active?this.gizmos.forEach(e=>{e.actionKey(t)}):(this.spaceEmit=!0,this.activeGizmo=this.controlGizmo,this.controlGizmo.interactionType="hand"===this.interactType||this.spaceEmit?"mouse":"wheel"),this.render())}onKeyUp(t){this.ignoreInteraction||(this.gizmos.forEach(e=>{e.endActionKey(t)}),"space"===t.code.toLocaleLowerCase()&&(this.spaceEmit=!1,this.controlGizmo.interactionType="hand"===this.interactType||this.spaceEmit?"mouse":"wheel"),this.render())}dispose(){this.container.removeChild(this.wireframeApplication.view),this.wireframeApplication.destroy(),this.gizmos=[],this.activeGizmo=void 0}setCursor(t){let e="default";if("circle"===t?.type){const i=1,r=t.radius||10;e=`url("data:image/svg+xml,${encodeURIComponent(`<svg width="${2*r}" height="${2*r}" xmlns="http://www.w3.org/2000/svg"><circle cx="${r}" cy="${r}" r="${r}" fill="rgba(255, 255, 255, 0.6)" stroke="#6A34FF" stroke-width="${i}" /></svg>`)}") ${r} ${r}, auto`}else if(t?.type&&["scale","rotation","hand","active-hand","pointer","text-create","frame-create"].includes(t.type)){const i=QO[t.type];if("svg"===i.type){const r=16;e=encodeURIComponent(i.content.replace("rotate(0.00)",`rotate(${t.angle??0})`)),e=`url("data:image/svg+xml,${e}") ${r} ${r}, auto`}else e=i.content}this.wireframeApplication.view.style.cursor=e}openPictureCutGizmo(){if(!this.pictureCutGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.pictureCutGizmo.interactive=!0,this.pictureCutGizmo.interactive&&(this.pictureExpandGizmo.interactive=!1,this.maskGizmo.interactive=!1,this.selectorGizmo.interactive=!1,this.transformGizmo.interactive=!1,this.textGizmo.interactive=!1,this.itemCreateGizmo.interactive=!1);const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}closePictureCutGizmo(){if(!this.pictureCutGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.pictureCutGizmo.interactive=!1,this.transformGizmo.interactive=!0,this.selectorGizmo.interactive=!0,this.textGizmo.interactive=!0;const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}setInteractType(t){t!==this.interactType&&(this.interactType=t,this.controlGizmo.interactionType="hand"===this.interactType||this.spaceEmit?"mouse":"wheel")}getCutInfo(){return this.pictureCutGizmo?.getCutInfo()}setCutBox(t,e){const i=this.pictureCutGizmo?.setCutBox(t,e);return this.render(),i}openPictureExpandGizmo(){if(!this.pictureExpandGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.pictureExpandGizmo.interactive=!0,this.pictureExpandGizmo.interactive&&(this.pictureCutGizmo.interactive=!1,this.maskGizmo.interactive=!1,this.selectorGizmo.interactive=!1,this.transformGizmo.interactive=!1,this.textGizmo.interactive=!1,this.itemCreateGizmo.interactive=!1);const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}closePictureExpandGizmo(){if(!this.pictureExpandGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.pictureExpandGizmo.interactive=!1,this.transformGizmo.interactive=!0,this.selectorGizmo.interactive=!0,this.textGizmo.interactive=!0;const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}getExpandInfo(){return this.pictureExpandGizmo?.getExpandInfo()}setExpandBox(t,e){const i=this.pictureExpandGizmo?.setExpandBox(t,e);return this.render(),i}openMaskGizmo(t){if(!this.maskGizmo)return;const e=JSON.parse(JSON.stringify(Lk.config));this.maskGizmo.interactive=!0,this.maskGizmo.config={brushSize:t},this.maskGizmo.interactive&&(this.pictureCutGizmo.interactive=!1,this.pictureExpandGizmo.interactive=!1,this.transformGizmo.interactive=!1,this.selectorGizmo.interactive=!1,this.itemCreateGizmo.interactive=!1);const i=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",e,i)}clearMaskGizmo(){this.maskGizmo&&(this.maskGizmo.clearMask(),this.render())}closeMaskGizmo(){if(!this.maskGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.maskGizmo.interactive=!1,this.transformGizmo.interactive=!0,this.selectorGizmo.interactive=!0;const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}setMaskGizmoConfig(t){this.maskGizmo&&(this.maskGizmo.config=t)}async getMask(){if(this.maskGizmo)return this.maskGizmo.getMask()}setMaskGizmoMode(t){this.maskGizmo&&this.maskGizmo.setMode(t)}openLoadingGizmo(t,e){if(!this.loadingGizmo)return;const i=JSON.parse(JSON.stringify(Lk.config));this.loadingGizmo.add(t,e),this.loadingGizmo.interactive&&(this.maskGizmo.interactive=!1,this.pictureCutGizmo.interactive=!1,this.pictureExpandGizmo.interactive=!1,this.itemCreateGizmo.interactive=!1);const r=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",i,r)}updateLoadingGizmo(t,e){if(!this.loadingGizmo)return;const i=JSON.parse(JSON.stringify(Lk.config));this.loadingGizmo.update(t,e);const r=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",i,r)}closeLoadingGizmo(t){if(!this.loadingGizmo)return;const e=JSON.parse(JSON.stringify(Lk.config));this.loadingGizmo.delete(t);const i=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",e,i)}setPictureCutGizmoLockScale(t){this.pictureCutGizmo.isLockScale=t}setPictureExpandGizmoLockScale(t){this.pictureExpandGizmo.isLockScale=t}setTransformGizmoLockScale(t){this.transformGizmo.isLockScale=t}maskGizmoUndo(){if(!this.maskGizmo)return!1;const t=this.maskGizmo.undo();return t&&this.render(),t}maskGizmoRedo(){if(!this.maskGizmo)return!1;const t=this.maskGizmo.redo();return t&&this.render(),t}get maskGizmoCanUndo(){return this.maskGizmo?.canUndo??!1}get maskGizmoCanRedo(){return this.maskGizmo?.canRedo??!1}clearMaskGizmoUndoRedo(){this.maskGizmo?.clearUndoRedo()}pictureCutGizmoUndo(){if(!this.pictureCutGizmo)return!1;const t=this.pictureCutGizmo.undo();return t&&this.render(),t}pictureCutGizmoRedo(){if(!this.pictureCutGizmo)return!1;const t=this.pictureCutGizmo.redo();return t&&this.render(),t}get pictureCutGizmoCanUndo(){return this.pictureCutGizmo?.canUndo??!1}get pictureCutGizmoCanRedo(){return this.pictureCutGizmo?.canRedo??!1}clearPictureCutGizmoUndoRedo(){this.pictureCutGizmo?.clearUndoRedo()}openSpriteTextGizmo(t){if(!this.spriteTextEditGizmo)return;const e=JSON.parse(JSON.stringify(Lk.config));this.spriteTextEditGizmo.interactive=!0,this.spriteTextEditGizmo.initResult(t),this.spriteTextEditGizmo.interactive&&(this.maskGizmo.interactive=!1,this.pictureCutGizmo.interactive=!1,this.pictureExpandGizmo.interactive=!1,this.transformGizmo.interactive=!1,this.selectorGizmo.interactive=!1,this.itemCreateGizmo.interactive=!1);const i=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",e,i)}closeSpriteTextEditGizmo(){if(!this.spriteTextEditGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.spriteTextEditGizmo.interactive=!1,this.spriteTextEditGizmo.clearResult(),this.transformGizmo.interactive=!0,this.selectorGizmo.interactive=!0;const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}setSpriteTextSelectedIndex(t,e){this.spriteTextEditGizmo?.setSelected(t,e)}setSpriteTextSelectedText(t,e,i){this.spriteTextEditGizmo?.setText(t,e,i)}setSpriteTextChangedState(t,e,i){this.spriteTextEditGizmo?.setChangedState(t,e,i)}setSpriteTextEditState(t,e,i){this.spriteTextEditGizmo?.setEditState(t,e,i)}openItemCreateGizmo(t){if(!this.itemCreateGizmo)return;const e=JSON.parse(JSON.stringify(Lk.config));this.itemCreateGizmo.interactive=!0,this.itemCreateGizmo.createType=t;const i=JSON.parse(JSON.stringify(Lk.config));this.itemCreateGizmo.interactive&&(this.maskGizmo.interactive=!1,this.pictureCutGizmo.interactive=!1,this.pictureExpandGizmo.interactive=!1,this.transformGizmo.interactive=!1,this.selectorGizmo.interactive=!1,this.spriteTextEditGizmo.interactive=!1),this.render(),this._emitter?.emit("sdkConfigChange",e,i)}closeItemCreateGizmo(){if(!this.itemCreateGizmo)return;const t=JSON.parse(JSON.stringify(Lk.config));this.itemCreateGizmo.interactive=!1,this.transformGizmo.interactive=!0,this.selectorGizmo.interactive=!0;const e=JSON.parse(JSON.stringify(Lk.config));this.render(),this._emitter?.emit("sdkConfigChange",t,e)}},gD=class{constructor(t){A(this,"plane",new eT),A(this,"ray",new iT),A(this,"viewportParam",{width:0,height:0,scale:1,translation:new Lw,rulerWidth:0}),A(this,"cameraParam",{position:new $w,rotation:new $w,focusPosition:new $w,focusRotation:new $w,viewProjectionMatrix:new Qw,inverseViewProjectionMatrix:new Qw}),A(this,"pageDataUtils"),this.pageDataUtils=t}refreshViewParam(){const t=this.pageDataUtils.getPageData();Be(t,"You must run SDK first");const e=new Lw(this.pageDataUtils.container.offsetWidth,this.pageDataUtils.container.offsetHeight),{zoom:i,translation:r}=t.property;this.viewportParam.width=e.x,this.viewportParam.height=e.y,this.viewportParam.scale=i,this.viewportParam.translation=new Lw(...r),this.viewportParam.rulerWidth=0}refreshCameraParam(){const{player:t}=this.pageDataUtils,e=t?.getCompositions()?.[0]?.camera;if(e){const t=Qw.fromArray(e.getViewProjectionMatrix().toArray()),i=Qw.fromArray(e.getViewMatrix().toArray()).invert(),r=new Jw;i.decompose(this.cameraParam.position,r,new $w),this.cameraParam.rotation=(new tT).setFromQuaternion(r).toDegreeVector3(),this.cameraParam.focusPosition=new $w(...this.cameraParam.position.toVector2().toArray(),this.cameraParam.position.z>0?0:2*this.cameraParam.position.z),this.cameraParam.focusPosition.applyEuler((new tT).setFromDegreeVector3(this.cameraParam.rotation.clone()),this.cameraParam.position),this.cameraParam.focusRotation=(new tT).setFromQuaternion(r.invert()).toDegreeVector3(),this.cameraParam.viewProjectionMatrix=t,this.cameraParam.inverseViewProjectionMatrix=Qw.fromArray(e.getInverseViewProjectionMatrix().toArray())}}refrehCameraParamByCameraInfo(t){const{near:e,far:i,fov:r,aspect:n,position:s,clipMode:o}=t,a=(new Qw).perspective(r*Math.PI/180,n,e,i,1===o),h=(new Qw).compose(new $w(...s),new Jw,new $w(1,1,1)).invert(),l=(new Qw).multiplyMatrices(a,h),c=l.clone().invert();this.cameraParam.position=new $w(...s),this.cameraParam.rotation=(new tT).toDegreeVector3(),this.cameraParam.focusPosition=new $w(s[0],s[1],this.cameraParam.position.z>0?0:2*this.cameraParam.position.z),this.cameraParam.focusPosition.applyEuler((new tT).setFromDegreeVector3(this.cameraParam.rotation.clone()),this.cameraParam.position),this.cameraParam.focusRotation=(new tT).toDegreeVector3(),this.cameraParam.viewProjectionMatrix=l,this.cameraParam.inverseViewProjectionMatrix=c}initInteractionPlane(t,e){t??(t=this.cameraParam.focusPosition),e??(e=(new tT).setFromDegreeVector3(this.cameraParam.rotation));const i=new $w(0,0,1).applyEuler(e);this.plane.setFromNormalAndCoplanarPoint(t,i)}getWorldSizeByViewSize(t,e=!0,i){const r=e||!i?(new tT).setFromDegreeVector3(this.cameraParam.rotation):(new tT).setFromQuaternion((new Jw).setFromRotationMatrix(this.pageDataUtils.getItemTransformById(i).matrix)),n=i?(new $w).setFromMatrixPosition(this.pageDataUtils.getItemTransformById(i).matrix):this.cameraParam.focusPosition,s="editor"===Lk.config.mode?1:this.viewportParam.scale;t.multiply(s);const o=this.projectPoint(n.clone()),a=this.getWorldPositionByViewPoint(o.add(t));if(!a)return console.warn("size is out of bounds."),new $w(0,0,0);const h=(new tT).setFromQuaternion((new Jw).setFromEuler(r).invert());return(e||!i?a.applyEuler(h,n):a).subtract(n)}getViewSizeByPixelSize(t){const{scale:e}=this.viewportParam,i="template"===Lk.config.mode?1:e;return t.clone().multiply(i)}projectPoint(t){const{width:e,height:i,scale:r}=this.viewportParam,{viewProjectionMatrix:n}=this.cameraParam,s="editor"===Lk.config.mode?1:r;return(new Lw).copyFrom(t.applyMatrix(n).toVector2()).toViewCoordinate(e*s,i*s)}getWorldPositionByViewPoint(t){const{position:e,inverseViewProjectionMatrix:i}=this.cameraParam,r=this.getNDCPositionByScreenPosition(t),n=(new rT).setFromCamera(r,{position:e,inverseViewProjectMatrix:i}).rayCastPlane(this.plane);return n?.point}getNDCPositionByScreenPosition(t){const{width:e,height:i,scale:r}=this.viewportParam,n="editor"===Lk.config.mode?1:r;return new Lw(t.x/(e*n)*2-1,1-t.y/(i*n)*2)}getNDCSizeByPixelSize(t){const{width:e,height:i}=this.viewportParam;return new Lw(t.x/e*2,-t.y/i*2)}getViewPositionWWithOutTransform(t){const{scale:e}=this.viewportParam,i="editor"===Lk.config.mode?1:e;return t.divide(i)}getViewPositionByPixelPoint(t){if("template"===Lk.config.mode)return t.clone();const{width:e,height:i,scale:r,translation:n}=this.viewportParam;return t.clone().scaleByCenter(new Lw(r,r),new Lw(e/2,i/2)).add(n)}getPixelPositionByViewPoint(t){if("template"===Lk.config.mode)return t.clone();const{width:e,height:i,scale:r,translation:n}=this.viewportParam;return t.clone().subtract(n.clone()).scaleByCenter(new Lw(1/r,1/r),new Lw(e/2,i/2))}getPixelSizeByWorldSize(t){const e=this.projectPoint(new $w),i=this.projectPoint(t).subtract(e);return i.abs(),i}getPixelSizeByNDCSize(t){const{width:e,height:i}=this.viewportParam;return new Lw(t.x/2*e,-t.y/2*i)}getPixelSizeByViewSize(t){const{scale:e}=this.viewportParam;return t.clone().divide(e)}},vD={SCRIPT:"https://gw.alipayobjects.com/os/gltf-asset/99531561844014/img2webp.js",WASM:"https://mdn.alipayobjects.com/mars/uri/file/as/0.0.4/wasm/img2webp/img2webp.wasm"},yD={CLASSWORKER:"https://mdn.alipayobjects.com/rms/uri/file/as/ffmpeg/core/0.12.10/dist/worker.js",DEFAULT:{CORE:"https://gw.alipayobjects.com/os/lib/ffmpeg/core/0.12.10/dist/esm/ffmpeg-core.js",WASM:"https://gw.alipayobjects.com/os/lib/ffmpeg/core/0.12.10/dist/esm/ffmpeg-core.wasm"},MT:{CORE:"https://gw.alipayobjects.com/os/lib/ffmpeg/core-mt/0.12.10/dist/esm/ffmpeg-core.js",WASM:"https://gw.alipayobjects.com/os/lib/ffmpeg/core-mt/0.12.10/dist/esm/ffmpeg-core.wasm",WORKER:"https://gw.alipayobjects.com/os/lib/ffmpeg/core-mt/0.12.10/dist/esm/ffmpeg-core.worker.js"}};function xD(t,e,i,r){const n=e.getContext("2d");rD(n),n.clearRect(0,0,e.width,e.height),i&&(n.save(),n.fillStyle=i,n.fillRect(0,0,e.width,e.height),n.restore()),r&&n.drawImage(r,0,0,r.width,r.height,0,0,e.width,e.height),n.drawImage(t,0,0,t.width,t.height,0,0,e.width,e.height)}function bD(t,e){return String(t).padStart(e,"0")}async function _D(){return new Promise(async(t,e)=>{try{await function(t,e={}){return new Promise((i,r)=>{const n=document.querySelector(`script[src="${t}"]`);if(n)return"true"===n.dataset.loaded?void i(n):(n.addEventListener("load",()=>{i(n)}),void n.addEventListener("error",()=>{r(new Error(`Script already failed: ${t}`))}));const s=document.createElement("script");s.src=t,s.async=!0,Object.keys(e).forEach(t=>{s.setAttribute(t,e[t]??"")}),s.onload=()=>{s.dataset.loaded="true",i(s)},s.onerror=()=>{r(new Error(`Failed to load script: ${t}`))},document.head.appendChild(s)})}(vD.SCRIPT,{crossOrigin:"anonymous"});const e={locateFile:(t,e)=>t.endsWith("createWebPCore.wasm")?vD.WASM:e+t};t(await window.createWebPCore(e))}catch(t){e(t)}})}function wD(t){for(const e of t.getCompositions())for(const t of e.textures)t.isDestroyed||t.dispose();t.disposed||t.destroyCurrentCompositions()}function TD(t=[750,750],e="AI 设计师画布"){const i=ei(),r={id:ei(),dataType:en.DataType.TimelineAsset,tracks:[]},n={id:ei(),item:{id:i},dataType:en.DataType.CompositionComponent,items:[],timelineAsset:{id:r.id},sceneBindings:[]},s={id:i,name:e,duration:999,startTime:0,endBehavior:en.EndBehavior.forward,previewSize:[...t],camera:{fov:60,far:40,near:.1,clipMode:1,position:[0,0,8],rotation:[0,0,0],aspect:t[0]/t[1]},components:[{id:n.id}]},o={version:en.JSONSceneVersion.LATEST,playerVersion:{web:Lm,native:"10.7.6"},type:"ge",compositionId:i,compositions:[],images:[],plugins:[],bins:[],textures:[],items:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]};return o.miscs.push(r),o.compositions.push(s),o.components.push(n),o}function ED(t,e,i,r,n,s,o){const a=ei(),h={id:t,name:s,dataType:en.DataType.VFXItemData,components:[{id:a}],delay:0,duration:999,endBehavior:en.EndBehavior.restart,renderLevel:en.RenderLevel.BPlus,type:en.ItemType.sprite,visible:!0,transform:{position:{x:e.x,y:e.y,z:e.z},eulerHint:{x:i.x,y:i.y,z:i.z},size:{x:r.x,y:r.y},scale:{x:n.x,y:n.y,z:n.z},anchor:{x:0,y:0}},content:void 0},l={id:a,item:{id:t},dataType:en.DataType.SpriteComponent,options:{startColor:[1,1,1,1]},renderer:{renderMode:en.RenderMode.MESH}};o&&(l.renderer.texture={id:o});const c={id:ei(),dataType:en.DataType.ActivationPlayableAsset},u={id:ei(),dataType:en.DataType.ActivationTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:c.id}}]},d={id:ei(),dataType:en.DataType.SpriteColorPlayableAsset,startColor:[1,1,1,1]};return{item:h,components:[l],tracks:[u,{id:ei(),dataType:en.DataType.SpriteColorTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:d.id}}]}],playableAssets:[c,d]}}function SD(t,e,i,r=new Lw(1,1),n=new $w){const s=JSON.parse(JSON.stringify(i)),o={id:t,name:e,duration:999,type:en.ItemType.null,visible:!0,endBehavior:en.EndBehavior.restart,delay:0,renderLevel:en.RenderLevel.BPlus,content:{options:{startColor:[1,1,1,1]}},components:[],transform:{position:s,eulerHint:{x:n.x,y:n.y,z:n.z},size:{x:1,y:1},scale:{x:r.x,y:r.y,z:1}},dataType:en.DataType.VFXItemData},a={id:ei(),dataType:en.DataType.ActivationPlayableAsset};return{item:o,components:[],tracks:[{id:ei(),dataType:en.DataType.ActivationTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:a.id}}]}],playableAssets:[a]}}function ID(t,e,i,r,n,s){const o=ei(),a={id:t,name:e,dataType:en.DataType.VFXItemData,components:[{id:o}],delay:0,duration:999,endBehavior:en.EndBehavior.restart,renderLevel:en.RenderLevel.BPlus,type:en.ItemType.text,visible:!0,transform:{position:{x:i.x,y:i.y,z:i.z},eulerHint:{x:r.x,y:r.y,z:r.z},scale:{x:n.x,y:n.y,z:1},anchor:{x:0,y:0}},content:void 0},h={id:o,item:{id:t},dataType:en.DataType.TextComponent,options:s,renderer:{renderMode:1}},l={id:ei(),dataType:en.DataType.ActivationPlayableAsset};return{item:a,components:[h],tracks:[{id:ei(),dataType:en.DataType.ActivationTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:l.id}}]}],playableAssets:[l]}}function AD(t,e,i,r,n,s,o=!1,a=!1,h=1,l=1,c,u){const d=ei(),f={id:t,name:s,dataType:en.DataType.VFXItemData,components:[{id:d}],delay:0,duration:999,endBehavior:en.EndBehavior.restart,renderLevel:en.RenderLevel.BPlus,type:en.ItemType.video,visible:!0,transform:{position:{x:e.x,y:e.y,z:e.z},eulerHint:{x:i.x,y:i.y,z:i.z},size:{x:r.x,y:r.y},scale:{x:n.x,y:n.y,z:n.z},anchor:{x:0,y:0}},content:void 0},p={id:d,item:{id:t},dataType:en.DataType.VideoComponent,options:{startColor:[1,1,1,1],muted:o,video:{id:u},volume:h,playbackRate:l,transparent:a},renderer:{renderMode:en.RenderMode.MESH}};c&&(p.renderer.texture={id:c});const m={id:ei(),dataType:en.DataType.ActivationPlayableAsset},g={id:ei(),dataType:en.DataType.ActivationTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:m.id}}]},v={id:ei(),dataType:en.DataType.SpriteColorPlayableAsset,startColor:[1,1,1,1]};return{item:f,components:[p],tracks:[g,{id:ei(),dataType:en.DataType.SpriteColorTrack,children:[],clips:[{start:0,duration:999,endBehavior:en.EndBehavior.restart,asset:{id:v.id}}]}],playableAssets:[m,v]}}function CD(t,e){t.items.push(e.item),t.miscs.push(...e.tracks,...e.playableAssets),t.components.push(...e.components);const i=t.compositions.find(e=>e.id===t.compositionId)??t.compositions[0],r=t.components.find(t=>t.id===i.components[0]?.id);if(r){r.items.push({id:e.item.id});const i={id:ei(),dataType:en.DataType.ObjectBindingTrack,children:[],clips:[]};for(const t of e.tracks)i.children.push({id:t.id});t.miscs.find(t=>t.id===r.timelineAsset.id).tracks.push({id:i.id}),r.sceneBindings.push({key:{id:i.id},value:{id:e.item.id}}),t.miscs.push(i)}}function PD(t,e,i){var r;const n=t.items.findIndex(t=>t.id===e);if(n<0)return;MD(t,e);const s=t.items.find(t=>t.id===i);if(!s)return;t.items[n].parentId=i;const{position:o={x:0,y:0,z:0},eulerHint:a=new $w,scale:h=new $w(1,1,1)}=s.transform;(r=t.items[n]).transform??(r.transform={position:{x:0,y:0,z:0},eulerHint:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},size:{x:1,y:1}}),t.items[n].transform.position.x-=o.x,t.items[n].transform.position.y-=o.y,t.items[n].transform.position.z-=o.z,t.items[n].transform.eulerHint.x-=a.x,t.items[n].transform.eulerHint.y-=a.y,t.items[n].transform.eulerHint.z-=a.z,t.items[n].transform.scale.x/=0===h.x?1:h.x,t.items[n].transform.scale.y/=0===h.y?1:h.y,t.items[n].transform.scale.z/=0===h.z?1:h.z}function MD(t,e){var i;const r=t.items.findIndex(t=>t.id===e);if(!t.items[r]?.parentId)return;const n=t.items.find(e=>e.id===t.items[r].parentId);if(!n)return void delete t.items[r].parentId;const{position:s={x:0,y:0,z:0},eulerHint:o=new $w,scale:a=new $w(1,1,1)}=n.transform;(i=t.items[r]).transform??(i.transform={position:{x:0,y:0,z:0},eulerHint:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},size:{x:1,y:1}}),t.items[r].transform.position.x+=s.x,t.items[r].transform.position.y+=s.y,t.items[r].transform.position.z+=s.z,t.items[r].transform.eulerHint.x+=o.x,t.items[r].transform.eulerHint.y+=o.y,t.items[r].transform.eulerHint.z+=o.z,t.items[r].transform.scale.x*=0===a.x?1:a.x,t.items[r].transform.scale.y*=0===a.y?1:a.y,t.items[r].transform.scale.z*=0===a.z?1:a.z}function RD(t,e){const i=t.items.find(t=>t.id===e);if(!i)return void console.warn(`item ${e} is not exsited.`);t.items=t.items.filter(t=>t.id!==e),t.items.forEach(t=>{t.parentId===e&&(t.transform??(t.transform={position:{x:0,y:0,z:0},eulerHint:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},size:{x:1,y:1}}),t.transform.position.x+=i.transform.position.x,t.transform.position.y+=i.transform.position.y,t.transform.position.z+=i.transform.position.z,t.transform.eulerHint.x+=i.transform.eulerHint.x,t.transform.eulerHint.y+=i.transform.eulerHint.y,t.transform.eulerHint.z+=i.transform.eulerHint.z,t.transform.scale.x*=0!==i.transform.scale.x?i.transform.scale.x:1,t.transform.scale.y*=0!==i.transform.scale.y?i.transform.scale.y:1,t.transform.scale.z*=0!==i.transform.scale.z?i.transform.scale.z:1),delete t.parentId});const r=t.components.filter(t=>t.item.id===e);t.components=t.components.filter(t=>!r.map(t=>t.id).includes(t.id)),r.forEach(e=>{switch(e.dataType){case en.DataType.SpriteComponent:if(e.renderer.texture){if(!t.components.find(t=>t.renderer?.texture?.id===e.renderer.texture.id)){const i=t.textures?.find(t=>t.id===e.renderer.texture?.id);i&&(t.textures=t.textures?.filter(t=>t.id!==i.id),t.images=t.images.filter(t=>t.id!==i.source.id))}}break;case en.DataType.VideoComponent:if(e.renderer.texture){if(!t.components.find(t=>t.renderer?.texture?.id===e.renderer.texture.id)){const i=t.textures?.find(t=>t.id===e.renderer.texture?.id);i&&(t.textures=t.textures?.filter(t=>t.id!==i.id),t.videos=t.videos?.filter(t=>t.id!==i.source.id))}}}});const n=[];let s,o;if(+t.version>=3.3){const i=t.components.filter(t=>t.dataType===en.DataType.CompositionComponent).find(t=>t.items.find(t=>t.id===e));i&&(i.items=i.items.filter(t=>t.id!==e),o=i.timelineAsset.id,s=i.sceneBindings.find(t=>t.value.id===e)?.key.id,i.sceneBindings=i.sceneBindings.filter(t=>t.value.id!==e),s&&n.push(s))}else{const i=t.compositions.find(t=>t.items.find(t=>t.id===e));i&&(i.items=i.items.filter(t=>t.id!==e),o=i.timelineAsset.id,s=i.sceneBindings.find(t=>t.value.id===e)?.key.id,i.sceneBindings=i.sceneBindings.filter(t=>t.value.id!==e),s&&n.push(s))}const a=t.miscs.findIndex(t=>t.id===o);a>=0&&(t.miscs[a].tracks=t.miscs[a].tracks.filter(t=>t.id!==s));const h=t.miscs.find(t=>t.id===s);return h&&(h.children.forEach(e=>{n.push(e.id);const i=t.miscs.find(t=>t.id===e.id);i&&n.push(...i.clips.map(t=>t.asset.id))}),n.push(...h.children.map(t=>t.id))),t.miscs=t.miscs.filter(t=>!n.includes(t.id)),t}function OD(t,e){let i;return t.components.forEach(r=>{if(r.item.id===e)if(r.dataType===en.DataType.SpriteComponent&&r.renderer.texture){const e=t.textures?.find(t=>t.id===r.renderer.texture?.id);e&&(i=t.images.find(t=>t.id===e.source.id)?.url)}else if(r.dataType===en.DataType.VideoComponent&&r.renderer.texture){const e=t.textures?.find(t=>t.id===r.renderer.texture?.id);e&&(i=t.videos?.find(t=>t.id===e.source.id)?.url)}}),i}function DD(t,e,i,r){const n=JSON.parse(JSON.stringify(e)),s=n.compositions?.[0]?.duration??5,o=en.EndBehavior.restart,a={options:{refId:n.compositionId??n.compositions[0].id,startColor:[1,1,1,1]}},h={id:i,components:[],name:"ref_"+n.compositions[0].name,duration:s,dataType:en.DataType.VFXItemData,parentId:r,type:en.ItemType.composition,visible:!0,endBehavior:o,delay:0,renderLevel:en.RenderLevel.BPlus,content:a,transform:{position:{x:0,y:0,z:0},eulerHint:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}};t.items.push(h);const l={id:ei(),dataType:"ActivationPlayableAsset"},c={id:ei(),dataType:"ActivationTrack",children:[],clips:[{start:0,duration:s,endBehavior:o,asset:{id:l.id}}]},u={id:ei(),dataType:"SubCompositionPlayableAsset"},d={id:ei(),dataType:"SubCompositionTrack",children:[],clips:[{start:0,duration:s,endBehavior:o,asset:{id:u.id}}]},f={id:ei(),dataType:en.DataType.ObjectBindingTrack,children:[],clips:[]};t.miscs.push(f);const p=[],m=[];if(p.push(c,d),m.push(l,u),Number(t.version)<=3.3){const e=t.compositions.findIndex(e=>e.id===t.compositionId);if(e>=0){t.compositions[e].items.push({id:h.id});const i=t.miscs.find(i=>i.id===t.compositions[e].timelineAsset.id);i?.tracks.push({id:f.id}),t.compositions[e].sceneBindings.push({key:{id:f.id},value:{id:h.id}})}}else{const e=t.components.find(e=>e.id===t.compositions[0].components[0].id&&e.dataType===en.DataType.CompositionComponent);e.items.push({id:h.id});const i=t.miscs.find(t=>t.id===e.timelineAsset.id);i?.tracks.push({id:f.id}),e.sceneBindings.push({key:{id:f.id},value:{id:h.id}})}return p.forEach(t=>{t.path||f.children.push({id:t.id})}),t.miscs.push(...p),t.miscs.push(...m),Object.keys(t).forEach(e=>{"compositionId"!==e?("components"===e&&n.components.forEach(t=>{t.dataType!==en.DataType.CompositionComponent||t.item.id||n.compositions.forEach(e=>{e.components[0]?.id===t.id&&(t.item.id=e.id)})}),n[e]&&Array.isArray(n[e])&&(t[e]??(t[e]=[]),t[e].push(...n[e]))):t.compositionId??(t.compositionId=t.compositions[0].id)}),t}function kD(t,e){t.items.forEach(i=>{const r=i.id,n=e.get(r);if(n){i.id=n;t.components.filter(t=>t.item.id===r).forEach(t=>{t.item.id=n});t.components.filter(t=>t.dataType===en.DataType.CompositionComponent).forEach(t=>{t.items.forEach(t=>{t.id===r&&(t.id=n)}),t.sceneBindings.forEach(t=>{t.value.id===r&&(t.value.id=n)})})}})}var LD,FD,ND,BD,zD,UD,VD,GD,jD,HD,WD,XD,YD,qD,KD,ZD,JD,$D,QD,tk,ek,ik,rk=class{static createEmpty(t,e=null,i="NewVFXItem"){const r=nk.createVFXItem(t,e,i);return r.type=en.ItemType.null,r}static createSprite(t,e=null,i="NewSpite"){const r=nk.createVFXItem(t,e,i,Yd);return r.type=en.ItemType.sprite,r}static createText(t,e=null,i="NewText"){const r=nk.createVFXItem(t,e,i,ef);return r.type=en.ItemType.text,r}static createVideo(t,e=null,i="NewVideo"){const r=nk.createVFXItem(t,e,i,Yy);return r.type=en.ItemType.video,r}static async createEffects(t,e,i=null,r="NewEffects"){const n=await dp.loadPrecomposition(e,{autoplay:!1}),s=Kp.instantiate(n,t);return s.name=r,s.type=en.ItemType.composition,s}},nk=class{static createVFXItem(t,e=null,i="NewVFXItem",...r){const n=new da(t.getEngine());n.name=i;for(const t of r)n.addComponent(t);return t.addItem(n),t.rootComposition.items.push(n),e&&n.setParent(e),n}},sk=class{constructor(t,e,i,r){A(this,"sdk"),A(this,"player"),A(this,"container"),A(this,"emitter"),A(this,"interactionUtils"),this.player=t,this.sdk=r,this.container=e,this.emitter=i}init(){this.interactionUtils=new gD(this)}getPageData(){return this.sdk.pageData}getCurrentComposition(){return this.player.getCompositions()[0]}isItemSelected(t){return!!this.sdk.pageData?.activeData.selectedItems?.find(e=>e===t)}getItemEditEnable(t){const e=this.getSDKItem(t);if(!e||!this.sdk.pageData||this.getViewProperty()?.ignoreInteraction)return!1;const i=this.sdk.pageData.time,{duration:r,delay:n,endBehavior:s,isLocked:o}=e;return i>=n&&(i<n+r||s===en.EndBehavior.restart)&&!o}getItemShow(t){const e=this.getSDKItem(t);if(!this.sdk.pageData||!e?.visible)return!1;const i=this.sdk.pageData.time,{duration:r,delay:n,endBehavior:s}=e;return i>=n&&(i<n+r||s===en.EndBehavior.restart||s===en.EndBehavior.freeze)}addSelectedItems(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=this.sdk.pageData.activeData.selectedItems??[];t.forEach(t=>{nT(e,t)}),this.sdk.pageData.activeData.selectedItems=[...e],this.emitter.emit("selectedItemChange",e),this.emitter.emit("pageDataChange",this.sdk.pageData)}removeSelectedItems(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=this.sdk.pageData.activeData.selectedItems??[];for(const i of t){const t=e.findIndex(t=>t===i);t>=0&&e.splice(t,1)}this.sdk.pageData.activeData.selectedItems=[...e],this.emitter.emit("selectedItemChange",e),this.emitter.emit("pageDataChange",this.sdk.pageData)}clearSelectedItems(t=!1){this.sdk.pageData&&(t?(this.sdk.pageData.activeData.selectedItems=[],this.emitter.emit("selectedItemChange",[])):this.sdk.pageData.activeData.selectedItems=[],this.emitter.emit("pageDataChange",this.sdk.pageData))}getSelectedItems(){const t=this.sdk.pageData?.activeData.selectedItems;return this.sdk.pageData?.items.filter(e=>t?.find(t=>t===e.id))??[]}addPreSelectedItem(t){Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.activeData.preSelectedItem=t,this.emitter.emit("preSelectedItemChange",t)}clearPreSelectedItem(){Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.activeData.preSelectedItem=void 0,this.emitter.emit("preSelectedItemChange",void 0)}getPreSelectedItem(){const t=this.getPageData();Be(t,"You must call SDK#run() first");const e=t.activeData.preSelectedItem;return e?this.getSDKItem(e):void 0}addLoadingItems(t){var e;Be(this.sdk.pageData,"You must call SDK#run() first"),(e=this.sdk.pageData.activeData).loadingItems??(e.loadingItems=[]);const i=this.sdk.pageData.activeData.loadingItems;t.forEach(t=>{nT(i,t)}),this.emitter.emit("loadingItemChange",i)}removeLoadingItems(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=this.sdk.pageData.activeData.loadingItems??[];for(const i of t){const t=e.findIndex(t=>t===i);t>=0&&e.splice(t,1)}this.emitter.emit("loadingItemChange",e)}clearLoadingItems(){this.sdk.pageData&&(this.sdk.pageData.activeData.loadingItems=[],this.emitter.emit("loadingItemChange",[]))}getLoadingItems(){const t=this.sdk.pageData?.activeData.loadingItems;return this.sdk.pageData?.items.filter(e=>t?.find(t=>t===e.id))??[]}getSDKItem(t){const e=this.sdk.pageData?.items.find(e=>e.id===t);return e||void 0}getPlayerSizeByParent(t,e){const[i,r]=t,[n=1624,s=750]=e;let o=r,a=o/s*n;return a>i&&(o=i/a*r,a=i),[a,o]}async loadScene(t){wD(this.player);const e=this.getViewProperty(t);if(!e||!this.sdk.pageData)return void console.warn(`This page does not have ${t} view property.`);const{scene:i,size:r}=e;if("template"===Lk.config.mode){const t=this.container.parentElement?.offsetWidth??300,e=this.container.parentElement?.offsetHeight??300,[i,n]=this.getPlayerSizeByParent([t,e],r);this.container.style.width=`${i}px`,this.container.style.height=`${n}px`}this.sdk.pageData.activeData={view:t,selectedItems:[],preSelectedItem:void 0},this.player.resize();const n=JSON.parse(JSON.stringify(i)),s=await this.player.loadScene(n,{autoplay:"editor"===Lk.config.mode});"template"===Lk.config.mode&&this.player.gotoAndStop(this.sdk.pageData.time),this.interactionUtils.refreshViewParam(),this.interactionUtils.refreshCameraParam(),this.sdk.pageData.items=[],this.addSDKItemsByItems(this.sdk.pageData.items,s.items),this.emitter.emit("pageDataChange",this.sdk.pageData)}refreshPageTime(t){Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.time=t}pageZoom(t,e,i){var r;Be(this.sdk.pageData,"You must call SDK#run() first"),(r=this.sdk.pageData.property).zoom??(r.zoom=1);const{zoom:n,translation:[s=0,o=0]}=this.sdk.pageData.property,{width:a,height:h,scale:l}=this.interactionUtils.viewportParam,c=i?t:Nw(t,-.1,.1),u=Gw(Nw(n+c,Lk.config.pageConfig.minZoom,Lk.config.pageConfig.maxZoom),2);switch(this.sdk.pageData.property.zoom=u,Lk.config.mode){case"editor":{const t=this.interactionUtils.getNDCSizeByPixelSize(new Lw(s,o)),i=e??new Lw(a/2,h/2),r=this.interactionUtils.getNDCPositionByScreenPosition(i),n=(r.x-t.x)/l,c=(r.y-t.y)/l,d=new Lw(r.x-n*u,r.y-c*u),f=(new Qw).compose(new $w(d.x,d.y,0),new Jw,new $w(u,u,1));this.sdk.pageData.property.translation=this.interactionUtils.getPixelSizeByNDCSize(d).toArray(),this.setCurrenCameraViewportMatrix(f);break}case"template":this.container.style.scale=`${u}`}this.refreshInteractionParam();const d=this.getCurrentComposition();this.addSDKItemsByItems(this.sdk.pageData.items,d.items),this.emitter.emit("zoomChange",u),this.emitter.emit("viewportTransform",{zoom:u,translation:[s,o]}),this.emitter.emit("pageDataChange",this.sdk.pageData)}setPageZoom(t,e,i){Be(this.sdk.pageData,"You must call SDK#run() first");const{zoom:r}=this.sdk.pageData.property,n=t-r;this.pageZoom(n,e,i)}refreshInteractionParam(){this.interactionUtils.refreshViewParam(),this.interactionUtils.refreshCameraParam()}pageMove(t){Be(this.sdk.pageData,"You must call SDK#run() first");const{translation:[e=0,i=0],zoom:r}=this.sdk.pageData.property,n=e+t.x,s=i+t.y;switch(this.sdk.pageData.property.translation=[n,s],Lk.config.mode){case"template":this.container.style.translate=`${n}px ${s}px`;break;case"editor":{const t=this.interactionUtils.getNDCSizeByPixelSize(new Lw(n,s)),e=(new Qw).compose(new $w(t.x,t.y,0),new Jw,new $w(r,r,1));this.setCurrenCameraViewportMatrix(e);break}}this.refreshInteractionParam();const o=this.getCurrentComposition();this.addSDKItemsByItems(this.sdk.pageData.items,o.items),this.emitter.emit("viewportTransform",{zoom:r,translation:[n,s]}),this.emitter.emit("pageDataChange",this.sdk.pageData)}setPageMove(t){Be(this.sdk.pageData,"You must call SDK#run() first");const{translation:e}=this.sdk.pageData.property,i=(new Lw).subtractVectors(t,new Lw(...e));this.pageMove(i)}setCurrenCameraViewportMatrix(t){const e=this.getCurrentComposition();if(!e)return;const{camera:i}=e;i.setViewportMatrix(t)}rotateItem(t,e){const i=this.getPlayerItemById(t);i&&(i.rotate(...e.toArray()),this.transformSceneItem(t,"rotation",e.toArray()),this.refreshSDKItem(t),this.emitter.emit("itemPropertyChange",{id:t,property:"rotation"}))}moveItem(t,e){const i=this.getPlayerItemById(t);if(i){const r=(new Qw).copyFrom(i.transform.getParentMatrix()??new Qw);r.setPosition(new $w);const n=e.clone().applyMatrix(r.invert());i.translate(...n.toArray()),i.transform.updateLocalMatrix(),this.transformSceneItem(t,"position",n.toArray()),this.refreshSDKItem(t),this.emitter.emit("itemPropertyChange",{id:t,property:"translation"})}}scaleItem(t,e){const i=this.getPlayerItemById(t);i&&(i.scale(...e.toArray()),this.transformSceneItem(t,"scale",e.toArray()),this.refreshSDKItem(t),this.emitter.emit("itemPropertyChange",{id:t,property:"size"}))}scaleTextItemWidth(t,e){const i=this.getSDKItem(t);if(mT(i)){const{width:t}=i.property;this.setItemProperty({itemId:i.id,type:"text",propertyName:"width",propertyValue:t*e})}}scaleTextItem(t,e){const i=this.getSDKItem(t);if(mT(i)){const{width:t,lineHeight:r,fontSize:n}=i.property;this.setItemProperty({itemId:i.id,type:"text",propertyName:"width",propertyValue:t*e}),this.setItemProperty({itemId:i.id,type:"text",propertyName:"fontSize",propertyValue:n*e}),this.setItemProperty({itemId:i.id,type:"text",propertyName:"lineHeight",propertyValue:r*e})}}getItemTransformById(t){const e={matrix:new Qw,parentMatrix:new Qw},i=this.getPlayerItemById(t);if(void 0!==i?.transform){i.transform.updateLocalMatrix();const t=Qw.fromArray(i.composition?.transform.getWorldMatrix().elements??[]).invert();e.matrix=t.clone().multiply(Qw.fromArray(i.transform.getWorldMatrix().elements)),e.parentMatrix=t.clone().multiply(Qw.fromArray(i.transform.parentTransform?.getWorldMatrix().elements??(new Qw).toArray()))}return e}addSDKItemsByItems(t,e,i){const r=e=>{e.forEach(e=>{const r=t.find(t=>t.id===e.getInstanceId());r?this.updateSDKItemFromPlayerItem(r,e):t.push(this.createSDKItemByPlayerItem(e,i))})};for(const i of e)Lk.config.pageConfig.filterItemNames.includes(i.name)||this.getFilterItemIds().includes(i.getInstanceId())||(r([i]),this.addSDKItemsByItems(t,i.children,i.getInstanceId()))}getFilterItemIds(){return[...this.getPageData()?.items.filter(t=>"effects"===t.type).flatMap(t=>t.property.children)??[],...this.getPageData()?.items.filter(t=>"frame"===t.type).map(t=>t.subCompositionId)??[]]}createSDKItemByPlayerItem(t,e){Be(this.sdk.pageData,"You must call SDK#run() first");const{transform:i,composition:r,isVisible:n}=t,s={position:[0,0],rotation:[0,0,0],scale:[1,1],width:0,height:0};let o=!0;const{scale:a}=this.interactionUtils.viewportParam,h="editor"===Lk.config.mode?1:a,l=this.getViewportLeftTopPosition();if(t.type!==en.ItemType.null){i.updateLocalMatrix();const e=(new Qw).copyFrom(r?.transform.getWorldMatrix()??(new Qw).identity()).invert().multiply(i.getWorldMatrix()),n=new $w,o=new Jw,h=new $w;e.decompose(n,o,h);const l=(new tT).setFromQuaternion(o);l.x=Number.isNaN(l.x)?0:l.x,l.y=Number.isNaN(l.y)?0:l.y,l.z=Number.isNaN(l.z)?0:l.z,this.interactionUtils.initInteractionPlane(n,l);const c=this.interactionUtils.projectPoint(n),u="editor"===Lk.config.mode?this.interactionUtils.getPixelPositionByViewPoint(c).toArray().map(t=>Gw(t,2)):c.divide(a).toArray().map(t=>Gw(t,2)),d=l.toArray().map(t=>Gw(t,2)),f=h.toArray(),p=i.size.toArray(),m=this.getPixelSizeByWorldSize([f[0]*p[0],f[1]*p[1],f[2]],t).map(t=>Gw(t,2));s.position=u,s.rotation=d,s.width=m[0],s.height=m[1],s.scale=[f[0],f[1]]}else if(t.getComponent(Kl)){i.updateLocalMatrix();const e=(new Qw).copyFrom(r?.transform.getWorldMatrix()??(new Qw).identity()).invert().multiply(i.getWorldMatrix()),n=new $w,o=new Jw,h=new $w;e.decompose(n,o,h);const l=(new tT).setFromQuaternion(o);l.x=Number.isNaN(l.x)?0:l.x,l.y=Number.isNaN(l.y)?0:l.y,l.z=Number.isNaN(l.z)?0:l.z,this.interactionUtils.initInteractionPlane(n,l);const c=this.interactionUtils.projectPoint(n),u="editor"===Lk.config.mode?this.interactionUtils.getPixelPositionByViewPoint(c).toArray().map(t=>Gw(t,2)):c.divide(a).toArray().map(t=>Gw(t,2)),d=l.toArray().map(t=>Gw(t,2)),f=h.toArray(),p=i.size.toArray(),m=this.getPixelSizeByWorldSize([f[0]*p[0],f[1]*p[1],f[2]],t).map(t=>Gw(t,2));s.position=u,s.rotation=d,s.width=m[0],s.height=m[1],s.scale=[f[0],f[1]]}else{const e=this.getViewBoxByPlayerItem(t,t.children),i=this.interactionUtils.getViewPositionWWithOutTransform(e.getCenter().subtract(l)),r="editor"===Lk.config.mode?this.interactionUtils.getPixelPositionByViewPoint(i).toArray().map(t=>Gw(t,2)):i.toArray();s.position=r;const n=e.getSize().divide(h).toArray();s.width=n[0],s.height=n[1]}switch(t.type){case en.ItemType.sprite:{const e=this.getViewProperty()?.scene;if(e){e.components.filter(e=>e.item.id===t.getInstanceId()).forEach(t=>{if(!("renderer"in t)||!("texture"in t.renderer)||!t.renderer.texture)return;const i=e.textures?.find(e=>e.id===t.renderer.texture.id);if(i&&"source"in i&&i.source){const t=e?.images.find(t=>t.id===i.source.id);o=!!t?.template;const r=t?.url??"";r&&Object.assign(s,{image:r})}})}break}case en.ItemType.video:{const e=this.getViewProperty()?.scene;if(e){e.components.filter(e=>e.item.id===t.getInstanceId()).forEach(t=>{if(!("renderer"in t)||!("texture"in t.renderer)||!t.renderer.texture)return;const i=e.textures?.find(e=>e.id===t.renderer.texture.id);if(i&&"source"in i&&i.source){const t=e?.videos?.find(t=>t.id===i.source.id),r=t?.url??"";r&&Object.assign(s,{video:r})}})}break}case en.ItemType.text:case en.ItemType.richtext:{const e=this.getViewProperty()?.scene;if(e){e.components.filter(e=>e.item.id===t.getInstanceId()).forEach(t=>{if(![en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType))return;const{textAlign:e,textColor:i,text:r,fontWeight:n,fontFamily:o,fontSize:a,fontStyle:h,outline:l,textWidth:c,lineHeight:u,textHeight:d}=t.options,f=l?.outlineColor?hT(l.outlineColor):void 0,p=hT(i),m=l?.outlineWidth,g=!!l;Object.assign(s,{outlineEnabled:g,textAlign:e,textColor:p,fontWeight:n,text:r,fontFamily:o,fontSize:a,fontStyle:h,outlineColor:f,outlineWidth:m,textWidth:c,lineHeight:u,textHeight:d})})}break}}const c=this.getSDKItem(t.getInstanceId())?.isLocked,u={id:t.getInstanceId(),name:t.name,parentId:t.parentId??e,children:[],duration:t.duration,delay:t.defination.delay,endBehavior:t.endBehavior,visible:n,isLocked:c,isCoreEditable:o};let d;const f=this.getSDKItem(t.getInstanceId()),p=f?.type,m=p;if("generator"===m){const t=f?.generatorType??"video";d=new bT({...u,property:{...s,generatorType:t}})}else if("sprite"===m)d=new dT({...u,property:s});else if("text"===m)d=new pT({...u,property:s});else if("video"===m)d=new gT({...u,property:s});else if("group"===m)d=new yT({...u,property:s});else if("effects"===p){const t=f?.property.effects;d=new wT({...u,property:{...s,effects:t}})}else d="frame"===p?new ST({...u,property:{...s}}):this.createSDKItemBySpecType(t.type,u,s);return d}createSDKItemBySpecType(t,e,i){switch(t){case en.ItemType.sprite:return new dT({...e,property:i});case en.ItemType.text:return new pT({...e,property:i});case en.ItemType.video:return new gT({...e,property:i});case en.ItemType.null:return new yT({...e,property:i});default:return console.warn(`SDKItem type ${t} not fully implemented, using GroupItem`),new yT({...e,property:i})}}getViewBoxById(t){const e=new Kw,i=this.getPlayerItemById(t),r=this.getChildrenPlayerItems(i);return i&&r?this.getViewBoxByPlayerItem(i,r):e}getItemViewAnchor(t){const e=this.getPlayerItemById(t);if(e?.transform?.anchor){const t=(new $w).copyFrom(e.transform.anchor).applyMatrix((new Qw).copyFrom(e.transform.getWorldMatrix())),i=this.getViewportLeftTopPosition();return this.interactionUtils.projectPoint(t).add(i).round(2)}}getChildrenPlayerItems(t){const e=[];return t?(e.push(...this.player.getCompositions()[0].items.filter(e=>e.parentId===t.getInstanceId())),e.push(...e.flatMap(t=>this.getChildrenPlayerItems(t))),e):[]}getChildrenSceneItemIds(t,e){const i=[];return i.push(...e.items.filter(e=>e.parentId===t).map(t=>t.id)),i.push(...i.flatMap(t=>this.getChildrenSceneItemIds(t,e))),i}getViewBoxByPlayerItem(t,e){const i=new Kw;switch(t.type){case en.ItemType.sprite:case en.ItemType.plugin:case en.ItemType.video:case en.ItemType.richtext:case en.ItemType.text:case en.ItemType.null:case en.ItemType.shape:{const r=!!t.getComponent(Kl);if(t.type!==en.ItemType.null||r){const{transform:e,composition:r}=t;e.updateLocalMatrix();const{size:n}=e,s=(new Qw).copyFrom(r?.transform.getWorldMatrix()??new Qw).invert().multiply(e.getWorldMatrix()),{x:o,y:a}=n.clone().divide(2),h=new $w(o,a,0).applyMatrix(s),l=new $w(o,-a,0).applyMatrix(s),c=new $w(-o,-a,0).applyMatrix(s),u=new $w(-o,a,0).applyMatrix(s),d=this.getViewportLeftTopPosition(),f=this.interactionUtils.projectPoint(h).add(d).round(2),p=this.interactionUtils.projectPoint(l).add(d).round(2),m=this.interactionUtils.projectPoint(c).add(d).round(2),g=this.interactionUtils.projectPoint(u).add(d).round(2);i.setFromVec2Array([f,p,m,g])}if(!r){const t=e?.map(t=>this.getViewBoxById(t.getInstanceId()));t&&t.map(t=>i.union(t))}break}}return i}getViewportLeftTopPosition(){if(!this.sdk.pageData||"editor"===Lk.config.mode)return new Lw;const{zoom:t,translation:e}=this.sdk.pageData.property,{offsetWidth:i,offsetHeight:r}=this.container.parentElement,{offsetWidth:n,offsetHeight:s}=this.container,o=new Lw(i,r),a=new Lw(n,s).multiply(t);return o.clone().divide(2).subtract(a.clone().divide(2)).add(e)}getViewportByViewPoint(t){if(!this.sdk.pageData)return t;const{zoom:e}=this.sdk.pageData.property,i="editor"===Lk.config.mode?1:e,{width:r,height:n}=this.interactionUtils.viewportParam,s=new Lw(r,n).multiply(i),o=this.getViewportLeftTopPosition(),a=t.clone().subtract(o);return new Lw(a.x/s.x*2-1,1-a.y/s.y*2)}async setItemProperty(t){Be(this.sdk.pageData,"You must call SDK#run() first"),"propertyName"in t?await this.setSingleItemSingleProperty(t):"property"in t&&await this.setSingleItemMultipleProperties(t)}async setSingleItemSingleProperty(t){const{itemId:e,propertyName:i}=t;let r=t.propertyValue;if("effects"===i){let t;if("string"==typeof r){const e=await fetch(r,{mode:"cors",credentials:"omit",headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}, statusText: ${e.statusText} `);t=await e.json()}if(t){const i=this.getSDKItem(e);TT(i)&&(i.effects=r,r=t)}}await this.updatePlayerItemProperty(e,i,r),this.updateJSONItemProperty(e,i,r),this.refreshSDKItem(e)}async setSingleItemMultipleProperties(t){const{itemId:e,property:i}=t;for(let[t,r]of Object.entries(i)){if("effects"===t){let t;if("string"==typeof r){const e=await fetch(r,{mode:"cors",credentials:"omit",headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}, statusText: ${e.statusText} `);t=await e.json()}if(t){const i=this.getSDKItem(e);TT(i)&&(i.effects=r,r=t)}}void 0!==r&&(await this.updatePlayerItemProperty(e,t,r),this.updateJSONItemProperty(e,t,r))}this.refreshSDKItem(e)}async updatePlayerItemProperty(t,e,i){const r=this.getPlayerItemById(t),n=this.getSDKItem(t);if(!r||!n)return void console.warn(`Id ${t} is not a valid item id.`);["name","duration","delay","endBehavior","visible","isLocked","parentId"].includes(e)?this.updatePlayerItemBaseProperty(r,e,i):await this.updatePlayerItemPropertyAttribute(r,n,e,i)}updatePlayerItemBaseProperty(t,e,i){switch(e){case"name":"string"==typeof i&&(t.name=i);break;case"duration":"number"==typeof i&&(t.duration=i);break;case"delay":"number"==typeof i&&(t.defination.delay=i);break;case"endBehavior":Object.values(en.EndBehavior).includes(i)&&(t.endBehavior=i);break;case"visible":"boolean"==typeof i&&t.setVisible(i);break;case"isLocked":break;case"parentId":t.parentId=i;const e=this.getPlayerItemById(i);t.parent=e}}async updatePlayerItemPropertyAttribute(t,e,i,r){switch(i){case"textAlign":[en.TextAlignment.left,en.TextAlignment.middle,en.TextAlignment.right].includes(r)&&t.getComponent(ef)?.setTextAlign(r);break;case"color":if(t.type===en.ItemType.text&&Array.isArray(r)&&4===r.length){const e=lT(r);t.getComponent(ef)?.setTextColor(e)}break;case"fontFamily":if("string"==typeof r){const e=r.split("/"),i=e[e.length-1]?.split(".")[0];if(await dp.loadFontFamily([{fontURL:r,fontFamily:i}]),i){const e=t.getComponent(ef);e&&(e.setFontFamily(i),e.isDirty=!0)}}break;case"text":if("string"==typeof r){const e=t.getComponent(ef);if(e&&(e.setText(r),"editor"===Lk.config.mode)){const t=e.getLineCount(r),i=Math.ceil(e.textLayout.lineHeight*t);e.setTextHeight(i)}}break;case"fontWeight":[en.TextWeight.normal,en.TextWeight.bold,en.TextWeight.lighter].includes(r)&&t.getComponent(ef)?.setFontWeight(r);break;case"lineHeight":{const e=t.getComponent(ef);if(e){e.setLineHeight(r);const t=Math.ceil(e.textLayout.lineHeight*e.lineCount);e.setTextHeight(t)}break}case"outlineColor":if(Array.isArray(r)&&4===r.length){const e=t.getComponent(ef);if(e&&"function"==typeof e.setOutlineColor){const t=lT(r);e.setOutlineColor(t)}}break;case"outlineWidth":if("number"==typeof r){const e=t.getComponent(ef);e&&"function"==typeof e.setOutlineWidth&&e.setOutlineWidth(r)}break;case"outlineEnabled":if("boolean"==typeof r){const e=t.getComponent(ef);e&&"function"==typeof e.setOutlineEnabled&&e.setOutlineEnabled(r)}break;case"fontSize":if("number"==typeof r&&t.type===en.ItemType.text){const e=t.getComponent(ef);if(e){const t=e.textStyle.fontSize;if(e.setFontSize(r),"editor"===Lk.config.mode){e.setLineHeight(e.textLayout.lineHeight*r/t);const i=e.getLineCount(e.text),n=Math.ceil(e.textLayout.lineHeight*i);e.setTextHeight(n)}}}break;case"width":if(t.type===en.ItemType.text){const e=t.getComponent(ef);if(e){e.setTextWidth(r);const t=Math.ceil(e.textLayout.lineHeight*e.lineCount);e.setTextHeight(t)}}else if([en.ItemType.sprite,en.ItemType.video].includes(t.type)){const e=this.interactionUtils.getViewSizeByPixelSize(new Lw(r,0)),i=this.interactionUtils.getWorldSizeByViewSize(e).x,n=t.transform.size.toArray();t.transform.setSize(Math.abs(i),n[1])}else if(t.type===en.ItemType.null&&IT(e)){const e=t.children?.[0];if(e){const i=t.composition.camera.getInverseVPRatio(0).multiply(2),n=r/i.x;e.transform.setScale(n,n,1)}}break;case"height":if(t.type===en.ItemType.text){t.getComponent(ef).setTextHeight(r)}else{const e=this.interactionUtils.getViewSizeByPixelSize(new Lw(0,r)),i=this.interactionUtils.getWorldSizeByViewSize(e).y,n=t.transform.size.toArray();t.transform.setSize(n[0],Math.abs(i))}break;case"image":"string"==typeof r&&t.type===en.ItemType.sprite&&t.getComponent(Yd)?.setTexture(await To.fromImage(r,this.player.renderer.engine));break;case"video":"string"==typeof r&&t.type===en.ItemType.video&&t.getComponent(Yy)?.setTexture(await To.fromVideo(r,this.player.renderer.engine));break;case"effects":if(t.type===en.ItemType.null){const e=t.children[0],i=e?.getInstanceId();if(e?.dispose(),!i)return;const n=r.compositions.find(t=>t.id===r.compositionId)??r.compositions[0];n||console.warn("Composition not found in effects scene.");const s=n?.previewSize??[750,1624],o=this.interactionUtils.getViewSizeByPixelSize(new Lw(...s)),a=this.interactionUtils.getWorldSizeByViewSize(o);t.transform.setSize(Math.abs(a.x),Math.abs(a.y));const h=await rk.createEffects(t.composition,r,null,"特效");h.setInstanceId(i),h.setParent(t),h.parentId=t.getInstanceId();const l=h.components[0];l?.pause(),this.sdk.player.gotoAndPlay(0)}break;case"muted":if("boolean"==typeof r&&t.type===en.ItemType.video){const e=t.getComponent(Yy);e&&e.setMuted(r)}break;case"playbackRate":if("number"==typeof r&&t.type===en.ItemType.video){const e=t.getComponent(Yy);e&&e.setPlaybackRate(r)}break;case"volume":if("number"==typeof r&&t.type===en.ItemType.video){const e=t.getComponent(Yy);e&&e.setVolume(r)}break;case"position":if(Array.isArray(r)&&2===r.length){const i=r.map((t,i)=>t-(e.property.position[i]??0)),n=this.interactionUtils.getViewSizeByPixelSize(new Lw(...i)),s=this.interactionUtils.getWorldSizeByViewSize(n,!0,t.getInstanceId());this.moveItem(t.getInstanceId(),s)}break;case"rotation":if(Array.isArray(r)&&3===r.length){const i=r.map((t,i)=>t-(e.property.rotation[i]??0));this.rotateItem(t.getInstanceId(),new $w(...i).negate())}break;case"scale":if(Array.isArray(r)&&2===r.length){const i=e.property.scale,n=r.map((t,e)=>t/(i[e]??1));this.scaleItem(t.getInstanceId(),new $w(...n,1))}break;case"visible":if("boolean"==typeof r&&(t.setVisible(r),Lk.config.pageConfig.groupVisible)){this.getChildrenPlayerItems(t).forEach(t=>{t.setVisible(r)})}break;default:console.log("ignore property name ",i),i in e.property&&(e.property[i]=r)}["position","rotation","size"].includes(i)||(this.player.gotoAndStop(this.sdk.pageData.time),this.player.gotoAndPlay(this.sdk.pageData.time))}updateJSONItemProperty(t,e,i){const r=["name","duration","delay","endBehavior","visible","isLocked","parentId"];this.sdk.pageData.viewProperties.forEach(n=>{if(!this.sdk.pageData?.property.asyncMode&&n.id!==this.sdk.pageData?.activeData.view)return;const{scene:s}=n;r.includes(e)?this.updateSceneItemBaseProperty(s,t,e,i):this.updateSceneItemPropertyAttribute(s,t,e,i)})}updateSceneItemBaseProperty(t,e,i,r){const n=t.items.find(t=>t.id===e);if(n)switch(i){case"name":n.name=r;break;case"duration":n.duration=r;break;case"delay":n.delay=r;break;case"endBehavior":n.endBehavior=r;break;case"visible":n.visible=r;break;case"parentId":n.parentId=r}}updateSceneItemPropertyAttribute(t,e,i,r){var n,s,o,a,h,l,c,u;const d=t.items.find(t=>t.id===e);if(d)switch(i){case"position":if(Array.isArray(r)&&2===r.length){const t=this.sdk.pageData.items.find(t=>t.id===e),i=t?.property.position,n=r.map((t,e)=>t-(i?.[e]??0)),s=this.interactionUtils.getViewSizeByPixelSize(new Lw(...n)),o=this.interactionUtils.getWorldSizeByViewSize(s,!0,e);d.transform&&(d.transform.position.x+=o.x,d.transform.position.y+=o.y,d.transform.position.z+=o.z)}break;case"rotation":if(Array.isArray(r)&&3===r.length){const t=this.sdk.pageData.items.find(t=>t.id===e),i=t?.property.rotation,n=r.map((t,e)=>t-(i?.[e]??0));d.transform&&(d.transform.eulerHint.x+=n[0],d.transform.eulerHint.y+=n[1],d.transform.eulerHint.z+=n[2])}break;case"scale":if(Array.isArray(r)&&2===r.length){const t=this.sdk.pageData.items.find(t=>t.id===e),i=t?.property.scale,n=r.map((t,e)=>t/(i?.[e]??0));d.transform&&(d.transform.scale.x*=n[0],d.transform.scale.y*=n[1])}break;case"width":if(d.type===en.ItemType.text){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));if(i?.options&&d){i.options.textWidth=r;const t=this.getPlayerItemById(e);if(t){const e=t.getComponent(ef),r=e.textLayout.width,s=Math.ceil(e.lineCount*e.lineCount);i.options.textHeight=s;const o=this.interactionUtils.getViewSizeByPixelSize(new Lw(r,s)),a=this.interactionUtils.getWorldSizeByViewSize(o);(n=d.transform).scale??(n.scale={x:1,y:1,z:1}),d.transform.scale={x:Math.abs(a.x),y:Math.abs(a.y),z:1}}}}else if(d.type===en.ItemType.null){const i=this.getSDKItem(e);if(IT(i)&&"number"==typeof r){const n=this.sdk.pageData.items.find(t=>t.id===e),s=n?.property.height??r,o=i.property.children?.[0];if(o){const e=t.compositions.find(t=>t.id===o);e&&(e.previewSize=[r,s],e.camera.aspect=r/s)}}}else if("number"==typeof r){const t=[r,0],i=this.interactionUtils.getViewSizeByPixelSize(new Lw(...t)),n=this.interactionUtils.getWorldSizeByViewSize(i,!0,e);d.transform&&((s=d.transform).size??(s.size={x:1,y:1}),d.transform.size.x=Math.abs(n.x))}break;case"height":if(d.type===en.ItemType.null){const i=this.getSDKItem(e);if(IT(i)&&"number"==typeof r){const n=this.sdk.pageData.items.find(t=>t.id===e),s=n?.property.width??r,o=i.property.children?.[0];if(o){const e=t.compositions.find(t=>t.id===o);e&&(e.previewSize=[s,r],e.camera.aspect=s/r)}}}else if("number"==typeof r){const t=[0,r],i=this.interactionUtils.getViewSizeByPixelSize(new Lw(...t)),n=this.interactionUtils.getWorldSizeByViewSize(i,!0,e);d.transform&&((o=d.transform).size??(o.size={x:1,y:1}),d.transform.size.y=Math.abs(n.y))}break;case"visible":if("boolean"==typeof r&&(d.visible=r,Lk.config.pageConfig.groupVisible)){this.getChildrenSceneItemIds(e,t).forEach(e=>{const i=t.items.find(t=>t.id===e);i&&(i.visible=r)})}break;case"textAlign":if([en.TextAlignment.left,en.TextAlignment.middle,en.TextAlignment.right].includes(r)){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));i?.options&&"textAlign"in i.options&&(i.options.textAlign=r)}break;case"color":if(Array.isArray(r)&&4===r.length){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));if(i?.options){const t=lT(r);i.options.textColor=[...t]}}break;case"fontFamily":if("string"==typeof r){const i=r.split("/"),n=i[i.length-1]?.split(".")[0],s=t.fonts?.find(t=>"family"in t&&t.family===n||"fontFamily"in t&&t.fontFamily===n);!s&&t.fonts&&n&&t.fonts.push({fontFamily:n,fontURL:r});const o=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));o&&(o.options.fontFamily=n)}break;case"lineHeight":if("number"==typeof r){const i=t.items.find(t=>t.id===e),n=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));if(i&&n?.options){n.options.lineHeight=r;const t=this.getPlayerItemById(e);if(t){const e=t.getComponent(ef),r=e.textLayout.width,s=Math.ceil(e.textLayout.lineHeight*e.lineCount);n.options.textHeight=s;const o=this.interactionUtils.getViewSizeByPixelSize(new Lw(r,s)),h=this.interactionUtils.getWorldSizeByViewSize(o);(a=i.transform).scale??(a.scale={x:1,y:1,z:1}),i.transform.scale={x:Math.abs(h.x),y:Math.abs(h.y),z:1}}}}break;case"text":if("string"==typeof r){const i=t.items.find(t=>t.id===e),n=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));if(n?.options&&i){n.options.text=r;const t=this.getPlayerItemById(e);if(t&&"editor"===Lk.config.mode){const e=t.getComponent(ef),s=e.getLineCount(r),o=e.textLayout.lineHeight,a=e.textLayout.width,l=Math.ceil(o*s);n.options.textHeight=l;const c=this.interactionUtils.getViewSizeByPixelSize(new Lw(a,l)),u=this.interactionUtils.getWorldSizeByViewSize(c);(h=i.transform).scale??(h.scale={x:1,y:1,z:1}),i.transform.scale={x:Math.abs(u.x),y:Math.abs(u.y),z:1}}}}break;case"fontWeight":if("string"==typeof r){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));i?.options&&(i.options.fontWeight=r)}break;case"outlineColor":if(Array.isArray(r)&&4===r.length){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));i?.options&&((l=i.options).outline??(l.outline={}),i.options.outline.outlineColor=[...lT(r)])}break;case"outlineWidth":if("number"==typeof r){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));i?.options&&((c=i.options).outline??(c.outline={}),i.options.outline.outlineWidth=r)}break;case"outlineEnabled":if("boolean"==typeof r){const i=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType)),n=this.getPlayerItemById(e),s=n?.getComponent(ef);if(i?.options&&n&&s)if(r){const{outlineWidth:t,outlineColor:e}=s.textStyle;i.options.outline={outlineWidth:t,outlineColor:[...e]}}else delete i.options.outline}break;case"fontSize":if("number"==typeof r){const i=t.items.find(t=>t.id===e),n=t.components.find(t=>t.item.id===e&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(t.dataType));if(n?.options&&i){n.options.fontSize=r;const t=this.getPlayerItemById(e);if(t&&"editor"===Lk.config.mode){const e=t.getComponent(ef);e.setFontSize(r);const s=e.textLayout.lineHeight;n.options.lineHeight=s;const o=Math.ceil(e.textLayout.lineHeight*e.lineCount);n.options.textHeight=o;const a=e.textLayout.width,h=this.interactionUtils.getViewSizeByPixelSize(new Lw(a,o)),l=this.interactionUtils.getWorldSizeByViewSize(h);(u=i.transform).scale??(u.scale={x:1,y:1,z:1}),i.transform.scale={x:Math.abs(l.x),y:Math.abs(l.y),z:1}}}}break;case"image":if("string"==typeof r){const i=t.components.filter(t=>t.item.id===e);if(i.find(t=>!!t.renderer?.texture)){const n=new Map;i.forEach(i=>{if(!("renderer"in i))return;const s=t.textures?.find(t=>t.id===i.renderer.texture.id);if(s&&"source"in s&&s.source){const o=t?.images.find(t=>t.id===s.source.id);o?.url&&(o.url=r,delete o.webp),o&&"template"in o&&o.template.background&&(o.template.background.url=r);const a=this.player.renderer.engine.findObject({id:s.id});a?.dispose();const h=this.getPlayerItemById(e)?.getComponent(Yd).renderer.texture.getInstanceId();n.set(s.id,h),s.id=h,i.renderer.texture.id=h}}),t.components.forEach(t=>{if(!("renderer"in t)||!t.renderer.texture)return;const e=n.get(t.renderer.texture.id);if(e){t.renderer.texture.id=e;const i=this.getPlayerItemById(t.item.id),r=this.player.renderer.engine.findObject({id:e}),n=i?.getComponent(Yd);n?.setTexture(r)}})}else{t.components.filter(t=>t.item.id===e).forEach(e=>{if(!("renderer"in e))return;const i=this.getPlayerItemById(e.item.id),n=i?.getComponent(Yd).renderer.texture.getInstanceId();if(n){const i={id:ei(),url:r,renderLevel:en.RenderLevel.BPlus},s={id:n,source:{id:i.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,generateMipmap:!0};t.images.push(i),t.textures??(t.textures=[]),t.textures.push(s),e.renderer.texture={id:n}}})}}break;case"video":if("string"==typeof r){const i=t.components.filter(t=>t.item.id===e);if(i.find(t=>!!t.renderer?.texture)){const n=new Map;i.forEach(i=>{if(!("renderer"in i)||!i.renderer.texture)return;const s=t.textures?.find(t=>t.id===i.renderer.texture.id);if(s&&"source"in s&&s.source){const o=t?.videos.find(t=>t.id===s.source.id);o&&(o.url=r);const a=this.player.renderer.engine.findObject({id:s.id});a?.dispose();const h=this.getPlayerItemById(e)?.getComponent(Yy).renderer.texture.getInstanceId();h&&(n.set(s.id,h),s.id=h,i.renderer.texture.id=h)}}),t.components.forEach(t=>{if(!("renderer"in t)||!t.renderer.texture)return;const e=n.get(t.renderer.texture.id);if(e){t.renderer.texture.id=e;const i=this.getPlayerItemById(t.item.id),r=this.player.renderer.engine.findObject({id:e}),n=i?.getComponent(Yy);n?.setTexture(r)}})}else{t.components.filter(t=>t.item.id===e).forEach(e=>{if(!("renderer"in e))return;const i=this.getPlayerItemById(e.item.id),n=i?.getComponent(Yy).renderer.texture.getInstanceId();if(n){const i={id:ei(),url:r,renderLevel:en.RenderLevel.BPlus},s={id:n,source:{id:i.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR,generateMipmap:!0};t.videos??(t.videos=[]),t.videos.push(i),t.textures??(t.textures=[]),t.textures.push(s),e.options.video={id:i.id},e.renderer.texture={id:n}}})}}break;case"effects":if(r){const i=this.getSDKItem(e)?.property.children,n=this.getPlayerItemById(e)?.children?.[0]?.getInstanceId();i&&n&&(!function(t,e){const i=[];e.forEach(e=>{const r=t.items.find(t=>t.id===e);if(r&&(RD(t,e),r.type===en.ItemType.composition)){const t=r?.content.options.refId;i.push(t)}}),i.forEach(e=>{!function(t,e){const i=t.components.find(t=>t.item.id===e);if(i){const r=i.timelineAsset.id;t.miscs=t.miscs.filter(t=>t.id!==r),t.compositions=t.compositions.filter(t=>t.id!==e),t.components=t.components.filter(t=>t.id!==i.id)}}(t,e)})}(t,i),DD(t,r,n,e))}break;case"muted":if("boolean"==typeof r){const i=t.components.find(t=>t.item.id===e&&t.dataType===en.DataType.VideoComponent);i?.options&&(i.options.muted=r)}break;case"playbackRate":if("number"==typeof r){const i=t.components.find(t=>t.item.id===e&&t.dataType===en.DataType.VideoComponent);i?.options&&(i.options.playbackRate=r)}break;case"volume":if("number"==typeof r){const i=t.components.find(t=>t.item.id===e&&t.dataType===en.DataType.VideoComponent);i?.options&&(i.options.volume=r)}break;default:console.warn(`Target property ${i} can not be changed.`)}else console.warn(`Item ${e} is not exsited.`)}setSpriteSize(t,e){var i;const r=this.getPlayerItemById(t),n=this.interactionUtils.getViewSizeByPixelSize(new Lw(...e)),s=this.interactionUtils.getWorldSizeByViewSize(n),o=this.getActiveTargetScene(),a=o?.items.find(e=>e.id===t);r&&a&&(r.transform.setSize(s.x,Math.abs(s.y)),a.transform??(a.transform={position:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},eulerHint:{x:0,y:0,z:0},size:{x:s.x,y:s.y}}),(i=a.transform).size??(i.size={x:1,y:1}),a.transform.size={x:Math.abs(s.x),y:Math.abs(s.y)},this.refreshSDKItem(t))}transformSceneItem(t,e,i){Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.viewProperties.forEach(r=>{if(!this.sdk.pageData?.property.asyncMode&&r.id!==this.sdk.pageData?.activeData.view)return;const{scene:n}=r;switch(e){case"position":if(Array.isArray(i)&&3===i.length){const e=n.items.find(e=>e.id===t);e?.transform&&(e.transform.position.x+=i[0],e.transform.position.y+=i[1],e.transform.position.z+=i[2])}break;case"rotation":if(Array.isArray(i)&&3===i.length){const e=n.items.find(e=>e.id===t);e?.transform&&(e.transform.eulerHint.x+=i[0],e.transform.eulerHint.y+=i[1],e.transform.eulerHint.z+=i[2])}break;case"scale":if(Array.isArray(i)&&3===i.length){const e=n.items.find(e=>e.id===t);e?.transform&&(e.transform.scale.x*=i[0],e.transform.scale.y*=i[1],e.transform.scale.z*=i[2])}}})}refreshSDKItem(t){const e=this.sdk.pageData;Be(e,"You must call SDK#run() first");const i=e.items.findIndex(e=>e.id===t);if(i<0)return void console.warn(`item ${t} is not existed.`);const r=e.items[i],n=this.getPlayerItemById(t);n&&r&&this.updateSDKItemFromPlayerItem(r,n)}updateSDKItemFromPlayerItem(t,e){const{transform:i,composition:r,isVisible:n,duration:s,endBehavior:o}=e;if(t.duration=s,t.delay=e.defination.delay,t.endBehavior=o,t.parentId=e.parentId,e.type!==en.ItemType.null){i.updateLocalMatrix();const s=(new Qw).copyFrom(r?.transform.getWorldMatrix()??(new Qw).identity()).invert().multiply(i.getWorldMatrix()),o=new $w,a=new Jw,h=new $w;s.decompose(o,a,h);const l=(new tT).setFromQuaternion(a);l.x=Number.isNaN(l.x)?0:l.x,l.y=Number.isNaN(l.y)?0:l.y,l.z=Number.isNaN(l.z)?0:l.z,this.interactionUtils.initInteractionPlane(o,l);const c=this.interactionUtils.projectPoint(o),{scale:u}=this.interactionUtils.viewportParam,d="editor"===Lk.config.mode?this.interactionUtils.getPixelPositionByViewPoint(c).toArray().map(t=>Gw(t,2)):c.divide(u).toArray().map(t=>Gw(t,2)),f=l.toArray().map(t=>Gw(t,2)),p=h.toArray(),m=i.size.toArray(),g=this.getPixelSizeByWorldSize([p[0]*m[0],p[1]*m[1],p[2]],e).map(t=>Gw(t,2));t.property.position=d,t.property.rotation=f,t.property.width=g[0],t.property.height=g[1],t.property.scale=[p[0],p[1]],t.visible=n}else{const i=e.children.map(t=>t.getInstanceId()),r=this.getViewportLeftTopPosition(),s=this.getViewBoxByPlayerItem(e,e.children),o="template"===Lk.config.mode?1:this.interactionUtils.viewportParam.scale,a=this.interactionUtils.getViewPositionWWithOutTransform(s.getCenter().subtract(r)),h="editor"===Lk.config.mode?this.interactionUtils.getPixelPositionByViewPoint(a).toArray().map(t=>Gw(t,2)):a.toArray();"group"===t.type&&(t.property.children=i),t.property.position=h;const l=s.getSize().divide(o).toArray();t.property.width=l[0],t.property.height=l[1],t.visible=n}switch(e.type){case en.ItemType.sprite:if(fT(t)){const i=this.getViewProperty()?.scene;if(i){i.components.filter(t=>t.item.id===e.getInstanceId()).forEach(e=>{if(!("renderer"in e)||!("texture"in e.renderer)||!e.renderer.texture)return;const r=i.textures?.find(t=>t.id===e.renderer.texture.id);if(r&&"source"in r&&r.source){const e=i?.images.find(t=>t.id===r.source.id);t.isCoreEditable=!!e?.template,t.property.image=e?.url??""}})}}break;case en.ItemType.video:if(vT(t)){const i=this.getViewProperty()?.scene;if(i){i.components.filter(t=>t.item.id===e.getInstanceId()).forEach(e=>{if(!("renderer"in e)||!("texture"in e.renderer)||!e.renderer.texture)return;const r=i.textures?.find(t=>t.id===e.renderer.texture.id);if(r&&"source"in r&&r.source){const e=i?.videos?.find(t=>t.id===r.source.id);t.isCoreEditable=!0,t.property.video=e?.url??""}})}}break;case en.ItemType.text:case en.ItemType.richtext:if(mT(t)){const i=this.getViewProperty()?.scene;if(t.isCoreEditable=!0,i){i.components.filter(t=>t.item.id===e.getInstanceId()).forEach(e=>{if(![en.DataType.TextComponent,en.DataType.RichTextComponent].includes(e.dataType))return;const{textAlign:i,textColor:r,text:n,fontWeight:s,fontFamily:o,fontSize:a,fontStyle:h,outline:l,textWidth:c,lineHeight:u,textHeight:d}=e.options,f=l?.outlineColor?hT(l.outlineColor):void 0,p=hT(r),m=l?.outlineWidth,g=!!l;Object.assign(t.property,{outlineEnabled:g,textAlign:i,textColor:p,fontWeight:s,text:n,fontFamily:o,fontSize:a,fontStyle:h,outlineColor:f,outlineWidth:m,textWidth:c,lineHeight:u,textHeight:d})})}}}}getPlayerItemById(t){return this.player.getCompositions()[0]?.items.find(e=>e.getInstanceId()===t)}getPixelSizeByWorldSize(t,e){Be(this.sdk.pageData,"You must call SDK#run() first");const i=[0,0],r=e.composition?.camera,n=this.getViewProperty()?.size;if(r&&n){const{z:s}=e.transform.getWorldPosition(),{x:o,y:a}=r.getInverseVPRatio(s);i[0]=Math.abs(t[0]*n[0]/o/2),i[1]=Math.abs(t[1]*n[1]/a/-2)}else console.warn("camera is not existed.");return i}getWorldSizeByPixelSize(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=[0,0],i=this.player.getCompositions()[0],r=i?.camera,n=this.getViewProperty()?.size;if(r&&n){const{x:i,y:s}=r.getInverseVPRatio(0);e[0]=Math.abs(2*t[0]*i/n[0]),e[1]=Math.abs(-2*t[1]*s/n[1])}else console.warn("camera is not existed.");return e}getActiveTargetScene(){const t=this.getViewProperty()?.scene;if(t)return t;console.warn("Target scene is not exsited.")}refreshSceneAndPageData(){Be(this.sdk.pageData,"You must call SDK#run() first");const t=this.player.getCompositions()[0];this.refreshItemRenderOrder(t),this.interactionUtils.refreshViewParam(),this.interactionUtils.refreshCameraParam(),this.addSDKItemsByItems(this.sdk.pageData.items,t.items),this.emitter.emit("pageDataChange",this.sdk.pageData)}async addSpriteItem(t,e=!1,i){if(i??(i=this.getActiveTargetScene()),!i)return;const{name:r="图片",property:{width:n,height:s,scale:o=[1,1],image:a,rotation:h=0,position:l},parentId:c,id:u=ei(),extension:d}=t,f=[n,s],p=Array.isArray(h)?[...h]:[0,0,h];p[2]=-p[2];const m=new $w(...o??[1,1],1),g=this.getWorldSizeByPixelSize(f),v=new $w(...p),y=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...l)))??new $w,x=i.images.findIndex(t=>t.url===a);let b,_,w={};if(a)if(_=e?t.textureId:ei(),x<0||"editor"===Lk.config.mode){e||(b=await To.fromImage(a,this.player.renderer.engine,{magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR,generateMipmap:!0,id:_}));const t={id:ei(),url:a,renderLevel:en.RenderLevel.BPlus};w={id:_,source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR,generateMipmap:!0},i.images.push(t),i.textures??(i.textures=[]),i.textures.push(w)}else if(!e){const t=i.textures?.find(t=>t.source.id===i.images[x].id);w={id:t?.id},b=this.player.renderer.engine.findObject({id:t.id})}const T=new dT({id:u,name:r,parentId:c,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,isLocked:!1,visible:!0,isCoreEditable:!0,property:{position:[...l],rotation:[...p],width:n,height:s,scale:[...o],image:a??""},extension:d});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(T);const E=ED(u,y,v,new Lw(...g),m,r,_);i.items.find(t=>t.id===c)&&(E.item.parentId=c),CD(i,E);const S=this.player.getCompositions()[0],I=rk.createSprite(S,null,r);if(I.setInstanceId(E.item.id),I.duration=999,I.defination.delay=0,I.endBehavior=en.EndBehavior.restart,I.transform.setSize(...g),I.transform.setPosition(...y.toArray()),I.transform.setRotation(...v.toArray()),I.transform.setScale(...m.toArray()),b&&!e){I.getComponent(Yd).setTexture(b)}return this.refreshSceneAndPageData(),"template"===Lk.config.mode&&this.player.gotoAndStop(this.getPageData().time),E.item.id}addGroupItem(t,e){if(e??(e=this.getActiveTargetScene()),!e)return;const{name:i="空节点",property:{position:r=[0,0],children:n=[],scale:s=[1,1]},id:o=ei(),extension:a}=t,h=n.filter(t=>!this.getPlayerItemById(t)),l=n.filter(t=>!!this.getPlayerItemById(t));if(h.length&&console.warn(`item ${h.join("、")} is not existed.`),0===l.length)return;const c=new $w(...this.getWorldSizeByPixelSize(r),0),u=new yT({id:o,name:i,children:l.map(t=>this.getPlayerItemById(t).getInstanceId()),duration:999,delay:0,endBehavior:en.EndBehavior.restart,isLocked:!1,visible:!0,isCoreEditable:!1,property:{position:r,rotation:[0,0,0],scale:[...s]},extension:a});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(u);const d=SD(o,i,c);CD(e,d),l.forEach(t=>{PD(e,t,o)});const f=this.player.getCompositions()[0],p=rk.createEmpty(f,null,i);return p.setInstanceId(d.item.id),p.duration=999,p.defination.delay=0,p.endBehavior=en.EndBehavior.restart,p.transform.setPosition(...c.toArray()),l.forEach(t=>{const e=this.getPlayerItemById(t);e.setParent(p),e.parentId=d.item.id,e.translate(...c.clone().negate().toArray())}),this.refreshSceneAndPageData(),d.item.id}async addTextItem(t,e){if(e??(e=this.getActiveTargetScene()),!e)return;const{id:i=ei(),parentId:r,name:n="文本",property:{lineHeight:s,width:o,height:a=s,fontFamily:h,position:l=[0,0],fontSize:c,fontWeight:u=en.TextWeight.normal,fontStyle:d=en.FontStyle.normal,textAlign:f=en.TextAlignment.left,text:p,color:m,outlineColor:g,outlineWidth:v,rotation:y=0,fontUrl:x,outlineEnabled:b},extension:_}=t,w=Array.isArray(y)?[...y]:[0,0,y];w[2]=-w[2],x&&!e.fonts?.find(t=>t.fontFamily===h)&&(e.fonts??(e.fonts=[]),e.fonts.push({fontFamily:h,fontURL:x}));const T=lT(m),E=g?lT(g):void 0,S={text:p,fontFamily:h,fontSize:c,textColor:T,fontWeight:u,letterSpace:0,textAlign:f,fontStyle:d,textWidth:o,textHeight:a,lineHeight:s,textBaseline:en.TextBaseline.top,textOverflow:en.TextOverflow.visible,outline:b?{outlineColor:E,outlineWidth:v}:void 0},I=new pT({id:i,name:n,parentId:r,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,isLocked:!1,visible:!0,isCoreEditable:!0,property:{position:l,rotation:w,width:o,height:a??s??c,scale:[1,1],text:p,fontFamily:h,fontSize:c,fontWeight:u,fontStyle:d,textAlign:f,color:m,lineHeight:s,outlineEnabled:b,outlineColor:g,outlineWidth:v},extension:_});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(I);const A=this.player.getCompositions()[0],C=rk.createText(A,null,n);C.setInstanceId(i),C.duration=999,C.defination.delay=0,C.endBehavior=en.EndBehavior.restart;const P=C.getComponent(ef),M={options:S,renderer:{renderMode:1},dataType:en.DataType.TextComponent,item:{id:C.getInstanceId()},id:P.getInstanceId()};P.fromData(M),await dp.loadFontFamily([{fontURL:x,fontFamily:h}]),P.setFontFamily(h);const R=[o,S.textHeight],O=this.getWorldSizeByPixelSize(R),D=new $w(...w),k=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...l)))??new $w,L=ID(i,n,k,D,new Lw(...O),S);e.items.find(t=>t.id===r)&&(L.item.parentId=r),CD(e,L);const F=O[0]/C.transform.size.x;return C.transform.setScale(F,F,1),C.transform.setPosition(...k.toArray()),C.transform.setRotation(...D.toArray()),Be(this.sdk.pageData,"You must call SDK#run() first"),this.refreshSceneAndPageData(),L.item.id}async addVideoItem(t,e,i){if(i??(i=this.getActiveTargetScene()),!i)return;const{name:r="视频",property:{width:n,height:s,scale:o=[1,1],video:a,rotation:h=0,position:l,muted:c=!0,transparent:u=!1,volume:d=1,playbackRate:f=1},parentId:p,id:m=ei(),extension:g}=t,v=[n,s],y=Array.isArray(h)?[...h]:[0,0,h];y[2]=-y[2];const x=new $w(...o??[1,1],1),b=this.getWorldSizeByPixelSize(v),_=new $w(...y),w=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...l)))??new $w;i.videos??(i.videos=[]);const T=i.videos.findIndex(t=>t.url===a);let E,S,I="",A={};if(a)if(S=e?t.textureId:ei(),T<0||"editor"===Lk.config.mode){e||(E=await To.fromVideo(a,this.player.renderer.engine,{magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,generateMipmap:!1,id:S}));const t={id:ei(),url:a,renderLevel:en.RenderLevel.BPlus};I=t.id,A={id:S,source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,generateMipmap:!1},i.videos.push(t),i.textures??(i.textures=[]),i.textures.push(A)}else if(!e){const t=i.textures?.find(t=>t.source.id===i.videos[T].id);I=t?.source.id,A={id:t?.id},E=this.player.renderer.engine.findObject({id:t.id})}const C=new gT({id:m,name:r,parentId:p,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,isLocked:!1,visible:!0,isCoreEditable:!0,property:{position:[...l],rotation:[...y],width:n,height:s,scale:[...o],video:a??"",muted:c,transparent:u,volume:d,playbackRate:f},extension:g});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(C);const P=AD(m,w,_,new Lw(...b),x,r,c,u,d,f,S,I);i.items.find(t=>t.id===p)&&(P.item.parentId=p),CD(i,P);const M=this.player.getCompositions()[0],R=rk.createVideo(M,null,r);if(R.setInstanceId(P.item.id),R.duration=999,R.defination.delay=0,R.endBehavior=en.EndBehavior.restart,R.transform.setSize(...b),R.transform.setPosition(...w.toArray()),R.transform.setRotation(..._.toArray()),R.transform.setScale(...x.toArray()),E&&!e){const t=R.getComponent(Yy);t.setTexture(E),t.setLoop(!0),t.setMuted(c),t.setVolume(d),t.setPlaybackRate(f),t.pauseVideo()}return this.refreshSceneAndPageData(),P.item.id}addGeneratorItem(t,e){if(e??(e=this.getActiveTargetScene()),!e)return"";const{id:i=ei(),name:r=("video"===t.property.generatorType?"视频生成器":"图片生成器"),property:{width:n,height:s,position:o,rotation:a=0,generatorType:h="image"},extension:l}=t,c=[n,s],u=Array.isArray(a)?[...a]:[0,0,a];u[2]=-u[2];const d=new $w(1,1,1),f=this.getWorldSizeByPixelSize(c),p=new $w(...u),m=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...o)))??new $w,g=new bT({id:i,name:r,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,visible:!0,isLocked:!1,isCoreEditable:!0,property:{position:[...o],rotation:[0,0,0],width:n,height:s,scale:[1,1],generatorType:h},extension:l});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(g);const v=this.player.getCompositions()[0],y=rk.createSprite(v,null,r);return y.getComponent(Yd).setColor(new Wg(0,0,0,.3)),y.setInstanceId(i),y.duration=999,y.defination.delay=0,y.endBehavior=en.EndBehavior.restart,y.transform.setSize(...f),y.transform.setPosition(...m.toArray()),y.transform.setRotation(...p.toArray()),y.transform.setScale(...d.toArray()),this.refreshSceneAndPageData(),i}async setGeneratorResource(t,e){const i=this.getActiveTargetScene();if(!i)return"";const r=this.getSDKItem(t);if(!r||!_T(r))return console.warn(`GeneratorItem ${t} not found`),"";const n="video"===r.generatorType?r.toVideoCreateInfo(e,!0):r.toSpriteCreateInfo(e,!0);this.deleteItem(t);return"video"===r.generatorType?await this.addVideoItem(n,!1,i):await this.addSpriteItem(n,!1,i)}async convertVideoGeneratorToVideo(t,e){return this.setGeneratorResource(t,e)}deleteItem(t){const e=this.getActiveTargetScene();if(!e)return;RD(e,t);const i=this.player.getCompositions()[0].items.find(e=>e.getInstanceId()===t);if(i){const t=i.getWorldTransform(),e=t.getWorldPosition(),r=t.getRotation(),n=t.getWorldScale();i.children.forEach(t=>{t.scale(...n.toArray()),t.rotate(...r.toArray()),t.translate(...e.toArray()),t.parent=void 0,t.parentId=void 0}),i.dispose()}this.getPageData().items=this.getPageData().items.filter(e=>e.id!==t)}setItemParent(t,e,i){const r=this.getPlayerItemById(e),n=this.getPlayerItemById(t);if(r?.type!==en.ItemType.null||!n)return void console.warn("Id info is error, can not set parent.");i??(i=this.getActiveTargetScene()),PD(i,t,e);const s=r.getWorldTransform(),o=s.getWorldPosition(),a=s.getRotation(),h=s.getWorldScale();n.scale(1/h.x,1/h.y,1/h.z),n.rotate(...a.clone().negate().toArray()),n.translate(...o.clone().negate().toArray()),n.setParent(r),n.parentId=r.getInstanceId(),this.refreshSDKItem(t),this.refreshSDKItem(e)}deleteItemParent(t,e,i){const r=this.getPlayerItemById(e),n=this.getPlayerItemById(t);r?.type===en.ItemType.null&&n?(i??(i=this.getActiveTargetScene()),MD(i,t),n.parent=void 0,n.parentId=void 0,this.refreshSDKItem(t),this.refreshSDKItem(e)):console.warn("Id info is error, can not set parent.")}setItemName(t,e,i){const r=this.getPlayerItemById(t);r?(i??(i=this.getActiveTargetScene()),function(t,e,i){const r=t.items.find(t=>t.id===e);r?r.name=i:console.warn(`item ${e} is not exsited.`)}(i,t,e),r.name=e,this.refreshSDKItem(t)):console.warn(`Item ${t} is not exsited.`)}get undoRedo(){return this.sdk.undoRedo}saveUndoRedoOldData(){const t=this.getPageData()?.activeData?.selectedItems;if(t){const e=t.map(t=>this.getItemCreateInfo(t));this.undoRedo.oldData=e}}pushUndoRedoData(){const t=this.getSelectedItems().map(t=>this.getItemCreateInfo(t.id));if(t.length&&this.undoRedo.oldData?.length){const e=this.undoRedo.oldData,i=t,r=oT(e,i);if(console.log("undo redo push data \nisEqual:",r,"\noldData:",e,"\nnewData:",i),!r){const t={type:"update",oldData:e,newData:i};this.undoRedo.push(t),this.emitter.emit("undoRedoChange",t)}}}getItemCreateInfo(t,e=!1){Be(this.sdk.pageData,"You must call SDK#run() first");const i=this.getPlayerItemById(t),r=this.getViewProperty()?.scene,n=this.getSDKItem(t);if(!n||!i||!r)return void console.warn(`item ${t} is not existed.`);const{transform:s}=i,o=s.getWorldScale();if(e&&i.parent){const t=i.parent.transform;o.divide(t.getWorldScale())}const{property:{width:a,height:h,position:l,rotation:c}}=n,u=[Gw(a/o.x,2),Gw(h/o.y,2)],d=n.getAllExtension();switch(n.type){case"sprite":return{type:"sprite",name:n.name,parentId:e?i.parent?.getInstanceId():void 0,id:t,property:{image:OD(r,t),width:u[0],height:u[1],scale:[o.x,o.y],rotation:c[2],position:[...l]},extension:d};case"group":{const r=i.children.map(t=>t.getInstanceId());return{type:"group",id:t,parentId:e?i.parent?.getInstanceId():void 0,name:i.name,property:{children:r,scale:[o.x,o.y],rotation:c[2],position:[...l]},extension:d}}case"text":{const s=r.components.find(e=>e.item.id===t),o=r.fonts?.find(t=>t.fontFamily===s.options.fontFamily)?.fontURL;return{type:"text",id:t,parentId:e?i.parent?.getInstanceId():void 0,name:n.name,property:{width:s.options.textWidth,height:s.options.textHeight??s.options.lineHeight,lineHeight:s.options.lineHeight,fontFamily:s.options.fontFamily,position:[...l],rotation:[...c],fontSize:s.options.fontSize,fontWeight:s.options.fontWeight,fontStyle:s.options.fontStyle,textAlign:s.options.textAlign,text:s.options.text,color:s.options.textColor?.map((t,e)=>e>2?t:Gw(255*t,0)),outlineColor:s.options.outline?.outlineColor?.map((t,e)=>e>2?t:Gw(255*t,0)),outlineWidth:s.options.outline?.outlineWidth,outlineEnabled:!!s.options.outline,fontUrl:o},extension:d}}case"video":{const s=r.components.find(e=>e.item.id===t);return{type:"video",name:n.name,parentId:e?i.parent?.getInstanceId():void 0,id:t,property:{video:OD(r,t),width:u[0],height:u[1],scale:[o.x,o.y],rotation:[...c],position:[...l],muted:s.options.muted,transparent:s.options.transparent,playbackRate:s.options.playbackRate,volume:s.options.volume},extension:d}}case"generator":return{type:"generator",name:n.name,parentId:e?i.parent?.getInstanceId():void 0,id:t,property:{generatorType:n.generatorType,width:u[0],height:u[1],scale:[o.x,o.y],rotation:[...c],position:[...l]},extension:d};case"effects":return{type:"effects",name:n.name,parentId:e?i.parent?.getInstanceId():void 0,id:t,property:{width:u[0],height:u[1],scale:[o.x,o.y],rotation:[...c],position:[...l],effects:n.effects},extension:d};case"frame":return{type:"frame",name:n.name,parentId:e?i.parent?.getInstanceId():void 0,id:t,property:{width:u[0],height:u[1],scale:[o.x,o.y],rotation:[...c],position:[...l],layoutMode:n.layoutMode,children:n.children},extension:d};default:return void console.warn(`getItemCreateInfo: unsupported item type ${n.type}`)}}getChildrenIds(t){return this.getPageData()?.items.filter(e=>e.parentId===t)?.map(t=>t.id)??[]}createScreenShotSceneByIds(t){const e=new Kw;let i;const r=(t,e,r)=>{const{id:n=ei(),name:s="图片",property:{image:o,scale:a=[1,1],rotation:h=0}}=t,l=Array.isArray(h)?[...h]:[0,0,h];l[2]=-l[2];const c=i.images.findIndex(t=>t.url===o);let u={};if(o)if(c<0){const t={id:ei(),url:o,renderLevel:en.RenderLevel.BPlus};u={id:ei(),source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR,generateMipmap:!0},i.images.push(t),i.textures??(i.textures=[]),i.textures.push(u)}else{const t=i.textures?.find(t=>t.source.id===i.images[c].id);u={id:t?.id}}const d=ED(n,new $w(r.x,r.y,0),new $w(...l),e,new $w(a[0]??1,a[1]??1,1),s,u.id);CD(i,d)},n=(t,e,r)=>{const{id:n=ei(),name:s="文本",property:{lineHeight:o,width:a,height:h=o,fontFamily:l,fontSize:c,fontWeight:u=en.TextWeight.normal,fontStyle:d=en.FontStyle.normal,textAlign:f=en.TextAlignment.left,text:p,color:m,rotation:g=0,fontUrl:v,outlineColor:y,outlineWidth:x,outlineEnabled:b}}=t,_=Array.isArray(g)?[...g]:[0,0,g];_[2]=-_[2],v&&!i.fonts?.find(t=>t.fontFamily===l)&&(i.fonts??(i.fonts=[]),i.fonts.push({fontFamily:l,fontURL:v}));const w=y?lT(y):void 0,T=m?lT(m):void 0,E={text:p,fontFamily:l,fontSize:c,textColor:T,fontWeight:u,letterSpace:0,textAlign:f,fontStyle:d,textWidth:a,textHeight:h??o,lineHeight:o,outline:b?{outlineColor:w,outlineWidth:x}:void 0},S=ID(n,s,new $w(...r.toArray(),0),new $w(..._),new Lw(e.x,e.y),E);CD(i,S)},s=(t,e,r)=>{const{id:n=ei(),name:s="视频",property:{video:o,scale:a=[1,1],rotation:h=0,muted:l=!0,transparent:c=!1,playbackRate:u=1,volume:d=1}}=t,f=Array.isArray(h)?[...h]:[0,0,h];f[2]=-f[2],i.videos??(i.videos=[]);const p=i.videos.findIndex(t=>t.url===o);let m,g={};if(o)if(p<0){const t={id:ei(),url:o,renderLevel:en.RenderLevel.BPlus};m=t.id,g={id:ei(),source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,generateMipmap:!1},i.videos.push(t),i.textures??(i.textures=[]),i.textures.push(g)}else{const t=i.textures?.find(t=>t.source.id===i.videos[p].id);m=t.resource.id,g={id:t?.id}}const v=AD(n,new $w(r.x,r.y,0),new $w(...f),e,new $w(a[0]??1,a[1]??1,1),s,l,c,d,u,g.id,m);CD(i,v)};if(Array.isArray(t)){t.map(t=>this.getItemBoxById(t)).map(t=>e.union(t));const o=e.getSize();i=TD(o.toArray());const a=(new Qw).compose(new $w(0,0,8),new Jw,new $w(1,1,1)).invert(),h=(new Qw).perspective(60*Bw,o.x/o.y,.1,40,!0),l=(new Qw).multiplyMatrices(h,a),c=l.clone().invert(),u=l.projectPoint(new $w).z,d=new $w(0,0,u).applyMatrix(c),f=new $w(2,2,u).applyMatrix(c),p=Math.abs(f.x-d.x)/o.x,m=Math.abs(f.y-d.y)/o.y;t.forEach(t=>{const i=this.getItemCreateInfo(t,!1);if(!i||"group"===i.type)return;const o=this.getItemBoxById(t),a="text"===i.type?[i.property.width,i.property.height??i.property.lineHeight]:[i.property.width,i.property.height],h=new Lw(...a).multiply(new Lw(p,m)).abs(),l=o.getCenter().subtract(e.getCenter()).multiply(new Lw(p,-m));switch(i.type){case"sprite":r(i,h,l);break;case"text":n(i,h,l);break;case"video":s(i,h,l)}})}else{const e=this.getItemBoxById(t),o=this.getItemCreateInfo(t,!1),a=e.clone().getSize();i=TD(a.toArray());const h=(new Qw).compose(new $w(0,0,8),new Jw,new $w(1,1,1)).invert(),l=(new Qw).perspective(60*Bw,a.x/a.y,.1,40,!0),c=(new Qw).multiplyMatrices(l,h),u=c.clone().invert(),d=c.projectPoint(new $w).z,f=new $w(0,0,d).applyMatrix(u),p=new $w(2,2,d).applyMatrix(u),m=(new $w).subtractVectors(p,f);if(o)switch(o.type){case"sprite":r(o,new Lw(m.x,m.y),new Lw);break;case"text":n(o,new Lw(m.x,m.y),new Lw);break;case"video":s(o,new Lw(m.x,m.y),new Lw)}}return i}createSceneByCreateInfos(t,e,i){const r=new Kw;e?r.setFromVec2Array([new Lw,new Lw(...e)]):r.copyFrom(this.getBoundingBoxByCreateInfos(t));const n=r.getSize(),s=TD(n.toArray(),i),o=(new Qw).compose(new $w(0,0,8),new Jw,new $w(1,1,1)).invert(),a=(new Qw).perspective(60*Bw,n.x/n.y,.1,40,!0),h=(new Qw).multiplyMatrices(a,o),l=h.clone().invert(),c=h.projectPoint(new $w).z,u=new $w(0,0,c).applyMatrix(l),d=new $w(2,2,c).applyMatrix(l),f=Math.abs(d.x-u.x)/n.x,p=Math.abs(d.y-u.y)/n.y,m=new Map;return t.forEach(t=>{const e=this.getBoundingBoxByCreateInfo(t),i=e.getSize().multiply(new Lw(f,p)).abs(),n=e.getCenter().subtract(r.getCenter()).multiply(new Lw(f,-p));switch(t.type){case"sprite":((t,e,i)=>{const{id:r=ei(),name:n="图片",property:{image:o,scale:a=[1,1],rotation:h=0}}=t,l=Array.isArray(h)?[...h]:[0,0,h];l[2]=-l[2];const c=s.images.findIndex(t=>t.url===o);let u={};if(o)if(c<0){const t={id:ei(),url:o,renderLevel:en.RenderLevel.BPlus};u={id:ei(),source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR_MIPMAP_LINEAR,generateMipmap:!0},s.images.push(t),s.textures??(s.textures=[]),s.textures.push(u)}else{const t=s.textures?.find(t=>t.source.id===s.images[c].id);u={id:t?.id}}const d=ED(r,new $w(i.x,i.y,0),new $w(...l),e,new $w(a[0],a[1],1),n,u.id);CD(s,d)})(t,i,n);break;case"text":((t,e,i)=>{const{id:r=ei(),name:n="文本",property:{lineHeight:o,width:a,height:h=o,fontFamily:l,fontSize:c,fontWeight:u=en.TextWeight.normal,fontStyle:d=en.FontStyle.normal,textAlign:f=en.TextAlignment.left,text:p,color:m,rotation:g=0,fontUrl:v,outlineColor:y,outlineWidth:x,outlineEnabled:b}}=t,_=Array.isArray(g)?[...g]:[0,0,g];_[2]=-_[2],v&&!s.fonts?.find(t=>t.fontFamily===l)&&(s.fonts??(s.fonts=[]),s.fonts.push({fontFamily:l,fontURL:v}));const w={text:p,fontFamily:l,fontSize:c,textColor:m,fontWeight:u,letterSpace:0,textAlign:f,fontStyle:d,textWidth:a,textHeight:h??o,lineHeight:o,outline:b?{outlineWidth:x,outlineColor:y}:void 0},T=ID(r,n,new $w(...i.toArray(),0),new $w(..._),new Lw(e.x,e.y),w);CD(s,T)})(t,i,n);break;case"group":(t=>{const{id:e=ei(),name:i="编组",property:{scale:r=[1,1],children:n,rotation:o=0,position:a=[0,0]}}=t,h=Array.isArray(o)?[...o]:[0,0,o];h[2]=-h[2];const l=new Lw(...a).multiply(new Lw(f,-p)),c=SD(e,i,new $w(l.x,l.y,0),new Lw(...r),new $w(...h));CD(s,c),m.set(e,n)})(t);break;case"video":((t,e,i)=>{const{id:r=ei(),name:n="视频",property:{video:o,scale:a=[1,1],rotation:h=0,muted:l=!0,transparent:c=!1,playbackRate:u=1,volume:d=1}={}}=t,f=Array.isArray(h)?[...h]:[0,0,h];f[2]=-f[2],s.videos??(s.videos=[]);const p=s.videos.findIndex(t=>t.url===o);let m={},g="";if(o)if(p<0){const t={id:ei(),url:o,renderLevel:en.RenderLevel.BPlus};g=t.id,m={id:ei(),source:{id:t.id},flipY:!0,dataType:en.DataType.Texture,magFilter:Ys.LINEAR,minFilter:Ys.LINEAR,generateMipmap:!1},s.videos.push(t),s.textures??(s.textures=[]),s.textures.push(m)}else{const t=s.textures?.find(t=>t.source.id===s.videos[p].id);g=t.source.id,m={id:t?.id}}const v=AD(r,new $w(i.x,i.y,0),new $w(...f),e,new $w(a[0],a[1],1),n,l,c,d,u,m.id,g);CD(s,v)})(t,i,n)}}),m.forEach((t,e)=>{const i=s.items.find(t=>t.id===e),r=i?.transform;if(r){const{position:i,scale:n,size:o}=r,a={x:n.x*(o?.x??1),y:n.y*(o?.y??1)};t.forEach(t=>{const n=s.items.find(e=>e.id===t);n&&(n.parentId=e,n.transform??(n.transform={position:{x:0,y:0,z:0},eulerHint:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},size:{x:1,y:1}}),n.transform.position.x-=i.x,n.transform.position.y-=i.y,r.scale&&(n.transform.scale.x/=a.x,n.transform.scale.y/=a.y))})}}),s}updateItemOrder(t,e){Be(this.sdk.pageData,"You must call SDK#run() first");const i=this.getCurrentComposition();if(!i)return void console.warn("Composition not found.");const r=i.items.find(e=>e.getInstanceId()===t);if(!r)return void console.warn(`Item with id ${t} not found.`);const n=r.parent,s=n.children.filter(t=>!this.isPluginItem(t)),o=n.children.filter(t=>this.isPluginItem(t)),a=s.findIndex(e=>e.getInstanceId()===t);if(-1===a)return void console.warn(`Item with id ${t} not found in siblings.`);let h=a;switch(e){case 0:h=s.length-1;break;case 1:h=0;break;case 2:h=Math.min(a+1,s.length-1);break;case 3:h=Math.max(a-1,0)}if(h===a)return;const[l]=s.splice(a,1);l&&s.splice(h,0,l),n.children=[...o,...s],this.refreshItemRenderOrder(i),this.addSDKItemsByItems(this.sdk.pageData.items,i.items),this.emitter.emit("pageDataChange",this.sdk.pageData)}isPluginItem(t){return"ModelPluginItem"===t.name}refreshItemRenderOrder(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=(()=>{const e=[],i=t=>{for(const r of t)this.isPluginItem(r)||(e.push(r),r.children.length>0&&i(r.children))},r=[...t.rootItem.children].filter(t=>"ModelPluginItem"!==t.name);return i(r),e})();t.items.length=0,t.items.push(...e);for(let e=0;e<t.items.length;e++){const i=t.items[e];i.renderOrder=e;let r=!1;i.type===en.ItemType.video&&(r=i.components[0].played),i.setActive(!1),i.setActive(!0),i.type===en.ItemType.video&&(r?i.components[0].playVideo():i.components[0].pauseVideo())}const i=this.getViewProperty();if(i){const{scene:e}=i;e.compositions.forEach(i=>{const r=i.components.map(t=>e.components.find(e=>e.id===t.id)).find(t=>t?.dataType===en.DataType.CompositionComponent);r&&(r.items=t.items.filter(t=>!Lk.config.pageConfig.filterItemNames.includes(t.name)&&r.items.find(e=>e.id===t.getInstanceId())).map(t=>({id:t.getInstanceId()})))})}this.syncPageDataItemsOrder(t)}syncPageDataItemsOrder(t){Be(this.sdk.pageData,"You must call SDK#run() first");const e=t.items.filter(t=>!Lk.config.pageConfig.filterItemNames.includes(t.name)).map(t=>t.getInstanceId()),i=new Map;for(const t of this.sdk.pageData.items)i.set(t.id,t);const r=[];for(const t of e){const e=i.get(t);e&&(r.push(e),i.delete(t))}for(const t of i.values())r.push(t);this.sdk.pageData.items=r}getViewProperty(t){return Be(this.sdk.pageData,"You must call SDK#run() first"),t??(t=this.sdk.pageData.activeData.view),this.sdk.pageData.viewProperties.find(e=>e.id===t)}viewportFit(t,e){switch(Lk.config.mode){case"template":{const{scale:t,translation:e}=this.interactionUtils.viewportParam;this.pageMove(e.clone().negate()),this.pageZoom(1-t,void 0,!0);break}case"editor":{Be(this.sdk.pageData,"You must call SDK#run() first"),t??(t={left:0,right:0,top:0,bottom:0});const{left:i=0,top:r=0,right:n=0,bottom:s=0}=t,o=new Kw;e?o.copyFrom(e):this.sdk.pageData.items.forEach(t=>{const e=this.getViewBoxById(t.id);o.union(e)});const{offsetWidth:a,offsetHeight:h}=this.container.parentElement,{scale:l,translation:c}=this.interactionUtils.viewportParam;if(o.isEmpty())this.pageMove(c.clone().negate()),this.pageZoom(1-l,void 0,!0);else{o.scale(1.1);const t=o.getCenter(),e=o.getSize(),u=a-i-n,d=h-r-s,f=new Lw(a/2+i/2-n/2,h/2+r/2-s/2),p=e.x/u*d>e.y?1/(e.x/u):1/(e.y/d),m=(new Lw).subtractVectors(f,t);this.setPageMove((new Lw).addVectors(c,m)),this.setPageZoom(p*l,new Lw(u/2+i,d/2+r),!0)}break}}}getItemBoxById(t){const e=t=>{const e=new Kw,i=this.getSDKItem(t);if(i){const{position:t,width:r,height:n,rotation:s}=i.property;e.setFromCenterAndSize(new Lw(...t),new Lw(r,n)).rotate(s[2]*Bw)}return e};if(Array.isArray(t)){const i=[];return i.push(...t.map(e)),i}return e(t)}async setItemFontFamily(t,e,i){Be(this.sdk.pageData,"You must call SDK#run() first");const r=this.getPlayerItemById(t),n=this.getActiveTargetScene();if(!r||!n||r.type!==en.ItemType.text)return void console.warn(`text item ${t} is not exsited.`);n.fonts??(n.fonts=[]);!n.fonts.find(t=>"family"in t&&t.family===e||"fontFamily"in t&&t.fontFamily===e)&&n.fonts&&(n.fonts.push({fontFamily:e,fontURL:i}),await dp.loadFontFamily([{fontURL:i,fontFamily:e}]));const s=n.components.find(e=>e.item.id===t&&[en.DataType.TextComponent,en.DataType.RichTextComponent].includes(e.dataType));s&&(s.options.fontFamily=e),r.getComponent(ef).setFontFamily(e),r.getComponent(ef).isDirty=!0,this.refreshSDKItem(t)}changeItemPropertyByCreateInfo(t){const e=t=>{const e=this.getItemCreateInfo(t.id);if(!e)return void console.warn(`item create info ${t.id} is not exsited.`);const i=e.property,r=t.property;Object.keys(t.property).forEach(async t=>{if(sD(i,r)||["type","id","size"].includes(t))return;const n=e.type;await this.setItemProperty({itemId:e.id,type:n,propertyName:t,propertyValue:r[t]})})};Array.isArray(t)?t.map(e):e(t)}getViewBoxByBox(t){const{translation:e,scale:i,width:r,height:n}=this.interactionUtils.viewportParam,s=new Lw(r/2,n/2);return t.clone().scale(i,s).translate(e)}playVideoItem(t){const e=this.getPlayerItemById(t);if(e?.type!==en.ItemType.video)return;e.getComponent(Yy).playVideo()}pauseVideoItem(t){const e=this.getPlayerItemById(t);if(e?.type!==en.ItemType.video)return;e.getComponent(Yy).pauseVideo()}playEffectsItem(t){const e=this.getPlayerItemById(t),i=e?.children?.[0];i?.type===en.ItemType.composition&&i.getComponent(Hh).play()}pauseEffectsItem(t){const e=this.getPlayerItemById(t),i=e?.children?.[0];i?.type===en.ItemType.composition&&i.getComponent(Hh).pause()}setEffectsResource(t,e){const i=this.getSDKItem(t);TT(i)?i.effects=e:console.warn(`Item ${t} is not a effects.`)}getBoundingBoxByCreateInfo(t){const e=new Kw;if("group"===t.type)return e;const i=new Lw(...t.property.position),r="text"===t.type?[t.property.width,t.property.height??t.property.lineHeight]:[t.property.width??750,t.property.height??1624],n=new Lw(...r),s=Array.isArray(t.property.rotation)?t.property.rotation[2]:t.property.rotation??0;return e.setFromCenterAndSize(i,n).rotate(s*Bw),e}getBoundingBoxByCreateInfos(t){const e=new Kw,i=new Map,r=new Map;return t.forEach((e,n)=>{const s=e.id??ei();switch(r.set(n,s),e.type){case"sprite":case"video":case"text":i.set(s,this.getBoundingBoxByCreateInfo(e));break;case"group":{const r=new Kw;e.property.children.forEach(e=>{const i=t.find(t=>t.id===e);i&&r.union(this.getBoundingBoxByCreateInfo(i))}),i.set(s,r);break}}}),i.forEach((t,i)=>{e.union(t)}),e}getVideoItemPlayTime(t){const e=this.getPlayerItemById(t);if(e?.type!==en.ItemType.video)return 0;return e.getComponent(Yy).getCurrentTime()}setVideoItemPlayTime(t,e){const i=this.getPlayerItemById(t);if(i?.type!==en.ItemType.video)return;i.getComponent(Yy).setCurrentTime(e)}getEffectsItemPlayTime(t){const e=this.getPlayerItemById(t),i=e?.children?.[0];if(i?.type!==en.ItemType.composition)return;return i.getComponent(Hh).getTime()}setEffectsItemPlayTime(t,e){const i=this.getPlayerItemById(t),r=i?.children?.[0];if(r?.type!==en.ItemType.composition)return;r.getComponent(Hh).setTime(e)}getPixelPositionByViewPosition(t){return this.interactionUtils.getPixelPositionByViewPoint(t)}getItemParentScale(t){const e=new $w(1,1,1),i=this.getPlayerItemById(t);if(!i)return console.warn(`Item ${t} is not exsited.`),e;const r=i.parent?.transform;return r?(r.getMatrix().decompose(new $w,new Jw,e),e):(console.warn(`Item ${t} does not have parent.`),e)}getJSONItem(t){const e=this.getActiveTargetScene(),i=e?.items.filter(e=>e.id===t);return i?.[0]}getJSONComponent(t){const e=this.getActiveTargetScene(),i=e?.components.filter(e=>e.item.id===t);return i?.[0]}getTextOriginSize(t){Be(this.sdk.pageData,"You must call SDK#run() first");let e=!1;const{scene:i}=this.sdk.pageData,r=i.compositions.length?i:this.getActiveTargetScene();if(!r)return console.warn("Scene is not existed."),{size:[0,0],isPublishScene:e};const n=new Lw,s=this.getJSONComponent(t);if(s?.dataType===en.DataType.TextComponent&&"options"in s&&s.options.size)n.set(s.options.size[0],s.options.size[1]),e=!0;else{const i=r.compositions.find(t=>t.id===r.compositionId)??r.compositions[0],s=i.previewSize??[750,1624],{fov:o,near:a,far:h,clipMode:l,position:c=[0,0,8]}=i.camera,u=(new Qw).perspective(o*Math.PI/180,s[0]/s[1],a,h,l===en.CameraClipMode.portrait),d=(new Qw).compose(new $w(...c),new Jw,new $w(1,1,1)).invert(),f=(new Qw).multiplyMatrices(u,d),p=f.clone().invert(),m=this.getPlayerItemById(t),g=m?.getComponent(ef);if(!g)return{size:[0,0],isPublishScene:e};const v=new gD(this);v.refrehCameraParamByCameraInfo({fov:o,near:a,far:h,clipMode:l,position:c,aspect:s[0]/s[1]}),v.viewportParam.width=s[0],v.viewportParam.height=s[1];const{width:y,height:x}=g.textLayout,b=(t,e)=>{const i=t.x/s[0]*2-1,r=1-t.y/s[1]*2;return new $w(i,r,e)},_=(new $w).applyProjectionMatrix(f).z,w=b(new Lw(0,0),_).applyProjectionMatrix(p),T=b(new Lw(y,x),_).applyProjectionMatrix(p);n.copyFrom(T.clone().subtract(w).abs())}return{size:[n.x,n.y],isPublishScene:e}}async asyncAddItemByCreateInfos(t){const e=t.map(t=>Object.assign({},t,t.id?{}:{id:ei()})),i=new Map;for(const t of e){const e=t.id,{type:r}=t,n="sprite"===r?t.property.image:"video"===r?t.property.video:void 0;if(("sprite"===r||"video"===r)&&n){const s=ei();i.set(e,{id:s,url:n,type:"sprite"===r?"image":"video"}),Object.assign(t,{textureId:s})}}await Promise.all(e.map(async t=>{const{type:e}=t;switch(e){case"sprite":await this.addSpriteItem(t,!0);break;case"video":await this.addVideoItem(t,!0);break;case"text":await this.addTextItem(t);break;case"group":this.addGroupItem(t);break;case"effects":await this.addEffectsItem(t);break;case"frame":await this.addFrameItem(t);break;case"generator":this.addGeneratorItem(t)}}));const r=e.map(t=>t.id),n=this.player.getCompositions()[0];this.addSDKItemsByItems(this.sdk.pageData.items,n.items),this.emitter.emit("pageDataChange",this.sdk.pageData);return(async()=>{if(!i.size)return;const t=[];i.forEach((e,i)=>{t.push({...e,textureId:e.id,id:i})});await Promise.all(t.map(async t=>{const e=this.getPlayerItemById(t.id);if(e)try{if("image"===t.type){const i=this.player.renderer.engine.findObject({id:t.textureId})??await To.fromImage(t.url,this.player.renderer.engine,{id:t.textureId});e.getComponent(Yd)?.setTexture(i)}else if("video"===t.type){const i=this.player.renderer.engine.findObject({id:t.textureId})??await To.fromVideo(t.url,this.player.renderer.engine,{id:t.textureId}),r=e.getComponent(Yy);if(r){const{muted:t=!0,playbackRate:n=1,volume:s=1}=this.getJSONComponent(e.getInstanceId()).options??{};r.setTexture(i),r.setLoop(!0),r.setMuted(t),r.setVolume(s),r.pauseVideo(),r.setPlaybackRate(n)}}}catch(e){console.error(`Failed to load texture for item ${t.id}: `,e)}}))})(),r}async addItemByCreateInfos(t){const e=t.map(t=>Object.assign({},t,t.id?{}:{id:ei()})).map(t=>t.id);for(const e of t)switch(e.type){case"sprite":await this.addSpriteItem(e,!1);break;case"text":await this.addTextItem(e);break;case"group":this.addGroupItem(e);break;case"video":await this.addVideoItem(e,!1);break;case"generator":this.addGeneratorItem(e);break;case"effects":await this.addEffectsItem(e);break;case"frame":await this.addFrameItem(e)}return e}async addEffectsItem(t,e){if(e??(e=this.getActiveTargetScene()),!e)return;const{id:i=ei(),name:r="特效",property:{scale:n=[1,1],effects:s,rotation:o=0,position:a},parentId:h,extension:l}=t,c=Array.isArray(o)?o:[0,0,o];c[2]=-c[2];const u=new $w(...n,1),d=new $w(...c),f=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...a)))??new $w;let p;if("string"==typeof s){const t=await fetch(s,{mode:"cors",credentials:"omit",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}, statusText: ${t.statusText} `);p=await t.json()}if(!p)return void console.error("Failed to load effects scene.");const m=p.compositions.find(t=>t.id===p.compositionId)??p.compositions[0];m||console.warn("Composition not found in effects scene.");const g=m?.previewSize??[750,1624],v=this.getWorldSizeByPixelSize(g),y=p.items.map(t=>t.id),x=new wT({id:i,name:r,parentId:h,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,isLocked:!1,visible:!0,isCoreEditable:!0,property:{position:[...a],rotation:[...c],width:v[0],height:v[1],scale:[...n],effects:s,children:y},extension:l});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(x);const b=ei();DD(e,p,b);const _=this.player.getCompositions()[0],w=JSON.parse(JSON.stringify(p)),T=await rk.createEffects(_,w,null,r);T.setInstanceId(b),x.property.children?.push(b);const E=SD(i,r+"控制器",f,new Lw(u.x,u.y),d);e.items.find(t=>t.id===h)&&(E.item.parentId=h),CD(e,E);const S=rk.createEmpty(_,null,r+"控制器");S.setInstanceId(E.item.id),S.duration=999,S.defination.delay=0,S.endBehavior=en.EndBehavior.restart,S.transform.setPosition(...f.toArray()),S.addComponent(Kl),T.setParent(S),S.transform.setSize(...v);const I=_.camera.getInverseVPRatio(0).multiply(2);T.transform.setScale(v[0]/I.x,v[0]/I.x,1);const A=new Map;return S.getDescendants().forEach(t=>{var e;(e=x.property).children??(e.children=[]),x.property.children.push(t.getInstanceId()),t.defination?.id&&A.set(t.defination?.id,t.getInstanceId())}),kD(e,A),x.property.children=S.getDescendants().map(t=>t.getInstanceId()),this.refreshSceneAndPageData(),i}async addFrameItem(t,e){if(e??(e=this.getActiveTargetScene()),!e)return"";const{id:i=ei(),name:r="画板",property:{width:n,height:s,position:o,rotation:a=0,scale:h=[1,1],layoutMode:l="free"},parentId:c,extension:u}=t,d=Array.isArray(a)?[...a]:[0,0,a];d[2]=-d[2];const f=new $w(...h,1),p=new $w(...d),m=this.interactionUtils.getWorldPositionByViewPoint(this.interactionUtils.getViewPositionByPixelPoint(new Lw(...o)))??new $w,g=new ST({id:i,name:r,parentId:c,children:[],duration:999,delay:0,endBehavior:en.EndBehavior.restart,visible:!0,isLocked:!1,isCoreEditable:!0,property:{position:[...o],rotation:[...d],width:n,height:s,scale:[...h],layoutMode:l,children:[]},extension:u});Be(this.sdk.pageData,"You must call SDK#run() first"),this.sdk.pageData.items.push(g);const v=function(t,e,i){const r=ei(),n=ei(),s=ei(),o={id:n,dataType:en.DataType.TimelineAsset,tracks:[]},a={id:s,item:{id:r},dataType:en.DataType.CompositionComponent,items:[],timelineAsset:{id:n},sceneBindings:[]},[h,l]=e,c={id:r,name:i+"_inner",duration:999,startTime:0,endBehavior:en.EndBehavior.forward,previewSize:[...e],camera:{fov:60,far:40,near:.1,clipMode:1,position:[0,0,8],rotation:[0,0,0],aspect:h/l},components:[{id:s}]};return{version:en.JSONSceneVersion.LATEST,playerVersion:{web:Lm,native:"10.7.6"},type:"ge",compositionId:r,compositions:[c],images:[],plugins:[],bins:[],textures:[],items:[],components:[a],materials:[],shaders:[],geometries:[],animations:[],miscs:[o]}}(0,[n,s],r),y=ei();DD(e,v,y,c);const x=this.getWorldSizeByPixelSize([n,s]),b=SD(i,r+"控制器",m,new Lw(f.x,f.y),p);e.items.find(t=>t.id===c)&&(b.item.parentId=c),CD(e,b);const _=this.player.getCompositions()[0],w=rk.createEmpty(_,null,r+"控制器");w.setInstanceId(i),w.duration=999,w.defination.delay=0,w.endBehavior=en.EndBehavior.restart,w.transform.setPosition(...m.toArray()),w.transform.setRotation(...p.toArray()),w.transform.setScale(...f.toArray()),w.transform.setSize(...x),w.addComponent(Kl);const T=JSON.parse(JSON.stringify(v)),E=await rk.createEffects(_,T,null,r);E.setInstanceId(y),E.setParent(w);const S=_.camera.getInverseVPRatio(0).multiply(2);E.transform.setScale(n/S.x,n/S.x,1),g.subCompositionId=E.getInstanceId();const I=new Map;return w.getDescendants().forEach(t=>{var e;(e=g.property).children??(e.children=[]),t.getInstanceId()!==g.subCompositionId&&g.property.children.push(t.getInstanceId()),t.defination?.id&&I.set(t.defination.id,t.getInstanceId())}),kD(e,I),this.refreshSceneAndPageData(),i}makeItemAlign(t,e){if(e??(e=this.getSelectedItems().map(t=>t.id)),e.length<2)return void console.warn("Items length less than 2, fucntion can not make item align.");const i=e.map(t=>({id:t,box:this.getViewBoxById(t)})),r=i.reduce((t,{box:e})=>(t.union(e),t),new Kw);i.forEach(({id:e,box:i})=>{const n=new Lw;switch(t){case"left":n.set(r.min.x-i.min.x,0);break;case"right":n.set(r.max.x-i.max.x,0);break;case"horizontal-center":n.set(r.getCenter().x-i.getCenter().x,0);break;case"top":n.set(0,r.min.y-i.min.y);break;case"bottom":n.set(0,r.max.y-i.max.y);break;case"vertical-center":n.set(0,r.getCenter().y-i.getCenter().y)}const s=this.interactionUtils.getWorldSizeByViewSize(n);this.moveItem(e,s)})}makeItemDistribute(t,e){e??(e=this.getSelectedItems().map(t=>t.id));const i=e.length;if(i<3)return void console.warn("Items length less than 3, fucntion can not make item align.");const r=e.map(t=>({id:t,box:this.getViewBoxById(t)})),n="horizontal-spacing"===t?"x":"y";r.sort((t,e)=>t.box.getCenter()[n]-e.box.getCenter()[n]);const s=r[0],o=(r[i-1].box.getCenter()[n]-s.box.getCenter()[n])/(i-1);r.forEach(({id:t,box:e},i)=>{const r=s.box.getCenter()[n]+o*i,a=new Lw;a[n]=r-e.getCenter()[n];const h=this.interactionUtils.getWorldSizeByViewSize(a);this.moveItem(t,h)})}setItemLockState(t,e){const i=this.getSDKItem(t);i?i.isLocked=e:console.warn(`Item ${t} is not exsited.`)}getItemLockState(t){const e=this.getSDKItem(t);return e?e.isLocked:(console.warn(`Item ${t} is not exsited.`),!0)}},ok=I(Kt(),1),ak=I(Kt(),1),hk="ready",lk="executable",ck="dispose",uk={APNG:"APNG",MP4:"MP4",WebM:"WebM",Images:"Images",WebP:"WebP",GIF:"GIF",AlphaMaskVideo:"AlphaMaskVideo"},dk="idle",fk="convertImage",pk="transcoding",mk="audio",gk="jpeg",vk="webp",yk="png",xk=(uk.MP4,uk.WebP,uk.APNG,uk.GIF,uk.AlphaMaskVideo,uk.Images,uk.MP4,uk.WebP,uk.APNG,uk.GIF,uk.AlphaMaskVideo,uk.Images,"default"),bk="exporting",_k="success",wk="error",Tk={highest:"flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256[p];[s1][p]paletteuse",high:"flags=bicubic,split[s0][s1];[s0]palettegen=max_colors=200[p];[s1][p]paletteuse",medium:"flags=bilinear,split[s0][s1];[s0]palettegen=max_colors=64[p];[s1][p]paletteuse=dither=bayer",low:"flags=neighbor,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=none"},Ek={highest:"1",high:"3",medium:"6",low:"9"},Sk=class{constructor(t){A(this,"sampleRate"),A(this,"duration"),A(this,"channels");const{sampleRate:e=44100,duration:i=1,channels:r=2}=t??{};this.sampleRate=e,this.duration=i,this.channels=r}getBuffer(){const t=this.sampleRate*this.duration*this.channels*2,e=44+t,i=new ArrayBuffer(e),r=new DataView(i);let n=0;const s=t=>{for(let e=0;e<t.length;e++)r.setUint8(n++,t.charCodeAt(e))},o=t=>{r.setUint32(n,t,!0),n+=4},a=t=>{r.setUint16(n,t,!0),n+=2};s("RIFF"),o(e-8),s("WAVE"),s("fmt "),o(16),a(1),a(this.channels),o(this.sampleRate),o(this.sampleRate*this.channels*2),a(2*this.channels),a(16),s("data"),o(t);for(let e=0;e<t;e++)r.setUint8(n++,0);return new Uint8Array(i)}},Ik=["@vvfx/sdk","exporter"],Ak=class extends Qo{constructor(t){super(),A(this,"status",hk),A(this,"stage",dk),A(this,"player"),M(this,LD),M(this,FD),M(this,ND,0),M(this,BD),M(this,zD),M(this,UD),M(this,VD),M(this,GD,[]),M(this,jD),M(this,HD),M(this,WD,[]),M(this,XD,0),M(this,YD),M(this,qD,[]),M(this,KD,0),M(this,ZD,0),M(this,JD,0),M(this,$D,0),M(this,QD,[]),M(this,tk,[]),M(this,ek,null),M(this,ik,!0),R(this,LD,ZI({loggerInTranscoding:!1,multiThreading:!1},t)),this.onInit()}setMediaType(t){t!==P(this,LD).mediaType&&(P(this,LD).mediaType=t,this.onReset(),this.clearAllListeners(),this.onInit())}setOptions(t){const e=ZI({},P(this,LD),t);P(this,LD).mediaType!==e.mediaType&&this.setMediaType(e.mediaType),R(this,LD,e)}get canceled(){return this.status===ck}get config(){const t=this.player?.getCompositions()??[],e=t?.[0],i=e?.name??(new Date).getTime().toString(),r=e?.getDuration()??0,n=e?.startTime??0,s=P(this,YD)?.time;return{name:i,startTime:n,oldTotalTime:r,newTotalTime:s,fps:P(this,YD)?.fps??30,backgroundColor:P(this,YD)?.backgroundColor??"#000000",loop:P(this,YD)?.loop??!0,audioEnable:P(this,YD)?.audioEnable??!1}}get mp4Config(){return P(this,YD)?.mp4Config}get gifConfig(){return P(this,YD)?.gifConfig}get apngConfig(){return P(this,YD)?.apngConfig}get progress(){const t=P(this,ZD)||1,e=P(this,JD)||1,i=Math.min(t/e,1),r=Math.min(P(this,KD),t)/t*.4,n=Math.min(P(this,$D),t)/t*.6,s=Math.min(r+n,1);P(this,qD)[P(this,XD)]=i;const o=P(this,qD).reduce((t,e,i)=>i<P(this,XD)?t+(e||0):t,0),a=o+s*i;return Math.min((h=a,Math.round(100*h)/100),1);var h}get transImageType(){return P(this,LD).mediaType===uk.MP4?gk:P(this,LD).mediaType===uk.WebP?vk:yk}async onInit(){try{nD("log",[...Ik,"ready"],"starting"),this.status=hk,await this.loadHelper(P(this,LD).mediaType),this.status=lk,nD("log",[...Ik,"ready"],"success"),this.emit("ready",P(this,LD).mediaType)}catch(t){this.status=ck,this.onError(t)}finally{return this.status}}onReset(){this.stage=dk,clearTimeout(P(this,FD)),window.cancelAnimationFrame(P(this,ND)),R(this,ND,0),R(this,FD,void 0),this.player?.pause(),this.clearTaskInfo(),this.setProgress()}onError(t){nD("log",[...Ik,"error"],t),this.onFinish(!1,P(this,QD),P(this,tk),P(this,ek)),this.emit("error",t),this.dispose()}onFinish(t,e,i,r){nD("log",[...Ik,"finish"],t?"success":"failed"),this.emit("progress",1),this.emit("finish",t,e,i,r)}async loadHelper(t){const e="WebP"===t&&!P(this,UD),i=[uk.MP4,uk.APNG,uk.GIF,uk.AlphaMaskVideo].includes(t)&&!P(this,zD);e&&R(this,UD,await _D()),i&&(R(this,zD,await async function(t){try{const[{FFmpeg:e},{toBlobURL:i}]=await Promise.all([Promise.resolve().then(()=>(jt(),kt)).catch(t=>{const e=t instanceof Error?t.message:"Unknown error";throw new Error(`Failed to load @ffmpeg/ffmpeg: ${e}`)}),Promise.resolve().then(()=>(qt(),Xt)).catch(t=>{const e=t instanceof Error?t.message:"Unknown error";throw new Error(`Failed to load @ffmpeg/util: ${e}`)})]),{multiThreading:r}=t??{},n=new e,s=!!r,o={classWorkerURL:await i(yD.CLASSWORKER,"text/javascript"),coreURL:"",wasmURL:""};return s?(o.coreURL=await i(yD.MT.CORE,"text/javascript"),o.wasmURL=await i(yD.MT.WASM,"application/wasm"),o.workerURL=await i(yD.MT.WORKER,"text/javascript")):(o.coreURL=await i(yD.DEFAULT.CORE,"text/javascript"),o.wasmURL=await i(yD.DEFAULT.WASM,"application/wasm")),await n.load(o),n}catch(t){throw t instanceof Error?t:new Error(`Unknown error occurred while loading FFmpeg: ${String(t)}`)}}({multiThreading:P(this,LD).multiThreading})),Be(P(this,zD)),P(this,zD).on("log",({message:t})=>{if(P(this,LD).loggerInTranscoding&&nD("log",[...Ik,"transcoding log"],t),this.canceled||this.stage!==pk)return;const e=/frame=\s*(\d+)/.exec(t),i=e?.[1],r=Number(i);r>=P(this,$D)&&this.setProgress({currentTaskInTranscodingFrameIndex:r})}))}getAllTaskFrames(t){return t.reduce((t,e)=>{const{scene:i,fps:r}=e,n=i.compositions?.[0]?.duration??0;return t+Math.round(n*(r??30))},0)}setProgress(t){void 0!==t?.completedTaskPercentArray&&R(this,qD,t.completedTaskPercentArray),void 0!==t?.currentTaskFrameIndex&&R(this,KD,t.currentTaskFrameIndex),void 0!==t?.currentTaskTotalFrames&&R(this,ZD,t.currentTaskTotalFrames),void 0!==t?.currentTaskInTranscodingFrameIndex&&R(this,$D,t.currentTaskInTranscodingFrameIndex),void 0!==t?.allTaskFrames&&R(this,JD,t.allTaskFrames),this.emit("progress",this.progress)}forwardPlayerTime(t,e=!1){Be(this.player);const{oldTotalTime:i,startTime:r}=this.config;Be(i);const n=1e3*i-1e3*i%15;return t=Math.min(t,n/1e3),e?this.player.gotoAndPlay(t-r):this.player.gotoAndStop(t-r),t}getWavAudio(t){R(this,jD,new Sk),P(this,zD)?P(this,zD).writeFile(t,P(this,jD).getBuffer()):nD("log",[...Ik,"getWavAudio"],"ffmpegCore is not ready")}async getImagesZip(t,e){const i=new ak.default,r=i.folder(t);return Be(r),P(this,WD).forEach((t,i)=>{r.file(t,e[i])}),i.generateAsync({type:"arraybuffer"})}getWebP(){Be(P(this,UD));const t=Math.round(1e3/this.config.fps/1),e="out.webp",i=`${P(this,WD).join(` -d ${t} `)} -d ${t} -o ${e} -loop ${this.config.loop?0:1}`.split(" "),r=P(this,UD).cwrap("main","string",["number","number"]),[n,s]=function(t,e){const i=t._malloc(e.length*Uint32Array.BYTES_PER_ELEMENT);return e.forEach((e,r)=>{const n=t._malloc(e.length+1);t.writeAsciiToMemory(e,n),t.setValue(i+Uint32Array.BYTES_PER_ELEMENT*r,n,"i32")}),[e.length,i]}(P(this,UD),i);rD(n&&s,"getWebP has error"),r(n,s);const o=P(this,UD).FS.readFile(e);return P(this,WD).forEach(t=>{P(this,UD)?.FS.unlink(t)}),o}async getAPNG(){Be(P(this,zD));this.stage=pk;const t="export.apng",{fps:e,scale:i="-1:-1",quality:r="highest"}=this.apngConfig??{},n=[`scale=${i}:force_original_aspect_ratio=decrease:flags=lanczos`];e&&n.push(`fps=${e}`);if(0!==await P(this,zD).exec(["-framerate",`${this.config.fps}`,"-start_number","1","-i",`image-%4d.${this.transImageType}`,"-vf",n.join(","),"-plays",this.config.loop?"0":"1","-compression_level",Ek[r],"-y",t]))throw new Error("the command executed by ffmpeg to generate a apng failed.");return t}async getGIF(){Be(P(this,zD));this.stage=pk;const t="export.gif",{fps:e,scale:i="-1:-1",quality:r="highest"}=this.gifConfig??{},n=[`scale=${i}:${Tk[r]}`];e&&n.unshift(`fps=${e}`);if(0!==await P(this,zD).exec(["-framerate",`${this.config.fps}`,"-start_number","1","-i",`image-%4d.${this.transImageType}`,"-loop",this.config.loop?"0":"-1","-vf",n.join(","),"-y",t]))throw new Error("the command executed by ffmpeg to generate a gif failed.");return t}async getMP4(t,e){Be(P(this,zD));this.stage=pk;const i="export.mp4";let r;const n=e?",setpts=PTS/"+Math.round(t/e*100)/100:"",s=e??t,{isExportLastFrameJPEG:o}=this.mp4Config??{};this.config.audioEnable&&!P(this,jD)&&(R(this,HD,"audio.wav"),this.getWavAudio(P(this,HD)));if(0!==await P(this,zD).exec(["-framerate",String(this.config.fps),"-start_number",String(1),"-i",`image-%4d.${this.transImageType}`,"-c:v","libx264","-crf","23","-pix_fmt","yuv420p","-vf",`pad=ceil(iw/2)*2:ceil(ih/2)*2${n}`,"-y",i]))throw new Error("the command executed by ffmpeg to generate a mp4 failed.");if(P(this,HD)&&P(this,jD)){this.stage=mk,r="export-with-audio.mp4";if(0!==await P(this,zD).exec(["-i",i,"-i",P(this,HD),"-c:v","copy","-c:a","aac","-t",`${s}`,"-y",r]))throw new Error("the command executed by ffmpeg to generate a audio of video failed.")}const a=r??i;let h="";return o&&(h=`image-${bD(P(this,ZD),4)}.${this.transImageType}`),r&&P(this,zD).deleteFile(i).catch(()=>{nD("log",[...Ik,"ffmpeg delete file error"])}),{video:a,lastFrame:h}}async getAlphaMaskVideo(t,e){Be(P(this,zD));this.stage=pk;const i="export.mp4",r=e?",setpts=PTS/"+Math.round(t/e*100)/100:"";return await P(this,zD).exec(["-framerate",String(this.config.fps),"-start_number",String(1),"-i",`image-%4d.${this.transImageType}`,"-c:v","libx264","-crf","23","-pix_fmt","yuv420p","-vf",`pad=ceil(iw/2)*2:ceil(ih/2)*2${r}`,"-y",i]),i}async getVideoByType(t,e){Be(P(this,zD));const i=P(this,LD).mediaType===uk.APNG,r=P(this,LD).mediaType===uk.GIF,n=P(this,LD).mediaType===uk.AlphaMaskVideo,s=P(this,LD).mediaType===uk.MP4;let o="",a="";try{if(i&&(o=await this.getAPNG()),r&&(o=await this.getGIF()),s){const{video:i,lastFrame:r}=await this.getMP4(t,e);o=i,a=r}n&&(o=await this.getAlphaMaskVideo(t,e)),this.stage=dk}catch(t){throw nD("log",[...Ik,"getVideoByType","failed"],t),t}let h=null,l=null;try{Be(o);const t=await P(this,zD).readFile(o);if(h="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t),a){const t=await P(this,zD).readFile(a).catch(()=>{nD("log",[...Ik,"ffmpeg read extra file error"])});l="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}}finally{P(this,zD).deleteFile(o).catch(()=>{nD("log",[...Ik,"ffmpeg delete file error"])});for(const t of P(this,WD))t&&P(this,zD).deleteFile(t)}return{data:h,extra:l}}onRecordWebM(t){const e=new MediaRecorder(t.captureStream(this.config.fps),{mimeType:"video/webm;codecs=vp9"});R(this,VD,e),P(this,VD).start(0);const i=[];P(this,VD).ondataavailable=t=>{t.data.size>0&&i.push(t.data)},R(this,GD,i)}async onExportImageFrame(t){try{if(this.canceled)return;const{canvas:e,imageBuffers:i,startTime:r,oldTotalTime:n,newTotalTime:s}=t;Be(this.player),Be(P(this,BD));const o=P(this,KD)+1;this.stage=fk,this.setProgress({currentTaskInTranscodingFrameIndex:0,currentTaskFrameIndex:o}),P(this,LD).loggerInTranscoding&&nD("log",[...Ik,"converting log"],`converting ${o} frame image`),o>=1&&this.forwardPlayerTime(o/this.config.fps+r),xD(P(this,BD),e,this.config.backgroundColor);let a=e;P(this,LD).mediaType===uk.AlphaMaskVideo&&(Be(P(this,LD).extraCanvas),function(t,e){e.width=2*t.width,e.height=t.height;const i=t.getContext("2d");if(!i)throw new Error("inputCtx is null");const r=e.getContext("2d");if(!r)throw new Error("ctx is null");r.clearRect(0,0,e.width,e.height);const n=i.getImageData(0,0,t.width,t.height),s=i.getImageData(0,0,t.width,t.height),o=n.data;for(let t=0;t<o.length;t+=4){const e=Math.max(0,(o[t+3]??0)-5)/250*255;e<=0?(o[t]=0,o[t+1]=0,o[t+2]=0,o[t+3]=255):(o[t]=(o[t]??0)*e/255,o[t+1]=(o[t+1]??0)*e/255,o[t+2]=(o[t+2]??0)*e/255,o[t+3]=255)}r.putImageData(n,0,0);const a=s.data;for(let t=0;t<a.length;t+=4){const e=Math.max(0,(a[t+3]??0)-5)/250*255;a[t]=e,a[t+1]=e,a[t+2]=e,a[t+3]=255}r.putImageData(s,t.width,0)}(e,P(this,LD).extraCanvas),a=P(this,LD).extraCanvas);const h=await async function(t,e,i){return new Promise((r,n)=>{t.toBlob(t=>{t?r(t.arrayBuffer()):n("toBlob failed")},e,i)})}(a,`image/${this.transImageType}`,1),l=`image-${bD(o,4)}.${this.transImageType}`;P(this,LD).mediaType===uk.Images?i.push(h):P(this,LD).mediaType===uk.WebP?(Be(P(this,UD)),P(this,UD).FS.writeFile(l,new Uint8Array(h))):(Be(P(this,zD)),await P(this,zD).writeFile(l,new Uint8Array(h))),P(this,WD).push(l);if(o===P(this,ZD)){this.player?.pause(),await new Promise(t=>{window.requestAnimationFrame(t)});let t=null,e=null;if("Images"===P(this,LD).mediaType)t=await this.getImagesZip(this.config.name,i);else if("WebP"===P(this,LD).mediaType)t=this.getWebP();else if([uk.MP4,uk.APNG,uk.GIF,uk.AlphaMaskVideo].includes(P(this,LD).mediaType)){const{data:i,extra:r}=await this.getVideoByType(n,s)??null;t=i,e=r}t&&(nD("log",[...Ik,"done"],"success"),this.emit("done",P(this,YD),!0,t,e))}else R(this,ND,window.requestAnimationFrame(()=>{this.canceled||this.onExportImageFrame({canvas:e,imageBuffers:i,startTime:r,oldTotalTime:n,newTotalTime:s})}))}catch(t){nD("log",[...Ik,"onExportImageFrame","failed"],t),this.emit("done",P(this,YD),!1,void 0,void 0)}}async onExportWebMFrame(t){try{if(this.canceled)return;Be(this.player),Be(P(this,BD));const e=P(this,KD)+1;if(this.stage=fk,this.setProgress({currentTaskInTranscodingFrameIndex:0,currentTaskFrameIndex:e}),P(this,LD).loggerInTranscoding&&nD("log",[...Ik,"converting log"],`converting ${e} frame image`),xD(P(this,BD),t,this.config.backgroundColor),1===e&&(this.player.play(),this.onRecordWebM(t)),e<P(this,ZD))R(this,ND,window.requestAnimationFrame(()=>{this.canceled||this.onExportWebMFrame(t)}));else{this.player?.pause(),P(this,VD)?.stop();const t=new Blob(P(this,GD),{type:"video/webm"}),e=await t.arrayBuffer();nD("log",[...Ik,"done"],"success"),this.emit("done",P(this,YD),!0,e,void 0)}}catch(t){nD("log",[...Ik,"done"],"failed",t),this.emit("done",P(this,YD),!1,void 0,void 0)}}async runTask(t){try{if(this.canceled)return;Be(this.player),Be(P(this,BD));const{size:e,startTime:i,containerCanvas:r}=t,{oldTotalTime:n,newTotalTime:s}=this.config,[o,a]=e;if(P(this,BD).width=o,P(this,BD).height=a,r.width=o,r.height=a,this.player.resize(),R(this,WD,[]),[uk.MP4,uk.APNG,uk.Images,uk.WebP,uk.GIF,uk.AlphaMaskVideo].includes(P(this,LD).mediaType)){const t={canvas:r,imageBuffers:[],startTime:i,oldTotalTime:n,newTotalTime:s};await this.onExportImageFrame(t)}else"WebM"===P(this,LD).mediaType&&await this.onExportWebMFrame(r)}catch(t){nD("log",[...Ik,"run task error"],t),this.emit("done",P(this,YD),!1,void 0,void 0)}}clearTaskInfo(){R(this,XD,0),R(this,YD,void 0),R(this,qD,[]),R(this,KD,0),R(this,ZD,0),R(this,JD,0),R(this,$D,0),R(this,QD,[]),R(this,tk,[]),R(this,ek,[]),R(this,ik,!0)}clearFFMpegCore(){if(P(this,zD)){for(const t of P(this,WD))t&&P(this,zD).deleteFile(t);R(this,WD,[]),P(this,zD).terminate(),R(this,zD,void 0)}}clearImage2WebPCore(){P(this,UD)&&(P(this,UD).FS.quit(),R(this,UD,void 0))}clearMediaRecorder(){P(this,VD)&&(P(this,VD).stop(),R(this,VD,void 0)),R(this,GD,[])}clearAllListeners(){for(const t of this.getListeners("ready"))this.off("ready",t);for(const t of this.getListeners("progress"))this.off("progress",t);for(const t of this.getListeners("done"))this.off("done",t);for(const t of this.getListeners("finish"))this.off("finish",t);for(const t of this.getListeners("error"))this.off("error",t)}onCancel(){this.canceled||(this.onFinish(!1,P(this,QD),P(this,tk),P(this,ek)),this.status=ck,this.onReset(),this.clearMediaRecorder(),this.clearFFMpegCore(),this.clearImage2WebPCore(),this.clearAllListeners(),nD("log",Ik,"canceled"))}async onExport(t){const e=t.length;try{if(this.status===hk)return nD("log",[...Ik],"readying"),void this.on("ready",()=>{this.onExport(t)});if(this.status===ck){if(await this.onInit()===ck)throw new Error("init environment failed")}if(this.clearTaskInfo(),!P(this,BD)){const t=document.createElement("canvas");t.dataset.key="player-canvas",R(this,BD,t)}this.player||(this.player=new km({canvas:P(this,BD),pixelRatio:2,transparentBackground:!0,env:"editor",renderOptions:{willCaptureImage:!0}}),this.player.on("rendererror",t=>{this.onError(t)}),this.player.on("webglcontextlost",t=>{this.onError(t)}));let e=null;e??(e=document.querySelector('canvas[data-key="container-canvas"]')),e??(e=document.createElement("canvas")),e.dataset.key="container-canvas",e.style.display="none",this.setProgress({allTaskFrames:this.getAllTaskFrames(t)});const i=[],r=[],n=[];let s=!0;for(const[o,a]of t.entries()){if(this.canceled){s=!1;break}R(this,XD,o),R(this,YD,a);const{size:t,scene:h}=a;await new Promise(async l=>{try{if(!this.player)throw new Error("player not found");nD("log",[...Ik,"export"],"start",a),wD(this.player);const c=JSON.parse(JSON.stringify(h));await this.player.loadScene(c,{env:"editor",autoplay:!1});const u=this.config.oldTotalTime,d=0;this.player.pause(),this.setProgress({currentTaskFrameIndex:0,currentTaskTotalFrames:Math.round(u*this.config.fps)});const f=(t,e,h,c)=>{this.off("done",f),i[o]=a,e&&h?(r[o]=h,n[o]=c??null):s=!1,l()};this.on("done",f);const p={size:t,startTime:d,containerCanvas:e};await this.runTask(p)}catch(t){nD("log",[...Ik,"export error"],t),s=!1,l()}})}R(this,QD,i),R(this,tk,r),R(this,ek,n),R(this,ik,s)}catch(t){this.onError(t),R(this,ik,!1)}e>=1&&P(this,ik)?this.onFinish(!0,P(this,QD),P(this,tk),P(this,ek)):this.onFinish(!1,P(this,QD),P(this,tk),P(this,ek))}dispose(){this.status=ck,this.onReset(),this.clearMediaRecorder(),this.clearFFMpegCore(),this.clearImage2WebPCore(),this.clearAllListeners(),this.player?.dispose(),this.player=void 0,P(this,BD)?.remove(),R(this,BD,void 0),R(this,HD,void 0),R(this,jD,void 0)}};LD=new WeakMap,FD=new WeakMap,ND=new WeakMap,BD=new WeakMap,zD=new WeakMap,UD=new WeakMap,VD=new WeakMap,GD=new WeakMap,jD=new WeakMap,HD=new WeakMap,WD=new WeakMap,XD=new WeakMap,YD=new WeakMap,qD=new WeakMap,KD=new WeakMap,ZD=new WeakMap,JD=new WeakMap,$D=new WeakMap,QD=new WeakMap,tk=new WeakMap,ek=new WeakMap,ik=new WeakMap;var Ck={[uk.MP4]:{suffix:"mp4",error:"export mp4 is error"},[uk.GIF]:{suffix:"gif",error:"export gif is error"},[uk.Images]:{suffix:"zip",error:"export Images is error"},[uk.APNG]:{suffix:"apng",error:"export APNG is error"},[uk.WebP]:{suffix:"webp",error:"export WebP is error"},[uk.AlphaMaskVideo]:{suffix:"mp4",error:"export AlphaMaskVideo is error"},[uk.WebM]:{suffix:"webm",error:"export WebM is error"}},Pk=class extends Qo{constructor(t){super(),A(this,"_options"),A(this,"_status",xk),A(this,"_exportMedia"),this._options=t,this._exportMedia=new Ak(t)}get status(){return this._status}setOptions(t){const e=ZI({},this._options,t);this._options=e,this._exportMedia.setOptions(e)}downloadByMediaBuffers(t,e,i){const{suffix:r,error:n}=Ck[this._options.mediaType];if(!e?.length||!r)return void nD("info",["@vvfx/sdk","downloadByMediaBuffers is error","buffers or suffix is empty"]);const s=t[0]?.folderName,o=new ok.default;e.forEach((e,n)=>{if(!e)return;const{name:s}=t[n]??{};s&&(o.file(`${s}.${r}`,e),i?.[n]?.byteLength&&o.file(`${s}.jpeg`,i[n]))}),o.generateAsync({type:"blob"}).then(t=>{!function(t,e,i="application/octet-stream"){const r=new Blob(Array.isArray(t)?t:[t],{type:i}),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)}(t,`${s}.zip`,"application/zip")}).catch(t=>{nD("error",["@vvfx/sdk"],n??"export media is error",t)})}onExportProgress(t){this.emit("progress",t)}onExportDone(t,e,i,r){this.emit("done",t,e,i,r)}onExportError(t){this._status=wk,nD("error",["@vvfx/sdk"],"export is error",t)}onExport(t){this._status=bk,this._exportMedia.onExport(t),this._exportMedia.on("progress",this.onExportProgress.bind(this)),this._exportMedia.on("done",this.onExportDone.bind(this)),this._exportMedia.once("finish",(e,i,r,n)=>{this._status=e?_k:wk,this.emit("complete",e,i,r,n),!this._options.isOutputBuffer&&r&&0!==r.length&&this.downloadByMediaBuffers(t,r,n)}),this._exportMedia.on("error",this.onExportError.bind(this))}onCancel(){this._status=wk,this._exportMedia.onCancel(),this.emit("complete",!1,[],[],[])}dispose(){this._exportMedia.dispose()}},Mk=class{constructor(){A(this,"enabled",!0),A(this,"_player"),A(this,"_container"),this._container=document.createElement("canvas"),this._player=new km({canvas:this._container,manualRender:!0,pixelRatio:2,env:"editor",renderOptions:{willCaptureImage:!0}})}async generate(t,e,i,r,n){if(!Lk.config.screenShotConfig.enabled)return void console.warn("Screen shot is not opened, use #SDK.setConfig() open this feature.");wD(this._player);const[s,o]=e;this._container.width=s,this._container.height=o,this._player.resize();const a=JSON.parse(JSON.stringify(t));await this._player.loadScene(a),this._player.gotoAndStop(r);const[h,l]=i,c=document.createElement("canvas");c.width=h,c.height=l;const u=c.getContext("2d");n??(n=Lk.config.screenShotConfig.defaultBackgroundColor),u&&(u.fillStyle=`rgba(${n.join(",")})`,u.fillRect(0,0,h,l),this.drawImageCover(u,this._player.canvas,0,0,h,l,.5,.5));const d=c.toDataURL("image/png");return wD(this._player),d}dispose(){this._player.dispose()}drawImageCover(t,e,i,r,n,s,o,a,h){2===arguments.length&&(i=r=0,n=t.canvas.width,s=t.canvas.height),o="number"==typeof o?Nw(o,0,1):.5,a="number"==typeof a?Nw(a,0,1):.5,h??(h={left:0,top:0,width:e instanceof HTMLVideoElement?e.videoWidth:e.width,height:e instanceof HTMLVideoElement?e.videoHeight:e.height});const l=h.width,c=h.height,u=Math.min(n/l,s/c);let d=l*u,f=c*u,p=1;d<n&&(p=n/d),Math.abs(p-1)<1e-14&&f<s&&(p=s/f),d*=p,f*=p;const m=Math.max(l/(d/n),0),g=Math.max(c/(f/s),0),v=Math.min((l-m)*o,l),y=Math.min((c-g)*a,c);t.drawImage(e,v+h.left,y+h.top,m,g,i,r,n,s)}},Rk={topAdsorption:"T",leftAdsorption:"L",rightAdsorption:"R",bottomAdsorption:"B",centerAdsorption:"C",bottomCenterAdsorption:"BC"},Ok=class{constructor(){A(this,"_player"),A(this,"_container"),A(this,"size",[0,0]),this._container=document.createElement("canvas"),this._player=new km({canvas:this._container,manualRender:!0})}async adjustment(t,e,i,r,n,s){if(!Lk.config.sizeAdaptConfig.enabled)return console.warn("Size adapt is not opened, use #SDK.setConfig() open this feature."),t;this._player??(this._player=new km({canvas:this._container,manualRender:!0})),n??(n=[0,0,0,0]),s??(s=i[0]<i[1]?"y":"x"),this.size=[...r],this._container.width=this.size[0],this._container.height=this.size[1],wD(this._player),this._player.resize();const o=JSON.parse(JSON.stringify(t));await this._player.loadScene(o,{reusable:!0,autoplay:!1}),this._player.gotoAndStop(e);const a=this._player.getCompositions()[0];if(a){const[e,o]=r,h=i[0]/i[1],l=e/o;h>l&&this.keepDistribute(t,a,l/h,r);const[c,u,d,f]=n,p=e-d-f,m=o-c-u,g=[(d-f)/2,(c-u)/2],v=(new Kw).setFromCenterAndSize(new Lw(e,o).divide(2),new Lw(e,o)),y=(new Kw).setFromCenterAndSize(new Lw(e,o).divide(2).add(new Lw(...g)),new Lw(p,m));this.keepAdsorption("topAdsorption",t,a,g,v,y,s),this.keepAdsorption("bottomAdsorption",t,a,g,v,y,s),this.keepAdsorption("leftAdsorption",t,a,g,v,y,s),this.keepAdsorption("rightAdsorption",t,a,g,v,y,s),this.keepAdsorption("centerAdsorption",t,a,g,v,y,s),this.keepDoubleAdsorption("bottomCenterAdsorption",t,a,g,v,y,s)}return t}keepDistribute(t,e,i,r){const n=t=>{const i=(new Qw).copyFrom(e.camera.getViewProjectionMatrix());return(new Lw).copyFrom(t.applyMatrix(i).toVector2()).toViewCoordinate(r[0],r[1])};["topAdsorption","centerAdsorption","bottomAdsorption"].forEach(s=>{e.items.filter(t=>t.name.split("-")[0]?.toLocaleUpperCase()===Rk[s]&&!t.parentId).forEach(s=>{const o=e.items.filter(t=>t.parentId===s.getInstanceId()),a=o.find(t=>"check-area"===t.name),h=a?this.getViewBoxByHeadlessPlayerItem(a,[],n):this.getViewBoxByHeadlessPlayerItem(s,o,n),l=s.transform.position.clone(),c=h.getCenter(),u=new Lw(...r.map(t=>t/2)),d=c.y-u.y;((t,i,n)=>{const{z:s}=t.transform.getWorldPosition(),{x:o,y:a}=e.camera.getInverseVPRatio(s);t.transform.translate(2*i*o/r[0],-2*n*a/r[1],0)})(s,0,d/i-d),s.transform.updateLocalMatrix();const f=s.transform.position.clone().subtract(l).toArray();this.transformSceneItem(t,s.getInstanceId(),"position",f)})})}keepAdsorption(t,e,i,r,n,s,o){const{x:a,y:h}=n.getSize(),l=(t,e,r)=>{const{z:n}=t.transform.getWorldPosition(),{x:s,y:o}=i.camera.getInverseVPRatio(n);t.transform.translate(2*e*s/a,-2*r*o/h,0)},c=t=>{const e=(new Qw).copyFrom(i.camera.getViewProjectionMatrix());return(new Lw).copyFrom(t.applyMatrix(e).toVector2()).toViewCoordinate(a,h)},u=Rk[t];i.items.filter(t=>t.name.split("-")[0]?.toLocaleUpperCase()===u&&!t.parentId).forEach(n=>{const a=i.items.filter(t=>t.parentId===n.getInstanceId()),h=a.find(t=>"check-area"===t.name),u=n.transform.position.clone(),d=["leftAdsorption","rightAdsorption"].includes(t)?"x":"y",f=["leftAdsorption","topAdsorption"].includes(t)?1:-1,p=["leftAdsorption","topAdsorption"].includes(t)?"min":"max",m=["leftAdsorption","topAdsorption"].includes(t)?"max":"min",g=3===n.name.split("-").length,v=Number(n.name.split("-")[1]),y=new Lw,x=[1,1],b=h?this.getViewBoxByHeadlessPlayerItem(h,[],c):this.getViewBoxByHeadlessPlayerItem(n,a,c);l(n,...r);const _="y"===o?"x":"y";b.getSize()[_]>s.getSize()[_]&&(x[0]=s.getSize()[_]/b.getSize()[_],x[1]=s.getSize()[_]/b.getSize()[_],n.scale(...x,1)),n.transform.updateLocalMatrix();const w=h?this.getViewBoxByHeadlessPlayerItem(h,[],c):this.getViewBoxByHeadlessPlayerItem(n,a,c),T=new Lw;if(!s.containsBox(w)){const{min:t,max:e}=w,{min:i,max:r}=s;T.x+=t.x<i.x?i.x-t.x:0,T.x+=e.x>r.x?r.x-e.x:0,T.y+=t.y<i.y?i.y-t.y:0,T.y+=e.y>r.y?r.y-e.y:0,l(n,...T.toArray()),n.transform.updateLocalMatrix()}const E=h?this.getViewBoxByHeadlessPlayerItem(h,[],c):this.getViewBoxByHeadlessPlayerItem(n,a,c);if(!Number.isNaN(v)&&g)if("centerAdsorption"!==t){const t=Math.abs(E[m][d]-s[p][d]),e=s.getSize()[d]*v;t>e&&(y[d]=(e-t)*f,l(n,...y.toArray()),n.transform.updateLocalMatrix())}else{const t=E.getSize()[o],e=s.getSize()[o];if(t/e>v){const i=e*v/t;n.scale(i,i,1),x[0]*=i,x[1]*=i}}const S=h?this.getViewBoxByHeadlessPlayerItem(h,[],c):this.getViewBoxByHeadlessPlayerItem(n,a,c),I=i.items.filter(t=>"T"===t.name.split("-")[0]?.toLocaleUpperCase()&&!t.parentId),A=new Kw;if(I.forEach(t=>{const e=i.items.filter(e=>e.parentId===t.getInstanceId()),r=e.find(t=>"check-area"===t.name),n=r?this.getViewBoxByHeadlessPlayerItem(r,[],c):this.getViewBoxByHeadlessPlayerItem(t,e,c);A.union(n)}),!A.isEmpty()&&A.max.y>S.min.y)if("centerAdsorption"===t){const t=A.max.y-S.min.y;l(n,0,t),n.transform.updateLocalMatrix()}else if(["leftAdsorption","rightAdsorption"].includes(t)){const t=S.getSize().y,e=s.getSize().y-(A.max.y-s.min.y);let i=A.max.y-S.min.y;if(t>e){const r=e/t;x[0]*=r,x[1]*=r,n.scale(r,r,1),n.transform.updateLocalMatrix(),i-=(t-e)/2}l(n,0,i),n.transform.updateLocalMatrix()}const C=n.transform.position.clone().subtract(u).toArray();this.transformSceneItem(e,n.getInstanceId(),"position",C),this.transformSceneItem(e,n.getInstanceId(),"scale",x)})}keepDoubleAdsorption(t,e,i,r,n,s,o){const{x:a,y:h}=n.getSize(),l=(t,e,r)=>{const{z:n}=t.transform.getWorldPosition(),{x:s,y:o}=i.camera.getInverseVPRatio(n);t.transform.translate(2*e*s/a,-2*r*o/h,0)},c=t=>{const e=(new Qw).copyFrom(i.camera.getViewProjectionMatrix());return(new Lw).copyFrom(t.applyMatrix(e).toVector2()).toViewCoordinate(a,h)},u=Rk[t];i.items.filter(t=>t.name.split("-")[0]?.toLocaleUpperCase()===u&&!t.parentId).forEach(t=>{const n=i.items.filter(e=>e.parentId===t.getInstanceId()),a=n.find(t=>"check-area"===t.name),h=t.transform.position.clone(),u=3===t.name.split("-").length,d=Number(t.name.split("-")[1]),f=[1,1],p=a?this.getViewBoxByHeadlessPlayerItem(a,[],c):this.getViewBoxByHeadlessPlayerItem(t,n,c);l(t,...r);const m="y"===o?"x":"y";p.getSize()[m]>s.getSize()[m]&&(f[0]=s.getSize()[m]/p.getSize()[m],f[1]=s.getSize()[m]/p.getSize()[m],t.scale(...f,1)),t.transform.updateLocalMatrix();const g=a?this.getViewBoxByHeadlessPlayerItem(a,[],c):this.getViewBoxByHeadlessPlayerItem(t,n,c);if(!Number.isNaN(d)&&u){const e=g.getSize()[m],i=s.getSize()[m];if(e/i>d){const r=i*d/e;t.scale(r,r,1),f[0]*=r,f[1]*=r}}const v=a?this.getViewBoxByHeadlessPlayerItem(a,[],c):this.getViewBoxByHeadlessPlayerItem(t,n,c),y=new Lw;if(!s.containsBox(v)){const{min:e,max:i}=v,{min:r,max:n}=s;y.x+=e.x<r.x?r.x-e.x:0,y.x+=i.x>n.x?n.x-i.x:0,y.y+=e.y<r.y?r.y-e.y:0,y.y+=i.y>n.y?n.y-i.y:0,l(t,...y.toArray()),t.transform.updateLocalMatrix()}const x=t.transform.position.clone().subtract(h).toArray();this.transformSceneItem(e,t.getInstanceId(),"position",x),this.transformSceneItem(e,t.getInstanceId(),"scale",f)})}getViewBoxByHeadlessPlayerItem(t,e,i){const r=new Kw,{transform:n,composition:s}=t;switch(t.type){case en.ItemType.sprite:case en.ItemType.plugin:case en.ItemType.video:case en.ItemType.richtext:case en.ItemType.text:case en.ItemType.shape:{n.setValid(!0),n.updateLocalMatrix();const{size:t}=n,o=(new Qw).copyFrom(s?.transform.getWorldMatrix()??new Qw).invert().multiply(n.getWorldMatrix()),{x:a,y:h}=t.clone().divide(2),l=new $w(a,h,0).applyMatrix(o),c=new $w(a,-h,0).applyMatrix(o),u=new $w(-a,-h,0).applyMatrix(o),d=new $w(-a,h,0).applyMatrix(o),f=i(l).round(2),p=i(c).round(2),m=i(u).round(2),g=i(d).round(2);r.setFromVec2Array([f,p,m,g]);const v=e?.map(t=>{const e=s?.items.filter(e=>e.parentId===t.getInstanceId())??[];return this.getViewBoxByHeadlessPlayerItem(t,e,i)});v&&v.map(t=>r.union(t));break}case en.ItemType.null:{const t=e?.map(t=>{const e=s?.items.filter(e=>e.parentId===t.getInstanceId())??[];return this.getViewBoxByHeadlessPlayerItem(t,e,i)});t&&t.map(t=>r.union(t));break}}return r}transformSceneItem(t,e,i,r){const n=t.items.find(t=>t.id===e);switch(i){case"position":{const t=r;Array.isArray(r)&&3===t.length&&n?.transform&&(n.transform.position.x+=t[0],n.transform.position.y+=t[1],n.transform.position.z+=t[2]);break}case"rotation":if(Array.isArray(r)&&3===r.length){const t=r;n?.transform&&(n.transform.eulerHint.x+=t[0],n.transform.eulerHint.y+=t[1],n.transform.eulerHint.z+=t[2])}break;case"size":Array.isArray(r)&&2===r.length&&n?.transform&&(n.transform.scale.x*=r[0],n.transform.scale.y*=r[1])}}dispose(){this._player?.dispose()}},Dk=class t{constructor(e,i="template"){A(this,"_eventEmitter",new Qo),A(this,"_pageData"),A(this,"_screenShot"),A(this,"_exporter"),A(this,"_pageDataUtils"),A(this,"_sizeAdapt"),A(this,"_gestureHandler"),A(this,"disposables",[]),A(this,"_isSwitchScene",!1),A(this,"_undoRedo",new eD),A(this,"player"),A(this,"_container"),A(this,"_playerContainer"),A(this,"on",this._eventEmitter.on),this._container=e,t.config.mode=i,this.initPlayer(i),this._eventEmitter.on("pageDataChange",t=>{this._pageData=t,this._gestureHandler.render()}),this._eventEmitter.on("preSelectedItemChange",t=>{Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData.preSelectedItem=t,this._gestureHandler.render()}),this._eventEmitter.on("selectedViewChange",t=>{Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData.view=t;const e=this.getViewProperty(t);this._gestureHandler.ignoreInteraction=!!e?.ignoreInteraction}),this._eventEmitter.on("sdkConfigChange",(t,e)=>{this.setExportConfig(e.exportConfig)}),this._eventEmitter.on("itemCreate",()=>{this._gestureHandler.closeItemCreateGizmo()}),this._pageDataUtils=new sk(this.player,this._playerContainer,this._eventEmitter,this),this._gestureHandler=new mD(e),this._screenShot=new Mk,this._sizeAdapt=new Ok;const r=new ResizeObserver(()=>{if(!this._pageData)return;const i=[e.offsetWidth,e.offsetHeight],r=this.getViewProperty(this._pageData.activeData.view??0);if(r){if("template"===t.config.mode){const{size:t}=r,[e,n]=this._pageDataUtils.getPlayerSizeByParent(i,t);this._playerContainer.style.width=`${e}px`,this._playerContainer.style.height=`${n}px`,this.player.resize()}this._pageDataUtils.refreshInteractionParam(),this._gestureHandler.resize()}});r.observe(e),this.disposables.push(()=>{r.disconnect()})}get container(){return this._container}get pageData(){return this._pageData}get initExporterEnabled(){return"template"===t.config.mode&&t.config.exportConfig.enabled}get exportStatus(){return this?._exporter?.status}get undoRedo(){return this._undoRedo}get exportOptions(){if(!this.pageData)return[];const t=this.pageData.viewProperties.filter(t=>!t.ignoreInteraction),e=t[0]?.scene?.compositions?.[0]?.name??"videos",i=[];return t.map((t,r)=>{const{size:n,scene:s,export:{name:o,...a}}=t,h=n?.[0]&&n?.[1]?` (${r+1})_${n[0]}×${n[1]}`:` (${r+1})`;let l="";return l=o?function(t,e){if(!e.includes(t))return t;let i=1,r=`${t} (${i})`;for(;e.includes(r);)i++,r=`${t} (${i})`;return r}(o,i):`${e}${h}`,i.push(l),{folderName:e,name:l,size:n,scene:JSON.parse(JSON.stringify(s)),...a}})}dispose(){this.player?.dispose(),this._screenShot?.dispose(),this._pageData=void 0,this._playerContainer.remove(),this?._exporter?.dispose(),this._screenShot.dispose(),this._gestureHandler.dispose(),this.disposables.forEach(t=>{t()})}initPlayer(e){const i=document.createElement("div"),[r,n]="editor"===e?[this._container.clientWidth,this._container.clientHeight]:[this._container.offsetWidth,this._container.offsetHeight];this._playerContainer=i,this._playerContainer.id="player-container",this._playerContainer.style.position="absolute",this._playerContainer.style.backgroundRepeat="no-repeat",this._playerContainer.style.backgroundPosition="center center",this._playerContainer.style.width=`${r}px`,this._playerContainer.style.height=`${n}px`,this._container.appendChild(i),this.player=new km({container:this._playerContainer,pixelRatio:2,interactive:!0,env:"editor"}),this.player.on("update",()=>{if(Be(this._pageData,"You must call SDK#run() first"),this._isSwitchScene)return;const t=this.player.getCompositions()[0]?.time;if(this._pageData.playing)if(void 0!==t)this._pageData.time===t&&this.player.pause(),this._pageData.time=t,this._pageDataUtils.refreshPageTime(t);else{this._pageData.playing=!1,this.setPlayProgress(100);const t=this.getViewProperty(this._pageData.activeData.view??0)?.scene,e=t?.compositions.find(e=>e.id===t.compositionId);this._pageData.time=e?.duration??2,this._pageDataUtils.refreshPageTime(this._pageData.time)}this._eventEmitter.emit("progress",{duration:this.player.getCompositions()[0]?.getDuration()??2,time:this._pageData.time,end:this.player.getCompositions()[0]?.isDestroyed??!1,paused:!this._pageData.playing})}),this.player.on("rendererror",t=>{console.error("player render error ",t)}),this.player.on("webglcontextlost",()=>{this._eventEmitter.emit("viewLost");const e=this.player?.canvas;e&&e.parentElement?.removeChild(e),this.player.pause(),this.player.dispose(),this._gestureHandler.dispose(),setTimeout(async()=>{this.initPlayer(t.config.mode),this._pageDataUtils=new sk(this.player,this._playerContainer,this._eventEmitter,this),this._gestureHandler=new mD(this._container),await this.runByPageData(this.pageData),this._eventEmitter.emit("viewRebuildFinish")},300)})}setSDKMode(e){if(e===t.config.mode)return;t.config.mode=e;const[i,r]="template"===e?[this._container.offsetWidth,this._container.offsetHeight]:[document.documentElement.clientWidth,document.documentElement.clientHeight];if(!this._playerContainer){const t=document.createElement("div");this._container.appendChild(t),this._playerContainer=t,this._playerContainer.id="player-container",this._playerContainer.style.position="absolute",this._playerContainer.style.backgroundRepeat="no-repeat",this._playerContainer.style.backgroundPosition="center center"}"editor"===e&&(this._playerContainer.style.left="0px",this._playerContainer.style.top="0px"),this._playerContainer.style.width=`${i}px`,this._playerContainer.style.height=`${r}px`,this.player??(this.player=new km({container:this._playerContainer,interactive:!0,pixelRatio:2,env:"editor"})),this.player.resize()}async getInitParam(t){const e=JSON.parse(JSON.stringify(t));if("editor"===e.mode){const t=[this._playerContainer.offsetWidth,this._playerContainer.offsetHeight];return{scene:TD(t),viewParams:[{size:t,export:{audioEnable:!1}}],options:{asyncMode:!1,safeAreaPreview:!1,adsorption:!0}}}{if("string"==typeof e.scene)try{const t=await fetch(e.scene,{mode:"cors",credentials:"omit",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}, statusText: ${t.statusText}`);const i=await t.json(),r=i.compositions.find(t=>t.id===i.compositionId)??i.compositions[0],n=e.viewParams?.length?e.viewParams:[{size:r.previewSize??[750,1624],export:{audioEnable:!1}}];return{...e,scene:i,viewParams:n}}catch(t){throw new Error(`Failed to fetch scene data from ${e.scene}: ${t instanceof Error?t.message:String(t)}`)}const t=e.scene.compositions.find(t=>t.id===e.scene.compositionId)??e.scene.compositions[0],i=e.viewParams?.length?e.viewParams:[{size:t.previewSize??[750,1624],export:{audioEnable:!1}}];return{...e,scene:e.scene,viewParams:i}}}initExporter(t){this.initExporterEnabled&&(this._exporter=new Pk(t),this._exporter.on("progress",t=>{this._eventEmitter.emit("exportProgress",t)}),this._exporter.on("done",(t,e,i)=>{this._eventEmitter.emit("exportDone",t,e,i)}),this._exporter.on("complete",(t,e,i,r)=>{this._eventEmitter.emit("exportComplete",t,e,i,r)}))}async initSDK(e){var i;const{scene:r,viewParams:n,options:s}=e,o=[];if(t.config.pageConfig.staticPreview){const t=JSON.parse(JSON.stringify(r)),e=t.compositions.find(e=>e.id===t.compositionId)??t.compositions[0];if(e){const[i,r]=e.previewSize??[1080,1920],n=e.duration??0;o.push({size:[i,r],safeArea:[0,0,0,0],previewSafeAreas:[],id:0,scene:t,ignoreInteraction:!0,export:{time:n,audioEnable:!1}})}}for(let e=0;e<n.length;e++){const s=n[e];if(!s)continue;let a=JSON.parse(JSON.stringify(r));const h=a.compositions.find(t=>t.id===a.compositionId)??a.compositions[0];Be(h);const l=h.previewSize??[750,1624],c=l,u=s.size??l;h.previewSize=u;const d=h.duration??0,f=s.safeArea??[0,0,0,0];t.config.sizeAdaptConfig.enabled&&(a=await this._sizeAdapt.adjustment(a,d,c,u,f,s.adaptionDirection)),(i=s.export).time??(i.time=d),o.push({...s,size:u,safeArea:f,previewSafeAreas:[...s.previewSafeAreas??[]],id:e+1,scene:a,ignoreInteraction:!1})}const a=o[0]?.scene;if(!a)return void console.warn("SDK need one view property at least.");const h=a.compositions.find(t=>t.id===a.compositionId)??a.compositions[0],l={...s,zoom:1,translation:[0,0],asyncMode:s.asyncMode??!1},c=(h?.duration??0)-.1,u=t.config.pageConfig.staticPreview?1:0;this._pageData={scene:JSON.parse(JSON.stringify(r)),time:c,property:l,activeData:{view:o[u].id,selectedItems:[]},items:[],viewProperties:o,playing:!1},this._pageDataUtils.init(),await this._gestureHandler.init(this._pageDataUtils,this._eventEmitter),this._gestureHandler.ignoreInteraction=!!o[1]?.ignoreInteraction,t.config.gestureHandlerConfig.preferenceGizmoConfig.safeAreaEnabled=l.safeAreaPreview,this._eventEmitter.emit("progress",{duration:c,time:c,end:this.player.getCompositions()[0]?.isDestroyed??!1,paused:!this._pageData.playing}),await this._pageDataUtils.loadScene(this._pageData.activeData.view),this._pageDataUtils.refreshPageTime(c)}async run(e){this.setSDKMode(e.mode),t.config.pageConfig.staticPreview="template"===e.mode&&t.config.pageConfig.staticPreview;const i=await this.getInitParam(e);await this.initSDK(i),this._eventEmitter.emit("pageDataChange",this.pageData),this.initExporter(t.config.exportConfig)}getActiveItems(){return Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData.selectedItems}setPreSelectedItem(t){Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData.preSelectedItem=t}getPreSelectedItem(){return Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData.preSelectedItem??""}setSelectedItems(t){this._pageDataUtils.clearPreSelectedItem(),this._pageDataUtils.clearSelectedItems(),this._pageDataUtils.addSelectedItems([...t])}async setItemProperty(t){Be(this._pageData,"You must call SDK#run() first");const e=this.getViewProperty(this._pageData.activeData.view??0)?.ignoreInteraction;e?console.warn("Static scene cannot change."):(await this._pageDataUtils.setItemProperty(t),this._gestureHandler.render(),this._eventEmitter.emit("pageDataChange",this.pageData))}async generateScreenShot(t,e=[300,400],i,r){Be(this._pageData,"You must call SDK#run() first");const n=this.getViewProperty(t);if(!n)return"";const{scene:s,size:[o,a]}=n,h=s.compositionId,l=s.compositions.find(t=>t.id===h);i??(i=l?.duration??0);const c=JSON.parse(JSON.stringify(s));return await this._screenShot.generate(c,[o,a],e,i,r)}async switchScene(t){if(Be(this._pageData,"You must call SDK#run() first"),t===this._pageData.activeData.view)return;this._isSwitchScene=!0;const e=this._pageData.viewProperties[t];if(e){const t=this._pageData.playing;this._pageData.activeData={view:e.id,selectedItems:[],preSelectedItem:void 0},await this._pageDataUtils.loadScene(e.id),t&&(this._pageData.playing=t,this.player.gotoAndPlay(this._pageData.time))}else console.warn("target scene does not exist.");this._eventEmitter.emit("selectedViewChange",t),this._eventEmitter.emit("pageDataChange",this.pageData),this._isSwitchScene=!1}getPageConfig(){return Be(this._pageData,"You must call SDK#run() first"),{safeAreaPreview:this._pageData.property.safeAreaPreview,zoom:this._pageData.property.zoom,adsorption:this._pageData.property.adsorption,asyncMode:this._pageData.property.asyncMode,translation:this._pageData.property.translation}}setPageConfig(e){Be(this._pageData,"You must call SDK#run() first");const{adsorption:i,safeAreaPreview:r,zoom:n}=this._pageData.property;this._pageData.property={...this._pageData.property,...e},this._pageData.property.zoom!==n&&this._pageDataUtils.setPageZoom(this._pageData.property.zoom),i!==e.adsorption&&(t.config.gestureHandlerConfig.adsorptionGizmoEnabled=e.adsorption),r!==e.safeAreaPreview&&(t.config.gestureHandlerConfig.preferenceGizmoConfig.safeAreaEnabled=e.safeAreaPreview),this._gestureHandler.render()}async setPlayProgress(t){Be(this._pageData,"You must call SDK#run() first");const e=(this.player.getCompositions()[0]?.getDuration()??2)*t/100;this._pageData.time=e;!this.player.getCompositions().length&&(wD(this.player),await this._pageDataUtils.loadScene(this._pageData.activeData.view??0));this._pageData.playing?this.player.gotoAndPlay(e):(this.player.gotoAndStop(e),this._eventEmitter.emit("progress",{duration:this.player.getCompositions()[0]?.getDuration()??2,time:e,end:this.player.getCompositions()[0]?.isDestroyed??!1,paused:!0})),this._pageDataUtils.refreshPageTime(e)}getSDKItem(t){return this._pageDataUtils.getSDKItem(t)}getSDKItems(t){return t?t.map(t=>this.getSDKItem(t)).filter(t=>!!t):this.pageData?.items??[]}async setPlayState(t){Be(this._pageData,"You must call SDK#run() first");const e="play"===t;if(this._pageData.playing!==e){if(this._pageData.playing=e,this._gestureHandler.ignoreInteraction=e,e){const t=this.player.getCompositions(),e=this.getViewProperty(this._pageData.activeData.view??0),i=JSON.parse(JSON.stringify(e.scene));await this.player.loadScene(i,{autoplay:!1}),this.player.gotoAndPlay(this._pageData.time),this.destroyCompositions(t)}else this.player.gotoAndStop(this._pageData.time);this._gestureHandler.render()}}getViewThumbnail(){return Be(this._pageData,"You must call SDK#run() first"),this._pageData.viewProperties.map(async t=>({id:t.id,thumbnail:await this.generateScreenShot(t.id)}))}getViewScene(){return Be(this._pageData,"You must call SDK#run() first"),this._pageData.viewProperties.map(t=>({id:t.id,thumbnail:t.scene}))}destroyCompositions(t){t.forEach(t=>{t.dispose();const e=this.player.getCompositions(),i=e.indexOf(t);i>-1&&e.splice(i,1)})}downloadByMediaBuffersOfExporter(t,e,i){Be(this._exporter,"You must init exporter first"),this._exporter.downloadByMediaBuffers(t,e,i)}onExport(){t.config.exportConfig.enabled&&(Be(this.pageData,"You must call SDK#run() first"),Be(this._exporter,"You must init exporter first"),this._exporter.onExport(this.exportOptions))}cancelExport(){Be(this._exporter,"You must init exporter first"),this._exporter.onCancel()}async loadPageData(t){Be(this._pageData,"You must call SDK#run() first"),this._pageData.activeData={view:this._pageData.viewProperties[this._pageData.viewProperties.length-1].id,selectedItems:[],preSelectedItem:void 0},this._pageData.viewProperties.push(...t.viewProperties),this._pageDataUtils.init(),await this._gestureHandler.init(this._pageDataUtils,this._eventEmitter),await this._pageDataUtils.loadScene(this.pageData?.activeData.view??0),this._eventEmitter.emit("pageDataChange",this.pageData)}async runByPageData(t){const e=JSON.parse(JSON.stringify(t));e.property.zoom=1,e.property.translation=[0,0],this._pageData=e,this._pageDataUtils.init(),await this._gestureHandler.init(this._pageDataUtils,this._eventEmitter),await this._pageDataUtils.loadScene(this.pageData?.activeData.view??0),this._pageDataUtils.refreshPageTime(this._pageData.time),this._eventEmitter.emit("pageDataChange",this.pageData)}async reloadPageDataByScene(t){Be(this._pageData,"You must call SDK#run() first");let e=JSON.parse(JSON.stringify(t));if("string"==typeof e)try{const t=await fetch(e,{mode:"cors",credentials:"omit",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}, statusText: ${t.statusText}`);e=await t.json()}catch(t){throw new Error(`Failed to fetch scene data from ${e}: ${t instanceof Error?t.message:String(t)}`)}this._pageData.time=e.compositions.find(t=>t.id===e.compositionId)?.duration??2,this._pageData.viewProperties.forEach(t=>{t.scene=JSON.parse(JSON.stringify(e))}),this._pageDataUtils.init(),await this._gestureHandler.init(this._pageDataUtils,this._eventEmitter),await this._pageDataUtils.loadScene(this._pageData.activeData.view??0),this._eventEmitter.emit("progress",{duration:this.player.getCompositions()[0]?.getDuration()??2,time:this._pageData.time,end:this.player.getCompositions()[0]?.isDestroyed??!1,paused:!this._pageData.playing})}async addViewParams(e,i){var r;Be(this._pageData);const n=[],s=this._pageData.viewProperties[this._pageData.viewProperties.length-1]?.id??this._pageData.viewProperties.length-1;for(let o=0;o<e.length;o++){const a=e[o];if(!a)continue;let h=JSON.parse(JSON.stringify(i??this._pageData.scene));const l=h.compositions.find(t=>t.id===h.compositionId)??h.compositions[0];Be(l);const{previewSize:c=[750,1624]}=l,u=c,d=a.size??c;l.previewSize=d;const f=l.duration??0,p=a.safeArea??[0,0,0,0];t.config.sizeAdaptConfig.enabled&&(h=await this._sizeAdapt.adjustment(h,f,u,d,p,a.adaptionDirection)),(r=a.export).time??(r.time=f),n.push({...a,size:d,safeArea:p,previewSafeAreas:[...a.previewSafeAreas??[]],id:s+1+o,scene:h,ignoreInteraction:!1})}this._pageData.viewProperties.push(...n),this._eventEmitter.emit("pageDataChange",this.pageData)}async deleteViewParams(t){t.sort((t,e)=>t-e);for(let e=0;e<t.length;e++){const i=t[e];Be(this._pageData);const r=i-e,n=this._pageData.viewProperties.findIndex(t=>t.id===r);if(!0===this._pageData.viewProperties[n]?.ignoreInteraction){console.warn("target view ignore interaction, it can not be deleted.");continue}if(n<0){console.warn("Target view is not existed.");continue}this._pageData.viewProperties.splice(n,1);const s=this._pageData.activeData.view??0;r===s?(this._pageData.activeData.view=0,await this._pageDataUtils.loadScene(0)):r<s&&(this._pageData.activeData.view=s-1),this._pageData.viewProperties.forEach(t=>{t.id>r&&(t.id-=1)})}this._eventEmitter.emit("selectedViewChange",this._pageData?.activeData?.view??0),this._eventEmitter.emit("pageDataChange",this.pageData)}setExportParam(t,e){Be(this._pageData),this._pageData.viewProperties.forEach(i=>{void 0!==e&&i.id!==e||Object.assign(i.export,t)})}setPageZoom(t,e,i){Be(this._pageData),this._pageData.property.zoom=t,this._pageDataUtils.setPageZoom(this._pageData.property.zoom,e,i),this._gestureHandler.render()}setPageMove(t){Be(this._pageData),this._pageData.property.translation=t.toArray(),this._pageDataUtils.setPageMove(t.clone()),this._gestureHandler.render()}setStaticPreviewEnabled(e){t.config.pageConfig.staticPreview=e}setStaticPreviewName(e){t.config.pageConfig.staticPreviewName=e}setAsyncEnabled(e){t.config.pageConfig.asncMode=e}setGroupVisibleEnabled(e){t.config.pageConfig.groupVisible=e}addFilterItemNames(e){"string"==typeof e?nT(t.config.pageConfig.filterItemNames,e):e.forEach(e=>{nT(t.config.pageConfig.filterItemNames,e)})}setPreferenceBackgroundColor(e){t.config.gestureHandlerConfig.preferenceGizmoConfig.markColor=e[0]<<16|e[1]<<8|e[2],t.config.gestureHandlerConfig.preferenceGizmoConfig.markAlpha=e[3]??.3,this._gestureHandler.render()}setSafeAreaColor(e){t.config.gestureHandlerConfig.preferenceGizmoConfig.safeAreaBoxColor=e[0]<<16|e[1]<<8|e[2],t.config.gestureHandlerConfig.preferenceGizmoConfig.safeAreaBoxAlpha=e[3]??.3,this._gestureHandler.render()}setSizeAdaptEnabled(e){t.config.sizeAdaptConfig.enabled=e}setScreenShotEnabled(e){t.config.screenShotConfig.enabled=e}setExportConfig(e){const i=ZI({},t.config.exportConfig,e);t.config.exportConfig=i,this._exporter?this._exporter.setOptions(i):this.initExporter(i)}setSelectorGizmoPreSelectConfig(e,i){void 0!==e&&(t.config.gestureHandlerConfig.selectorGizmoConfig.preSelectedColor=e),void 0!==i&&(t.config.gestureHandlerConfig.selectorGizmoConfig.preSelectedWidth=i),this._gestureHandler.render()}setTranformGizmoWireframeConfig(e){void 0!==e.wireframeAlpha&&(t.config.gestureHandlerConfig.transformGizmoConfig.wireframeAlpha=e.wireframeAlpha),void 0!==e.wireframeColor&&(t.config.gestureHandlerConfig.transformGizmoConfig.wireframeColor=e.wireframeColor),void 0!==e.wireframeWidth&&(t.config.gestureHandlerConfig.transformGizmoConfig.wireframeWidth=e.wireframeWidth),this._gestureHandler.render()}getSDKConfig(){return t.config}setSDKConfig(e){const i=Object.assign({},t.config);this._eventEmitter.emit("sdkConfigChange",i,e),t.config=e}setSDKBackground(t,e){switch(t){case"color":this._container.style.removeProperty("background-color"),this._container.style.removeProperty("background-image"),this._container.style.removeProperty("background-repeat"),this._container.style.removeProperty("background-position"),this._container.style.removeProperty("background-size"),e&&(this._container.style.backgroundColor=e);break;case"image":this._container.style.removeProperty("background-color"),this._container.style.removeProperty("background-image"),this._container.style.removeProperty("background-repeat"),this._container.style.removeProperty("background-position"),this._container.style.removeProperty("background-size"),e&&(this._container.style.backgroundImage=`url(${e})`);break;case"chess-board":e??(e="#CCCCCC"),this._container.style.backgroundColor=e,this._container.style.backgroundImage="linear-gradient(45deg, #FFFFFF 25%, transparent 25%, transparent 75%, #FFFFFF 75%),linear-gradient(45deg, #FFFFFF 25%, transparent 25%, transparent 75%, #FFFFFF 75%)",this._container.style.backgroundRepeat="repeat",this._container.style.backgroundPosition="0 0, 10px 10px",this._container.style.backgroundSize="20px 20px"}}async addSpriteItem(t,e){return await this._pageDataUtils.addSpriteItem(t,!1,e)}async addVideoItem(t,e){return await this._pageDataUtils.addVideoItem(t,!1,e)}openPictureCutGizmo(){this._gestureHandler.openPictureCutGizmo()}closePictureCutGizmo(){this._gestureHandler.closePictureCutGizmo()}getCutInfo(){return this._gestureHandler.getCutInfo()}setCutBox(t,e){return this._gestureHandler.setCutBox(t,e)}openPictureExpandGizmo(){this._gestureHandler.openPictureExpandGizmo()}closePictureExpandGizmo(){this._gestureHandler.closePictureExpandGizmo()}getExpandInfo(){return this._gestureHandler.getExpandInfo()}setExpandBox(t,e){return this._gestureHandler.setExpandBox(t,e)}openMaskGizmo(t){this._gestureHandler.openMaskGizmo(t)}clearMaskGizmo(){this._gestureHandler.clearMaskGizmo()}closeMaskGizmo(){this._gestureHandler.closeMaskGizmo()}async getMask(){return this._gestureHandler.getMask()}setMaskGizmoConfig(t){this._gestureHandler.setMaskGizmoConfig(t)}setMaskGizmoMode(t){this._gestureHandler.setMaskGizmoMode(t)}undoMaskGizmo(){return this._gestureHandler.maskGizmoUndo()}redoMaskGizmo(){return this._gestureHandler.maskGizmoRedo()}get canUndoMaskGizmo(){return this._gestureHandler.maskGizmoCanUndo}get canRedoMaskGizmo(){return this._gestureHandler.maskGizmoCanRedo}clearMaskGizmoUndoRedo(){this._gestureHandler.clearMaskGizmoUndoRedo()}undoPictureCutGizmo(){return this._gestureHandler.pictureCutGizmoUndo()}redoPictureCutGizmo(){return this._gestureHandler.pictureCutGizmoRedo()}get canUndoPictureCutGizmo(){return this._gestureHandler.pictureCutGizmoCanUndo}get canRedoPictureCutGizmo(){return this._gestureHandler.pictureCutGizmoCanRedo}clearPictureCutGizmoUndoRedo(){this._gestureHandler.clearPictureCutGizmoUndoRedo()}openLoadingGizmo(t,e){this._gestureHandler.openLoadingGizmo(t,e)}updateLoadingGizmo(t,e){this._gestureHandler.updateLoadingGizmo(t,e)}closeLoadingGizmo(t){this._gestureHandler.closeLoadingGizmo(t)}groupItems(t,e){return this._pageDataUtils.addGroupItem(t,e)}setItemParent(t,e){this._pageDataUtils.setItemParent(t,e)}deleteItemParent(t,e){this._pageDataUtils.deleteItemParent(t,e)}async addTextItem(t,e){return await this._pageDataUtils.addTextItem(t,e)}async addItemByCreateInfos(t,e=!1){if(e){return await this._pageDataUtils.asyncAddItemByCreateInfos(t)}return await this._pageDataUtils.addItemByCreateInfos(t)}deleteItems(t){if(Be(this._pageData,"You must call SDK#run() first"),Array.isArray(t)){t.forEach(t=>{this._pageDataUtils.deleteItem(t)});const e=this._pageData.activeData.selectedItems.filter(e=>!t.includes(e));this._pageData.activeData.selectedItems=[...e],this._eventEmitter.emit("selectedItemChange",e)}else{this._pageDataUtils.deleteItem(t);const e=this._pageData.activeData.selectedItems.filter(e=>e!==t);this._pageData.activeData.selectedItems=[...e],this._eventEmitter.emit("selectedItemChange",e)}this._pageDataUtils.interactionUtils.refreshViewParam(),this._pageDataUtils.interactionUtils.refreshCameraParam(),this._pageData.items=[];const e=this._pageDataUtils.getCurrentComposition();this._pageDataUtils.addSDKItemsByItems(this._pageData.items,e.items),this._eventEmitter.emit("pageDataChange",this._pageData)}getItemCreateInfo(t){return this._pageDataUtils.getItemCreateInfo(t,!1)}getItemCreateInfos(t){const e=[];return t??(t=this._pageData?.items.map(t=>t.id)??[]),t.forEach(i=>{const r=this._pageDataUtils.getSDKItem(i),n=this._pageDataUtils.getItemCreateInfo(i,!(!r?.parentId||!t.includes(r?.parentId)));n&&e.push(n)}),e}async createScreenShotSceneByIds(t,e=0){const i=this._pageDataUtils.createScreenShotSceneByIds(t);if(!i)return;const r=i?.compositions[0]?.previewSize??[750,1624];return await this._screenShot.generate(i,r,r,e)}getChildrenIds(t){return this._pageDataUtils.getChildrenIds(t)}updateItemOrder(t,e){Be(this._pageData,"You must call SDK#run() first");const i=this.getViewProperty(this._pageData.activeData.view??0)?.ignoreInteraction;i?console.warn("Static scene cannot change."):(this._pageDataUtils.updateItemOrder(t,e),this._gestureHandler.render())}exportJSON(t){Be(this._pageData,"You must call SDK#run() first");const e=[];if(Array.isArray(t))t.forEach(t=>{const i=this.getViewProperty(t);i?e.push(i.scene):console.warn(`view id ${t} is not exsited.`)});else if(void 0!==t){const i=this.getViewProperty(t);i?e.push(i.scene):console.warn(`view id ${t} is not exsited.`)}else e.push(...this._pageData.viewProperties.map(t=>t.scene));return e}getViewBoxById(t){return this._pageDataUtils.getViewBoxById(t)}setItemExtension(t,e){Be(this._pageData,"You must call SDK#run() first");const i=this._pageDataUtils.getSDKItem(t);return i?(Object.entries(e).forEach(([t,e])=>{i.setExtension(t,e)}),this._eventEmitter.emit("pageDataChange",this.pageData),!0):(console.warn(`Item ${t} not found`),!1)}getItemExtension(t,e){Be(this._pageData,"You must call SDK#run() first");const i=this._pageDataUtils.getSDKItem(t);if(!i)return void console.warn(`Item ${t} not found`);if(!e||0===e.length)return i.getAllExtension();const r={};return e.forEach(t=>{i.hasExtension(t)&&(r[t]=i.getExtension(t))}),r}deleteItemExtensions(t,e){Be(this._pageData,"You must call SDK#run() first");const i=this._pageDataUtils.getSDKItem(t);return i?(e.forEach(t=>{i.deleteExtension(t)}),this._eventEmitter.emit("pageDataChange",this.pageData),!0):(console.warn(`Item ${t} not found`),!1)}hasItemExtension(t,e){Be(this._pageData,"You must call SDK#run() first");const i=this._pageDataUtils.getSDKItem(t);return!!i&&i.hasExtension(e)}getItemExtensionKeys(t){Be(this._pageData,"You must call SDK#run() first");const e=this._pageDataUtils.getSDKItem(t);if(e)return e.getExtensionKeys();console.warn(`Item ${t} not found`)}getViewProperty(t){return this._pageDataUtils.getViewProperty(t)}pageMove(t){this._pageDataUtils.pageMove(new Lw(...t))}pageZoom(t,e){this._pageDataUtils.pageZoom(t,e?new Lw(...e):void 0)}setPictureCutGizmoLockScale(t){this._gestureHandler.setPictureCutGizmoLockScale(t)}setPictureExpandGizmoLockScale(t){this._gestureHandler.setPictureExpandGizmoLockScale(t)}viewportFit(t,e){this._pageDataUtils.viewportFit(t,e)}getItemBoxById(t){return this._pageDataUtils.getItemBoxById(t)}async setItemFontFamily(t,e,i){await this._pageDataUtils.setItemFontFamily(t,e,i),this._eventEmitter.emit("itemPropertyChange",{id:t,property:"fontFamily"})}createSceneByCreateInfos(t,e){return this._pageDataUtils.createSceneByCreateInfos(t,e.size,e.name)}setSpriteSize(t,e){this._pageDataUtils.setSpriteSize(t,e),this._gestureHandler.render()}setItemPropertyByCreateInfo(t){this._pageDataUtils.changeItemPropertyByCreateInfo(t),this._gestureHandler.render()}setTransformGizmoLockScale(t){this._gestureHandler.setTransformGizmoLockScale(t)}getViewBoxByBox(t){return this._pageDataUtils.getViewBoxByBox(t)}openSpriteTextEditGizmo(t){this._gestureHandler.openSpriteTextGizmo(t)}closeSpriteTextEditGizmo(){this._gestureHandler.closeSpriteTextEditGizmo()}setSpriteTextSelectedIndex(t,e){this._gestureHandler.setSpriteTextSelectedIndex(t,e)}setSpriteTextSelectedText(t,e,i){this._gestureHandler.setSpriteTextSelectedText(t,e,i)}getBoundingBoxByItemCreateInfo(t){return this._pageDataUtils.getBoundingBoxByCreateInfo(t)}getBoundingBoxByItemCreateInfos(t){return this._pageDataUtils.getBoundingBoxByCreateInfos(t)}setSpriteTextChangedState(t,e,i){this._gestureHandler.setSpriteTextChangedState(t,e,i)}setSpriteTextEditState(t,e,i){this._gestureHandler.setSpriteTextEditState(t,e,i)}getVideoItemPlayTime(t){return this._pageDataUtils.getVideoItemPlayTime(t)}setVideoItemPlayTime(t,e){this._pageDataUtils.setVideoItemPlayTime(t,e)}getEffectsItemPlayTime(t){return this._pageDataUtils.getEffectsItemPlayTime(t)}setEffectsItemPlayTime(t,e){this._pageDataUtils.setEffectsItemPlayTime(t,e)}setEffectsResource(t,e){this._pageDataUtils.setEffectsResource(t,e)}getPixelPositionByViewPosition(t){return this._pageDataUtils.getPixelPositionByViewPosition(t)}hitTest(t,e){return this._gestureHandler.selectorGizmo?.hitTest(new Lw(t,e))}setInteractType(t){this._gestureHandler.setInteractType(t)}makeItemAlign(t,e){this._pageDataUtils.makeItemAlign(t,e),this._gestureHandler.render()}makeItemDistribute(t,e){this._pageDataUtils.makeItemDistribute(t,e),this._gestureHandler.render()}addGeneratorItem(t){return this._pageDataUtils.addGeneratorItem(t)}async addEffectsItem(t){return await this._pageDataUtils.addEffectsItem(t)}async addFrameItem(t){return await this._pageDataUtils.addFrameItem(t)}async setGeneratorResource(t,e){return Be(this._pageData,"You must call SDK#run() first"),this._pageDataUtils.setGeneratorResource(t,e)}setGeneratorResourceFromObject(t){this.setGeneratorResource(t.itemId,t.url)}setVideoGeneratorResource(t){return this.setGeneratorResource(t.itemId,t.url)}setSpriteGeneratorResource(t){return this.setGeneratorResource(t.itemId,t.url)}setItemLockState(t,e){this._pageDataUtils.setItemLockState(t,e)}getItemLockState(t){this._pageDataUtils.getItemLockState(t)}openItemCreateGizmo(t){this._gestureHandler.openItemCreateGizmo(t)}closeItemCreateGizmo(){this._gestureHandler.closeItemCreateGizmo()}setItemName(t,e){this._pageDataUtils.setItemName(t,e)}setSafeAreaPreviewVisible(t,e,i){const r=this.getViewProperty(t);r?.previewSafeAreas.forEach(t=>{e in t&&(t.visible=i)}),this._eventEmitter.emit("pageDataChange",this.pageData)}};A(Dk,"config",{mode:"template",pageConfig:{asncMode:!1,minZoom:.01,maxZoom:20,staticPreview:!0,staticPreviewName:"标准模板",filterItemNames:["ModelPluginItem"],groupVisible:!0},asyncLoadConfig:{enabled:!0,loadingTextureUrl:"https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*BzgbTb8dBhoAAAAARwAAAAgAev-aAQ/original"},screenShotConfig:{enabled:!0,defaultBackgroundColor:[255,255,255,0]},exportConfig:{enabled:!0,mediaType:"MP4",loggerInTranscoding:!1},sizeAdaptConfig:{enabled:!0},gestureHandlerConfig:{enabled:!0,adsorptionGizmoEnabled:!0,adsorptionGizmoConfig:{lineWidth:.8,lineColor:775935,distance:6},controlGizmoEnabled:!0,controlGizmoConfig:{zoomStep:.01},preferenceGizmoEnabled:!0,preferenceGizmoConfig:{boxColor:16711680,boxWidth:1,markColor:0,markAlpha:.17,safeAreaEnabled:!0,safeAreaBoxColor:65280,safeAreaBoxAlpha:.3},selectorGizmoEnabled:!0,selectorGizmoConfig:{videoPreSelectedPlay:!0,preSelectedWidth:3,preSelectedColor:15425024,regionBoxColor:16777215,regionBoxAlpha:.17,regionWireframeColor:16777215,regionWireframeAlpha:.78,regionWireframeWidth:1},transformGizmoEnabled:!0,transformGizmoConfig:{wireframeColor:16711680,wireframeAlpha:1,wireframeWidth:1.5,cornerFillColor:16777215,cornerLineColor:0,cornerLineWidth:1,cornerLineAlpha:.3,scaleCircleSize:4,rotationCircleSize:8,pictureLogoUrl:"https://mdn.alipayobjects.com/huamei_ppzin5/afts/img/EMCfRoZQj8cAAAAAOmAAAAgADjdkAQFr/original",groupLogoUrl:"https://mdn.alipayobjects.com/huamei_ppzin5/afts/img/Yo69Sr7boqYAAAAAH3AAAAgADjdkAQFr/original",textLogoUrl:"https://mdn.alipayobjects.com/huamei_ppzin5/afts/img/Yo69Sr7boqYAAAAAH3AAAAgADjdkAQFr/original",videoLogoUrl:"https://mdn.alipayobjects.com/huamei_ppzin5/afts/img/Yo69Sr7boqYAAAAAH3AAAAgADjdkAQFr/original",sizeTextColor:6710886,nameTextColor:6710886,infoShowEnabled:!0},pictureCutGizmoEnabled:!1,pictureCutGizmoConfig:{maskColor:16777215,maskAlpha:.5,cutBoxLineWidth:2,cutBoxLineColor:6960383,cutBoxLineAlpha:1,itemBoxLineWidth:1,itemBoxLineColor:6960383,itemBoxLineAlpha:1,cutBoxCornerRadius:5,cutBoxCornerLineWidth:2,cutBoxCornerLineColor:6960383,cutBoxCornerLineAlpha:1,cutBoxCornerFillColor:16777215,scaleInteractionDistance:8,directionScaleInteractionDistance:5,gridLineWidth:1,gridLineColor:16777215,gridLineAlpha:1,gridCount:2},pictureExpandGizmoEnabled:!1,pictureExpandGizmoConfig:{maskColor:6960383,maskAlpha:.2,expandBoxLineWidth:2,expandBoxLineColor:6960383,expandBoxLineAlpha:1,expandBoxCornerRadius:5,expandBoxCornerLineWidth:2,expandBoxCornerLineColor:6960383,expandBoxCornerLineAlpha:1,expandBoxCornerFillColor:16777215,scaleInteractionDistance:8,directionScaleInteractionDistance:5,gridLineWidth:1,gridLineColor:16777215,gridLineAlpha:1,gridCount:2},textGizmoEnbaled:!0,textGizmoConfig:{rotateInteractMode:"corner",boxLineWidth:2,boxLineColor:7026175,rotationCornerWidth:30,rotationCornerTexture:"https://mdn.alipayobjects.com/huamei_ppzin5/afts/img/Zc9ZSqNEjnQAAAAAQBAAAAgADjdkAQFr/original",rotationTopCenterInteractionDistance:14,rotationCornerRadius:5,rotationCornerFillColor:16777215,rotationCornerStrokeWidth:2,rotationCornerStrokeColor:7026175,rotationCornerInteractionDistance:14,scaleCornerRadius:5,scaleCornerFillColor:16777215,scaleCornerStrokeWidth:2,scaleCornerStrokeColor:7026175,scaleInteractionDistance:7,widthScaleInteractionDistance:4},maskGizmoEnabled:!1,maskGizmoConfig:{brushSize:20,brushColor:6960383,brushAlpha:.5,maskColor:65280,maskAlpha:1,boxLineWidth:1,boxLineColor:6960383,boxLineAlpha:1},spriteTextEditGizmoEnabled:!1,spriteTextEditGizmoConfig:{textColor:16777215,preSelectedTextColor:16777215,boxLineWidth:3,dashLineDash:8,dashLineGap:8,editBoxAlpha:.15,editBoxColor:3900150,editBoxLineAlpha:1,editBoxLineColor:3900150,editBoxPreSelectedAlpha:.25,editBoxPreSelectedColor:3900150,editBoxLinePreSelectedAlpha:1,editBoxLinePreSelectedColor:3900150,hasChangedEditBoxAlpha:.2,hasChangedEditBoxColor:2278750,hasChangedEditBoxLineAlpha:1,hasChangedEditBoxLineColor:2278750,hasChangedEditBoxPreSelectedAlpha:.3,hasChangedEditBoxPreSelectedColor:2278750,hasChangedEditBoxLinePreSelectedAlpha:1,hasChangedEditBoxLinePreSelectedColor:2278750,editBoxSelectedAlpha:.6,editBoxSelectedColor:16776960},videoPlayGizmoEnabled:!0,videoPlayGizmoConfig:{autoShow:!0,logoUrl:"https://mdn.alipayobjects.com/huamei_banz2t/afts/img/A*jW1LRYu9OLwAAAAAHoAAAAgAeiCuAQ/original",logoShift:[25,25],width:30,height:30},itemCreateGizmoEnabled:!1,itemCreateGizmoConfig:{frameBorderColor:2193663,frameBorderWidth:1,frameBorderAlpha:.8,frameFillColor:2193663,frameFillAlpha:.15}}});var kk,Lk=Dk;return kk=Zt,S(m({},"__esModule",{value:!0}),kk)})();
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
punycode/punycode.js:
|
|
5
|
-
(*! https://mths.be/punycode v1.4.1 by @mathias *)
|
|
6
|
-
|
|
7
|
-
object-assign/index.js:
|
|
8
|
-
(*
|
|
9
|
-
object-assign
|
|
10
|
-
(c) Sindre Sorhus
|
|
11
|
-
@license MIT
|
|
12
|
-
*)
|
|
13
|
-
|
|
14
|
-
jszip/dist/jszip.min.js:
|
|
15
|
-
(*!
|
|
16
|
-
|
|
17
|
-
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
18
|
-
<http://stuartk.com/jszip>
|
|
19
|
-
|
|
20
|
-
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
21
|
-
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
22
|
-
|
|
23
|
-
JSZip uses the library pako released under the MIT license :
|
|
24
|
-
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
25
|
-
*)
|
|
26
|
-
|
|
27
|
-
@galacean/effects/dist/index.mjs:
|
|
28
|
-
(*!
|
|
29
|
-
* Name: @galacean/effects
|
|
30
|
-
* Description: Galacean Effects runtime player for the web
|
|
31
|
-
* Author: Ant Group CO., Ltd.
|
|
32
|
-
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
33
|
-
* Version: v2.9.0-alpha.1
|
|
34
|
-
*)
|
|
35
|
-
|
|
36
|
-
@galacean/effects-plugin-rich-text/dist/index.mjs:
|
|
37
|
-
(*!
|
|
38
|
-
* Name: @galacean/effects-plugin-rich-text
|
|
39
|
-
* Description: Galacean Effects player rich text plugin
|
|
40
|
-
* Author: Ant Group CO., Ltd.
|
|
41
|
-
* Contributors: 云垣
|
|
42
|
-
* Version: v2.9.0-alpha.1
|
|
43
|
-
*)
|
|
44
|
-
|
|
45
|
-
@galacean/effects-plugin-model/dist/index.mjs:
|
|
46
|
-
(*!
|
|
47
|
-
* Name: @galacean/effects-plugin-model
|
|
48
|
-
* Description: Galacean Effects player model plugin
|
|
49
|
-
* Author: Ant Group CO., Ltd.
|
|
50
|
-
* Contributors: 飂兮
|
|
51
|
-
* Version: v2.9.0-alpha.1
|
|
52
|
-
*)
|
|
53
|
-
|
|
54
|
-
@galacean/effects-plugin-multimedia/dist/index.mjs:
|
|
55
|
-
(*!
|
|
56
|
-
* Name: @galacean/effects-plugin-multimedia
|
|
57
|
-
* Description: Galacean Effects player multimedia plugin
|
|
58
|
-
* Author: Ant Group CO., Ltd.
|
|
59
|
-
* Contributors: 云垣
|
|
60
|
-
* Version: v2.9.0-alpha.1
|
|
61
|
-
*)
|
|
62
|
-
|
|
63
|
-
@galacean/effects-plugin-spine/dist/index.mjs:
|
|
64
|
-
(*!
|
|
65
|
-
* Name: @galacean/effects-plugin-spine
|
|
66
|
-
* Description: Galacean Effects player spine plugin
|
|
67
|
-
* Author: Ant Group CO., Ltd.
|
|
68
|
-
* Contributors: 十弦
|
|
69
|
-
* Version: v2.9.0-alpha.1
|
|
70
|
-
*)
|
|
71
|
-
|
|
72
|
-
@galacean/effects-plugin-ffd/dist/index.mjs:
|
|
73
|
-
(*!
|
|
74
|
-
* Name: @galacean/effects-plugin-ffd
|
|
75
|
-
* Description: Galacean Effects player Free-form deformation plugin
|
|
76
|
-
* Author: Ant Group CO., Ltd.
|
|
77
|
-
* Contributors: 澄弈
|
|
78
|
-
* Version: v2.9.0-alpha.1
|
|
79
|
-
*)
|
|
80
|
-
|
|
81
|
-
lodash-es/lodash.js:
|
|
82
|
-
(**
|
|
83
|
-
* @license
|
|
84
|
-
* Lodash (Custom Build) <https://lodash.com/>
|
|
85
|
-
* Build: `lodash modularize exports="es" -o ./`
|
|
86
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
87
|
-
* Released under MIT license <https://lodash.com/license>
|
|
88
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
89
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
90
|
-
*)
|
|
91
|
-
|
|
92
|
-
@pixi/constants/dist/esm/constants.mjs:
|
|
93
|
-
(*!
|
|
94
|
-
* @pixi/constants - v6.5.10
|
|
95
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
96
|
-
*
|
|
97
|
-
* @pixi/constants is licensed under the MIT License.
|
|
98
|
-
* http://www.opensource.org/licenses/mit-license
|
|
99
|
-
*)
|
|
100
|
-
|
|
101
|
-
@pixi/settings/dist/esm/settings.mjs:
|
|
102
|
-
(*!
|
|
103
|
-
* @pixi/settings - v6.5.10
|
|
104
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
105
|
-
*
|
|
106
|
-
* @pixi/settings is licensed under the MIT License.
|
|
107
|
-
* http://www.opensource.org/licenses/mit-license
|
|
108
|
-
*)
|
|
109
|
-
|
|
110
|
-
@pixi/utils/dist/esm/utils.mjs:
|
|
111
|
-
(*!
|
|
112
|
-
* @pixi/utils - v6.5.10
|
|
113
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
114
|
-
*
|
|
115
|
-
* @pixi/utils is licensed under the MIT License.
|
|
116
|
-
* http://www.opensource.org/licenses/mit-license
|
|
117
|
-
*)
|
|
118
|
-
|
|
119
|
-
@pixi/extensions/dist/esm/extensions.mjs:
|
|
120
|
-
(*!
|
|
121
|
-
* @pixi/extensions - v6.5.10
|
|
122
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
123
|
-
*
|
|
124
|
-
* @pixi/extensions is licensed under the MIT License.
|
|
125
|
-
* http://www.opensource.org/licenses/mit-license
|
|
126
|
-
*)
|
|
127
|
-
(*! *****************************************************************************
|
|
128
|
-
Copyright (c) Microsoft Corporation.
|
|
129
|
-
|
|
130
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
131
|
-
purpose with or without fee is hereby granted.
|
|
132
|
-
|
|
133
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
134
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
135
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
136
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
137
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
138
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
139
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
140
|
-
***************************************************************************** *)
|
|
141
|
-
|
|
142
|
-
@pixi/runner/dist/esm/runner.mjs:
|
|
143
|
-
(*!
|
|
144
|
-
* @pixi/runner - v6.5.10
|
|
145
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
146
|
-
*
|
|
147
|
-
* @pixi/runner is licensed under the MIT License.
|
|
148
|
-
* http://www.opensource.org/licenses/mit-license
|
|
149
|
-
*)
|
|
150
|
-
|
|
151
|
-
@pixi/ticker/dist/esm/ticker.mjs:
|
|
152
|
-
(*!
|
|
153
|
-
* @pixi/ticker - v6.5.10
|
|
154
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
155
|
-
*
|
|
156
|
-
* @pixi/ticker is licensed under the MIT License.
|
|
157
|
-
* http://www.opensource.org/licenses/mit-license
|
|
158
|
-
*)
|
|
159
|
-
|
|
160
|
-
@pixi/math/dist/esm/math.mjs:
|
|
161
|
-
(*!
|
|
162
|
-
* @pixi/math - v6.5.10
|
|
163
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
164
|
-
*
|
|
165
|
-
* @pixi/math is licensed under the MIT License.
|
|
166
|
-
* http://www.opensource.org/licenses/mit-license
|
|
167
|
-
*)
|
|
168
|
-
|
|
169
|
-
@pixi/core/dist/esm/core.mjs:
|
|
170
|
-
(*!
|
|
171
|
-
* @pixi/core - v6.5.10
|
|
172
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
173
|
-
*
|
|
174
|
-
* @pixi/core is licensed under the MIT License.
|
|
175
|
-
* http://www.opensource.org/licenses/mit-license
|
|
176
|
-
*)
|
|
177
|
-
(*! *****************************************************************************
|
|
178
|
-
Copyright (c) Microsoft Corporation.
|
|
179
|
-
|
|
180
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
181
|
-
purpose with or without fee is hereby granted.
|
|
182
|
-
|
|
183
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
184
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
185
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
186
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
187
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
188
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
189
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
190
|
-
***************************************************************************** *)
|
|
191
|
-
|
|
192
|
-
@pixi/display/dist/esm/display.mjs:
|
|
193
|
-
(*!
|
|
194
|
-
* @pixi/display - v6.5.10
|
|
195
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
196
|
-
*
|
|
197
|
-
* @pixi/display is licensed under the MIT License.
|
|
198
|
-
* http://www.opensource.org/licenses/mit-license
|
|
199
|
-
*)
|
|
200
|
-
(*! *****************************************************************************
|
|
201
|
-
Copyright (c) Microsoft Corporation.
|
|
202
|
-
|
|
203
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
204
|
-
purpose with or without fee is hereby granted.
|
|
205
|
-
|
|
206
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
207
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
208
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
209
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
210
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
211
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
212
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
213
|
-
***************************************************************************** *)
|
|
214
|
-
|
|
215
|
-
@pixi/app/dist/esm/app.mjs:
|
|
216
|
-
(*!
|
|
217
|
-
* @pixi/app - v6.5.10
|
|
218
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
219
|
-
*
|
|
220
|
-
* @pixi/app is licensed under the MIT License.
|
|
221
|
-
* http://www.opensource.org/licenses/mit-license
|
|
222
|
-
*)
|
|
223
|
-
|
|
224
|
-
@pixi/graphics/dist/esm/graphics.mjs:
|
|
225
|
-
(*!
|
|
226
|
-
* @pixi/graphics - v6.5.10
|
|
227
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
228
|
-
*
|
|
229
|
-
* @pixi/graphics is licensed under the MIT License.
|
|
230
|
-
* http://www.opensource.org/licenses/mit-license
|
|
231
|
-
*)
|
|
232
|
-
(*! *****************************************************************************
|
|
233
|
-
Copyright (c) Microsoft Corporation.
|
|
234
|
-
|
|
235
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
236
|
-
purpose with or without fee is hereby granted.
|
|
237
|
-
|
|
238
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
239
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
240
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
241
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
242
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
243
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
244
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
245
|
-
***************************************************************************** *)
|
|
246
|
-
|
|
247
|
-
@pixi/polyfill/dist/esm/polyfill.mjs:
|
|
248
|
-
(*!
|
|
249
|
-
* @pixi/polyfill - v6.5.10
|
|
250
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
251
|
-
*
|
|
252
|
-
* @pixi/polyfill is licensed under the MIT License.
|
|
253
|
-
* http://www.opensource.org/licenses/mit-license
|
|
254
|
-
*)
|
|
255
|
-
|
|
256
|
-
@pixi/interaction/dist/esm/interaction.mjs:
|
|
257
|
-
(*!
|
|
258
|
-
* @pixi/interaction - v6.5.10
|
|
259
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
260
|
-
*
|
|
261
|
-
* @pixi/interaction is licensed under the MIT License.
|
|
262
|
-
* http://www.opensource.org/licenses/mit-license
|
|
263
|
-
*)
|
|
264
|
-
(*! *****************************************************************************
|
|
265
|
-
Copyright (c) Microsoft Corporation.
|
|
266
|
-
|
|
267
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
268
|
-
purpose with or without fee is hereby granted.
|
|
269
|
-
|
|
270
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
271
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
272
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
273
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
274
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
275
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
276
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
277
|
-
***************************************************************************** *)
|
|
278
|
-
|
|
279
|
-
@pixi/loaders/dist/esm/loaders.mjs:
|
|
280
|
-
(*!
|
|
281
|
-
* @pixi/loaders - v6.5.10
|
|
282
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
283
|
-
*
|
|
284
|
-
* @pixi/loaders is licensed under the MIT License.
|
|
285
|
-
* http://www.opensource.org/licenses/mit-license
|
|
286
|
-
*)
|
|
287
|
-
|
|
288
|
-
@pixi/sprite/dist/esm/sprite.mjs:
|
|
289
|
-
(*!
|
|
290
|
-
* @pixi/sprite - v6.5.10
|
|
291
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
292
|
-
*
|
|
293
|
-
* @pixi/sprite is licensed under the MIT License.
|
|
294
|
-
* http://www.opensource.org/licenses/mit-license
|
|
295
|
-
*)
|
|
296
|
-
(*! *****************************************************************************
|
|
297
|
-
Copyright (c) Microsoft Corporation.
|
|
298
|
-
|
|
299
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
300
|
-
purpose with or without fee is hereby granted.
|
|
301
|
-
|
|
302
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
303
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
304
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
305
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
306
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
307
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
308
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
309
|
-
***************************************************************************** *)
|
|
310
|
-
|
|
311
|
-
@pixi/text/dist/esm/text.mjs:
|
|
312
|
-
(*!
|
|
313
|
-
* @pixi/text - v6.5.10
|
|
314
|
-
* Compiled Thu, 06 Jul 2023 15:25:11 UTC
|
|
315
|
-
*
|
|
316
|
-
* @pixi/text is licensed under the MIT License.
|
|
317
|
-
* http://www.opensource.org/licenses/mit-license
|
|
318
|
-
*)
|
|
319
|
-
(*! *****************************************************************************
|
|
320
|
-
Copyright (c) Microsoft Corporation.
|
|
321
|
-
|
|
322
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
323
|
-
purpose with or without fee is hereby granted.
|
|
324
|
-
|
|
325
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
326
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
327
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
328
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
329
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
330
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
331
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
332
|
-
***************************************************************************** *)
|
|
333
|
-
*/
|