@doki-land/live2d 0.0.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/dist/l2d.esm.js +20890 -0
- package/dist/l2d.umd.js +1072 -0
- package/lib/cubism2.d.ts +179 -0
- package/lib/cubism2.min.js +2 -0
- package/lib/cubism5.min.js +9 -0
- package/package.json +39 -0
- package/src/index.ts +149 -0
- package/src/types/Live2dOptions.ts +30 -0
- package/src/types/ModelOptions.ts +40 -0
- package/src/types/index.ts +2 -0
package/dist/l2d.umd.js
ADDED
|
@@ -0,0 +1,1072 @@
|
|
|
1
|
+
(function(re,Ut){typeof exports=="object"&&typeof module<"u"?Ut(exports):typeof define=="function"&&define.amd?define(["exports"],Ut):(re=typeof globalThis<"u"?globalThis:re||self,Ut(re.l2d={}))})(this,function(re){"use strict";var Ut;(function(i){i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2"})(Ut||(Ut={}));var cr;(function(i){i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS"})(cr||(cr={}));var Fr;(function(i){i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL"})(Fr||(Fr={}));var tt;(function(i){i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR"})(tt||(tt={}));var jt;(function(i){i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(jt||(jt={}));var H;(function(i){i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(H||(H={}));var Ce;(function(i){i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(Ce||(Ce={}));var Q;(function(i){i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT"})(Q||(Q={}));var Lr;(function(i){i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT"})(Lr||(Lr={}));var ie;(function(i){i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR"})(ie||(ie={}));var ne;(function(i){i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(ne||(ne={}));var zt;(function(i){i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL"})(zt||(zt={}));var Wt;(function(i){i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(Wt||(Wt={}));var Yt;(function(i){i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT"})(Yt||(Yt={}));var Br;(function(i){i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL"})(Br||(Br={}));var kt;(function(i){i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp"})(kt||(kt={}));var It;(function(i){i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR"})(It||(It={}));var Pn;(function(i){i[i.RED=1]="RED",i[i.GREEN=2]="GREEN",i[i.BLUE=4]="BLUE",i[i.ALPHA=8]="ALPHA"})(Pn||(Pn={}));var xt;(function(i){i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH"})(xt||(xt={}));var se;(function(i){i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(se||(se={}));var Vo={createCanvas:function(i,t){var e=document.createElement("canvas");return e.width=i,e.height=t,e},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var i;return(i=document.baseURI)!==null&&i!==void 0?i:window.location.href},fetch:function(i,t){return fetch(i,t)}},wn=/iPhone/i,jo=/iPod/i,zo=/iPad/i,Wo=/\biOS-universal(?:.+)Mac\b/i,Cn=/\bAndroid(?:.+)Mobile\b/i,Yo=/Android/i,dr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ei=/Silk/i,ye=/Windows Phone/i,qo=/\bWindows(?:.+)ARM\b/i,$o=/BlackBerry/i,Ko=/BB10/i,Zo=/Opera Mini/i,Jo=/\b(CriOS|Chrome)(?:.+)Mobile/i,Qo=/Mobile(?:.+)Firefox\b/i,th=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function Yf(i){return function(t){return t.test(i)}}function qf(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var n=Yf(e),s={apple:{phone:n(wn)&&!n(ye),ipod:n(jo),tablet:!n(wn)&&(n(zo)||th(t))&&!n(ye),universal:n(Wo),device:(n(wn)||n(jo)||n(zo)||n(Wo)||th(t))&&!n(ye)},amazon:{phone:n(dr),tablet:!n(dr)&&n(Ei),device:n(dr)||n(Ei)},android:{phone:!n(ye)&&n(dr)||!n(ye)&&n(Cn),tablet:!n(ye)&&!n(dr)&&!n(Cn)&&(n(Ei)||n(Yo)),device:!n(ye)&&(n(dr)||n(Ei)||n(Cn)||n(Yo))||n(/\bokhttp\b/i)},windows:{phone:n(ye),tablet:n(qo),device:n(ye)||n(qo)},other:{blackberry:n($o),blackberry10:n(Ko),opera:n(Zo),firefox:n(Qo),chrome:n(Jo),device:n($o)||n(Ko)||n(Zo)||n(Qo)||n(Jo)},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}var qt=qf(globalThis.navigator);function $f(){return!qt.apple.device}function Kf(i){var t=!0;if(qt.tablet||qt.phone){if(qt.apple.device){var e=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(e){var r=parseInt(e[1],10);r<11&&(t=!1)}}if(qt.android.device){var e=navigator.userAgent.match(/Android\s([0-9.]*)/);if(e){var r=parseInt(e[1],10);r<7&&(t=!1)}}}return t?i:4}var z={ADAPTER:Vo,MIPMAP_TEXTURES:zt.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:xt.NONE,SPRITE_MAX_TEXTURES:Kf(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:Br.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:ne.CLAMP,SCALE_MODE:ie.LINEAR,PRECISION_VERTEX:kt.HIGH,PRECISION_FRAGMENT:qt.apple.device?kt.HIGH:kt.MEDIUM,CAN_UPLOAD_SAME_BUFFER:$f(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},In=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function An(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Zf(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var t=i.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var n=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return i[r]}})}),e}var Mn={exports:{}},eh;function Jf(){return eh||(eh=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function n(h,u,l){this.fn=h,this.context=u,this.once=l||!1}function s(h,u,l,c,f){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new n(l,c||h,f),v=e?e+u:u;return h._events[v]?h._events[v].fn?h._events[v]=[h._events[v],d]:h._events[v].push(d):(h._events[v]=d,h._eventsCount++),h}function a(h,u){--h._eventsCount===0?h._events=new r:delete h._events[u]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],l,c;if(this._eventsCount===0)return u;for(c in l=this._events)t.call(l,c)&&u.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},o.prototype.listeners=function(u){var l=e?e+u:u,c=this._events[l];if(!c)return[];if(c.fn)return[c.fn];for(var f=0,d=c.length,v=new Array(d);f<d;f++)v[f]=c[f].fn;return v},o.prototype.listenerCount=function(u){var l=e?e+u:u,c=this._events[l];return c?c.fn?1:c.length:0},o.prototype.emit=function(u,l,c,f,d,v){var _=e?e+u:u;if(!this._events[_])return!1;var p=this._events[_],g=arguments.length,y,T;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),g){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,l),!0;case 3:return p.fn.call(p.context,l,c),!0;case 4:return p.fn.call(p.context,l,c,f),!0;case 5:return p.fn.call(p.context,l,c,f,d),!0;case 6:return p.fn.call(p.context,l,c,f,d,v),!0}for(T=1,y=new Array(g-1);T<g;T++)y[T-1]=arguments[T];p.fn.apply(p.context,y)}else{var I=p.length,m;for(T=0;T<I;T++)switch(p[T].once&&this.removeListener(u,p[T].fn,void 0,!0),g){case 1:p[T].fn.call(p[T].context);break;case 2:p[T].fn.call(p[T].context,l);break;case 3:p[T].fn.call(p[T].context,l,c);break;case 4:p[T].fn.call(p[T].context,l,c,f);break;default:if(!y)for(m=1,y=new Array(g-1);m<g;m++)y[m-1]=arguments[m];p[T].fn.apply(p[T].context,y)}}return!0},o.prototype.on=function(u,l,c){return s(this,u,l,c,!1)},o.prototype.once=function(u,l,c){return s(this,u,l,c,!0)},o.prototype.removeListener=function(u,l,c,f){var d=e?e+u:u;if(!this._events[d])return this;if(!l)return a(this,d),this;var v=this._events[d];if(v.fn)v.fn===l&&(!f||v.once)&&(!c||v.context===c)&&a(this,d);else{for(var _=0,p=[],g=v.length;_<g;_++)(v[_].fn!==l||f&&!v[_].once||c&&v[_].context!==c)&&p.push(v[_]);p.length?this._events[d]=p.length===1?p[0]:p:a(this,d)}return this},o.prototype.removeAllListeners=function(u){var l;return u?(l=e?e+u:u,this._events[l]&&a(this,l)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,i.exports=o}(Mn)),Mn.exports}var Qf=Jf();const xe=An(Qf);var Si={exports:{}},rh;function tc(){if(rh)return Si.exports;rh=1,Si.exports=i,Si.exports.default=i;function i(b,P,E){E=E||2;var A=P&&P.length,C=A?P[0]*E:b.length,w=t(b,0,C,E,!0),M=[];if(!w||w.next===w.prev)return M;var R,U,X,W,V,Y,K;if(A&&(w=h(b,P,w,E)),b.length>80*E){R=X=b[0],U=W=b[1];for(var j=E;j<C;j+=E)V=b[j],Y=b[j+1],V<R&&(R=V),Y<U&&(U=Y),V>X&&(X=V),Y>W&&(W=Y);K=Math.max(X-R,W-U),K=K!==0?32767/K:0}return r(w,M,E,R,U,K,0),M}function t(b,P,E,A,C){var w,M;if(C===G(b,P,E,A)>0)for(w=P;w<E;w+=A)M=L(w,b[w],b[w+1],M);else for(w=E-A;w>=P;w-=A)M=L(w,b[w],b[w+1],M);return M&&I(M,M.next)&&(q(M),M=M.next),M}function e(b,P){if(!b)return b;P||(P=b);var E=b,A;do if(A=!1,!E.steiner&&(I(E,E.next)||T(E.prev,E,E.next)===0)){if(q(E),E=P=E.prev,E===E.next)break;A=!0}else E=E.next;while(A||E!==P);return P}function r(b,P,E,A,C,w,M){if(b){!M&&w&&d(b,A,C,w);for(var R=b,U,X;b.prev!==b.next;){if(U=b.prev,X=b.next,w?s(b,A,C,w):n(b)){P.push(U.i/E|0),P.push(b.i/E|0),P.push(X.i/E|0),q(b),b=X.next,R=X.next;continue}if(b=X,b===R){M?M===1?(b=a(e(b),P,E),r(b,P,E,A,C,w,2)):M===2&&o(b,P,E,A,C,w):r(e(b),P,E,A,C,w,1);break}}}}function n(b){var P=b.prev,E=b,A=b.next;if(T(P,E,A)>=0)return!1;for(var C=P.x,w=E.x,M=A.x,R=P.y,U=E.y,X=A.y,W=C<w?C<M?C:M:w<M?w:M,V=R<U?R<X?R:X:U<X?U:X,Y=C>w?C>M?C:M:w>M?w:M,K=R>U?R>X?R:X:U>X?U:X,j=A.next;j!==P;){if(j.x>=W&&j.x<=Y&&j.y>=V&&j.y<=K&&g(C,R,w,U,M,X,j.x,j.y)&&T(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function s(b,P,E,A){var C=b.prev,w=b,M=b.next;if(T(C,w,M)>=0)return!1;for(var R=C.x,U=w.x,X=M.x,W=C.y,V=w.y,Y=M.y,K=R<U?R<X?R:X:U<X?U:X,j=W<V?W<Y?W:Y:V<Y?V:Y,et=R>U?R>X?R:X:U>X?U:X,nt=W>V?W>Y?W:Y:V>Y?V:Y,ft=_(K,j,P,E,A),J=_(et,nt,P,E,A),$=b.prevZ,rt=b.nextZ;$&&$.z>=ft&&rt&&rt.z<=J;){if($.x>=K&&$.x<=et&&$.y>=j&&$.y<=nt&&$!==C&&$!==M&&g(R,W,U,V,X,Y,$.x,$.y)&&T($.prev,$,$.next)>=0||($=$.prevZ,rt.x>=K&&rt.x<=et&&rt.y>=j&&rt.y<=nt&&rt!==C&&rt!==M&&g(R,W,U,V,X,Y,rt.x,rt.y)&&T(rt.prev,rt,rt.next)>=0))return!1;rt=rt.nextZ}for(;$&&$.z>=ft;){if($.x>=K&&$.x<=et&&$.y>=j&&$.y<=nt&&$!==C&&$!==M&&g(R,W,U,V,X,Y,$.x,$.y)&&T($.prev,$,$.next)>=0)return!1;$=$.prevZ}for(;rt&&rt.z<=J;){if(rt.x>=K&&rt.x<=et&&rt.y>=j&&rt.y<=nt&&rt!==C&&rt!==M&&g(R,W,U,V,X,Y,rt.x,rt.y)&&T(rt.prev,rt,rt.next)>=0)return!1;rt=rt.nextZ}return!0}function a(b,P,E){var A=b;do{var C=A.prev,w=A.next.next;!I(C,w)&&m(C,A,A.next,w)&&D(C,w)&&D(w,C)&&(P.push(C.i/E|0),P.push(A.i/E|0),P.push(w.i/E|0),q(A),q(A.next),A=b=w),A=A.next}while(A!==b);return e(A)}function o(b,P,E,A,C,w){var M=b;do{for(var R=M.next.next;R!==M.prev;){if(M.i!==R.i&&y(M,R)){var U=k(M,R);M=e(M,M.next),U=e(U,U.next),r(M,P,E,A,C,w,0),r(U,P,E,A,C,w,0);return}R=R.next}M=M.next}while(M!==b)}function h(b,P,E,A){var C=[],w,M,R,U,X;for(w=0,M=P.length;w<M;w++)R=P[w]*A,U=w<M-1?P[w+1]*A:b.length,X=t(b,R,U,A,!1),X===X.next&&(X.steiner=!0),C.push(p(X));for(C.sort(u),w=0;w<C.length;w++)E=l(C[w],E);return E}function u(b,P){return b.x-P.x}function l(b,P){var E=c(b,P);if(!E)return P;var A=k(E,b);return e(A,A.next),e(E,E.next)}function c(b,P){var E=P,A=b.x,C=b.y,w=-1/0,M;do{if(C<=E.y&&C>=E.next.y&&E.next.y!==E.y){var R=E.x+(C-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(R<=A&&R>w&&(w=R,M=E.x<E.next.x?E:E.next,R===A))return M}E=E.next}while(E!==P);if(!M)return null;var U=M,X=M.x,W=M.y,V=1/0,Y;E=M;do A>=E.x&&E.x>=X&&A!==E.x&&g(C<W?A:w,C,X,W,C<W?w:A,C,E.x,E.y)&&(Y=Math.abs(C-E.y)/(A-E.x),D(E,b)&&(Y<V||Y===V&&(E.x>M.x||E.x===M.x&&f(M,E)))&&(M=E,V=Y)),E=E.next;while(E!==U);return M}function f(b,P){return T(b.prev,b,P.prev)<0&&T(P.next,b,b.next)<0}function d(b,P,E,A){var C=b;do C.z===0&&(C.z=_(C.x,C.y,P,E,A)),C.prevZ=C.prev,C.nextZ=C.next,C=C.next;while(C!==b);C.prevZ.nextZ=null,C.prevZ=null,v(C)}function v(b){var P,E,A,C,w,M,R,U,X=1;do{for(E=b,b=null,w=null,M=0;E;){for(M++,A=E,R=0,P=0;P<X&&(R++,A=A.nextZ,!!A);P++);for(U=X;R>0||U>0&&A;)R!==0&&(U===0||!A||E.z<=A.z)?(C=E,E=E.nextZ,R--):(C=A,A=A.nextZ,U--),w?w.nextZ=C:b=C,C.prevZ=w,w=C;E=A}w.nextZ=null,X*=2}while(M>1);return b}function _(b,P,E,A,C){return b=(b-E)*C|0,P=(P-A)*C|0,b=(b|b<<8)&16711935,b=(b|b<<4)&252645135,b=(b|b<<2)&858993459,b=(b|b<<1)&1431655765,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,b|P<<1}function p(b){var P=b,E=b;do(P.x<E.x||P.x===E.x&&P.y<E.y)&&(E=P),P=P.next;while(P!==b);return E}function g(b,P,E,A,C,w,M,R){return(C-M)*(P-R)>=(b-M)*(w-R)&&(b-M)*(A-R)>=(E-M)*(P-R)&&(E-M)*(w-R)>=(C-M)*(A-R)}function y(b,P){return b.next.i!==P.i&&b.prev.i!==P.i&&!N(b,P)&&(D(b,P)&&D(P,b)&&F(b,P)&&(T(b.prev,b,P.prev)||T(b,P.prev,P))||I(b,P)&&T(b.prev,b,b.next)>0&&T(P.prev,P,P.next)>0)}function T(b,P,E){return(P.y-b.y)*(E.x-P.x)-(P.x-b.x)*(E.y-P.y)}function I(b,P){return b.x===P.x&&b.y===P.y}function m(b,P,E,A){var C=x(T(b,P,E)),w=x(T(b,P,A)),M=x(T(E,A,b)),R=x(T(E,A,P));return!!(C!==w&&M!==R||C===0&&S(b,E,P)||w===0&&S(b,A,P)||M===0&&S(E,b,A)||R===0&&S(E,P,A))}function S(b,P,E){return P.x<=Math.max(b.x,E.x)&&P.x>=Math.min(b.x,E.x)&&P.y<=Math.max(b.y,E.y)&&P.y>=Math.min(b.y,E.y)}function x(b){return b>0?1:b<0?-1:0}function N(b,P){var E=b;do{if(E.i!==b.i&&E.next.i!==b.i&&E.i!==P.i&&E.next.i!==P.i&&m(E,E.next,b,P))return!0;E=E.next}while(E!==b);return!1}function D(b,P){return T(b.prev,b,b.next)<0?T(b,P,b.next)>=0&&T(b,b.prev,P)>=0:T(b,P,b.prev)<0||T(b,b.next,P)<0}function F(b,P){var E=b,A=!1,C=(b.x+P.x)/2,w=(b.y+P.y)/2;do E.y>w!=E.next.y>w&&E.next.y!==E.y&&C<(E.next.x-E.x)*(w-E.y)/(E.next.y-E.y)+E.x&&(A=!A),E=E.next;while(E!==b);return A}function k(b,P){var E=new Z(b.i,b.x,b.y),A=new Z(P.i,P.x,P.y),C=b.next,w=P.prev;return b.next=P,P.prev=b,E.next=C,C.prev=E,A.next=E,E.prev=A,w.next=A,A.prev=w,A}function L(b,P,E,A){var C=new Z(b,P,E);return A?(C.next=A.next,C.prev=A,A.next.prev=C,A.next=C):(C.prev=C,C.next=C),C}function q(b){b.next.prev=b.prev,b.prev.next=b.next,b.prevZ&&(b.prevZ.nextZ=b.nextZ),b.nextZ&&(b.nextZ.prevZ=b.prevZ)}function Z(b,P,E){this.i=b,this.x=P,this.y=E,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(b,P,E,A){var C=P&&P.length,w=C?P[0]*E:b.length,M=Math.abs(G(b,0,w,E));if(C)for(var R=0,U=P.length;R<U;R++){var X=P[R]*E,W=R<U-1?P[R+1]*E:b.length;M-=Math.abs(G(b,X,W,E))}var V=0;for(R=0;R<A.length;R+=3){var Y=A[R]*E,K=A[R+1]*E,j=A[R+2]*E;V+=Math.abs((b[Y]-b[j])*(b[K+1]-b[Y+1])-(b[Y]-b[K])*(b[j+1]-b[Y+1]))}return M===0&&V===0?0:Math.abs((V-M)/M)};function G(b,P,E,A){for(var C=0,w=P,M=E-A;w<E;w+=A)C+=(b[M]-b[w])*(b[w+1]+b[M+1]),M=w;return C}return i.flatten=function(b){for(var P=b[0][0].length,E={vertices:[],holes:[],dimensions:P},A=0,C=0;C<b.length;C++){for(var w=0;w<b[C].length;w++)for(var M=0;M<P;M++)E.vertices.push(b[C][w][M]);C>0&&(A+=b[C-1].length,E.holes.push(A))}return E},Si.exports}var ec=tc();const Rn=An(ec);var Xe={},Nr={exports:{}};var rc=Nr.exports,ih;function ic(){return ih||(ih=1,function(i,t){(function(e){var r=t&&!t.nodeType&&t,n=i&&!i.nodeType&&i,s=typeof In=="object"&&In;(s.global===s||s.window===s||s.self===s)&&(e=s);var a,o=2147483647,h=36,u=1,l=26,c=38,f=700,d=72,v=128,_="-",p=/^xn--/,g=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=h-u,m=Math.floor,S=String.fromCharCode,x;function N(C){throw new RangeError(T[C])}function D(C,w){for(var M=C.length,R=[];M--;)R[M]=w(C[M]);return R}function F(C,w){var M=C.split("@"),R="";M.length>1&&(R=M[0]+"@",C=M[1]),C=C.replace(y,".");var U=C.split("."),X=D(U,w).join(".");return R+X}function k(C){for(var w=[],M=0,R=C.length,U,X;M<R;)U=C.charCodeAt(M++),U>=55296&&U<=56319&&M<R?(X=C.charCodeAt(M++),(X&64512)==56320?w.push(((U&1023)<<10)+(X&1023)+65536):(w.push(U),M--)):w.push(U);return w}function L(C){return D(C,function(w){var M="";return w>65535&&(w-=65536,M+=S(w>>>10&1023|55296),w=56320|w&1023),M+=S(w),M}).join("")}function q(C){return C-48<10?C-22:C-65<26?C-65:C-97<26?C-97:h}function Z(C,w){return C+22+75*(C<26)-((w!=0)<<5)}function G(C,w,M){var R=0;for(C=M?m(C/f):C>>1,C+=m(C/w);C>I*l>>1;R+=h)C=m(C/I);return m(R+(I+1)*C/(C+c))}function b(C){var w=[],M=C.length,R,U=0,X=v,W=d,V,Y,K,j,et,nt,ft,J,$;for(V=C.lastIndexOf(_),V<0&&(V=0),Y=0;Y<V;++Y)C.charCodeAt(Y)>=128&&N("not-basic"),w.push(C.charCodeAt(Y));for(K=V>0?V+1:0;K<M;){for(j=U,et=1,nt=h;K>=M&&N("invalid-input"),ft=q(C.charCodeAt(K++)),(ft>=h||ft>m((o-U)/et))&&N("overflow"),U+=ft*et,J=nt<=W?u:nt>=W+l?l:nt-W,!(ft<J);nt+=h)$=h-J,et>m(o/$)&&N("overflow"),et*=$;R=w.length+1,W=G(U-j,R,j==0),m(U/R)>o-X&&N("overflow"),X+=m(U/R),U%=R,w.splice(U++,0,X)}return L(w)}function P(C){var w,M,R,U,X,W,V,Y,K,j,et,nt=[],ft,J,$,rt;for(C=k(C),ft=C.length,w=v,M=0,X=d,W=0;W<ft;++W)et=C[W],et<128&&nt.push(S(et));for(R=U=nt.length,U&&nt.push(_);R<ft;){for(V=o,W=0;W<ft;++W)et=C[W],et>=w&&et<V&&(V=et);for(J=R+1,V-w>m((o-M)/J)&&N("overflow"),M+=(V-w)*J,w=V,W=0;W<ft;++W)if(et=C[W],et<w&&++M>o&&N("overflow"),et==w){for(Y=M,K=h;j=K<=X?u:K>=X+l?l:K-X,!(Y<j);K+=h)rt=Y-j,$=h-j,nt.push(S(Z(j+rt%$,0))),Y=m(rt/$);nt.push(S(Z(Y,0))),X=G(M,J,R==U),M=0,++R}++M,++w}return nt.join("")}function E(C){return F(C,function(w){return p.test(w)?b(w.slice(4).toLowerCase()):w})}function A(C){return F(C,function(w){return g.test(w)?"xn--"+P(w):w})}if(a={version:"1.4.1",ucs2:{decode:k,encode:L},decode:b,encode:P,toASCII:A,toUnicode:E},r&&n)if(i.exports==r)n.exports=a;else for(x in a)a.hasOwnProperty(x)&&(r[x]=a[x]);else e.punycode=a})(rc)}(Nr,Nr.exports)),Nr.exports}var On,nh;function nc(){return nh||(nh=1,On=Error),On}var Dn,sh;function sc(){return sh||(sh=1,Dn=EvalError),Dn}var Fn,ah;function ac(){return ah||(ah=1,Fn=RangeError),Fn}var Ln,oh;function oc(){return oh||(oh=1,Ln=ReferenceError),Ln}var Bn,hh;function uh(){return hh||(hh=1,Bn=SyntaxError),Bn}var Nn,lh;function Ur(){return lh||(lh=1,Nn=TypeError),Nn}var Un,fh;function hc(){return fh||(fh=1,Un=URIError),Un}var kn,ch;function uc(){return ch||(ch=1,kn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var n=42;t[e]=n;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==n||a.enumerable!==!0)return!1}return!0}),kn}var Gn,dh;function lc(){if(dh)return Gn;dh=1;var i=typeof Symbol<"u"&&Symbol,t=uc();return Gn=function(){return typeof i!="function"||typeof Symbol!="function"||typeof i("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Gn}var Xn,ph;function fc(){if(ph)return Xn;ph=1;var i={__proto__:null,foo:{}},t=Object;return Xn=function(){return{__proto__:i}.foo===i.foo&&!(i instanceof t)},Xn}var Hn,vh;function cc(){if(vh)return Hn;vh=1;var i="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,r="[object Function]",n=function(h,u){for(var l=[],c=0;c<h.length;c+=1)l[c]=h[c];for(var f=0;f<u.length;f+=1)l[f+h.length]=u[f];return l},s=function(h,u){for(var l=[],c=u,f=0;c<h.length;c+=1,f+=1)l[f]=h[c];return l},a=function(o,h){for(var u="",l=0;l<o.length;l+=1)u+=o[l],l+1<o.length&&(u+=h);return u};return Hn=function(h){var u=this;if(typeof u!="function"||t.apply(u)!==r)throw new TypeError(i+u);for(var l=s(arguments,1),c,f=function(){if(this instanceof c){var g=u.apply(this,n(l,arguments));return Object(g)===g?g:this}return u.apply(h,n(l,arguments))},d=e(0,u.length-l.length),v=[],_=0;_<d;_++)v[_]="$"+_;if(c=Function("binder","return function ("+a(v,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var p=function(){};p.prototype=u.prototype,c.prototype=new p,p.prototype=null}return c},Hn}var Vn,_h;function jn(){if(_h)return Vn;_h=1;var i=cc();return Vn=Function.prototype.bind||i,Vn}var zn,gh;function dc(){if(gh)return zn;gh=1;var i=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=jn();return zn=e.call(i,t),zn}var Wn,mh;function pr(){if(mh)return Wn;mh=1;var i,t=nc(),e=sc(),r=ac(),n=oc(),s=uh(),a=Ur(),o=hc(),h=Function,u=function(P){try{return h('"use strict"; return ('+P+").constructor;")()}catch{}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch{l=null}var c=function(){throw new a},f=l?function(){try{return arguments.callee,c}catch{try{return l(arguments,"callee").get}catch{return c}}}():c,d=lc()(),v=fc()(),_=Object.getPrototypeOf||(v?function(P){return P.__proto__}:null),p={},g=typeof Uint8Array>"u"||!_?i:_(Uint8Array),y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?i:ArrayBuffer,"%ArrayIteratorPrototype%":d&&_?_([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":typeof Atomics>"u"?i:Atomics,"%BigInt%":typeof BigInt>"u"?i:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?i:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":e,"%Float32Array%":typeof Float32Array>"u"?i:Float32Array,"%Float64Array%":typeof Float64Array>"u"?i:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?i:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":p,"%Int8Array%":typeof Int8Array>"u"?i:Int8Array,"%Int16Array%":typeof Int16Array>"u"?i:Int16Array,"%Int32Array%":typeof Int32Array>"u"?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&_?_(_([][Symbol.iterator]())):i,"%JSON%":typeof JSON=="object"?JSON:i,"%Map%":typeof Map>"u"?i:Map,"%MapIteratorPrototype%":typeof Map>"u"||!d||!_?i:_(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?i:Promise,"%Proxy%":typeof Proxy>"u"?i:Proxy,"%RangeError%":r,"%ReferenceError%":n,"%Reflect%":typeof Reflect>"u"?i:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?i:Set,"%SetIteratorPrototype%":typeof Set>"u"||!d||!_?i:_(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&_?_(""[Symbol.iterator]()):i,"%Symbol%":d?Symbol:i,"%SyntaxError%":s,"%ThrowTypeError%":f,"%TypedArray%":g,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?i:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?i:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?i:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?i:Uint32Array,"%URIError%":o,"%WeakMap%":typeof WeakMap>"u"?i:WeakMap,"%WeakRef%":typeof WeakRef>"u"?i:WeakRef,"%WeakSet%":typeof WeakSet>"u"?i:WeakSet};if(_)try{null.error}catch(P){var T=_(_(P));y["%Error.prototype%"]=T}var I=function P(E){var A;if(E==="%AsyncFunction%")A=u("async function () {}");else if(E==="%GeneratorFunction%")A=u("function* () {}");else if(E==="%AsyncGeneratorFunction%")A=u("async function* () {}");else if(E==="%AsyncGenerator%"){var C=P("%AsyncGeneratorFunction%");C&&(A=C.prototype)}else if(E==="%AsyncIteratorPrototype%"){var w=P("%AsyncGenerator%");w&&_&&(A=_(w.prototype))}return y[E]=A,A},m={__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"]},S=jn(),x=dc(),N=S.call(Function.call,Array.prototype.concat),D=S.call(Function.apply,Array.prototype.splice),F=S.call(Function.call,String.prototype.replace),k=S.call(Function.call,String.prototype.slice),L=S.call(Function.call,RegExp.prototype.exec),q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Z=/\\(\\)?/g,G=function(E){var A=k(E,0,1),C=k(E,-1);if(A==="%"&&C!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(C==="%"&&A!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var w=[];return F(E,q,function(M,R,U,X){w[w.length]=U?F(X,Z,"$1"):R||M}),w},b=function(E,A){var C=E,w;if(x(m,C)&&(w=m[C],C="%"+w[0]+"%"),x(y,C)){var M=y[C];if(M===p&&(M=I(C)),typeof M>"u"&&!A)throw new a("intrinsic "+E+" exists, but is not available. Please file an issue!");return{alias:w,name:C,value:M}}throw new s("intrinsic "+E+" does not exist!")};return Wn=function(E,A){if(typeof E!="string"||E.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof A!="boolean")throw new a('"allowMissing" argument must be a boolean');if(L(/^%?[^%]*%?$/,E)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var C=G(E),w=C.length>0?C[0]:"",M=b("%"+w+"%",A),R=M.name,U=M.value,X=!1,W=M.alias;W&&(w=W[0],D(C,N([0,1],W)));for(var V=1,Y=!0;V<C.length;V+=1){var K=C[V],j=k(K,0,1),et=k(K,-1);if((j==='"'||j==="'"||j==="`"||et==='"'||et==="'"||et==="`")&&j!==et)throw new s("property names with quotes must have matching quotes");if((K==="constructor"||!Y)&&(X=!0),w+="."+K,R="%"+w+"%",x(y,R))U=y[R];else if(U!=null){if(!(K in U)){if(!A)throw new a("base intrinsic for "+E+" exists, but the property is not available.");return}if(l&&V+1>=C.length){var nt=l(U,K);Y=!!nt,Y&&"get"in nt&&!("originalValue"in nt.get)?U=nt.get:U=U[K]}else Y=x(U,K),U=U[K];Y&&!X&&(y[R]=U)}}return U},Wn}var Yn={exports:{}},qn,yh;function $n(){if(yh)return qn;yh=1;var i=pr(),t=i("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return qn=t,qn}var Kn,xh;function bh(){if(xh)return Kn;xh=1;var i=pr(),t=i("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch{t=null}return Kn=t,Kn}var Zn,Th;function pc(){if(Th)return Zn;Th=1;var i=$n(),t=uh(),e=Ur(),r=bh();return Zn=function(s,a,o){if(!s||typeof s!="object"&&typeof s!="function")throw new e("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new e("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new e("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new e("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new e("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new e("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,f=!!r&&r(s,a);if(i)i(s,a,{configurable:l===null&&f?f.configurable:!l,enumerable:h===null&&f?f.enumerable:!h,value:o,writable:u===null&&f?f.writable:!u});else if(c||!h&&!u&&!l)s[a]=o;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Zn}var Jn,Eh;function vc(){if(Eh)return Jn;Eh=1;var i=$n(),t=function(){return!!i};return t.hasArrayLengthDefineBug=function(){if(!i)return null;try{return i([],"length",{value:1}).length!==1}catch{return!0}},Jn=t,Jn}var Qn,Sh;function _c(){if(Sh)return Qn;Sh=1;var i=pr(),t=pc(),e=vc()(),r=bh(),n=Ur(),s=i("%Math.floor%");return Qn=function(o,h){if(typeof o!="function")throw new n("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||s(h)!==h)throw new n("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],l=!0,c=!0;if("length"in o&&r){var f=r(o,"length");f&&!f.configurable&&(l=!1),f&&!f.writable&&(c=!1)}return(l||c||!u)&&(e?t(o,"length",h,!0,!0):t(o,"length",h)),o},Qn}var Ph;function gc(){return Ph||(Ph=1,function(i){var t=jn(),e=pr(),r=_c(),n=Ur(),s=e("%Function.prototype.apply%"),a=e("%Function.prototype.call%"),o=e("%Reflect.apply%",!0)||t.call(a,s),h=$n(),u=e("%Math.max%");i.exports=function(f){if(typeof f!="function")throw new n("a function is required");var d=o(t,a,arguments);return r(d,1+u(0,f.length-(arguments.length-1)),!0)};var l=function(){return o(t,s,arguments)};h?h(i.exports,"apply",{value:l}):i.exports.apply=l}(Yn)),Yn.exports}var ts,wh;function mc(){if(wh)return ts;wh=1;var i=pr(),t=gc(),e=t(i("String.prototype.indexOf"));return ts=function(n,s){var a=i(n,!!s);return typeof a=="function"&&e(n,".prototype.")>-1?t(a):a},ts}const yc=Zf(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var es,Ch;function xc(){if(Ch)return es;Ch=1;var i=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,e=i&&t&&typeof t.get=="function"?t.get:null,r=i&&Map.prototype.forEach,n=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=n&&s&&typeof s.get=="function"?s.get:null,o=n&&Set.prototype.forEach,h=typeof WeakMap=="function"&&WeakMap.prototype,u=h?WeakMap.prototype.has:null,l=typeof WeakSet=="function"&&WeakSet.prototype,c=l?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,d=f?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,_=Object.prototype.toString,p=Function.prototype.toString,g=String.prototype.match,y=String.prototype.slice,T=String.prototype.replace,I=String.prototype.toUpperCase,m=String.prototype.toLowerCase,S=RegExp.prototype.test,x=Array.prototype.concat,N=Array.prototype.join,D=Array.prototype.slice,F=Math.floor,k=typeof BigInt=="function"?BigInt.prototype.valueOf:null,L=Object.getOwnPropertySymbols,q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Z=typeof Symbol=="function"&&typeof Symbol.iterator=="object",G=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Z||!0)?Symbol.toStringTag:null,b=Object.prototype.propertyIsEnumerable,P=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(O){return O.__proto__}:null);function E(O,B){if(O===1/0||O===-1/0||O!==O||O&&O>-1e3&&O<1e3||S.call(/e/,B))return B;var ct=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof O=="number"){var gt=O<0?-F(-O):F(O);if(gt!==O){var At=String(gt),ht=y.call(B,At.length+1);return T.call(At,ct,"$&_")+"."+T.call(T.call(ht,/([0-9]{3})/g,"$&_"),/_$/,"")}}return T.call(B,ct,"$&_")}var A=yc,C=A.custom,w=et(C)?C:null;es=function O(B,ct,gt,At){var ht=ct||{};if(J(ht,"quoteStyle")&&ht.quoteStyle!=="single"&&ht.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(J(ht,"maxStringLength")&&(typeof ht.maxStringLength=="number"?ht.maxStringLength<0&&ht.maxStringLength!==1/0:ht.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var ke=J(ht,"customInspect")?ht.customInspect:!0;if(typeof ke!="boolean"&&ke!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(J(ht,"indent")&&ht.indent!==null&&ht.indent!==" "&&!(parseInt(ht.indent,10)===ht.indent&&ht.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(J(ht,"numericSeparator")&&typeof ht.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var fr=ht.numericSeparator;if(typeof B>"u")return"undefined";if(B===null)return"null";if(typeof B=="boolean")return B?"true":"false";if(typeof B=="string")return xi(B,ht);if(typeof B=="number"){if(B===0)return 1/0/B>0?"0":"-0";var Vt=String(B);return fr?E(B,Vt):Vt}if(typeof B=="bigint"){var Ge=String(B)+"n";return fr?E(B,Ge):Ge}var Bo=typeof ht.depth>"u"?5:ht.depth;if(typeof gt>"u"&&(gt=0),gt>=Bo&&Bo>0&&typeof B=="object")return U(B)?"[Array]":"[Object]";var Or=T0(ht,gt);if(typeof At>"u")At=[];else if(ot(At,B)>=0)return"[Circular]";function fe(Dr,Sn,S0){if(Sn&&(At=D.call(At),At.push(Sn)),S0){var Wf={depth:ht.depth};return J(ht,"quoteStyle")&&(Wf.quoteStyle=ht.quoteStyle),O(Dr,Wf,gt+1,At)}return O(Dr,ht,gt+1,At)}if(typeof B=="function"&&!W(B)){var kf=rt(B),Gf=Tn(B,fe);return"[Function"+(kf?": "+kf:" (anonymous)")+"]"+(Gf.length>0?" { "+N.call(Gf,", ")+" }":"")}if(et(B)){var Xf=Z?T.call(String(B),/^(Symbol\(.*\))_[^)]*$/,"$1"):q.call(B);return typeof B=="object"&&!Z?bi(Xf):Xf}if(bn(B)){for(var Ti="<"+m.call(String(B.nodeName)),No=B.attributes||[],En=0;En<No.length;En++)Ti+=" "+No[En].name+"="+M(R(No[En].value),"double",ht);return Ti+=">",B.childNodes&&B.childNodes.length&&(Ti+="..."),Ti+="</"+m.call(String(B.nodeName))+">",Ti}if(U(B)){if(B.length===0)return"[]";var Uo=Tn(B,fe);return Or&&!b0(Uo)?"["+Lo(Uo,Or)+"]":"[ "+N.call(Uo,", ")+" ]"}if(V(B)){var ko=Tn(B,fe);return!("cause"in Error.prototype)&&"cause"in B&&!b.call(B,"cause")?"{ ["+String(B)+"] "+N.call(x.call("[cause]: "+fe(B.cause),ko),", ")+" }":ko.length===0?"["+String(B)+"]":"{ ["+String(B)+"] "+N.call(ko,", ")+" }"}if(typeof B=="object"&&ke){if(w&&typeof B[w]=="function"&&A)return A(B,{depth:Bo-gt});if(ke!=="symbol"&&typeof B.inspect=="function")return B.inspect()}if(Ht(B)){var Hf=[];return r&&r.call(B,function(Dr,Sn){Hf.push(fe(Sn,B,!0)+" => "+fe(Dr,B))}),Uf("Map",e.call(B),Hf,Or)}if(yn(B)){var Vf=[];return o&&o.call(B,function(Dr){Vf.push(fe(Dr,B))}),Uf("Set",a.call(B),Vf,Or)}if(Ue(B))return Fo("WeakMap");if(xn(B))return Fo("WeakSet");if(Rr(B))return Fo("WeakRef");if(K(B))return bi(fe(Number(B)));if(nt(B))return bi(fe(k.call(B)));if(j(B))return bi(v.call(B));if(Y(B))return bi(fe(String(B)));if(typeof window<"u"&&B===window)return"{ [object Window] }";if(B===In)return"{ [object globalThis] }";if(!X(B)&&!W(B)){var Go=Tn(B,fe),jf=P?P(B)===Object.prototype:B instanceof Object||B.constructor===Object,Xo=B instanceof Object?"":"null prototype",zf=!jf&&G&&Object(B)===B&&G in B?y.call($(B),8,-1):Xo?"Object":"",E0=jf||typeof B.constructor!="function"?"":B.constructor.name?B.constructor.name+" ":"",Ho=E0+(zf||Xo?"["+N.call(x.call([],zf||[],Xo||[]),": ")+"] ":"");return Go.length===0?Ho+"{}":Or?Ho+"{"+Lo(Go,Or)+"}":Ho+"{ "+N.call(Go,", ")+" }"}return String(B)};function M(O,B,ct){var gt=(ct.quoteStyle||B)==="double"?'"':"'";return gt+O+gt}function R(O){return T.call(String(O),/"/g,""")}function U(O){return $(O)==="[object Array]"&&(!G||!(typeof O=="object"&&G in O))}function X(O){return $(O)==="[object Date]"&&(!G||!(typeof O=="object"&&G in O))}function W(O){return $(O)==="[object RegExp]"&&(!G||!(typeof O=="object"&&G in O))}function V(O){return $(O)==="[object Error]"&&(!G||!(typeof O=="object"&&G in O))}function Y(O){return $(O)==="[object String]"&&(!G||!(typeof O=="object"&&G in O))}function K(O){return $(O)==="[object Number]"&&(!G||!(typeof O=="object"&&G in O))}function j(O){return $(O)==="[object Boolean]"&&(!G||!(typeof O=="object"&&G in O))}function et(O){if(Z)return O&&typeof O=="object"&&O instanceof Symbol;if(typeof O=="symbol")return!0;if(!O||typeof O!="object"||!q)return!1;try{return q.call(O),!0}catch{}return!1}function nt(O){if(!O||typeof O!="object"||!k)return!1;try{return k.call(O),!0}catch{}return!1}var ft=Object.prototype.hasOwnProperty||function(O){return O in this};function J(O,B){return ft.call(O,B)}function $(O){return _.call(O)}function rt(O){if(O.name)return O.name;var B=g.call(p.call(O),/^function\s*([\w$]+)/);return B?B[1]:null}function ot(O,B){if(O.indexOf)return O.indexOf(B);for(var ct=0,gt=O.length;ct<gt;ct++)if(O[ct]===B)return ct;return-1}function Ht(O){if(!e||!O||typeof O!="object")return!1;try{e.call(O);try{a.call(O)}catch{return!0}return O instanceof Map}catch{}return!1}function Ue(O){if(!u||!O||typeof O!="object")return!1;try{u.call(O,u);try{c.call(O,c)}catch{return!0}return O instanceof WeakMap}catch{}return!1}function Rr(O){if(!d||!O||typeof O!="object")return!1;try{return d.call(O),!0}catch{}return!1}function yn(O){if(!a||!O||typeof O!="object")return!1;try{a.call(O);try{e.call(O)}catch{return!0}return O instanceof Set}catch{}return!1}function xn(O){if(!c||!O||typeof O!="object")return!1;try{c.call(O,c);try{u.call(O,u)}catch{return!0}return O instanceof WeakSet}catch{}return!1}function bn(O){return!O||typeof O!="object"?!1:typeof HTMLElement<"u"&&O instanceof HTMLElement?!0:typeof O.nodeName=="string"&&typeof O.getAttribute=="function"}function xi(O,B){if(O.length>B.maxStringLength){var ct=O.length-B.maxStringLength,gt="... "+ct+" more character"+(ct>1?"s":"");return xi(y.call(O,0,B.maxStringLength),B)+gt}var At=T.call(T.call(O,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,x0);return M(At,"single",B)}function x0(O){var B=O.charCodeAt(0),ct={8:"b",9:"t",10:"n",12:"f",13:"r"}[B];return ct?"\\"+ct:"\\x"+(B<16?"0":"")+I.call(B.toString(16))}function bi(O){return"Object("+O+")"}function Fo(O){return O+" { ? }"}function Uf(O,B,ct,gt){var At=gt?Lo(ct,gt):N.call(ct,", ");return O+" ("+B+") {"+At+"}"}function b0(O){for(var B=0;B<O.length;B++)if(ot(O[B],`
|
|
2
|
+
`)>=0)return!1;return!0}function T0(O,B){var ct;if(O.indent===" ")ct=" ";else if(typeof O.indent=="number"&&O.indent>0)ct=N.call(Array(O.indent+1)," ");else return null;return{base:ct,prev:N.call(Array(B+1),ct)}}function Lo(O,B){if(O.length===0)return"";var ct=`
|
|
3
|
+
`+B.prev+B.base;return ct+N.call(O,","+ct)+`
|
|
4
|
+
`+B.prev}function Tn(O,B){var ct=U(O),gt=[];if(ct){gt.length=O.length;for(var At=0;At<O.length;At++)gt[At]=J(O,At)?B(O[At],O):""}var ht=typeof L=="function"?L(O):[],ke;if(Z){ke={};for(var fr=0;fr<ht.length;fr++)ke["$"+ht[fr]]=ht[fr]}for(var Vt in O)J(O,Vt)&&(ct&&String(Number(Vt))===Vt&&Vt<O.length||Z&&ke["$"+Vt]instanceof Symbol||(S.call(/[^\w$]/,Vt)?gt.push(B(Vt,O)+": "+B(O[Vt],O)):gt.push(Vt+": "+B(O[Vt],O))));if(typeof L=="function")for(var Ge=0;Ge<ht.length;Ge++)b.call(O,ht[Ge])&>.push("["+B(ht[Ge])+"]: "+B(O[ht[Ge]],O));return gt}return es}var rs,Ih;function bc(){if(Ih)return rs;Ih=1;var i=pr(),t=mc(),e=xc(),r=Ur(),n=i("%WeakMap%",!0),s=i("%Map%",!0),a=t("WeakMap.prototype.get",!0),o=t("WeakMap.prototype.set",!0),h=t("WeakMap.prototype.has",!0),u=t("Map.prototype.get",!0),l=t("Map.prototype.set",!0),c=t("Map.prototype.has",!0),f=function(p,g){for(var y=p,T;(T=y.next)!==null;y=T)if(T.key===g)return y.next=T.next,T.next=p.next,p.next=T,T},d=function(p,g){var y=f(p,g);return y&&y.value},v=function(p,g,y){var T=f(p,g);T?T.value=y:p.next={key:g,next:p.next,value:y}},_=function(p,g){return!!f(p,g)};return rs=function(){var g,y,T,I={assert:function(m){if(!I.has(m))throw new r("Side channel does not contain "+e(m))},get:function(m){if(n&&m&&(typeof m=="object"||typeof m=="function")){if(g)return a(g,m)}else if(s){if(y)return u(y,m)}else if(T)return d(T,m)},has:function(m){if(n&&m&&(typeof m=="object"||typeof m=="function")){if(g)return h(g,m)}else if(s){if(y)return c(y,m)}else if(T)return _(T,m);return!1},set:function(m,S){n&&m&&(typeof m=="object"||typeof m=="function")?(g||(g=new n),o(g,m,S)):s?(y||(y=new s),l(y,m,S)):(T||(T={key:{},next:null}),v(T,m,S))}};return I},rs}var is,Ah;function ns(){if(Ah)return is;Ah=1;var i=String.prototype.replace,t=/%20/g,e={RFC1738:"RFC1738",RFC3986:"RFC3986"};return is={default:e.RFC3986,formatters:{RFC1738:function(r){return i.call(r,t,"+")},RFC3986:function(r){return String(r)}},RFC1738:e.RFC1738,RFC3986:e.RFC3986},is}var ss,Mh;function Rh(){if(Mh)return ss;Mh=1;var i=ns(),t=Object.prototype.hasOwnProperty,e=Array.isArray,r=function(){for(var p=[],g=0;g<256;++g)p.push("%"+((g<16?"0":"")+g.toString(16)).toUpperCase());return p}(),n=function(g){for(;g.length>1;){var y=g.pop(),T=y.obj[y.prop];if(e(T)){for(var I=[],m=0;m<T.length;++m)typeof T[m]<"u"&&I.push(T[m]);y.obj[y.prop]=I}}},s=function(g,y){for(var T=y&&y.plainObjects?Object.create(null):{},I=0;I<g.length;++I)typeof g[I]<"u"&&(T[I]=g[I]);return T},a=function p(g,y,T){if(!y)return g;if(typeof y!="object"){if(e(g))g.push(y);else if(g&&typeof g=="object")(T&&(T.plainObjects||T.allowPrototypes)||!t.call(Object.prototype,y))&&(g[y]=!0);else return[g,y];return g}if(!g||typeof g!="object")return[g].concat(y);var I=g;return e(g)&&!e(y)&&(I=s(g,T)),e(g)&&e(y)?(y.forEach(function(m,S){if(t.call(g,S)){var x=g[S];x&&typeof x=="object"&&m&&typeof m=="object"?g[S]=p(x,m,T):g.push(m)}else g[S]=m}),g):Object.keys(y).reduce(function(m,S){var x=y[S];return t.call(m,S)?m[S]=p(m[S],x,T):m[S]=x,m},I)},o=function(g,y){return Object.keys(y).reduce(function(T,I){return T[I]=y[I],T},g)},h=function(p,g,y){var T=p.replace(/\+/g," ");if(y==="iso-8859-1")return T.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(T)}catch{return T}},u=1024,l=function(g,y,T,I,m){if(g.length===0)return g;var S=g;if(typeof g=="symbol"?S=Symbol.prototype.toString.call(g):typeof g!="string"&&(S=String(g)),T==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(q){return"%26%23"+parseInt(q.slice(2),16)+"%3B"});for(var x="",N=0;N<S.length;N+=u){for(var D=S.length>=u?S.slice(N,N+u):S,F=[],k=0;k<D.length;++k){var L=D.charCodeAt(k);if(L===45||L===46||L===95||L===126||L>=48&&L<=57||L>=65&&L<=90||L>=97&&L<=122||m===i.RFC1738&&(L===40||L===41)){F[F.length]=D.charAt(k);continue}if(L<128){F[F.length]=r[L];continue}if(L<2048){F[F.length]=r[192|L>>6]+r[128|L&63];continue}if(L<55296||L>=57344){F[F.length]=r[224|L>>12]+r[128|L>>6&63]+r[128|L&63];continue}k+=1,L=65536+((L&1023)<<10|D.charCodeAt(k)&1023),F[F.length]=r[240|L>>18]+r[128|L>>12&63]+r[128|L>>6&63]+r[128|L&63]}x+=F.join("")}return x},c=function(g){for(var y=[{obj:{o:g},prop:"o"}],T=[],I=0;I<y.length;++I)for(var m=y[I],S=m.obj[m.prop],x=Object.keys(S),N=0;N<x.length;++N){var D=x[N],F=S[D];typeof F=="object"&&F!==null&&T.indexOf(F)===-1&&(y.push({obj:S,prop:D}),T.push(F))}return n(y),g},f=function(g){return Object.prototype.toString.call(g)==="[object RegExp]"},d=function(g){return!g||typeof g!="object"?!1:!!(g.constructor&&g.constructor.isBuffer&&g.constructor.isBuffer(g))},v=function(g,y){return[].concat(g,y)},_=function(g,y){if(e(g)){for(var T=[],I=0;I<g.length;I+=1)T.push(y(g[I]));return T}return y(g)};return ss={arrayToObject:s,assign:o,combine:v,compact:c,decode:h,encode:l,isBuffer:d,isRegExp:f,maybeMap:_,merge:a},ss}var as,Oh;function Tc(){if(Oh)return as;Oh=1;var i=bc(),t=Rh(),e=ns(),r=Object.prototype.hasOwnProperty,n={brackets:function(p){return p+"[]"},comma:"comma",indices:function(p,g){return p+"["+g+"]"},repeat:function(p){return p}},s=Array.isArray,a=Array.prototype.push,o=function(_,p){a.apply(_,s(p)?p:[p])},h=Date.prototype.toISOString,u=e.default,l={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t.encode,encodeValuesOnly:!1,format:u,formatter:e.formatters[u],indices:!1,serializeDate:function(p){return h.call(p)},skipNulls:!1,strictNullHandling:!1},c=function(p){return typeof p=="string"||typeof p=="number"||typeof p=="boolean"||typeof p=="symbol"||typeof p=="bigint"},f={},d=function _(p,g,y,T,I,m,S,x,N,D,F,k,L,q,Z,G,b,P){for(var E=p,A=P,C=0,w=!1;(A=A.get(f))!==void 0&&!w;){var M=A.get(p);if(C+=1,typeof M<"u"){if(M===C)throw new RangeError("Cyclic object value");w=!0}typeof A.get(f)>"u"&&(C=0)}if(typeof D=="function"?E=D(g,E):E instanceof Date?E=L(E):y==="comma"&&s(E)&&(E=t.maybeMap(E,function($){return $ instanceof Date?L($):$})),E===null){if(m)return N&&!G?N(g,l.encoder,b,"key",q):g;E=""}if(c(E)||t.isBuffer(E)){if(N){var R=G?g:N(g,l.encoder,b,"key",q);return[Z(R)+"="+Z(N(E,l.encoder,b,"value",q))]}return[Z(g)+"="+Z(String(E))]}var U=[];if(typeof E>"u")return U;var X;if(y==="comma"&&s(E))G&&N&&(E=t.maybeMap(E,N)),X=[{value:E.length>0?E.join(",")||null:void 0}];else if(s(D))X=D;else{var W=Object.keys(E);X=F?W.sort(F):W}var V=x?g.replace(/\./g,"%2E"):g,Y=T&&s(E)&&E.length===1?V+"[]":V;if(I&&s(E)&&E.length===0)return Y+"[]";for(var K=0;K<X.length;++K){var j=X[K],et=typeof j=="object"&&typeof j.value<"u"?j.value:E[j];if(!(S&&et===null)){var nt=k&&x?j.replace(/\./g,"%2E"):j,ft=s(E)?typeof y=="function"?y(Y,nt):Y:Y+(k?"."+nt:"["+nt+"]");P.set(p,C);var J=i();J.set(f,P),o(U,_(et,ft,y,T,I,m,S,x,y==="comma"&&G&&s(E)?null:N,D,F,k,L,q,Z,G,b,J))}}return U},v=function(p){if(!p)return l;if(typeof p.allowEmptyArrays<"u"&&typeof p.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof p.encodeDotInKeys<"u"&&typeof p.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(p.encoder!==null&&typeof p.encoder<"u"&&typeof p.encoder!="function")throw new TypeError("Encoder has to be a function.");var g=p.charset||l.charset;if(typeof p.charset<"u"&&p.charset!=="utf-8"&&p.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var y=e.default;if(typeof p.format<"u"){if(!r.call(e.formatters,p.format))throw new TypeError("Unknown format option provided.");y=p.format}var T=e.formatters[y],I=l.filter;(typeof p.filter=="function"||s(p.filter))&&(I=p.filter);var m;if(p.arrayFormat in n?m=p.arrayFormat:"indices"in p?m=p.indices?"indices":"repeat":m=l.arrayFormat,"commaRoundTrip"in p&&typeof p.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof p.allowDots>"u"?p.encodeDotInKeys===!0?!0:l.allowDots:!!p.allowDots;return{addQueryPrefix:typeof p.addQueryPrefix=="boolean"?p.addQueryPrefix:l.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:l.allowEmptyArrays,arrayFormat:m,charset:g,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:l.charsetSentinel,commaRoundTrip:p.commaRoundTrip,delimiter:typeof p.delimiter>"u"?l.delimiter:p.delimiter,encode:typeof p.encode=="boolean"?p.encode:l.encode,encodeDotInKeys:typeof p.encodeDotInKeys=="boolean"?p.encodeDotInKeys:l.encodeDotInKeys,encoder:typeof p.encoder=="function"?p.encoder:l.encoder,encodeValuesOnly:typeof p.encodeValuesOnly=="boolean"?p.encodeValuesOnly:l.encodeValuesOnly,filter:I,format:y,formatter:T,serializeDate:typeof p.serializeDate=="function"?p.serializeDate:l.serializeDate,skipNulls:typeof p.skipNulls=="boolean"?p.skipNulls:l.skipNulls,sort:typeof p.sort=="function"?p.sort:null,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:l.strictNullHandling}};return as=function(_,p){var g=_,y=v(p),T,I;typeof y.filter=="function"?(I=y.filter,g=I("",g)):s(y.filter)&&(I=y.filter,T=I);var m=[];if(typeof g!="object"||g===null)return"";var S=n[y.arrayFormat],x=S==="comma"&&y.commaRoundTrip;T||(T=Object.keys(g)),y.sort&&T.sort(y.sort);for(var N=i(),D=0;D<T.length;++D){var F=T[D];y.skipNulls&&g[F]===null||o(m,d(g[F],F,S,x,y.allowEmptyArrays,y.strictNullHandling,y.skipNulls,y.encodeDotInKeys,y.encode?y.encoder:null,y.filter,y.sort,y.allowDots,y.serializeDate,y.format,y.formatter,y.encodeValuesOnly,y.charset,N))}var k=m.join(y.delimiter),L=y.addQueryPrefix===!0?"?":"";return y.charsetSentinel&&(y.charset==="iso-8859-1"?L+="utf8=%26%2310003%3B&":L+="utf8=%E2%9C%93&"),k.length>0?L+k:""},as}var os,Dh;function Ec(){if(Dh)return os;Dh=1;var i=Rh(),t=Object.prototype.hasOwnProperty,e=Array.isArray,r={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},n=function(f){return f.replace(/&#(\d+);/g,function(d,v){return String.fromCharCode(parseInt(v,10))})},s=function(f,d){return f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1?f.split(","):f},a="utf8=%26%2310003%3B",o="utf8=%E2%9C%93",h=function(d,v){var _={__proto__:null},p=v.ignoreQueryPrefix?d.replace(/^\?/,""):d;p=p.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var g=v.parameterLimit===1/0?void 0:v.parameterLimit,y=p.split(v.delimiter,g),T=-1,I,m=v.charset;if(v.charsetSentinel)for(I=0;I<y.length;++I)y[I].indexOf("utf8=")===0&&(y[I]===o?m="utf-8":y[I]===a&&(m="iso-8859-1"),T=I,I=y.length);for(I=0;I<y.length;++I)if(I!==T){var S=y[I],x=S.indexOf("]="),N=x===-1?S.indexOf("="):x+1,D,F;N===-1?(D=v.decoder(S,r.decoder,m,"key"),F=v.strictNullHandling?null:""):(D=v.decoder(S.slice(0,N),r.decoder,m,"key"),F=i.maybeMap(s(S.slice(N+1),v),function(L){return v.decoder(L,r.decoder,m,"value")})),F&&v.interpretNumericEntities&&m==="iso-8859-1"&&(F=n(F)),S.indexOf("[]=")>-1&&(F=e(F)?[F]:F);var k=t.call(_,D);k&&v.duplicates==="combine"?_[D]=i.combine(_[D],F):(!k||v.duplicates==="last")&&(_[D]=F)}return _},u=function(f,d,v,_){for(var p=_?d:s(d,v),g=f.length-1;g>=0;--g){var y,T=f[g];if(T==="[]"&&v.parseArrays)y=v.allowEmptyArrays&&(p===""||v.strictNullHandling&&p===null)?[]:[].concat(p);else{y=v.plainObjects?Object.create(null):{};var I=T.charAt(0)==="["&&T.charAt(T.length-1)==="]"?T.slice(1,-1):T,m=v.decodeDotInKeys?I.replace(/%2E/g,"."):I,S=parseInt(m,10);!v.parseArrays&&m===""?y={0:p}:!isNaN(S)&&T!==m&&String(S)===m&&S>=0&&v.parseArrays&&S<=v.arrayLimit?(y=[],y[S]=p):m!=="__proto__"&&(y[m]=p)}p=y}return p},l=function(d,v,_,p){if(d){var g=_.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,y=/(\[[^[\]]*])/,T=/(\[[^[\]]*])/g,I=_.depth>0&&y.exec(g),m=I?g.slice(0,I.index):g,S=[];if(m){if(!_.plainObjects&&t.call(Object.prototype,m)&&!_.allowPrototypes)return;S.push(m)}for(var x=0;_.depth>0&&(I=T.exec(g))!==null&&x<_.depth;){if(x+=1,!_.plainObjects&&t.call(Object.prototype,I[1].slice(1,-1))&&!_.allowPrototypes)return;S.push(I[1])}if(I){if(_.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+_.depth+" and strictDepth is true");S.push("["+g.slice(I.index)+"]")}return u(S,v,_,p)}},c=function(d){if(!d)return r;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var v=typeof d.charset>"u"?r.charset:d.charset,_=typeof d.duplicates>"u"?r.duplicates:d.duplicates;if(_!=="combine"&&_!=="first"&&_!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var p=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:r.allowDots:!!d.allowDots;return{allowDots:p,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:r.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:r.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:r.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:r.arrayLimit,charset:v,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:r.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:r.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:r.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:r.decoder,delimiter:typeof d.delimiter=="string"||i.isRegExp(d.delimiter)?d.delimiter:r.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:r.depth,duplicates:_,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:r.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:r.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:r.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:r.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:r.strictNullHandling}};return os=function(f,d){var v=c(d);if(f===""||f===null||typeof f>"u")return v.plainObjects?Object.create(null):{};for(var _=typeof f=="string"?h(f,v):f,p=v.plainObjects?Object.create(null):{},g=Object.keys(_),y=0;y<g.length;++y){var T=g[y],I=l(T,_[T],v,typeof f=="string");p=i.merge(p,I,v)}return v.allowSparse===!0?p:i.compact(p)},os}var hs,Fh;function Sc(){if(Fh)return hs;Fh=1;var i=Tc(),t=Ec(),e=ns();return hs={formats:e,parse:t,stringify:i},hs}var Lh;function Pc(){if(Lh)return Xe;Lh=1;var i=ic();function t(){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 e=/^([a-z0-9.+-]+:)/i,r=/:[0-9]*$/,n=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,s=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],a=["{","}","|","\\","^","`"].concat(s),o=["'"].concat(a),h=["%","/","?",";","#"].concat(o),u=["/","?","#"],l=255,c=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},p=Sc();function g(m,S,x){if(m&&typeof m=="object"&&m instanceof t)return m;var N=new t;return N.parse(m,S,x),N}t.prototype.parse=function(m,S,x){if(typeof m!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof m);var N=m.indexOf("?"),D=N!==-1&&N<m.indexOf("#")?"?":"#",F=m.split(D),k=/\\/g;F[0]=F[0].replace(k,"/"),m=F.join(D);var L=m;if(L=L.trim(),!x&&m.split("#").length===1){var q=n.exec(L);if(q)return this.path=L,this.href=L,this.pathname=q[1],q[2]?(this.search=q[2],S?this.query=p.parse(this.search.substr(1)):this.query=this.search.substr(1)):S&&(this.search="",this.query={}),this}var Z=e.exec(L);if(Z){Z=Z[0];var G=Z.toLowerCase();this.protocol=G,L=L.substr(Z.length)}if(x||Z||L.match(/^\/\/[^@/]+@[^@/]+/)){var b=L.substr(0,2)==="//";b&&!(Z&&v[Z])&&(L=L.substr(2),this.slashes=!0)}if(!v[Z]&&(b||Z&&!_[Z])){for(var P=-1,E=0;E<u.length;E++){var A=L.indexOf(u[E]);A!==-1&&(P===-1||A<P)&&(P=A)}var C,w;P===-1?w=L.lastIndexOf("@"):w=L.lastIndexOf("@",P),w!==-1&&(C=L.slice(0,w),L=L.slice(w+1),this.auth=decodeURIComponent(C)),P=-1;for(var E=0;E<h.length;E++){var A=L.indexOf(h[E]);A!==-1&&(P===-1||A<P)&&(P=A)}P===-1&&(P=L.length),this.host=L.slice(0,P),L=L.slice(P),this.parseHost(),this.hostname=this.hostname||"";var M=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!M)for(var R=this.hostname.split(/\./),E=0,U=R.length;E<U;E++){var X=R[E];if(X&&!X.match(c)){for(var W="",V=0,Y=X.length;V<Y;V++)X.charCodeAt(V)>127?W+="x":W+=X[V];if(!W.match(c)){var K=R.slice(0,E),j=R.slice(E+1),et=X.match(f);et&&(K.push(et[1]),j.unshift(et[2])),j.length&&(L="/"+j.join(".")+L),this.hostname=K.join(".");break}}}this.hostname.length>l?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=i.toASCII(this.hostname));var nt=this.port?":"+this.port:"",ft=this.hostname||"";this.host=ft+nt,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),L[0]!=="/"&&(L="/"+L))}if(!d[G])for(var E=0,U=o.length;E<U;E++){var J=o[E];if(L.indexOf(J)!==-1){var $=encodeURIComponent(J);$===J&&($=escape(J)),L=L.split(J).join($)}}var rt=L.indexOf("#");rt!==-1&&(this.hash=L.substr(rt),L=L.slice(0,rt));var ot=L.indexOf("?");if(ot!==-1?(this.search=L.substr(ot),this.query=L.substr(ot+1),S&&(this.query=p.parse(this.query)),L=L.slice(0,ot)):S&&(this.search="",this.query={}),L&&(this.pathname=L),_[G]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var nt=this.pathname||"",Ht=this.search||"";this.path=nt+Ht}return this.href=this.format(),this};function y(m){return typeof m=="string"&&(m=g(m)),m instanceof t?m.format():t.prototype.format.call(m)}t.prototype.format=function(){var m=this.auth||"";m&&(m=encodeURIComponent(m),m=m.replace(/%3A/i,":"),m+="@");var S=this.protocol||"",x=this.pathname||"",N=this.hash||"",D=!1,F="";this.host?D=m+this.host:this.hostname&&(D=m+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(D+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(F=p.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var k=this.search||F&&"?"+F||"";return S&&S.substr(-1)!==":"&&(S+=":"),this.slashes||(!S||_[S])&&D!==!1?(D="//"+(D||""),x&&x.charAt(0)!=="/"&&(x="/"+x)):D||(D=""),N&&N.charAt(0)!=="#"&&(N="#"+N),k&&k.charAt(0)!=="?"&&(k="?"+k),x=x.replace(/[?#]/g,function(L){return encodeURIComponent(L)}),k=k.replace("#","%23"),S+D+x+k+N};function T(m,S){return g(m,!1,!0).resolve(S)}t.prototype.resolve=function(m){return this.resolveObject(g(m,!1,!0)).format()};function I(m,S){return m?g(m,!1,!0).resolveObject(S):S}return t.prototype.resolveObject=function(m){if(typeof m=="string"){var S=new t;S.parse(m,!1,!0),m=S}for(var x=new t,N=Object.keys(this),D=0;D<N.length;D++){var F=N[D];x[F]=this[F]}if(x.hash=m.hash,m.href==="")return x.href=x.format(),x;if(m.slashes&&!m.protocol){for(var k=Object.keys(m),L=0;L<k.length;L++){var q=k[L];q!=="protocol"&&(x[q]=m[q])}return _[x.protocol]&&x.hostname&&!x.pathname&&(x.pathname="/",x.path=x.pathname),x.href=x.format(),x}if(m.protocol&&m.protocol!==x.protocol){if(!_[m.protocol]){for(var Z=Object.keys(m),G=0;G<Z.length;G++){var b=Z[G];x[b]=m[b]}return x.href=x.format(),x}if(x.protocol=m.protocol,!m.host&&!v[m.protocol]){for(var U=(m.pathname||"").split("/");U.length&&!(m.host=U.shift()););m.host||(m.host=""),m.hostname||(m.hostname=""),U[0]!==""&&U.unshift(""),U.length<2&&U.unshift(""),x.pathname=U.join("/")}else x.pathname=m.pathname;if(x.search=m.search,x.query=m.query,x.host=m.host||"",x.auth=m.auth,x.hostname=m.hostname||m.host,x.port=m.port,x.pathname||x.search){var P=x.pathname||"",E=x.search||"";x.path=P+E}return x.slashes=x.slashes||m.slashes,x.href=x.format(),x}var A=x.pathname&&x.pathname.charAt(0)==="/",C=m.host||m.pathname&&m.pathname.charAt(0)==="/",w=C||A||x.host&&m.pathname,M=w,R=x.pathname&&x.pathname.split("/")||[],U=m.pathname&&m.pathname.split("/")||[],X=x.protocol&&!_[x.protocol];if(X&&(x.hostname="",x.port=null,x.host&&(R[0]===""?R[0]=x.host:R.unshift(x.host)),x.host="",m.protocol&&(m.hostname=null,m.port=null,m.host&&(U[0]===""?U[0]=m.host:U.unshift(m.host)),m.host=null),w=w&&(U[0]===""||R[0]==="")),C)x.host=m.host||m.host===""?m.host:x.host,x.hostname=m.hostname||m.hostname===""?m.hostname:x.hostname,x.search=m.search,x.query=m.query,R=U;else if(U.length)R||(R=[]),R.pop(),R=R.concat(U),x.search=m.search,x.query=m.query;else if(m.search!=null){if(X){x.host=R.shift(),x.hostname=x.host;var W=x.host&&x.host.indexOf("@")>0?x.host.split("@"):!1;W&&(x.auth=W.shift(),x.hostname=W.shift(),x.host=x.hostname)}return x.search=m.search,x.query=m.query,(x.pathname!==null||x.search!==null)&&(x.path=(x.pathname?x.pathname:"")+(x.search?x.search:"")),x.href=x.format(),x}if(!R.length)return x.pathname=null,x.search?x.path="/"+x.search:x.path=null,x.href=x.format(),x;for(var V=R.slice(-1)[0],Y=(x.host||m.host||R.length>1)&&(V==="."||V==="..")||V==="",K=0,j=R.length;j>=0;j--)V=R[j],V==="."?R.splice(j,1):V===".."?(R.splice(j,1),K++):K&&(R.splice(j,1),K--);if(!w&&!M)for(;K--;K)R.unshift("..");w&&R[0]!==""&&(!R[0]||R[0].charAt(0)!=="/")&&R.unshift(""),Y&&R.join("/").substr(-1)!=="/"&&R.push("");var et=R[0]===""||R[0]&&R[0].charAt(0)==="/";if(X){x.hostname=et?"":R.length?R.shift():"",x.host=x.hostname;var W=x.host&&x.host.indexOf("@")>0?x.host.split("@"):!1;W&&(x.auth=W.shift(),x.hostname=W.shift(),x.host=x.hostname)}return w=w||x.host&&R.length,w&&!et&&R.unshift(""),R.length>0?x.pathname=R.join("/"):(x.pathname=null,x.path=null),(x.pathname!==null||x.search!==null)&&(x.path=(x.pathname?x.pathname:"")+(x.search?x.search:"")),x.auth=m.auth||x.auth,x.slashes=x.slashes||m.slashes,x.href=x.format(),x},t.prototype.parseHost=function(){var m=this.host,S=r.exec(m);S&&(S=S[0],S!==":"&&(this.port=S.substr(1)),m=m.substr(0,m.length-S.length)),m&&(this.hostname=m)},Xe.parse=g,Xe.resolve=T,Xe.resolveObject=I,Xe.format=y,Xe.Url=t,Xe}var us=Pc();var ce={parse:us.parse,format:us.format,resolve:us.resolve};function ae(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Bh(i){var t=i.split("?")[0];return t.split("#")[0]}function wc(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cc(i,t,e){return i.replace(new RegExp(wc(t),"g"),e)}function Ic(i,t){for(var e="",r=0,n=-1,s=0,a,o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(n===o-1||s===1))if(n!==o-1&&s===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){var h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),n=o,s=0;continue}}else if(e.length===2||e.length===1){e="",r=0,n=o,s=0;continue}}}else e.length>0?e+="/"+i.slice(n+1,o):e=i.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return e}var Nh={toPosix:function(i){return Cc(i,"\\","/")},isUrl:function(i){return/^https?:/.test(this.toPosix(i))},isDataUrl:function(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},hasProtocol:function(i){return/^[^/:]+:\//.test(this.toPosix(i))},getProtocol:function(i){ae(i),i=this.toPosix(i);var t="",e=/^file:\/\/\//.exec(i),r=/^[^/:]+:\/\//.exec(i),n=/^[^/:]+:\//.exec(i);if(e||r||n){var s=(e==null?void 0:e[0])||(r==null?void 0:r[0])||(n==null?void 0:n[0]);t=s,i=i.slice(s.length)}return t},toAbsolute:function(i,t,e){if(this.isDataUrl(i))return i;var r=Bh(this.toPosix(t??z.ADAPTER.getBaseUrl())),n=Bh(this.toPosix(e??this.rootname(r)));if(ae(i),i=this.toPosix(i),i.startsWith("/"))return Nh.join(n,i.slice(1));var s=this.isAbsolute(i)?i:this.join(r,i);return s},normalize:function(i){if(i=this.toPosix(i),ae(i),i.length===0)return".";var t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));var r=i.endsWith("/");return i=Ic(i),i.length>0&&r&&(i+="/"),e?"/"+i:t+i},isAbsolute:function(i){return ae(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join:function(){for(var i=arguments,t,e=[],r=0;r<arguments.length;r++)e[r]=i[r];if(e.length===0)return".";for(var n,s=0;s<e.length;++s){var a=e[s];if(ae(a),a.length>0)if(n===void 0)n=a;else{var o=(t=e[s-1])!==null&&t!==void 0?t:"";this.extname(o)?n+="/../"+a:n+="/"+a}}return n===void 0?".":this.normalize(n)},dirname:function(i){if(ae(i),i.length===0)return".";i=this.toPosix(i);var t=i.charCodeAt(0),e=t===47,r=-1,n=!0,s=this.getProtocol(i),a=i;i=i.slice(s.length);for(var o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?e?"/":this.isUrl(a)?s+i:s:e&&r===1?"//":s+i.slice(0,r)},rootname:function(i){ae(i),i=this.toPosix(i);var t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){var e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename:function(i,t){ae(i),t&&ae(t),i=this.toPosix(i);var e=0,r=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";var a=t.length-1,o=-1;for(s=i.length-1;s>=0;--s){var h=i.charCodeAt(s);if(h===47){if(!n){e=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return e===r?r=o:r===-1&&(r=i.length),i.slice(e,r)}for(s=i.length-1;s>=0;--s)if(i.charCodeAt(s)===47){if(!n){e=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":i.slice(e,r)},extname:function(i){ae(i),i=this.toPosix(i);for(var t=-1,e=0,r=-1,n=!0,s=0,a=i.length-1;a>=0;--a){var o=i.charCodeAt(a);if(o===47){if(!n){e=a+1;break}continue}r===-1&&(n=!1,r=a+1),o===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse:function(i){ae(i);var t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=this.toPosix(i);var e=i.charCodeAt(0),r=this.isAbsolute(i),n;t.root=this.rootname(i),r||this.hasProtocol(i)?n=1:n=0;for(var s=-1,a=0,o=-1,h=!0,u=i.length-1,l=0;u>=n;--u){if(e=i.charCodeAt(u),e===47){if(!h){a=u+1;break}continue}o===-1&&(h=!1,o=u+1),e===46?s===-1?s=u:l!==1&&(l=1):s!==-1&&(l=-1)}return s===-1||o===-1||l===0||l===1&&s===o-1&&s===a+1?o!==-1&&(a===0&&r?t.base=t.name=i.slice(1,o):t.base=t.name=i.slice(a,o)):(a===0&&r?(t.name=i.slice(1,s),t.base=i.slice(1,o)):(t.name=i.slice(a,s),t.base=i.slice(a,o)),t.ext=i.slice(s,o)),t.dir=this.dirname(i),t},sep:"/",delimiter:":"};z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ls=!1,Uh="6.5.10";function Ac(){ls=!0}function kh(i){var t;if(!ls){if(z.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var e=[`
|
|
6
|
+
%c %c %c PixiJS `+Uh+" - ✰ "+i+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
|
|
7
|
+
|
|
8
|
+
`,"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;"];(t=globalThis.console).log.apply(t,e)}else globalThis.console&&globalThis.console.log("PixiJS "+Uh+" - "+i+" - http://www.pixijs.com/");ls=!0}}var fs;function Gh(){return typeof fs>"u"&&(fs=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;var e=z.ADAPTER.createCanvas(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),n=!!(r&&r.getContextAttributes().stencil);if(r){var s=r.getExtension("WEBGL_lose_context");s&&s.loseContext()}return r=null,n}catch{return!1}}()),fs}var Mc="#f0f8ff",Rc="#faebd7",Oc="#00ffff",Dc="#7fffd4",Fc="#f0ffff",Lc="#f5f5dc",Bc="#ffe4c4",Nc="#000000",Uc="#ffebcd",kc="#0000ff",Gc="#8a2be2",Xc="#a52a2a",Hc="#deb887",Vc="#5f9ea0",jc="#7fff00",zc="#d2691e",Wc="#ff7f50",Yc="#6495ed",qc="#fff8dc",$c="#dc143c",Kc="#00ffff",Zc="#00008b",Jc="#008b8b",Qc="#b8860b",td="#a9a9a9",ed="#006400",rd="#a9a9a9",id="#bdb76b",nd="#8b008b",sd="#556b2f",ad="#ff8c00",od="#9932cc",hd="#8b0000",ud="#e9967a",ld="#8fbc8f",fd="#483d8b",cd="#2f4f4f",dd="#2f4f4f",pd="#00ced1",vd="#9400d3",_d="#ff1493",gd="#00bfff",md="#696969",yd="#696969",xd="#1e90ff",bd="#b22222",Td="#fffaf0",Ed="#228b22",Sd="#ff00ff",Pd="#dcdcdc",wd="#f8f8ff",Cd="#daa520",Id="#ffd700",Ad="#808080",Md="#008000",Rd="#adff2f",Od="#808080",Dd="#f0fff0",Fd="#ff69b4",Ld="#cd5c5c",Bd="#4b0082",Nd="#fffff0",Ud="#f0e68c",kd="#fff0f5",Gd="#e6e6fa",Xd="#7cfc00",Hd="#fffacd",Vd="#add8e6",jd="#f08080",zd="#e0ffff",Wd="#fafad2",Yd="#d3d3d3",qd="#90ee90",$d="#d3d3d3",Kd="#ffb6c1",Zd="#ffa07a",Jd="#20b2aa",Qd="#87cefa",tp="#778899",ep="#778899",rp="#b0c4de",ip="#ffffe0",np="#00ff00",sp="#32cd32",ap="#faf0e6",op="#ff00ff",hp="#800000",up="#66cdaa",lp="#0000cd",fp="#ba55d3",cp="#9370db",dp="#3cb371",pp="#7b68ee",vp="#00fa9a",_p="#48d1cc",gp="#c71585",mp="#191970",yp="#f5fffa",xp="#ffe4e1",bp="#ffe4b5",Tp="#ffdead",Ep="#000080",Sp="#fdf5e6",Pp="#808000",wp="#6b8e23",Cp="#ffa500",Ip="#ff4500",Ap="#da70d6",Mp="#eee8aa",Rp="#98fb98",Op="#afeeee",Dp="#db7093",Fp="#ffefd5",Lp="#ffdab9",Bp="#cd853f",Np="#ffc0cb",Up="#dda0dd",kp="#b0e0e6",Gp="#800080",Xp="#663399",Hp="#ff0000",Vp="#bc8f8f",jp="#4169e1",zp="#8b4513",Wp="#fa8072",Yp="#f4a460",qp="#2e8b57",$p="#fff5ee",Kp="#a0522d",Zp="#c0c0c0",Jp="#87ceeb",Qp="#6a5acd",tv="#708090",ev="#708090",rv="#fffafa",iv="#00ff7f",nv="#4682b4",sv="#d2b48c",av="#008080",ov="#d8bfd8",hv="#ff6347",uv="#40e0d0",lv="#ee82ee",fv="#f5deb3",cv="#ffffff",dv="#f5f5f5",pv="#ffff00",vv="#9acd32",_v={aliceblue:Mc,antiquewhite:Rc,aqua:Oc,aquamarine:Dc,azure:Fc,beige:Lc,bisque:Bc,black:Nc,blanchedalmond:Uc,blue:kc,blueviolet:Gc,brown:Xc,burlywood:Hc,cadetblue:Vc,chartreuse:jc,chocolate:zc,coral:Wc,cornflowerblue:Yc,cornsilk:qc,crimson:$c,cyan:Kc,darkblue:Zc,darkcyan:Jc,darkgoldenrod:Qc,darkgray:td,darkgreen:ed,darkgrey:rd,darkkhaki:id,darkmagenta:nd,darkolivegreen:sd,darkorange:ad,darkorchid:od,darkred:hd,darksalmon:ud,darkseagreen:ld,darkslateblue:fd,darkslategray:cd,darkslategrey:dd,darkturquoise:pd,darkviolet:vd,deeppink:_d,deepskyblue:gd,dimgray:md,dimgrey:yd,dodgerblue:xd,firebrick:bd,floralwhite:Td,forestgreen:Ed,fuchsia:Sd,gainsboro:Pd,ghostwhite:wd,goldenrod:Cd,gold:Id,gray:Ad,green:Md,greenyellow:Rd,grey:Od,honeydew:Dd,hotpink:Fd,indianred:Ld,indigo:Bd,ivory:Nd,khaki:Ud,lavenderblush:kd,lavender:Gd,lawngreen:Xd,lemonchiffon:Hd,lightblue:Vd,lightcoral:jd,lightcyan:zd,lightgoldenrodyellow:Wd,lightgray:Yd,lightgreen:qd,lightgrey:$d,lightpink:Kd,lightsalmon:Zd,lightseagreen:Jd,lightskyblue:Qd,lightslategray:tp,lightslategrey:ep,lightsteelblue:rp,lightyellow:ip,lime:np,limegreen:sp,linen:ap,magenta:op,maroon:hp,mediumaquamarine:up,mediumblue:lp,mediumorchid:fp,mediumpurple:cp,mediumseagreen:dp,mediumslateblue:pp,mediumspringgreen:vp,mediumturquoise:_p,mediumvioletred:gp,midnightblue:mp,mintcream:yp,mistyrose:xp,moccasin:bp,navajowhite:Tp,navy:Ep,oldlace:Sp,olive:Pp,olivedrab:wp,orange:Cp,orangered:Ip,orchid:Ap,palegoldenrod:Mp,palegreen:Rp,paleturquoise:Op,palevioletred:Dp,papayawhip:Fp,peachpuff:Lp,peru:Bp,pink:Np,plum:Up,powderblue:kp,purple:Gp,rebeccapurple:Xp,red:Hp,rosybrown:Vp,royalblue:jp,saddlebrown:zp,salmon:Wp,sandybrown:Yp,seagreen:qp,seashell:$p,sienna:Kp,silver:Zp,skyblue:Jp,slateblue:Qp,slategray:tv,slategrey:ev,snow:rv,springgreen:iv,steelblue:nv,tan:sv,teal:av,thistle:ov,tomato:hv,turquoise:uv,violet:lv,wheat:fv,white:cv,whitesmoke:dv,yellow:pv,yellowgreen:vv};function He(i,t){return t===void 0&&(t=[]),t[0]=(i>>16&255)/255,t[1]=(i>>8&255)/255,t[2]=(i&255)/255,t}function cs(i){var t=i.toString(16);return t="000000".substring(0,6-t.length)+t,"#"+t}function ds(i){return typeof i=="string"&&(i=_v[i.toLowerCase()]||i,i[0]==="#"&&(i=i.slice(1))),parseInt(i,16)}function gv(i){return(i[0]*255<<16)+(i[1]*255<<8)+(i[2]*255|0)}function mv(){for(var i=[],t=[],e=0;e<32;e++)i[e]=e,t[e]=e;i[tt.NORMAL_NPM]=tt.NORMAL,i[tt.ADD_NPM]=tt.ADD,i[tt.SCREEN_NPM]=tt.SCREEN,t[tt.NORMAL]=tt.NORMAL_NPM,t[tt.ADD]=tt.ADD_NPM,t[tt.SCREEN]=tt.SCREEN_NPM;var r=[];return r.push(t),r.push(i),r}var ps=mv();function vs(i,t){return ps[t?1:0][i]}function Xh(i,t,e,r){return e=e||new Float32Array(4),r||r===void 0?(e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t):(e[0]=i[0],e[1]=i[1],e[2]=i[2]),e[3]=t,e}function Pi(i,t){if(t===1)return(t*255<<24)+i;if(t===0)return 0;var e=i>>16&255,r=i>>8&255,n=i&255;return e=e*t+.5|0,r=r*t+.5|0,n=n*t+.5|0,(t*255<<24)+(e<<16)+(r<<8)+n}function _s(i,t,e,r){return e=e||new Float32Array(4),e[0]=(i>>16&255)/255,e[1]=(i>>8&255)/255,e[2]=(i&255)/255,(r||r===void 0)&&(e[0]*=t,e[1]*=t,e[2]*=t),e[3]=t,e}function Hh(i,t){t===void 0&&(t=null);var e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+e);for(var r=0,n=0;r<e;r+=6,n+=4)t[r+0]=n+0,t[r+1]=n+1,t[r+2]=n+2,t[r+3]=n+0,t[r+4]=n+2,t[r+5]=n+3;return t}function wi(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}var yv={Float32Array,Uint32Array,Int32Array,Uint8Array};function xv(i,t){for(var e=0,r=0,n={},s=0;s<i.length;s++)r+=t[s],e+=i[s].length;for(var a=new ArrayBuffer(e*4),o=null,h=0,s=0;s<i.length;s++){var u=t[s],l=i[s],c=wi(l);n[c]||(n[c]=new yv[c](a)),o=n[c];for(var f=0;f<l.length;f++){var d=(f/u|0)*r+h,v=f%u;o[d+v]=l[f]}h+=u}return new Float32Array(a)}function kr(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function gs(i){return!(i&i-1)&&!!i}function ms(i){var t=(i>65535?1:0)<<4;i>>>=t;var e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Ve(i,t,e){var r=i.length,n;if(!(t>=r||e===0)){e=t+e>r?r-t:e;var s=r-e;for(n=t;n<s;++n)i[n]=i[n+e];i.length=s}}function je(i){return i===0?0:i<0?-1:1}var bv=0;function Ie(){return++bv}var Vh={};function Bt(i,t,e){if(e===void 0&&(e=3),!Vh[t]){var r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",t+`
|
|
9
|
+
Deprecated since v`+i):(r=r.split(`
|
|
10
|
+
`).splice(e).join(`
|
|
11
|
+
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",t+`
|
|
12
|
+
Deprecated since v`+i),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",t+`
|
|
13
|
+
Deprecated since v`+i),console.warn(r))),Vh[t]=!0}}var ys={},Gt=Object.create(null),$t=Object.create(null);function Tv(){var i;for(i in Gt)Gt[i].destroy();for(i in $t)$t[i].destroy()}function Ev(){var i;for(i in Gt)delete Gt[i];for(i in $t)delete $t[i]}var xs=function(){function i(t,e,r){this.canvas=z.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=r||z.RESOLUTION,this.resize(t,e)}return i.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},i.prototype.resize=function(t,e){this.canvas.width=Math.round(t*this.resolution),this.canvas.height=Math.round(e*this.resolution)},i.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(i.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0}),i}();function jh(i){var t=i.width,e=i.height,r=i.getContext("2d",{willReadFrequently:!0}),n=r.getImageData(0,0,t,e),s=n.data,a=s.length,o={top:null,left:null,right:null,bottom:null},h=null,u,l,c;for(u=0;u<a;u+=4)s[u+3]!==0&&(l=u/4%t,c=~~(u/4/t),o.top===null&&(o.top=c),(o.left===null||l<o.left)&&(o.left=l),(o.right===null||o.right<l)&&(o.right=l+1),(o.bottom===null||o.bottom<c)&&(o.bottom=c));return o.top!==null&&(t=o.right-o.left,e=o.bottom-o.top+1,h=r.getImageData(o.left,o.top,t,e)),{height:e,width:t,data:h}}var zh=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function Sv(i){var t=zh.exec(i);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]}}var Ci;function Wh(i,t){if(t===void 0&&(t=globalThis.location),i.indexOf("data:")===0)return"";t=t||globalThis.location,Ci||(Ci=document.createElement("a")),Ci.href=i;var e=ce.parse(Ci.href),r=!e.port&&t.port===""||e.port===t.port;return e.hostname!==t.hostname||!r||e.protocol!==t.protocol?"anonymous":""}function Gr(i,t){var e=z.RETINA_PREFIX.exec(i);return e?parseFloat(e[1]):t!==void 0?t:1}const Pv=Object.freeze(Object.defineProperty({__proto__:null,BaseTextureCache:$t,CanvasRenderTarget:xs,DATA_URI:zh,EventEmitter:xe,ProgramCache:ys,TextureCache:Gt,clearTextureCache:Ev,correctBlendMode:vs,createIndicesForQuads:Hh,decomposeDataUri:Sv,deprecation:Bt,destroyTextureCache:Tv,determineCrossOrigin:Wh,earcut:Rn,getBufferType:wi,getResolutionOfUrl:Gr,hex2rgb:He,hex2string:cs,interleaveTypedArrays:xv,isMobile:qt,isPow2:gs,isWebGLSupported:Gh,log2:ms,nextPow2:kr,path:Nh,premultiplyBlendMode:ps,premultiplyRgba:Xh,premultiplyTint:Pi,premultiplyTintToRgba:_s,removeItems:Ve,rgb2hex:gv,sayHello:kh,sign:je,skipHello:Ac,string2hex:ds,trimCanvas:jh,uid:Ie,url:ce},Symbol.toStringTag,{value:"Module"}));var Xr=Math.PI*2,Yh=180/Math.PI,qh=Math.PI/180,Rt;(function(i){i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC"})(Rt||(Rt={}));var vt=function(){function i(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return i.prototype.clone=function(){return new i(this.x,this.y)},i.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},i.prototype.copyTo=function(t){return t.set(this.x,this.y),t},i.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},i.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x=t,this.y=e,this},i.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},i}(),Ii=[new vt,new vt,new vt,new vt],ut=function(){function i(t,e,r,n){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),n===void 0&&(n=0),this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(n),this.type=Rt.RECT}return Object.defineProperty(i.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(i,"EMPTY",{get:function(){return new i(0,0,0,0)},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.prototype.contains=function(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height},i.prototype.intersects=function(t,e){if(!e){var r=this.x<t.x?t.x:this.x,n=this.right>t.right?t.right:this.right;if(n<=r)return!1;var s=this.y<t.y?t.y:this.y,a=this.bottom>t.bottom?t.bottom:this.bottom;return a>s}var o=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=o||l<=u)return!1;var c=Ii[0].set(t.left,t.top),f=Ii[1].set(t.left,t.bottom),d=Ii[2].set(t.right,t.top),v=Ii[3].set(t.right,t.bottom);if(d.x<=c.x||f.y<=c.y)return!1;var _=Math.sign(e.a*e.d-e.b*e.c);if(_===0||(e.apply(c,c),e.apply(f,f),e.apply(d,d),e.apply(v,v),Math.max(c.x,f.x,d.x,v.x)<=o||Math.min(c.x,f.x,d.x,v.x)>=h||Math.max(c.y,f.y,d.y,v.y)<=u||Math.min(c.y,f.y,d.y,v.y)>=l))return!1;var p=_*(f.y-c.y),g=_*(c.x-f.x),y=p*o+g*u,T=p*h+g*u,I=p*o+g*l,m=p*h+g*l;if(Math.max(y,T,I,m)<=p*c.x+g*c.y||Math.min(y,T,I,m)>=p*v.x+g*v.y)return!1;var S=_*(c.y-d.y),x=_*(d.x-c.x),N=S*o+x*u,D=S*h+x*u,F=S*o+x*l,k=S*h+x*l;return!(Math.max(N,D,F,k)<=S*c.x+x*c.y||Math.min(N,D,F,k)>=S*v.x+x*v.y)},i.prototype.pad=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this},i.prototype.fit=function(t){var e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=n,this.height=Math.max(s-n,0),this},i.prototype.ceil=function(t,e){t===void 0&&(t=1),e===void 0&&(e=.001);var r=Math.ceil((this.x+this.width-e)*t)/t,n=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=r-this.x,this.height=n-this.y,this},i.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=n,this.height=s-n,this},i.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},i}(),$h=function(){function i(t,e,r){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),this.x=t,this.y=e,this.radius=r,this.type=Rt.CIRC}return i.prototype.clone=function(){return new i(this.x,this.y,this.radius)},i.prototype.contains=function(t,e){if(this.radius<=0)return!1;var r=this.radius*this.radius,n=this.x-t,s=this.y-e;return n*=n,s*=s,n+s<=r},i.prototype.getBounds=function(){return new ut(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},i.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},i}(),Kh=function(){function i(t,e,r,n){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),n===void 0&&(n=0),this.x=t,this.y=e,this.width=r,this.height=n,this.type=Rt.ELIP}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var r=(t-this.x)/this.width,n=(e-this.y)/this.height;return r*=r,n*=n,r+n<=1},i.prototype.getBounds=function(){return new ut(this.x-this.width,this.y-this.height,this.width,this.height)},i.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},i}(),Hr=function(){function i(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];var n=Array.isArray(e[0])?e[0]:e;if(typeof n[0]!="number"){for(var s=[],a=0,o=n.length;a<o;a++)s.push(n[a].x,n[a].y);n=s}this.points=n,this.type=Rt.POLY,this.closeStroke=!0}return i.prototype.clone=function(){var t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e},i.prototype.contains=function(t,e){for(var r=!1,n=this.points.length/2,s=0,a=n-1;s<n;a=s++){var o=this.points[s*2],h=this.points[s*2+1],u=this.points[a*2],l=this.points[a*2+1],c=h>e!=l>e&&t<(u-o)*((e-h)/(l-h))+o;c&&(r=!r)}return r},i.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(t,e){return t+", "+e},"")+"]")},i}(),Zh=function(){function i(t,e,r,n,s){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=t,this.y=e,this.width=r,this.height=n,this.radius=s,this.type=Rt.RREC}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.radius)},i.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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;var n=t-(this.x+r),s=e-(this.y+r),a=r*r;if(n*n+s*s<=a||(n=t-(this.x+this.width-r),n*n+s*s<=a)||(s=e-(this.y+this.height-r),n*n+s*s<=a)||(n=t-(this.x+r),n*n+s*s<=a))return!0}return!1},i.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},i}(),Ae=function(){function i(t,e,r,n){r===void 0&&(r=0),n===void 0&&(n=0),this._x=r,this._y=n,this.cb=t,this.scope=e}return i.prototype.clone=function(t,e){return t===void 0&&(t=this.cb),e===void 0&&(e=this.scope),new i(t,e,this._x,this._y)},i.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this},i.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},i.prototype.copyTo=function(t){return t.set(this._x,this._y),t},i.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},i.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(i.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(i.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}),i}(),bt=function(){function i(t,e,r,n,s,a){t===void 0&&(t=1),e===void 0&&(e=0),r===void 0&&(r=0),n===void 0&&(n=1),s===void 0&&(s=0),a===void 0&&(a=0),this.array=null,this.a=t,this.b=e,this.c=r,this.d=n,this.tx=s,this.ty=a}return i.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]},i.prototype.set=function(t,e,r,n,s,a){return this.a=t,this.b=e,this.c=r,this.d=n,this.tx=s,this.ty=a,this},i.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r},i.prototype.apply=function(t,e){e=e||new vt;var r=t.x,n=t.y;return e.x=this.a*r+this.c*n+this.tx,e.y=this.b*r+this.d*n+this.ty,e},i.prototype.applyInverse=function(t,e){e=e||new vt;var r=1/(this.a*this.d+this.c*-this.b),n=t.x,s=t.y;return e.x=this.d*r*n+-this.c*r*s+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*s+-this.b*r*n+(-this.ty*this.a+this.tx*this.b)*r,e},i.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},i.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},i.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),n=this.a,s=this.c,a=this.tx;return this.a=n*e-this.b*r,this.b=n*r+this.b*e,this.c=s*e-this.d*r,this.d=s*r+this.d*e,this.tx=a*e-this.ty*r,this.ty=a*r+this.ty*e,this},i.prototype.append=function(t){var e=this.a,r=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*r+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*r+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this},i.prototype.setTransform=function(t,e,r,n,s,a,o,h,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(r*this.a+n*this.c),this.ty=e-(r*this.b+n*this.d),this},i.prototype.prepend=function(t){var e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){var r=this.a,n=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*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},i.prototype.decompose=function(t){var e=this.a,r=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),h=Math.atan2(r,e),u=Math.abs(o+h);return u<1e-5||Math.abs(Xr-u)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*e+a.y*n),t.position.y=this.ty+(a.x*r+a.y*s),t},i.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,s=this.tx,a=t*n-e*r;return this.a=n/a,this.b=-e/a,this.c=-r/a,this.d=t/a,this.tx=(r*this.ty-n*s)/a,this.ty=-(t*this.ty-e*s)/a,this},i.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},i.prototype.clone=function(){var t=new i;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},i.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},i.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},i.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(i,"IDENTITY",{get:function(){return new i},enumerable:!1,configurable:!0}),Object.defineProperty(i,"TEMP_MATRIX",{get:function(){return new i},enumerable:!1,configurable:!0}),i}(),ze=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],We=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ye=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],qe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],bs=[],Jh=[],Ai=Math.sign;function wv(){for(var i=0;i<16;i++){var t=[];bs.push(t);for(var e=0;e<16;e++)for(var r=Ai(ze[i]*ze[e]+Ye[i]*We[e]),n=Ai(We[i]*ze[e]+qe[i]*We[e]),s=Ai(ze[i]*Ye[e]+Ye[i]*qe[e]),a=Ai(We[i]*Ye[e]+qe[i]*qe[e]),o=0;o<16;o++)if(ze[o]===r&&We[o]===n&&Ye[o]===s&&qe[o]===a){t.push(o);break}}for(var i=0;i<16;i++){var h=new bt;h.set(ze[i],We[i],Ye[i],qe[i],0,0),Jh.push(h)}}wv();var Tt={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(i){return ze[i]},uY:function(i){return We[i]},vX:function(i){return Ye[i]},vY:function(i){return qe[i]},inv:function(i){return i&8?i&15:-i&7},add:function(i,t){return bs[i][t]},sub:function(i,t){return bs[i][Tt.inv(t)]},rotate180:function(i){return i^4},isVertical:function(i){return(i&3)===2},byDirection:function(i,t){return Math.abs(i)*2<=Math.abs(t)?t>=0?Tt.S:Tt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Tt.E:Tt.W:t>0?i>0?Tt.SE:Tt.SW:i>0?Tt.NE:Tt.NW},matrixAppendRotationInv:function(i,t,e,r){e===void 0&&(e=0),r===void 0&&(r=0);var n=Jh[Tt.inv(t)];n.tx=e,n.ty=r,i.append(n)}},Mi=function(){function i(){this.worldTransform=new bt,this.localTransform=new bt,this.position=new Ae(this.onChange,this,0,0),this.scale=new Ae(this.onChange,this,1,1),this.pivot=new Ae(this.onChange,this,0,0),this.skew=new Ae(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 i.prototype.onChange=function(){this._localID++},i.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++},i.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+") ")+"]"},i.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)},i.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 r=t.worldTransform,n=this.worldTransform;n.a=e.a*r.a+e.b*r.c,n.b=e.a*r.b+e.b*r.d,n.c=e.c*r.a+e.d*r.c,n.d=e.c*r.b+e.d*r.d,n.tx=e.tx*r.a+e.ty*r.c+r.tx,n.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}},i.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(i.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),i.IDENTITY=new i,i}();var Vr=function(){return Vr=Object.assign||function(t){for(var e=arguments,r,n=1,s=arguments.length;n<s;n++){r=e[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Vr.apply(this,arguments)},dt;(function(i){i.Application="application",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Loader="loader",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser"})(dt||(dt={}));var Qh=function(i){if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");var t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=Vr(Vr({},t),{ref:i})}if(typeof i=="object")i=Vr({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Kt={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var i=arguments,t=this,e=[],r=0;r<arguments.length;r++)e[r]=i[r];return e.map(Qh).forEach(function(n){n.type.forEach(function(s){var a,o;return(o=(a=t._removeHandlers)[s])===null||o===void 0?void 0:o.call(a,n)})}),this},add:function(){for(var i=arguments,t=this,e=[],r=0;r<arguments.length;r++)e[r]=i[r];return e.map(Qh).forEach(function(n){n.type.forEach(function(s){var a=t._addHandlers,o=t._queue;a[s]?a[s](n):(o[s]=o[s]||[],o[s].push(n))})}),this},handle:function(i,t,e){var r=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(r[i]||n[i])throw new Error("Extension type "+i+" already has a handler");r[i]=t,n[i]=e;var s=this._queue;return s[i]&&(s[i].forEach(function(a){return t(a)}),delete s[i]),this},handleByMap:function(i,t){return this.handle(i,function(e){t[e.name]=e.ref},function(e){delete t[e.name]})},handleByList:function(i,t){return this.handle(i,function(e){var r,n;t.includes(e.ref)||(t.push(e.ref),i===dt.Loader&&((n=(r=e.ref).add)===null||n===void 0||n.call(r)))},function(e){var r=t.indexOf(e.ref);r!==-1&&t.splice(r,1)})}};var Dt=function(){function i(t){this.items=[],this._name=t,this._aliasCount=0}return i.prototype.emit=function(t,e,r,n,s,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");var u=this,l=u.name,c=u.items;this._aliasCount++;for(var f=0,d=c.length;f<d;f++)c[f][l](t,e,r,n,s,a,o,h);return c===this.items&&this._aliasCount--,this},i.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},i.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},i.prototype.remove=function(t){var e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},i.prototype.contains=function(t){return this.items.indexOf(t)!==-1},i.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},i.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(i.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),i}();Object.defineProperties(Dt.prototype,{dispatch:{value:Dt.prototype.emit},run:{value:Dt.prototype.emit}});z.TARGET_FPMS=.06;var de;(function(i){i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY"})(de||(de={}));var Ts=function(){function i(t,e,r,n){e===void 0&&(e=null),r===void 0&&(r=0),n===void 0&&(n=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=n}return i.prototype.match=function(t,e){return e===void 0&&(e=null),this.fn===t&&this.context===e},i.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},i.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},i.prototype.destroy=function(t){t===void 0&&(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},i}(),Ot=function(){function i(){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 Ts(null,null,1/0),this.deltaMS=1/z.TARGET_FPMS,this.elapsedMS=1/z.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&t._requestId===null&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return i.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},i.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},i.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},i.prototype.add=function(t,e,r){return r===void 0&&(r=de.NORMAL),this._addListener(new Ts(t,e,r))},i.prototype.addOnce=function(t,e,r){return r===void 0&&(r=de.NORMAL),this._addListener(new Ts(t,e,r,!0))},i.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this},i.prototype.remove=function(t,e){for(var r=this._head.next;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(i.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}),i.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},i.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},i.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}},i.prototype.update=function(t){t===void 0&&(t=performance.now());var e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=t-r%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*z.TARGET_FPMS;for(var n=this._head,s=n.next;s;)s=s.emit(this.deltaTime);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(i.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,z.TARGET_FPMS);this._maxElapsedMS=1/r},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){if(t===0)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(i,"shared",{get:function(){if(!i._shared){var t=i._shared=new i;t.autoStart=!0,t._protected=!0}return i._shared},enumerable:!1,configurable:!0}),Object.defineProperty(i,"system",{get:function(){if(!i._system){var t=i._system=new i;t.autoStart=!0,t._protected=!0}return i._system},enumerable:!1,configurable:!0}),i}(),Es=function(){function i(){}return i.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(r){this._ticker&&this._ticker.remove(this.render,this),this._ticker=r,r&&r.add(this.render,this,de.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?Ot.shared:new Ot,t.autoStart&&this.start()},i.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},i.extension=dt.Application,i}();z.PREFER_ENV=qt.any?Ut.WEBGL:Ut.WEBGL2,z.STRICT_TEXTURE_CACHE=!1;var jr=[];function Ri(i,t){if(!i)return null;var e="";if(typeof i=="string"){var r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(var n=jr.length-1;n>=0;--n){var s=jr[n];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Ss=function(i,t){return Ss=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Ss(i,t)};function mt(i,t){Ss(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Ps=function(){return Ps=Object.assign||function(t){for(var e=arguments,r,n=1,s=arguments.length;n<s;n++){r=e[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ps.apply(this,arguments)};function Cv(i,t){var e={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(i);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(i,r[n])&&(e[r[n]]=i[r[n]]);return e}var $e=function(){function i(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Dt("setRealSize"),this.onUpdate=new Dt("update"),this.onError=new Dt("onError")}return i.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)},i.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},i.prototype.resize=function(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(i.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),i.prototype.update=function(){this.destroyed||this.onUpdate.emit()},i.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(i.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),i.prototype.style=function(t,e,r){return!1},i.prototype.dispose=function(){},i.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)},i.test=function(t,e){return!1},i}(),Ke=function(i){mt(t,i);function t(e,r){var n=this,s=r||{},a=s.width,o=s.height;if(!a||!o)throw new Error("BufferResource width or height invalid");return n=i.call(this,a,o)||this,n.data=e,n}return t.prototype.upload=function(e,r,n){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===Wt.UNPACK);var a=r.realWidth,o=r.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(r.target,0,0,0,a,o,r.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(r.target,0,n.internalFormat,a,o,0,r.format,n.type,this.data)),!0},t.prototype.dispose=function(){this.data=null},t.test=function(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array},t}($e),Iv={scaleMode:ie.NEAREST,format:H.RGBA,alphaMode:Wt.NPM},lt=function(i){mt(t,i);function t(e,r){e===void 0&&(e=null),r===void 0&&(r=null);var n=i.call(this)||this;r=r||{};var s=r.alphaMode,a=r.mipmap,o=r.anisotropicLevel,h=r.scaleMode,u=r.width,l=r.height,c=r.wrapMode,f=r.format,d=r.type,v=r.target,_=r.resolution,p=r.resourceOptions;return e&&!(e instanceof $e)&&(e=Ri(e,p),e.internal=!0),n.resolution=_||z.RESOLUTION,n.width=Math.round((u||0)*n.resolution)/n.resolution,n.height=Math.round((l||0)*n.resolution)/n.resolution,n._mipmap=a!==void 0?a:z.MIPMAP_TEXTURES,n.anisotropicLevel=o!==void 0?o:z.ANISOTROPIC_LEVEL,n._wrapMode=c||z.WRAP_MODE,n._scaleMode=h!==void 0?h:z.SCALE_MODE,n.format=f||H.RGBA,n.type=d||Q.UNSIGNED_BYTE,n.target=v||Ce.TEXTURE_2D,n.alphaMode=s!==void 0?s:Wt.UNPACK,n.uid=Ie(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=u>0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(e),n}return Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,r){var n;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,n=!0),r!==void 0&&r!==this.mipmap&&(this.mipmap=r,n=!0),n&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,r,n){return n=n||this.resolution,this.setRealSize(e*n,r*n,n)},t.prototype.setRealSize=function(e,r,n){return this.resolution=n||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(r)/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=gs(this.realWidth)&&gs(this.realHeight)},t.prototype.setResolution=function(e){var r=this.resolution;return r===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*r)/e,this.height=Math.round(this.height*r)/e,this.emit("update",this)),this._refreshPOT(),this)},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.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))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete $t[this.cacheId],delete Gt[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,r,n){n===void 0&&(n=z.STRICT_TEXTURE_CACHE);var s=typeof e=="string",a=null;if(s)a=e;else{if(!e._pixiId){var o=r&&r.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+Ie()}a=e._pixiId}var h=$t[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||(h=new t(e,r),h.cacheId=a,t.addToCache(h,a)),h},t.fromBuffer=function(e,r,n,s){e=e||new Float32Array(r*n*4);var a=new Ke(e,{width:r,height:n}),o=e instanceof Float32Array?Q.FLOAT:Q.UNSIGNED_BYTE;return new t(a,Object.assign({},Iv,s||{width:r,height:n,type:o}))},t.addToCache=function(e,r){r&&(e.textureCacheIds.indexOf(r)===-1&&e.textureCacheIds.push(r),$t[r]&&console.warn("BaseTexture added to the cache with an id ["+r+"] that already had an entry"),$t[r]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var r=$t[e];if(r){var n=r.textureCacheIds.indexOf(e);return n>-1&&r.textureCacheIds.splice(n,1),delete $t[e],r}}else if(e&&e.textureCacheIds){for(var s=0;s<e.textureCacheIds.length;++s)delete $t[e.textureCacheIds[s]];return e.textureCacheIds.length=0,e}return null},t._globalBatch=0,t}(xe),Oi=function(i){mt(t,i);function t(e,r){var n=this,s=r||{},a=s.width,o=s.height;n=i.call(this,a,o)||this,n.items=[],n.itemDirtyIds=[];for(var h=0;h<e;h++){var u=new lt;n.items.push(u),n.itemDirtyIds.push(-2)}return n.length=e,n._load=null,n.baseTexture=null,n}return t.prototype.initFromArray=function(e,r){for(var n=0;n<this.length;n++)e[n]&&(e[n].castToBaseTexture?this.addBaseTextureAt(e[n].castToBaseTexture(),n):e[n]instanceof $e?this.addResourceAt(e[n],n):this.addResourceAt(Ri(e[n],r),n))},t.prototype.dispose=function(){for(var e=0,r=this.length;e<r;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},t.prototype.addResourceAt=function(e,r){if(!this.items[r])throw new Error("Index "+r+" is out of bounds");return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[r].setResource(e),this},t.prototype.bind=function(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");i.prototype.bind.call(this,e);for(var r=0;r<this.length;r++)this.items[r].parentTextureArray=e,this.items[r].on("update",e.update,e)},t.prototype.unbind=function(e){i.prototype.unbind.call(this,e);for(var r=0;r<this.length;r++)this.items[r].parentTextureArray=null,this.items[r].off("update",e.update,e)},t.prototype.load=function(){var e=this;if(this._load)return this._load;var r=this.items.map(function(s){return s.resource}).filter(function(s){return s}),n=r.map(function(s){return s.load()});return this._load=Promise.all(n).then(function(){var s=e.items[0],a=s.realWidth,o=s.realHeight;return e.resize(a,o),Promise.resolve(e)}),this._load},t}($e),ws=function(i){mt(t,i);function t(e,r){var n=this,s=r||{},a=s.width,o=s.height,h,u;return Array.isArray(e)?(h=e,u=e.length):u=e,n=i.call(this,u,{width:a,height:o})||this,h&&n.initFromArray(h,r),n}return t.prototype.addBaseTextureAt=function(e,r){if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("ArrayResource does not support RenderTexture");return this},t.prototype.bind=function(e){i.prototype.bind.call(this,e),e.target=Ce.TEXTURE_2D_ARRAY},t.prototype.upload=function(e,r,n){var s=this,a=s.length,o=s.itemDirtyIds,h=s.items,u=e.gl;n.dirtyId<0&&u.texImage3D(u.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,a,0,r.format,n.type,null);for(var l=0;l<a;l++){var c=h[l];o[l]<c.dirtyId&&(o[l]=c.dirtyId,c.valid&&u.texSubImage3D(u.TEXTURE_2D_ARRAY,0,0,0,l,c.resource.width,c.resource.height,1,r.format,n.type,c.resource.source))}return!0},t}(Oi),pe=function(i){mt(t,i);function t(e){var r=this,n=e,s=n.naturalWidth||n.videoWidth||n.width,a=n.naturalHeight||n.videoHeight||n.height;return r=i.call(this,s,a)||this,r.source=e,r.noSubImage=!1,r}return t.crossOrigin=function(e,r,n){n===void 0&&r.indexOf("data:")!==0?e.crossOrigin=Wh(r):n!==!1&&(e.crossOrigin=typeof n=="string"?n:"anonymous")},t.prototype.upload=function(e,r,n,s){var a=e.gl,o=r.realWidth,h=r.realHeight;if(s=s||this.source,s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===Wt.UNPACK),!this.noSubImage&&r.target===a.TEXTURE_2D&&n.width===o&&n.height===h?a.texSubImage2D(a.TEXTURE_2D,0,0,0,r.format,n.type,s):(n.width=o,n.height=h,a.texImage2D(r.target,0,n.internalFormat,r.format,n.type,s)),!0},t.prototype.update=function(){if(!this.destroyed){var e=this.source,r=e.naturalWidth||e.videoWidth||e.width,n=e.naturalHeight||e.videoHeight||e.height;this.resize(r,n),i.prototype.update.call(this)}},t.prototype.dispose=function(){this.source=null},t}($e),Cs=function(i){mt(t,i);function t(e){return i.call(this,e)||this}return t.test=function(e){var r=globalThis.OffscreenCanvas;return r&&e instanceof r?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement},t}(pe),Is=function(i){mt(t,i);function t(e,r){var n=this,s=r||{},a=s.width,o=s.height,h=s.autoLoad,u=s.linkBaseTexture;if(e&&e.length!==t.SIDES)throw new Error("Invalid length. Got "+e.length+", expected 6");n=i.call(this,6,{width:a,height:o})||this;for(var l=0;l<t.SIDES;l++)n.items[l].target=Ce.TEXTURE_CUBE_MAP_POSITIVE_X+l;return n.linkBaseTexture=u!==!1,e&&n.initFromArray(e,r),h!==!1&&n.load(),n}return t.prototype.bind=function(e){i.prototype.bind.call(this,e),e.target=Ce.TEXTURE_CUBE_MAP},t.prototype.addBaseTextureAt=function(e,r,n){if(!this.items[r])throw new Error("Index "+r+" is out of bounds");if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,r);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ce.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this},t.prototype.upload=function(e,r,n){for(var s=this.itemDirtyIds,a=0;a<t.SIDES;a++){var o=this.items[a];(s[a]<o.dirtyId||n.dirtyId<r.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(e,o,n),s[a]=o.dirtyId):s[a]<-1&&(e.gl.texImage2D(o.target,0,n.internalFormat,r.realWidth,r.realHeight,0,r.format,n.type,null),s[a]=-1))}return!0},t.test=function(e){return Array.isArray(e)&&e.length===t.SIDES},t.SIDES=6,t}(Oi),Di=function(i){mt(t,i);function t(e,r){var n=this;if(r=r||{},!(e instanceof HTMLImageElement)){var s=new Image;pe.crossOrigin(s,e,r.crossorigin),s.src=e,e=s}return n=i.call(this,e)||this,!e.complete&&n._width&&n._height&&(n._width=0,n._height=0),n.url=e.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(r.createBitmap!==void 0?r.createBitmap:z.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,n.alphaMode=typeof r.alphaMode=="number"?r.alphaMode:null,n.bitmap=null,n._load=null,r.autoLoad!==!1&&n.load(),n}return t.prototype.load=function(e){var r=this;return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise(function(n,s){var a=r.source;r.url=a.src;var o=function(){r.destroyed||(a.onload=null,a.onerror=null,r.resize(a.width,a.height),r._load=null,r.createBitmap?n(r.process()):n(r))};a.complete&&a.src?o():(a.onload=o,a.onerror=function(h){s(h),r.onError.emit(h)})}),this._load)},t.prototype.process=function(){var e=this,r=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var n=globalThis.createImageBitmap,s=!r.crossOrigin||r.crossOrigin==="anonymous";return this._process=fetch(r.src,{mode:s?"cors":"no-cors"}).then(function(a){return a.blob()}).then(function(a){return n(a,0,0,r.width,r.height,{premultiplyAlpha:e.alphaMode===null||e.alphaMode===Wt.UNPACK?"premultiply":"none"})}).then(function(a){return e.destroyed?Promise.reject():(e.bitmap=a,e.update(),e._process=null,Promise.resolve(e))}),this._process},t.prototype.upload=function(e,r,n){if(typeof this.alphaMode=="number"&&(r.alphaMode=this.alphaMode),!this.createBitmap)return i.prototype.upload.call(this,e,r,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(i.prototype.upload.call(this,e,r,n,this.bitmap),!this.preserveBitmap){var s=!0,a=r._glTextures;for(var o in a){var h=a[o];if(h!==n&&h.dirtyId!==r.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},t.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,i.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},t.test=function(e){return typeof e=="string"||e instanceof HTMLImageElement},t}(pe),As=function(i){mt(t,i);function t(e,r){var n=this;return r=r||{},n=i.call(this,z.ADAPTER.createCanvas())||this,n._width=0,n._height=0,n.svg=e,n.scale=r.scale||1,n._overrideWidth=r.width,n._overrideHeight=r.height,n._resolve=null,n._crossorigin=r.crossorigin,n._load=null,r.autoLoad!==!1&&n.load(),n}return t.prototype.load=function(){var e=this;return this._load?this._load:(this._load=new Promise(function(r){if(e._resolve=function(){e.resize(e.source.width,e.source.height),r(e)},t.SVG_XML.test(e.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");e.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e.svg)))}e._loadSvg()}),this._load)},t.prototype._loadSvg=function(){var e=this,r=new Image;pe.crossOrigin(r,this.svg,this._crossorigin),r.src=this.svg,r.onerror=function(n){e._resolve&&(r.onerror=null,e.onError.emit(n))},r.onload=function(){if(e._resolve){var n=r.width,s=r.height;if(!n||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var a=n*e.scale,o=s*e.scale;(e._overrideWidth||e._overrideHeight)&&(a=e._overrideWidth||e._overrideHeight/s*n,o=e._overrideHeight||e._overrideWidth/n*s),a=Math.round(a),o=Math.round(o);var h=e.source;h.width=a,h.height=o,h._pixiId="canvas_"+Ie(),h.getContext("2d").drawImage(r,0,0,n,s,0,0,a,o),e._resolve(),e._resolve=null}}},t.getSize=function(e){var r=t.SVG_SIZE.exec(e),n={};return r&&(n[r[1]]=Math.round(parseFloat(r[3])),n[r[5]]=Math.round(parseFloat(r[7]))),n},t.prototype.dispose=function(){i.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},t.test=function(e,r){return r==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&t.SVG_XML.test(e)},t.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,t.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(pe),Ms=function(i){mt(t,i);function t(e,r){var n=this;if(r=r||{},!(e instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);var a=e[0].src||e[0];pe.crossOrigin(s,a,r.crossorigin);for(var o=0;o<e.length;++o){var h=document.createElement("source"),u=e[o],l=u.src,c=u.mime;l=l||e[o];var f=l.split("?").shift().toLowerCase(),d=f.slice(f.lastIndexOf(".")+1);c=c||t.MIME_TYPES[d]||"video/"+d,h.src=l,h.type=c,s.appendChild(h)}e=s}return n=i.call(this,e)||this,n.noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=r.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=r.autoPlay!==!1,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),r.autoLoad!==!1&&n.load(),n}return t.prototype.update=function(e){if(!this.destroyed){var r=Ot.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-r),(!this._updateFPS||this._msToNextUpdate<=0)&&(i.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},t.prototype.load=function(){var e=this;if(this._load)return this._load;var r=this.source;return(r.readyState===r.HAVE_ENOUGH_DATA||r.readyState===r.HAVE_FUTURE_DATA)&&r.width&&r.height&&(r.complete=!0),r.addEventListener("play",this._onPlayStart.bind(this)),r.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(r.addEventListener("canplay",this._onCanPlay),r.addEventListener("canplaythrough",this._onCanPlay),r.addEventListener("error",this._onError,!0)),this._load=new Promise(function(n){e.valid?n(e):(e._resolve=n,r.load())}),this._load},t.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},t.prototype._isSourcePlaying=function(){var e=this.source;return!e.paused&&!e.ended&&this._isSourceReady()},t.prototype._isSourceReady=function(){var e=this.source;return e.readyState>2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Ot.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var r=this.valid;this.resize(e.videoWidth,e.videoHeight),!r&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(Ot.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()),i.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Ot.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(r)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(pe),Rs=function(i){mt(t,i);function t(e){return i.call(this,e)||this}return t.test=function(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap},t}(pe);jr.push(Di,Rs,Cs,Ms,As,Ke,Is,ws);var tu={__proto__:null,Resource:$e,BaseImageResource:pe,INSTALLED:jr,autoDetectResource:Ri,AbstractMultiResource:Oi,ArrayResource:ws,BufferResource:Ke,CanvasResource:Cs,CubeResource:Is,ImageResource:Di,SVGResource:As,VideoResource:Ms,ImageBitmapResource:Rs},Av=function(i){mt(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.upload=function(e,r,n){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===Wt.UNPACK);var a=r.realWidth,o=r.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(r.target,0,0,0,a,o,r.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(r.target,0,n.internalFormat,a,o,0,r.format,n.type,this.data)),!0},t}(Ke),Fi=function(){function i(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 Dt("disposeFramebuffer"),this.multisample=xt.NONE}return Object.defineProperty(i.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),i.prototype.addColorTexture=function(t,e){return t===void 0&&(t=0),this.colorTextures[t]=e||new lt(null,{scaleMode:ie.NEAREST,resolution:1,mipmap:zt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},i.prototype.addDepthTexture=function(t){return this.depthTexture=t||new lt(new Av(null,{width:this.width,height:this.height}),{scaleMode:ie.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:zt.OFF,format:H.DEPTH_COMPONENT,type:Q.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},i.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},i.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},i.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 r=0;r<this.colorTextures.length;r++){var n=this.colorTextures[r],s=n.resolution;n.setSize(t/s,e/s)}if(this.depthTexture){var s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}},i.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},i.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},i}(),Os=function(i){mt(t,i);function t(e){e===void 0&&(e={});var r=this;if(typeof e=="number"){var n=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];e={width:n,height:s,scaleMode:a,resolution:o}}return e.width=e.width||100,e.height=e.height||100,e.multisample=e.multisample!==void 0?e.multisample:xt.NONE,r=i.call(this,null,e)||this,r.mipmap=zt.OFF,r.valid=!0,r.clearColor=[0,0,0,0],r.framebuffer=new Fi(r.realWidth,r.realHeight).addColorTexture(0,r),r.framebuffer.multisample=e.multisample,r.maskStack=[],r.filterStack=[{}],r}return t.prototype.resize=function(e,r){this.framebuffer.resize(e*this.resolution,r*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},t.prototype.dispose=function(){this.framebuffer.dispose(),i.prototype.dispose.call(this)},t.prototype.destroy=function(){i.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},t}(lt),Ds=function(){function i(){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 i.prototype.set=function(t,e,r){var n=e.width,s=e.height;if(r){var a=t.width/2/n,o=t.height/2/s,h=t.x/n+a,u=t.y/s+o;r=Tt.add(r,Tt.NW),this.x0=h+a*Tt.uX(r),this.y0=u+o*Tt.uY(r),r=Tt.add(r,2),this.x1=h+a*Tt.uX(r),this.y1=u+o*Tt.uY(r),r=Tt.add(r,2),this.x2=h+a*Tt.uX(r),this.y2=u+o*Tt.uY(r),r=Tt.add(r,2),this.x3=h+a*Tt.uX(r),this.y3=u+o*Tt.uY(r)}else this.x0=t.x/n,this.y0=t.y/s,this.x1=(t.x+t.width)/n,this.y1=t.y/s,this.x2=(t.x+t.width)/n,this.y2=(t.y+t.height)/s,this.x3=t.x/n,this.y3=(t.y+t.height)/s;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},i.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)+"]"},i}(),eu=new Ds;function Li(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var it=function(i){mt(t,i);function t(e,r,n,s,a,o){var h=i.call(this)||this;if(h.noFrame=!1,r||(h.noFrame=!0,r=new ut(0,0,1,1)),e instanceof t&&(e=e.baseTexture),h.baseTexture=e,h._frame=r,h.trim=s,h.valid=!1,h._uvs=eu,h.uvMatrix=null,h.orig=n||r,h._rotate=Number(a||0),a===!0)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=o?new vt(o.x,o.y):new vt(0,0),h._updateID=0,h.textureCacheIds=[],e.valid?h.noFrame?e.valid&&h.onBaseTextureUpdated(e):h.frame=r:e.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&e.on("update",h.onBaseTextureUpdated,h),h}return t.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},t.prototype.onBaseTextureUpdated=function(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},t.prototype.destroy=function(e){if(this.baseTexture){if(e){var r=this.baseTexture.resource;r&&r.url&&Gt[r.url]&&t.removeFromCache(r.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,t.removeFromCache(this),this.textureCacheIds=null},t.prototype.clone=function(){var e=this._frame.clone(),r=this._frame===this.orig?e:this.orig.clone(),n=new t(this.baseTexture,!this.noFrame&&e,r,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(n._frame=e),n},t.prototype.updateUvs=function(){this._uvs===eu&&(this._uvs=new Ds),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},t.from=function(e,r,n){r===void 0&&(r={}),n===void 0&&(n=z.STRICT_TEXTURE_CACHE);var s=typeof e=="string",a=null;if(s)a=e;else if(e instanceof lt){if(!e.cacheId){var o=r&&r.pixiIdPrefix||"pixiid";e.cacheId=o+"-"+Ie(),lt.addToCache(e,e.cacheId)}a=e.cacheId}else{if(!e._pixiId){var o=r&&r.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+Ie()}a=e._pixiId}var h=Gt[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in TextureCache.');return!h&&!(e instanceof lt)?(r.resolution||(r.resolution=Gr(e)),h=new t(new lt(e,r)),h.baseTexture.cacheId=a,lt.addToCache(h.baseTexture,a),t.addToCache(h,a)):!h&&e instanceof lt&&(h=new t(e),t.addToCache(h,a)),h},t.fromURL=function(e,r){var n=Object.assign({autoLoad:!1},r==null?void 0:r.resourceOptions),s=t.from(e,Object.assign({resourceOptions:n},r),!1),a=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):a.load().then(function(){return Promise.resolve(s)})},t.fromBuffer=function(e,r,n,s){return new t(lt.fromBuffer(e,r,n,s))},t.fromLoader=function(e,r,n,s){var a=new lt(e,Object.assign({scaleMode:z.SCALE_MODE,resolution:Gr(r)},s)),o=a.resource;o instanceof Di&&(o.url=r);var h=new t(a);return n||(n=r),lt.addToCache(h.baseTexture,n),t.addToCache(h,n),n!==r&&(lt.addToCache(h.baseTexture,r),t.addToCache(h,r)),h.baseTexture.valid?Promise.resolve(h):new Promise(function(u){h.baseTexture.once("loaded",function(){return u(h)})})},t.addToCache=function(e,r){r&&(e.textureCacheIds.indexOf(r)===-1&&e.textureCacheIds.push(r),Gt[r]&&console.warn("Texture added to the cache with an id ["+r+"] that already had an entry"),Gt[r]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var r=Gt[e];if(r){var n=r.textureCacheIds.indexOf(e);return n>-1&&r.textureCacheIds.splice(n,1),delete Gt[e],r}}else if(e&&e.textureCacheIds){for(var s=0;s<e.textureCacheIds.length;++s)Gt[e.textureCacheIds[s]]===e&&delete Gt[e.textureCacheIds[s]];return e.textureCacheIds.length=0,e}return null},Object.defineProperty(t.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frame",{get:function(){return this._frame},set:function(e){this._frame=e,this.noFrame=!1;var r=e.x,n=e.y,s=e.width,a=e.height,o=r+s>this.baseTexture.width,h=n+a>this.baseTexture.height;if(o||h){var u=o&&h?"and":"or",l="X: "+r+" + "+s+" = "+(r+s)+" > "+this.baseTexture.width,c="Y: "+n+" + "+a+" = "+(n+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+u+" "+c))}this.valid=s&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(t,"EMPTY",{get:function(){return t._EMPTY||(t._EMPTY=new t(new lt),Li(t._EMPTY),Li(t._EMPTY.baseTexture)),t._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(t,"WHITE",{get:function(){if(!t._WHITE){var e=z.ADAPTER.createCanvas(16,16),r=e.getContext("2d");e.width=16,e.height=16,r.fillStyle="white",r.fillRect(0,0,16,16),t._WHITE=new t(lt.from(e)),Li(t._WHITE),Li(t._WHITE.baseTexture)}return t._WHITE},enumerable:!1,configurable:!0}),t}(xe),Me=function(i){mt(t,i);function t(e,r){var n=i.call(this,e,r)||this;return n.valid=!0,n.filterFrame=null,n.filterPoolKey=null,n.updateUvs(),n}return Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,r,n){n===void 0&&(n=!0);var s=this.baseTexture.resolution,a=Math.round(e*s)/s,o=Math.round(r*s)/s;this.valid=a>0&&o>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=o,n&&this.baseTexture.resize(a,o),this.updateUvs()},t.prototype.setResolution=function(e){var r=this.baseTexture;r.resolution!==e&&(r.setResolution(e),this.resize(r.width,r.height,!1))},t.create=function(e){for(var r=arguments,n=[],s=1;s<arguments.length;s++)n[s-1]=r[s];return typeof e=="number"&&(Bt("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),e={width:e,height:n[0],scaleMode:n[1],resolution:n[2]}),new t(new Os(e))},t}(it),ru=function(){function i(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return i.prototype.createTexture=function(t,e,r){r===void 0&&(r=xt.NONE);var n=new Os(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new Me(n)},i.prototype.getOptimalTexture=function(t,e,r,n){r===void 0&&(r=1),n===void 0&&(n=xt.NONE);var s;t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=kr(t),e=kr(e),s=((t&65535)<<16|e&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(t,e,n)),a.filterPoolKey=s,a.setResolution(r),a},i.prototype.getFilterTexture=function(t,e,r){var n=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||xt.NONE);return n.filterFrame=t.filterFrame,n},i.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},i.prototype.returnFilterTexture=function(t){this.returnTexture(t)},i.prototype.clear=function(t){if(t=t!==!1,t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var n=0;n<r.length;n++)r[n].destroy(!0)}this.texturePool={}},i.prototype.setScreenSize=function(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(var e in this.texturePool)if(Number(e)<0){var r=this.texturePool[e];if(r)for(var n=0;n<r.length;n++)r[n].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},i.SCREEN_KEY=-1,i}(),Fs=function(){function i(t,e,r,n,s,a,o){e===void 0&&(e=0),r===void 0&&(r=!1),n===void 0&&(n=Q.FLOAT),this.buffer=t,this.size=e,this.normalized=r,this.type=n,this.stride=s,this.start=a,this.instance=o}return i.prototype.destroy=function(){this.buffer=null},i.from=function(t,e,r,n,s){return new i(t,e,r,n,s)},i}(),Mv=0,Mt=function(){function i(t,e,r){e===void 0&&(e=!0),r===void 0&&(r=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=Mv++,this.disposeRunner=new Dt("disposeBuffer")}return i.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++},i.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},i.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(i.prototype,"index",{get:function(){return this.type===se.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?se.ELEMENT_ARRAY_BUFFER:se.ARRAY_BUFFER},enumerable:!1,configurable:!0}),i.from=function(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)},i}(),Rv={Float32Array,Uint32Array,Int32Array,Uint8Array};function Ov(i,t){for(var e=0,r=0,n={},s=0;s<i.length;s++)r+=t[s],e+=i[s].length;for(var a=new ArrayBuffer(e*4),o=null,h=0,s=0;s<i.length;s++){var u=t[s],l=i[s],c=wi(l);n[c]||(n[c]=new Rv[c](a)),o=n[c];for(var f=0;f<l.length;f++){var d=(f/u|0)*r+h,v=f%u;o[d+v]=l[f]}h+=u}return new Float32Array(a)}var iu={5126:4,5123:2,5121:1},Dv=0,Fv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},vr=function(){function i(t,e){t===void 0&&(t=[]),e===void 0&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Dv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Dt("disposeGeometry"),this.refCount=0}return i.prototype.addAttribute=function(t,e,r,n,s,a,o,h){if(r===void 0&&(r=0),n===void 0&&(n=!1),h===void 0&&(h=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Mt||(e instanceof Array&&(e=new Float32Array(e)),e=new Mt(e));var u=t.split("|");if(u.length>1){for(var l=0;l<u.length;l++)this.addAttribute(u[l],e,r,n,s);return this}var c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Fs(c,r,n,s,a,o,h),this.instanced=this.instanced||h,this},i.prototype.getAttribute=function(t){return this.attributes[t]},i.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},i.prototype.addIndex=function(t){return t instanceof Mt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Mt(t)),t.type=se.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.indexOf(t)===-1&&this.buffers.push(t),this},i.prototype.getIndex=function(){return this.indexBuffer},i.prototype.interleave=function(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;var t=[],e=[],r=new Mt,n;for(n in this.attributes){var s=this.attributes[n],a=this.buffers[s.buffer];t.push(a.data),e.push(s.size*iu[s.type]/4),s.buffer=0}for(r.data=Ov(t,e),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},i.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t],r=this.buffers[e.buffer];return r.data.length/(e.stride/4||e.size)}return 0},i.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},i.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},i.prototype.clone=function(){for(var t=new i,e=0;e<this.buffers.length;e++)t.buffers[e]=new Mt(this.buffers[e].data.slice(0));for(var e in this.attributes){var r=this.attributes[e];t.attributes[e]=new Fs(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=se.ELEMENT_ARRAY_BUFFER),t},i.merge=function(t){for(var e=new i,r=[],n=[],s=[],a,o=0;o<t.length;o++){a=t[o];for(var h=0;h<a.buffers.length;h++)n[h]=n[h]||0,n[h]+=a.buffers[h].data.length,s[h]=0}for(var o=0;o<a.buffers.length;o++)r[o]=new Fv[wi(a.buffers[o].data)](n[o]),e.buffers[o]=new Mt(r[o]);for(var o=0;o<t.length;o++){a=t[o];for(var h=0;h<a.buffers.length;h++)r[h].set(a.buffers[h].data,s[h]),s[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=se.ELEMENT_ARRAY_BUFFER;for(var u=0,l=0,c=0,f=0,o=0;o<a.buffers.length;o++)if(a.buffers[o]!==a.indexBuffer){f=o;break}for(var o in a.attributes){var d=a.attributes[o];(d.buffer|0)===f&&(l+=d.size*iu[d.type]/4)}for(var o=0;o<t.length;o++){for(var v=t[o].indexBuffer.data,h=0;h<v.length;h++)e.indexBuffer.data[h+c]+=u;u+=t[o].buffers[f].data.length/l,c+=v.length}}return e},i}(),nu=function(i){mt(t,i);function t(){var e=i.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return t}(vr),Ls=function(i){mt(t,i);function t(){var e=i.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 Mt(e.vertices),e.uvBuffer=new Mt(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return t.prototype.map=function(e,r){var n=0,s=0;return this.uvs[0]=n,this.uvs[1]=s,this.uvs[2]=n+r.width/e.width,this.uvs[3]=s,this.uvs[4]=n+r.width/e.width,this.uvs[5]=s+r.height/e.height,this.uvs[6]=n,this.uvs[7]=s+r.height/e.height,n=r.x,s=r.y,this.vertices[0]=n,this.vertices[1]=s,this.vertices[2]=n+r.width,this.vertices[3]=s,this.vertices[4]=n+r.width,this.vertices[5]=s+r.height,this.vertices[6]=n,this.vertices[7]=s+r.height,this.invalidate(),this},t.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},t}(vr),Lv=0,Re=function(){function i(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Lv++,this.static=!!e,this.ubo=!!r,t instanceof Mt?(this.buffer=t,this.buffer.type=se.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Mt(new Float32Array(1)),this.buffer.type=se.UNIFORM_BUFFER,this.autoManage=!0))}return i.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},i.prototype.add=function(t,e,r){if(!this.ubo)this.uniforms[t]=new i(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},i.from=function(t,e,r){return new i(t,e,r)},i.uboFrom=function(t,e){return new i(t,e??!0,!0)},i}(),su=function(){function i(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=xt.NONE,this.sourceFrame=new ut,this.destinationFrame=new ut,this.bindingSourceFrame=new ut,this.bindingDestinationFrame=new ut,this.filters=[],this.transform=null}return i.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},i}(),Bi=[new vt,new vt,new vt,new vt],Bs=new bt,Ns=function(){function i(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ru,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new nu,this.quadUv=new Ls,this.tempRect=new ut,this.activeState={},this.globalUniforms=new Re({outputFrame:new ut,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 i.prototype.push=function(t,e){for(var r,n,s=this.renderer,a=this.defaultFilterStack,o=this.statePool.pop()||new su,h=this.renderer.renderTexture,u=e[0].resolution,l=e[0].multisample,c=e[0].padding,f=e[0].autoFit,d=(r=e[0].legacy)!==null&&r!==void 0?r:!0,v=1;v<e.length;v++){var _=e[v];u=Math.min(u,_.resolution),l=Math.min(l,_.multisample),c=this.useMaxPadding?Math.max(c,_.padding):c+_.padding,f=f&&_.autoFit,d=d||((n=_.legacy)!==null&&n!==void 0?n:!0)}a.length===1&&(this.defaultFilterStack[0].renderTexture=h.current),a.push(o),o.resolution=u,o.multisample=l,o.legacy=d,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(c);var p=this.tempRect.copyFrom(h.sourceFrame);s.projection.transform&&this.transformAABB(Bs.copyFrom(s.projection.transform).invert(),p),f?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,h.current?h.current.resolution:s.resolution,h.sourceFrame,h.destinationFrame,s.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,u,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(h.sourceFrame),o.bindingDestinationFrame.copyFrom(h.destinationFrame),o.transform=s.projection.transform,s.projection.transform=null,h.bind(o.renderTexture,o.sourceFrame,g),s.framebuffer.clear(0,0,0,0)},i.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;var n=this.globalUniforms.uniforms;n.outputFrame=e.sourceFrame,n.resolution=e.resolution;var s=n.inputSize,a=n.inputPixel,o=n.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],a[0]=Math.round(s[0]*e.resolution),a[1]=Math.round(s[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*s[2]-.5*a[2],o[3]=e.sourceFrame.height*s[3]-.5*a[3],e.legacy){var h=n.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();var u=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,u.renderTexture,Yt.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 f=0;for(f=0;f<r.length-1;++f){f===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[f].apply(this,l,c,Yt.CLEAR,e);var d=l;l=c,c=d}r[f].apply(this,l,u.renderTexture,Yt.BLEND,e),f>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)},i.prototype.bindAndClear=function(t,e){e===void 0&&(e=Yt.CLEAR);var r=this.renderer,n=r.renderTexture,s=r.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 a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,n.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=s.stateId&1||this.forceClear;(e===Yt.CLEAR||e===Yt.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},i.prototype.applyFilter=function(t,e,r,n){var s=this.renderer;s.state.set(t.state),this.bindAndClear(r,n),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(jt.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(jt.TRIANGLE_STRIP))},i.prototype.calculateSpriteMatrix=function(t,e){var r=this.activeState,n=r.sourceFrame,s=r.destinationFrame,a=e._texture.orig,o=t.set(s.width,0,0,s.height,n.x,n.y),h=e.worldTransform.copyTo(bt.TEMP_MATRIX);return h.invert(),o.prepend(h),o.scale(1/a.width,1/a.height),o.translate(e.anchor.x,e.anchor.y),o},i.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},i.prototype.getOptimalFilterTexture=function(t,e,r,n){return r===void 0&&(r=1),n===void 0&&(n=xt.NONE),this.texturePool.getOptimalTexture(t,e,r,n)},i.prototype.getFilterTexture=function(t,e,r){if(typeof t=="number"){var n=t;t=e,e=n}t=t||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||xt.NONE);return s.filterFrame=t.filterFrame,s},i.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},i.prototype.emptyPool=function(){this.texturePool.clear(!0)},i.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},i.prototype.transformAABB=function(t,e){var r=Bi[0],n=Bi[1],s=Bi[2],a=Bi[3];r.set(e.left,e.top),n.set(e.left,e.bottom),s.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(r,r),t.apply(n,n),t.apply(s,s),t.apply(a,a);var o=Math.min(r.x,n.x,s.x,a.x),h=Math.min(r.y,n.y,s.y,a.y),u=Math.max(r.x,n.x,s.x,a.x),l=Math.max(r.y,n.y,s.y,a.y);e.x=o,e.y=h,e.width=u-o,e.height=l-h},i.prototype.roundFrame=function(t,e,r,n,s){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(s){var a=s.a,o=s.b,h=s.c,u=s.d;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}s=s?Bs.copyFrom(s):Bs.identity(),s.translate(-r.x,-r.y).scale(n.width/r.width,n.height/r.height).translate(n.x,n.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}},i}(),zr=function(){function i(t){this.renderer=t}return i.prototype.flush=function(){},i.prototype.destroy=function(){this.renderer=null},i.prototype.start=function(){},i.prototype.stop=function(){this.flush()},i.prototype.render=function(t){},i}(),Us=function(){function i(t){this.renderer=t,this.emptyRenderer=new zr(t),this.currentRenderer=this.emptyRenderer}return i.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},i.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},i.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},i.prototype.copyBoundTextures=function(t,e){for(var r=this.renderer.texture.boundTextures,n=e-1;n>=0;--n)t[n]=r[n]||null,t[n]&&(t[n]._batchLocation=n)},i.prototype.boundArray=function(t,e,r,n){for(var s=t.elements,a=t.ids,o=t.count,h=0,u=0;u<o;u++){var l=s[u],c=l._batchLocation;if(c>=0&&c<n&&e[c]===l){a[u]=c;continue}for(;h<n;){var f=e[h];if(f&&f._batchEnabled===r&&f._batchLocation===h){h++;continue}a[u]=h,l._batchLocation=h,e[h]=l;break}}},i.prototype.destroy=function(){this.renderer=null},i}(),au=0,ks=function(){function i(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(i.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),i.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=au++},i.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=au++,this.renderer.runners.contextChange.emit(t)},i.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},i.prototype.createContext=function(t,e){var r;if(z.PREFER_ENV>=Ut.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl},i.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")};this.webGLVersion===1?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")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},i.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},i.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},i.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()},i.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},i.prototype.validateContext=function(t){var e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var n=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},i}(),ou=function(){function i(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=xt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return i}(),Bv=new ut,Gs=function(){function i(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Fi(10,10),this.msaaSamples=null}return i.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 ut,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===Ut.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=function(n){return e.drawBuffersWEBGL(n)}:(this.hasMRT=!1,t.drawBuffers=function(){}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},i.prototype.bind=function(t,e,r){r===void 0&&(r=0);var n=this.gl;if(t){var s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=r),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var a=0;a<t.colorTextures.length;a++){var o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var h=e.width>>r,u=e.height>>r,l=h/e.width;this.setViewport(e.x*l,e.y*l,h,u)}else{var h=t.width>>r,u=t.height>>r;this.setViewport(0,0,h,u)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},i.prototype.setViewport=function(t,e,r,n){var s=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),n=Math.round(n),(s.width!==r||s.height!==n||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=r,s.height=n,this.gl.viewport(t,e,r,n))},Object.defineProperty(i.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}),i.prototype.clear=function(t,e,r,n,s){s===void 0&&(s=Fr.COLOR|Fr.DEPTH);var a=this.gl;a.clearColor(t,e,r,n),a.clear(s)},i.prototype.initFramebuffer=function(t){var e=this.gl,r=new ou(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r},i.prototype.resizeFramebuffer=function(t){var e=this.gl,r=t.glFramebuffers[this.CONTEXT_UID];r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.RGBA8,t.width,t.height)),r.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var n=t.colorTextures,s=n.length;e.drawBuffers||(s=Math.min(s,1));for(var a=0;a<s;a++){var o=n[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},i.prototype.updateFramebuffer=function(t,e){var r=this.gl,n=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures,a=s.length;r.drawBuffers||(a=Math.min(a,1)),n.multisample>1&&this.canMultisampleFramebuffer(t)?(n.msaaBuffer=n.msaaBuffer||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,n.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,n.multisample,r.RGBA8,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,n.msaaBuffer)):n.msaaBuffer&&(r.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));for(var o=[],h=0;h<a;h++){var u=s[h],l=u.parentTextureArray||u;this.renderer.texture.bind(l,0),!(h===0&&n.msaaBuffer)&&(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,u.target,l._glTextures[this.CONTEXT_UID].texture,e),o.push(r.COLOR_ATTACHMENT0+h))}if(o.length>1&&r.drawBuffers(o),t.depthTexture){var c=this.writeDepthTexture;if(c){var f=t.depthTexture;this.renderer.texture.bind(f,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,f._glTextures[this.CONTEXT_UID].texture,e)}}(t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)?(n.stencil=n.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,n.stencil),n.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,n.multisample,r.DEPTH24_STENCIL8,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,n.stencil)):n.stencil&&(r.deleteRenderbuffer(n.stencil),n.stencil=null)},i.prototype.canMultisampleFramebuffer=function(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture},i.prototype.detectSamples=function(t){var e=this.msaaSamples,r=xt.NONE;if(t<=1||e===null)return r;for(var n=0;n<e.length;n++)if(e[n]<=t){r=e[n];break}return r===1&&(r=xt.NONE),r},i.prototype.blit=function(t,e,r){var n=this,s=n.current,a=n.renderer,o=n.gl,h=n.CONTEXT_UID;if(a.context.webGLVersion===2&&s){var u=s.glFramebuffers[h];if(u){if(!t){if(!u.msaaBuffer)return;var l=s.colorTextures[0];if(!l)return;u.blitFramebuffer||(u.blitFramebuffer=new Fi(s.width,s.height),u.blitFramebuffer.addColorTexture(0,l)),t=u.blitFramebuffer,t.colorTextures[0]!==l&&(t.colorTextures[0]=l,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=Bv,e.width=s.width,e.height=s.height),r||(r=e);var c=e.width===r.width&&e.height===r.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,u.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,o.COLOR_BUFFER_BIT,c?o.NEAREST:o.LINEAR)}}},i.prototype.disposeFramebuffer=function(t,e){var r=t.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(r){delete t.glFramebuffers[this.CONTEXT_UID];var s=this.managedFramebuffers.indexOf(t);s>=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(n.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&n.deleteRenderbuffer(r.msaaBuffer),r.stencil&&n.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}},i.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)},i.prototype.forceStencil=function(){var t=this.current;if(t){var e=t.glFramebuffers[this.CONTEXT_UID];if(!(!e||e.stencil)){t.stencil=!0;var r=t.width,n=t.height,s=this.gl,a=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,a),e.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,e.multisample,s.DEPTH24_STENCIL8,r,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,r,n),e.stencil=a,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)}}},i.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new ut},i.prototype.destroy=function(){this.renderer=null},i}(),Xs={5126:4,5123:2,5121:1},Hs=function(){function i(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return i.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,e.webGLVersion!==2){var r=this.renderer.context.extensions.vertexArrayObject;z.PREFER_ENV===Ut.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=function(){return r.createVertexArrayOES()},t.bindVertexArray=function(s){return r.bindVertexArrayOES(s)},t.deleteVertexArray=function(s){return r.deleteVertexArrayOES(s)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(e.webGLVersion!==2){var n=t.getExtension("ANGLE_instanced_arrays");n?(t.vertexAttribDivisor=function(s,a){return n.vertexAttribDivisorANGLE(s,a)},t.drawElementsInstanced=function(s,a,o,h,u){return n.drawElementsInstancedANGLE(s,a,o,h,u)},t.drawArraysInstanced=function(s,a,o,h){return n.drawArraysInstancedANGLE(s,a,o,h)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex},i.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var r=this.gl,n=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);var a=n[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?r.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()},i.prototype.reset=function(){this.unbind()},i.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,r=0;r<t.buffers.length;r++){var n=t.buffers[r];e.update(n)}},i.prototype.checkCompatibility=function(t,e){var r=t.attributes,n=e.attributeData;for(var s in n)if(!r[s])throw new Error('shader and geometry incompatible, geometry missing the "'+s+'" attribute')},i.prototype.getSignature=function(t,e){var r=t.attributes,n=e.attributeData,s=["g",t.id];for(var a in r)n[a]&&s.push(a,n[a].location);return s.join("-")},i.prototype.initGeometryVao=function(t,e,r){r===void 0&&(r=!0);var n=this.gl,s=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);var h=this.getSignature(t,o),u=t.glVertexArrayObjects[this.CONTEXT_UID],l=u[h];if(l)return u[o.id]=l,l;var c=t.buffers,f=t.attributes,d={},v={};for(var _ in c)d[_]=0,v[_]=0;for(var _ in f)!f[_].size&&o.attributeData[_]?f[_].size=o.attributeData[_].size:f[_].size||console.warn("PIXI Geometry attribute '"+_+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[f[_].buffer]+=f[_].size*Xs[f[_].type];for(var _ in f){var p=f[_],g=p.size;p.stride===void 0&&(d[p.buffer]===g*Xs[p.type]?p.stride=0:p.stride=d[p.buffer]),p.start===void 0&&(p.start=v[p.buffer],v[p.buffer]+=g*Xs[p.type])}l=n.createVertexArray(),n.bindVertexArray(l);for(var y=0;y<c.length;y++){var T=c[y];a.bind(T),r&&T._glBuffers[s].refCount++}return this.activateVao(t,o),this._activeVao=l,u[o.id]=l,u[h]=l,l},i.prototype.disposeGeometry=function(t,e){var r;if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var n=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,a=t.buffers,o=(r=this.renderer)===null||r===void 0?void 0:r.buffer;if(t.disposeRunner.remove(this),!!n){if(o)for(var h=0;h<a.length;h++){var u=a[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!e&&o.dispose(a[h],e))}if(!e){for(var l in n)if(l[0]==="g"){var c=n[l];this._activeVao===c&&this.unbind(),s.deleteVertexArray(c)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},i.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)},i.prototype.activateVao=function(t,e){var r=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);var h=null;for(var u in o){var l=o[u],c=a[l.buffer],f=c._glBuffers[n];if(e.attributeData[u]){h!==f&&(s.bind(c),h=f);var d=e.attributeData[u].location;if(r.enableVertexAttribArray(d),r.vertexAttribPointer(d,l.size,l.type||r.FLOAT,l.normalized,l.stride,l.start),l.instance)if(this.hasInstance)r.vertexAttribDivisor(d,1);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}},i.prototype.draw=function(t,e,r,n){var s=this.gl,a=this._activeGeometry;if(a.indexBuffer){var o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?s.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(r||0)*o,n||1):s.drawElements(t,e||a.indexBuffer.data.length,h,(r||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?s.drawArraysInstanced(t,r,e||a.getSize(),n||1):s.drawArrays(t,r,e||a.getSize());return this},i.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},i.prototype.destroy=function(){this.renderer=null},i}(),hu=function(){function i(t){t===void 0&&(t=null),this.type=It.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=z.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(i.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}),i.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=It.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},i.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)},i}();function uu(i,t,e){var r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function lu(i,t){var e=i.getShaderSource(t).split(`
|
|
14
|
+
`).map(function(u,l){return l+": "+u}),r=i.getShaderInfoLog(t),n=r.split(`
|
|
15
|
+
`),s={},a=n.map(function(u){return parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(u){return u&&!s[u]?(s[u]=!0,!0):!1}),o=[""];a.forEach(function(u){e[u-1]="%c"+e[u-1]+"%c",o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=e.join(`
|
|
16
|
+
`);o[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,o),console.groupEnd()}function Nv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||lu(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||lu(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}function Vs(i){for(var t=new Array(i),e=0;e<t.length;e++)t[e]=!1;return t}function fu(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Vs(2*t);case"bvec3":return Vs(3*t);case"bvec4":return Vs(4*t);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 cu={},Wr=cu;function du(){if(Wr===cu||Wr&&Wr.isContextLost()){var i=z.ADAPTER.createCanvas(),t=void 0;z.PREFER_ENV>=Ut.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Wr=t}return Wr}var Ni;function Uv(){if(!Ni){Ni=kt.MEDIUM;var i=du();if(i&&i.getShaderPrecisionFormat){var t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);Ni=t.precision?kt.HIGH:kt.MEDIUM}}return Ni}function pu(i,t,e){if(i.substring(0,9)!=="precision"){var r=t;return t===kt.HIGH&&e!==kt.HIGH&&(r=kt.MEDIUM),"precision "+r+` float;
|
|
17
|
+
`+i}else if(e!==kt.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var kv={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 vu(i){return kv[i]}var Ui=null,_u={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 gu(i,t){if(!Ui){var e=Object.keys(_u);Ui={};for(var r=0;r<e.length;++r){var n=e[r];Ui[i[n]]=_u[n]}}return Ui[t]}var Ze=[{test:function(i){return i.type==="float"&&i.size===1&&!i.isArray},code:function(i){return`
|
|
18
|
+
if(uv["`+i+'"] !== ud["'+i+`"].value)
|
|
19
|
+
{
|
|
20
|
+
ud["`+i+'"].value = uv["'+i+`"]
|
|
21
|
+
gl.uniform1f(ud["`+i+'"].location, uv["'+i+`"])
|
|
22
|
+
}
|
|
23
|
+
`}},{test:function(i,t){return(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0)},code:function(i){return`t = syncData.textureCount++;
|
|
24
|
+
|
|
25
|
+
renderer.texture.bind(uv["`+i+`"], t);
|
|
26
|
+
|
|
27
|
+
if(ud["`+i+`"].value !== t)
|
|
28
|
+
{
|
|
29
|
+
ud["`+i+`"].value = t;
|
|
30
|
+
gl.uniform1i(ud["`+i+`"].location, t);
|
|
31
|
+
; // eslint-disable-line max-len
|
|
32
|
+
}`}},{test:function(i,t){return i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0},code:function(i){return`
|
|
33
|
+
gl.uniformMatrix3fv(ud["`+i+'"].location, false, uv["'+i+`"].toArray(true));
|
|
34
|
+
`},codeUbo:function(i){return`
|
|
35
|
+
var `+i+"_matrix = uv."+i+`.toArray(true);
|
|
36
|
+
|
|
37
|
+
data[offset] = `+i+`_matrix[0];
|
|
38
|
+
data[offset+1] = `+i+`_matrix[1];
|
|
39
|
+
data[offset+2] = `+i+`_matrix[2];
|
|
40
|
+
|
|
41
|
+
data[offset + 4] = `+i+`_matrix[3];
|
|
42
|
+
data[offset + 5] = `+i+`_matrix[4];
|
|
43
|
+
data[offset + 6] = `+i+`_matrix[5];
|
|
44
|
+
|
|
45
|
+
data[offset + 8] = `+i+`_matrix[6];
|
|
46
|
+
data[offset + 9] = `+i+`_matrix[7];
|
|
47
|
+
data[offset + 10] = `+i+`_matrix[8];
|
|
48
|
+
`}},{test:function(i,t){return i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0},code:function(i){return`
|
|
49
|
+
cv = ud["`+i+`"].value;
|
|
50
|
+
v = uv["`+i+`"];
|
|
51
|
+
|
|
52
|
+
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
53
|
+
{
|
|
54
|
+
cv[0] = v.x;
|
|
55
|
+
cv[1] = v.y;
|
|
56
|
+
gl.uniform2f(ud["`+i+`"].location, v.x, v.y);
|
|
57
|
+
}`},codeUbo:function(i){return`
|
|
58
|
+
v = uv.`+i+`;
|
|
59
|
+
|
|
60
|
+
data[offset] = v.x;
|
|
61
|
+
data[offset+1] = v.y;
|
|
62
|
+
`}},{test:function(i){return i.type==="vec2"&&i.size===1&&!i.isArray},code:function(i){return`
|
|
63
|
+
cv = ud["`+i+`"].value;
|
|
64
|
+
v = uv["`+i+`"];
|
|
65
|
+
|
|
66
|
+
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
67
|
+
{
|
|
68
|
+
cv[0] = v[0];
|
|
69
|
+
cv[1] = v[1];
|
|
70
|
+
gl.uniform2f(ud["`+i+`"].location, v[0], v[1]);
|
|
71
|
+
}
|
|
72
|
+
`}},{test:function(i,t){return i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0},code:function(i){return`
|
|
73
|
+
cv = ud["`+i+`"].value;
|
|
74
|
+
v = uv["`+i+`"];
|
|
75
|
+
|
|
76
|
+
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
77
|
+
{
|
|
78
|
+
cv[0] = v.x;
|
|
79
|
+
cv[1] = v.y;
|
|
80
|
+
cv[2] = v.width;
|
|
81
|
+
cv[3] = v.height;
|
|
82
|
+
gl.uniform4f(ud["`+i+`"].location, v.x, v.y, v.width, v.height)
|
|
83
|
+
}`},codeUbo:function(i){return`
|
|
84
|
+
v = uv.`+i+`;
|
|
85
|
+
|
|
86
|
+
data[offset] = v.x;
|
|
87
|
+
data[offset+1] = v.y;
|
|
88
|
+
data[offset+2] = v.width;
|
|
89
|
+
data[offset+3] = v.height;
|
|
90
|
+
`}},{test:function(i){return i.type==="vec4"&&i.size===1&&!i.isArray},code:function(i){return`
|
|
91
|
+
cv = ud["`+i+`"].value;
|
|
92
|
+
v = uv["`+i+`"];
|
|
93
|
+
|
|
94
|
+
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
95
|
+
{
|
|
96
|
+
cv[0] = v[0];
|
|
97
|
+
cv[1] = v[1];
|
|
98
|
+
cv[2] = v[2];
|
|
99
|
+
cv[3] = v[3];
|
|
100
|
+
|
|
101
|
+
gl.uniform4f(ud["`+i+`"].location, v[0], v[1], v[2], v[3])
|
|
102
|
+
}`}}],Gv={float:`
|
|
103
|
+
if (cv !== v)
|
|
104
|
+
{
|
|
105
|
+
cu.value = v;
|
|
106
|
+
gl.uniform1f(location, v);
|
|
107
|
+
}`,vec2:`
|
|
108
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
109
|
+
{
|
|
110
|
+
cv[0] = v[0];
|
|
111
|
+
cv[1] = v[1];
|
|
112
|
+
|
|
113
|
+
gl.uniform2f(location, v[0], v[1])
|
|
114
|
+
}`,vec3:`
|
|
115
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
116
|
+
{
|
|
117
|
+
cv[0] = v[0];
|
|
118
|
+
cv[1] = v[1];
|
|
119
|
+
cv[2] = v[2];
|
|
120
|
+
|
|
121
|
+
gl.uniform3f(location, v[0], v[1], v[2])
|
|
122
|
+
}`,vec4:`
|
|
123
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
124
|
+
{
|
|
125
|
+
cv[0] = v[0];
|
|
126
|
+
cv[1] = v[1];
|
|
127
|
+
cv[2] = v[2];
|
|
128
|
+
cv[3] = v[3];
|
|
129
|
+
|
|
130
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
131
|
+
}`,int:`
|
|
132
|
+
if (cv !== v)
|
|
133
|
+
{
|
|
134
|
+
cu.value = v;
|
|
135
|
+
|
|
136
|
+
gl.uniform1i(location, v);
|
|
137
|
+
}`,ivec2:`
|
|
138
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
139
|
+
{
|
|
140
|
+
cv[0] = v[0];
|
|
141
|
+
cv[1] = v[1];
|
|
142
|
+
|
|
143
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
144
|
+
}`,ivec3:`
|
|
145
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
146
|
+
{
|
|
147
|
+
cv[0] = v[0];
|
|
148
|
+
cv[1] = v[1];
|
|
149
|
+
cv[2] = v[2];
|
|
150
|
+
|
|
151
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
152
|
+
}`,ivec4:`
|
|
153
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
154
|
+
{
|
|
155
|
+
cv[0] = v[0];
|
|
156
|
+
cv[1] = v[1];
|
|
157
|
+
cv[2] = v[2];
|
|
158
|
+
cv[3] = v[3];
|
|
159
|
+
|
|
160
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
161
|
+
}`,uint:`
|
|
162
|
+
if (cv !== v)
|
|
163
|
+
{
|
|
164
|
+
cu.value = v;
|
|
165
|
+
|
|
166
|
+
gl.uniform1ui(location, v);
|
|
167
|
+
}`,uvec2:`
|
|
168
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
169
|
+
{
|
|
170
|
+
cv[0] = v[0];
|
|
171
|
+
cv[1] = v[1];
|
|
172
|
+
|
|
173
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
174
|
+
}`,uvec3:`
|
|
175
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
176
|
+
{
|
|
177
|
+
cv[0] = v[0];
|
|
178
|
+
cv[1] = v[1];
|
|
179
|
+
cv[2] = v[2];
|
|
180
|
+
|
|
181
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
182
|
+
}`,uvec4:`
|
|
183
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
184
|
+
{
|
|
185
|
+
cv[0] = v[0];
|
|
186
|
+
cv[1] = v[1];
|
|
187
|
+
cv[2] = v[2];
|
|
188
|
+
cv[3] = v[3];
|
|
189
|
+
|
|
190
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
191
|
+
}`,bool:`
|
|
192
|
+
if (cv !== v)
|
|
193
|
+
{
|
|
194
|
+
cu.value = v;
|
|
195
|
+
gl.uniform1i(location, v);
|
|
196
|
+
}`,bvec2:`
|
|
197
|
+
if (cv[0] != v[0] || cv[1] != v[1])
|
|
198
|
+
{
|
|
199
|
+
cv[0] = v[0];
|
|
200
|
+
cv[1] = v[1];
|
|
201
|
+
|
|
202
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
203
|
+
}`,bvec3:`
|
|
204
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
205
|
+
{
|
|
206
|
+
cv[0] = v[0];
|
|
207
|
+
cv[1] = v[1];
|
|
208
|
+
cv[2] = v[2];
|
|
209
|
+
|
|
210
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
211
|
+
}`,bvec4:`
|
|
212
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
213
|
+
{
|
|
214
|
+
cv[0] = v[0];
|
|
215
|
+
cv[1] = v[1];
|
|
216
|
+
cv[2] = v[2];
|
|
217
|
+
cv[3] = v[3];
|
|
218
|
+
|
|
219
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
220
|
+
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
|
|
221
|
+
if (cv !== v)
|
|
222
|
+
{
|
|
223
|
+
cu.value = v;
|
|
224
|
+
|
|
225
|
+
gl.uniform1i(location, v);
|
|
226
|
+
}`,samplerCube:`
|
|
227
|
+
if (cv !== v)
|
|
228
|
+
{
|
|
229
|
+
cu.value = v;
|
|
230
|
+
|
|
231
|
+
gl.uniform1i(location, v);
|
|
232
|
+
}`,sampler2DArray:`
|
|
233
|
+
if (cv !== v)
|
|
234
|
+
{
|
|
235
|
+
cu.value = v;
|
|
236
|
+
|
|
237
|
+
gl.uniform1i(location, v);
|
|
238
|
+
}`},Xv={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)"};function Hv(i,t){var e,r=[`
|
|
239
|
+
var v = null;
|
|
240
|
+
var cv = null;
|
|
241
|
+
var cu = null;
|
|
242
|
+
var t = 0;
|
|
243
|
+
var gl = renderer.gl;
|
|
244
|
+
`];for(var n in i.uniforms){var s=t[n];if(!s){!((e=i.uniforms[n])===null||e===void 0)&&e.group&&(i.uniforms[n].ubo?r.push(`
|
|
245
|
+
renderer.shader.syncUniformBufferGroup(uv.`+n+", '"+n+`');
|
|
246
|
+
`):r.push(`
|
|
247
|
+
renderer.shader.syncUniformGroup(uv.`+n+`, syncData);
|
|
248
|
+
`));continue}for(var a=i.uniforms[n],o=!1,h=0;h<Ze.length;h++)if(Ze[h].test(s,a)){r.push(Ze[h].code(n,a)),o=!0;break}if(!o){var u=s.size===1&&!s.isArray?Gv:Xv,l=u[s.type].replace("location",'ud["'+n+'"].location');r.push(`
|
|
249
|
+
cu = ud["`+n+`"];
|
|
250
|
+
cv = cu.value;
|
|
251
|
+
v = uv["`+n+`"];
|
|
252
|
+
`+l+";")}}return new Function("ud","uv","renderer","syncData",r.join(`
|
|
253
|
+
`))}var Vv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
254
|
+
`);function jv(i){for(var t="",e=0;e<i;++e)e>0&&(t+=`
|
|
255
|
+
else `),e<i-1&&(t+="if(test == "+e+".0){}");return t}function mu(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var e=t.createShader(t.FRAGMENT_SHADER);;){var r=Vv.replace(/%forloop%/gi,jv(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Yr;function zv(){if(typeof Yr=="boolean")return Yr;try{var i=new Function("param1","param2","param3","return param1[param2] === param3;");Yr=i({a:"b"},"a","b")===!0}catch{Yr=!1}return Yr}var Wv=`varying vec2 vTextureCoord;
|
|
256
|
+
|
|
257
|
+
uniform sampler2D uSampler;
|
|
258
|
+
|
|
259
|
+
void main(void){
|
|
260
|
+
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
261
|
+
}`,Yv=`attribute vec2 aVertexPosition;
|
|
262
|
+
attribute vec2 aTextureCoord;
|
|
263
|
+
|
|
264
|
+
uniform mat3 projectionMatrix;
|
|
265
|
+
|
|
266
|
+
varying vec2 vTextureCoord;
|
|
267
|
+
|
|
268
|
+
void main(void){
|
|
269
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
270
|
+
vTextureCoord = aTextureCoord;
|
|
271
|
+
}
|
|
272
|
+
`,qv=0,ki={},_r=function(){function i(t,e,r){r===void 0&&(r="pixi-shader"),this.id=qv++,this.vertexSrc=t||i.defaultVertexSrc,this.fragmentSrc=e||i.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),ki[r]?(ki[r]++,r+="-"+ki[r]):ki[r]=1,this.vertexSrc="#define SHADER_NAME "+r+`
|
|
273
|
+
`+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+r+`
|
|
274
|
+
`+this.fragmentSrc,this.vertexSrc=pu(this.vertexSrc,z.PRECISION_VERTEX,kt.HIGH),this.fragmentSrc=pu(this.fragmentSrc,z.PRECISION_FRAGMENT,Uv())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(i,"defaultVertexSrc",{get:function(){return Yv},enumerable:!1,configurable:!0}),Object.defineProperty(i,"defaultFragmentSrc",{get:function(){return Wv},enumerable:!1,configurable:!0}),i.from=function(t,e,r){var n=t+e,s=ys[n];return s||(ys[n]=s=new i(t,e,r)),s},i}(),be=function(){function i(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Re?this.uniformGroup=e:this.uniformGroup=new Re(e):this.uniformGroup=new Re({}),this.disposeRunner=new Dt("disposeShader")}return i.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var r in e.uniforms){var n=e.uniforms[r];if(n.group&&this.checkUniformExists(t,n))return!0}return!1},i.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(i.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),i.from=function(t,e,r){var n=_r.from(t,e);return new i(n,r)},i}(),js=0,zs=1,Ws=2,Ys=3,qs=4,$s=5,Oe=function(){function i(){this.data=0,this.blendMode=tt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(i.prototype,"blend",{get:function(){return!!(this.data&1<<js)},set:function(t){!!(this.data&1<<js)!==t&&(this.data^=1<<js)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"offsets",{get:function(){return!!(this.data&1<<zs)},set:function(t){!!(this.data&1<<zs)!==t&&(this.data^=1<<zs)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"culling",{get:function(){return!!(this.data&1<<Ws)},set:function(t){!!(this.data&1<<Ws)!==t&&(this.data^=1<<Ws)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthTest",{get:function(){return!!(this.data&1<<Ys)},set:function(t){!!(this.data&1<<Ys)!==t&&(this.data^=1<<Ys)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthMask",{get:function(){return!!(this.data&1<<$s)},set:function(t){!!(this.data&1<<$s)!==t&&(this.data^=1<<$s)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<qs)},set:function(t){!!(this.data&1<<qs)!==t&&(this.data^=1<<qs)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==tt.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),i.prototype.toString=function(){return"[@pixi/core:State "+("blendMode="+this.blendMode+" ")+("clockwiseFrontFace="+this.clockwiseFrontFace+" ")+("culling="+this.culling+" ")+("depthMask="+this.depthMask+" ")+("polygonOffset="+this.polygonOffset)+"]"},i.for2d=function(){var t=new i;return t.depthTest=!1,t.blend=!0,t},i}(),$v=`varying vec2 vTextureCoord;
|
|
275
|
+
|
|
276
|
+
uniform sampler2D uSampler;
|
|
277
|
+
|
|
278
|
+
void main(void){
|
|
279
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
280
|
+
}
|
|
281
|
+
`,Kv=`attribute vec2 aVertexPosition;
|
|
282
|
+
|
|
283
|
+
uniform mat3 projectionMatrix;
|
|
284
|
+
|
|
285
|
+
varying vec2 vTextureCoord;
|
|
286
|
+
|
|
287
|
+
uniform vec4 inputSize;
|
|
288
|
+
uniform vec4 outputFrame;
|
|
289
|
+
|
|
290
|
+
vec4 filterVertexPosition( void )
|
|
291
|
+
{
|
|
292
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
293
|
+
|
|
294
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
vec2 filterTextureCoord( void )
|
|
298
|
+
{
|
|
299
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
void main(void)
|
|
303
|
+
{
|
|
304
|
+
gl_Position = filterVertexPosition();
|
|
305
|
+
vTextureCoord = filterTextureCoord();
|
|
306
|
+
}
|
|
307
|
+
`,Te=function(i){mt(t,i);function t(e,r,n){var s=this,a=_r.from(e||t.defaultVertexSrc,r||t.defaultFragmentSrc);return s=i.call(this,a,n)||this,s.padding=0,s.resolution=z.FILTER_RESOLUTION,s.multisample=z.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Oe,s}return t.prototype.apply=function(e,r,n,s,a){e.applyFilter(this,r,n,s)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._resolution=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultVertexSrc",{get:function(){return Kv},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return $v},enumerable:!1,configurable:!0}),t}(be),Zv=`attribute vec2 aVertexPosition;
|
|
308
|
+
attribute vec2 aTextureCoord;
|
|
309
|
+
|
|
310
|
+
uniform mat3 projectionMatrix;
|
|
311
|
+
uniform mat3 otherMatrix;
|
|
312
|
+
|
|
313
|
+
varying vec2 vMaskCoord;
|
|
314
|
+
varying vec2 vTextureCoord;
|
|
315
|
+
|
|
316
|
+
void main(void)
|
|
317
|
+
{
|
|
318
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
319
|
+
|
|
320
|
+
vTextureCoord = aTextureCoord;
|
|
321
|
+
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
322
|
+
}
|
|
323
|
+
`,Jv=`varying vec2 vMaskCoord;
|
|
324
|
+
varying vec2 vTextureCoord;
|
|
325
|
+
|
|
326
|
+
uniform sampler2D uSampler;
|
|
327
|
+
uniform sampler2D mask;
|
|
328
|
+
uniform float alpha;
|
|
329
|
+
uniform float npmAlpha;
|
|
330
|
+
uniform vec4 maskClamp;
|
|
331
|
+
|
|
332
|
+
void main(void)
|
|
333
|
+
{
|
|
334
|
+
float clip = step(3.5,
|
|
335
|
+
step(maskClamp.x, vMaskCoord.x) +
|
|
336
|
+
step(maskClamp.y, vMaskCoord.y) +
|
|
337
|
+
step(vMaskCoord.x, maskClamp.z) +
|
|
338
|
+
step(vMaskCoord.y, maskClamp.w));
|
|
339
|
+
|
|
340
|
+
vec4 original = texture2D(uSampler, vTextureCoord);
|
|
341
|
+
vec4 masky = texture2D(mask, vMaskCoord);
|
|
342
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
343
|
+
|
|
344
|
+
original *= (alphaMul * masky.r * alpha * clip);
|
|
345
|
+
|
|
346
|
+
gl_FragColor = original;
|
|
347
|
+
}
|
|
348
|
+
`,yu=new bt,Gi=function(){function i(t,e){this._texture=t,this.mapCoord=new bt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}return Object.defineProperty(i.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),i.prototype.multiplyUvs=function(t,e){e===void 0&&(e=t);for(var r=this.mapCoord,n=0;n<t.length;n+=2){var s=t[n],a=t[n+1];e[n]=s*r.a+a*r.c+r.tx,e[n+1]=s*r.b+a*r.d+r.ty}return e},i.prototype.update=function(t){var e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);var n=e.orig,s=e.trim;s&&(yu.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(yu));var a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,u=this.clampOffset;return o[0]=(e._frame.x+h+u)/a.width,o[1]=(e._frame.y+h+u)/a.height,o[2]=(e._frame.x+e._frame.width-h+u)/a.width,o[3]=(e._frame.y+e._frame.height-h+u)/a.height,this.uClampOffset[0]=u/a.realWidth,this.uClampOffset[1]=u/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0},i}(),xu=function(i){mt(t,i);function t(e,r,n){var s=this,a=null;return typeof e!="string"&&r===void 0&&n===void 0&&(a=e,e=void 0,r=void 0,n=void 0),s=i.call(this,e||Zv,r||Jv,n)||this,s.maskSprite=a,s.maskMatrix=new bt,s}return Object.defineProperty(t.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),t.prototype.apply=function(e,r,n,s){var a=this._maskSprite,o=a._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Gi(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,a).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=a.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,r,n,s))},t}(Te),Ks=function(){function i(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return i.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},i.prototype.push=function(t,e){var r=e;if(!r.isMaskData){var n=this.maskDataPool.pop()||new hu;n.pooled=!0,n.maskObject=e,r=n}var s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==It.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case It.SCISSOR:this.renderer.scissor.push(r);break;case It.STENCIL:this.renderer.stencil.push(r);break;case It.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case It.COLOR:this.pushColorMask(r);break}r.type===It.SPRITE&&this.maskStack.push(r)},i.prototype.pop=function(t){var e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case It.SCISSOR:this.renderer.scissor.pop(e);break;case It.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case It.SPRITE:this.popSpriteMask(e);break;case It.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){var r=this.maskStack[this.maskStack.length-1];r.type===It.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}},i.prototype.detect=function(t){var e=t.maskObject;e?e.isSprite?t.type=It.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=It.SCISSOR:t.type=It.STENCIL:t.type=It.COLOR},i.prototype.pushSpriteMask=function(t){var e,r,n=t.maskObject,s=t._target,a=t._filters;a||(a=this.alphaMaskPool[this.alphaMaskIndex],a||(a=this.alphaMaskPool[this.alphaMaskIndex]=[new xu]));var o=this.renderer,h=o.renderTexture,u,l;if(h.current){var c=h.current;u=t.resolution||c.resolution,l=(e=t.multisample)!==null&&e!==void 0?e:c.multisample}else u=t.resolution||o.resolution,l=(r=t.multisample)!==null&&r!==void 0?r:o.multisample;a[0].resolution=u,a[0].multisample=l,a[0].maskSprite=n;var f=s.filterArea;s.filterArea=n.getBounds(!0),o.filter.push(s,a),s.filterArea=f,t._filters||this.alphaMaskIndex++},i.prototype.popSpriteMask=function(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},i.prototype.pushColorMask=function(t){var e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)},i.prototype.popColorMask=function(t){var e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)},i.prototype.destroy=function(){this.renderer=null},i}(),bu=function(){function i(t){this.renderer=t,this.maskStack=[],this.glConst=0}return i.prototype.getStackLength=function(){return this.maskStack.length},i.prototype.setMaskStack=function(t){var e=this.renderer.gl,r=this.getStackLength();this.maskStack=t;var n=this.getStackLength();n!==r&&(n===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},i.prototype._useCurrent=function(){},i.prototype.destroy=function(){this.renderer=null,this.maskStack=null},i}(),Tu=new bt,Eu=[],Zs=function(i){mt(t,i);function t(e){var r=i.call(this,e)||this;return r.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,r}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},t.prototype.calcScissorRect=function(e){var r;if(!e._scissorRectLocal){var n=e._scissorRect,s=e.maskObject,a=this.renderer,o=a.renderTexture,h=s.getBounds(!0,(r=Eu.pop())!==null&&r!==void 0?r:new ut);this.roundFrameToPixels(h,o.current?o.current.resolution:a.resolution,o.sourceFrame,o.destinationFrame,a.projection.transform),n&&h.fit(n),e._scissorRectLocal=h}},t.isMatrixRotated=function(e){if(!e)return!1;var r=e.a,n=e.b,s=e.c,a=e.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(r)>1e-4||Math.abs(a)>1e-4)},t.prototype.testScissor=function(e){var r=e.maskObject;if(!r.isFastRect||!r.isFastRect()||t.isMatrixRotated(r.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var n=e._scissorRectLocal;return n.width>0&&n.height>0},t.prototype.roundFrameToPixels=function(e,r,n,s,a){t.isMatrixRotated(a)||(a=a?Tu.copyFrom(a):Tu.identity(),a.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(a,e),e.fit(s),e.x=Math.round(e.x*r),e.y=Math.round(e.y*r),e.width=Math.round(e.width*r),e.height=Math.round(e.height*r))},t.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var r=this.renderer.gl;e._scissorRect||r.enable(r.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},t.prototype.pop=function(e){var r=this.renderer.gl;e&&Eu.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():r.disable(r.SCISSOR_TEST)},t.prototype._useCurrent=function(){var e=this.maskStack[this.maskStack.length-1]._scissorRect,r;this.renderer.renderTexture.current?r=e.y:r=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,r,e.width,e.height)},t}(bu),Js=function(i){mt(t,i);function t(e){var r=i.call(this,e)||this;return r.glConst=z.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,r}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},t.prototype.push=function(e){var r=e.maskObject,n=this.renderer.gl,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),e._stencilCounter++;var a=e._colorMask;a!==0&&(e._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilFunc(n.EQUAL,s,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.INCR),r.renderable=!0,r.render(this.renderer),this.renderer.batch.flush(),r.renderable=!1,a!==0&&(e._colorMask=a,n.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()},t.prototype.pop=function(e){var r=this.renderer.gl;if(this.getStackLength()===0)r.disable(r.STENCIL_TEST);else{var n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=n?n._colorMask:15;s!==0&&(n._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilOp(r.KEEP,r.KEEP,r.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(n._colorMask=s,r.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}},t.prototype._useCurrent=function(){var e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},t}(bu),Qs=function(){function i(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new bt,this.transform=null}return i.prototype.update=function(t,e,r,n){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,n),this.transform&&this.projectionMatrix.append(this.transform);var s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)},i.prototype.calculateProjection=function(t,e,r,n){var s=this.projectionMatrix,a=n?-1:1;s.identity(),s.a=1/e.width*2,s.d=a*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-a-e.y*s.d},i.prototype.setTransform=function(t){},i.prototype.destroy=function(){this.renderer=null},i}(),Je=new ut,qr=new ut,ta=function(){function i(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ut,this.destinationFrame=new ut,this.viewportFrame=new ut}return i.prototype.bind=function(t,e,r){t===void 0&&(t=null);var n=this.renderer;this.current=t;var s,a,o;t?(s=t.baseTexture,o=s.resolution,e||(Je.width=t.frame.width,Je.height=t.frame.height,e=Je),r||(qr.x=t.frame.x,qr.y=t.frame.y,qr.width=e.width,qr.height=e.height,r=qr),a=s.framebuffer):(o=n.resolution,e||(Je.width=n.screen.width,Je.height=n.screen.height,e=Je),r||(r=Je,r.width=e.width,r.height=e.height));var h=this.viewportFrame;h.x=r.x*o,h.y=r.y*o,h.width=r.width*o,h.height=r.height*o,t||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(r,e,o,!a),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)},i.prototype.clear=function(t,e){this.current?t=t||this.current.baseTexture.clearColor:t=t||this.clearColor;var r=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer.screen,s=r.width!==n.width||r.height!==n.height;if(s){var a=this.viewportFrame,o=a.x,h=a.y,u=a.width,l=a.height;o=Math.round(o),h=Math.round(h),u=Math.round(u),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,h,u,l)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),s&&this.renderer.scissor.pop()},i.prototype.resize=function(){this.bind(null)},i.prototype.reset=function(){this.bind(null)},i.prototype.destroy=function(){this.renderer=null},i}();function Qv(i,t,e,r,n){e.buffer.update(n)}var t_={float:`
|
|
349
|
+
data[offset] = v;
|
|
350
|
+
`,vec2:`
|
|
351
|
+
data[offset] = v[0];
|
|
352
|
+
data[offset+1] = v[1];
|
|
353
|
+
`,vec3:`
|
|
354
|
+
data[offset] = v[0];
|
|
355
|
+
data[offset+1] = v[1];
|
|
356
|
+
data[offset+2] = v[2];
|
|
357
|
+
|
|
358
|
+
`,vec4:`
|
|
359
|
+
data[offset] = v[0];
|
|
360
|
+
data[offset+1] = v[1];
|
|
361
|
+
data[offset+2] = v[2];
|
|
362
|
+
data[offset+3] = v[3];
|
|
363
|
+
`,mat2:`
|
|
364
|
+
data[offset] = v[0];
|
|
365
|
+
data[offset+1] = v[1];
|
|
366
|
+
|
|
367
|
+
data[offset+4] = v[2];
|
|
368
|
+
data[offset+5] = v[3];
|
|
369
|
+
`,mat3:`
|
|
370
|
+
data[offset] = v[0];
|
|
371
|
+
data[offset+1] = v[1];
|
|
372
|
+
data[offset+2] = v[2];
|
|
373
|
+
|
|
374
|
+
data[offset + 4] = v[3];
|
|
375
|
+
data[offset + 5] = v[4];
|
|
376
|
+
data[offset + 6] = v[5];
|
|
377
|
+
|
|
378
|
+
data[offset + 8] = v[6];
|
|
379
|
+
data[offset + 9] = v[7];
|
|
380
|
+
data[offset + 10] = v[8];
|
|
381
|
+
`,mat4:`
|
|
382
|
+
for(var i = 0; i < 16; i++)
|
|
383
|
+
{
|
|
384
|
+
data[offset + i] = v[i];
|
|
385
|
+
}
|
|
386
|
+
`},Su={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:16*2,mat3:16*3,mat4:16*4};function Pu(i){for(var t=i.map(function(h){return{data:h,offset:0,dataLen:0,dirty:0}}),e=0,r=0,n=0,s=0;s<t.length;s++){var a=t[s];if(e=Su[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,r%e!==0&&r<16){var o=r%e%16;r+=o,n+=o}r+e>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=e,r=e):(a.offset=n,r+=e,n+=e)}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}function wu(i,t){var e=[];for(var r in i)t[r]&&e.push(t[r]);return e.sort(function(n,s){return n.index-s.index}),e}function Cu(i,t){if(!i.autoManage)return{size:0,syncFunc:Qv};for(var e=wu(i.uniforms,t),r=Pu(e),n=r.uboElements,s=r.size,a=[`
|
|
387
|
+
var v = null;
|
|
388
|
+
var v2 = null;
|
|
389
|
+
var cv = null;
|
|
390
|
+
var t = 0;
|
|
391
|
+
var gl = renderer.gl
|
|
392
|
+
var index = 0;
|
|
393
|
+
var data = buffer.data;
|
|
394
|
+
`],o=0;o<n.length;o++){for(var h=n[o],u=i.uniforms[h.data.name],l=h.data.name,c=!1,f=0;f<Ze.length;f++){var d=Ze[f];if(d.codeUbo&&d.test(h.data,u)){a.push("offset = "+h.offset/4+";",Ze[f].codeUbo(h.data.name,u)),c=!0;break}}if(!c)if(h.data.size>1){var v=vu(h.data.type),_=Math.max(Su[h.data.type]/16,1),p=v/_,g=(4-p%4)%4;a.push(`
|
|
395
|
+
cv = ud.`+l+`.value;
|
|
396
|
+
v = uv.`+l+`;
|
|
397
|
+
offset = `+h.offset/4+`;
|
|
398
|
+
|
|
399
|
+
t = 0;
|
|
400
|
+
|
|
401
|
+
for(var i=0; i < `+h.data.size*_+`; i++)
|
|
402
|
+
{
|
|
403
|
+
for(var j = 0; j < `+p+`; j++)
|
|
404
|
+
{
|
|
405
|
+
data[offset++] = v[t++];
|
|
406
|
+
}
|
|
407
|
+
offset += `+g+`;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
`)}else{var y=t_[h.data.type];a.push(`
|
|
411
|
+
cv = ud.`+l+`.value;
|
|
412
|
+
v = uv.`+l+`;
|
|
413
|
+
offset = `+h.offset/4+`;
|
|
414
|
+
`+y+`;
|
|
415
|
+
`)}}return a.push(`
|
|
416
|
+
renderer.buffer.update(buffer);
|
|
417
|
+
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",a.join(`
|
|
418
|
+
`))}}var e_=function(){function i(){}return i}(),Iu=function(){function i(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return i.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},i}();function r_(i,t){for(var e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=t.getActiveAttrib(i,n);if(s.name.indexOf("gl_")!==0){var a=gu(t,s.type),o={type:a,name:s.name,size:vu(a),location:t.getAttribLocation(i,s.name)};e[s.name]=o}}return e}function i_(i,t){for(var e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS),n=0;n<r;n++){var s=t.getActiveUniform(i,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),h=gu(t,s.type);e[a]={name:a,index:n,type:h,size:s.size,isArray:o,value:fu(h,s.size)}}return e}function Au(i,t){var e=uu(i,i.VERTEX_SHADER,t.vertexSrc),r=uu(i,i.FRAGMENT_SHADER,t.fragmentSrc),n=i.createProgram();if(i.attachShader(n,e),i.attachShader(n,r),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)||Nv(i,n,e,r),t.attributeData=r_(n,i),t.uniformData=i_(n,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){var s=Object.keys(t.attributeData);s.sort(function(l,c){return l>c?1:-1});for(var a=0;a<s.length;a++)t.attributeData[s[a]].location=a,i.bindAttribLocation(n,a,s[a]);i.linkProgram(n)}i.deleteShader(e),i.deleteShader(r);var o={};for(var a in t.uniformData){var h=t.uniformData[a];o[a]={location:i.getUniformLocation(n,a),value:fu(h.type,h.size)}}var u=new Iu(n,o);return u}var n_=0,Xi={textureCount:0,uboCount:0},ea=function(){function i(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=n_++}return i.prototype.systemCheck=function(){if(!zv())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},i.prototype.contextChange=function(t){this.gl=t,this.reset()},i.prototype.bind=function(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;var r=t.program,n=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(n.program)),e||(Xi.textureCount=0,Xi.uboCount=0,this.syncUniformGroup(t.uniformGroup,Xi)),n},i.prototype.setUniforms=function(t){var e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)},i.prototype.syncUniformGroup=function(t,e){var r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))},i.prototype.syncUniforms=function(t,e,r){var n=t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t);n(e.uniformData,t.uniforms,this.renderer,r)},i.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Hv(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},i.prototype.syncUniformBufferGroup=function(t,e){var r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;var n=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),n(r.uniformData,t.uniforms,this.renderer,Xi,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])},i.prototype.createSyncBufferGroup=function(t,e,r){var n=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var s=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,n.uniformBlockBinding(e.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;var a=this.getSignature(t,this.shader.program.uniformData,"ubo"),o=this._uboCache[a];if(o||(o=this._uboCache[a]=Cu(t,this.shader.program.uniformData)),t.autoManage){var h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]},i.prototype.getSignature=function(t,e,r){var n=t.uniforms,s=[r+"-"];for(var a in n)s.push(a),e[a]&&s.push(e[a].type);return s.join("-")},i.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},i.prototype.generateProgram=function(t){var e=this.gl,r=t.program,n=Au(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=n,n},i.prototype.reset=function(){this.program=null,this.shader=null},i.prototype.disposeShader=function(t){this.shader===t&&(this.shader=null)},i.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},i}();function s_(i,t){return t===void 0&&(t=[]),t[tt.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.ADD]=[i.ONE,i.ONE],t[tt.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.NONE]=[0,0],t[tt.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[tt.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[tt.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[tt.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[tt.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[tt.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[tt.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[tt.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[tt.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[tt.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[tt.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var a_=0,o_=1,h_=2,u_=3,l_=4,f_=5,ra=function(){function i(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=tt.NONE,this._blendEq=!1,this.map=[],this.map[a_]=this.setBlend,this.map[o_]=this.setOffset,this.map[h_]=this.setCullFace,this.map[u_]=this.setDepthTest,this.map[l_]=this.setFrontFace,this.map[f_]=this.setDepthMask,this.checks=[],this.defaultState=new Oe,this.defaultState.blend=!0}return i.prototype.contextChange=function(t){this.gl=t,this.blendModes=s_(t),this.set(this.defaultState),this.reset()},i.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,r=0;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(var r=0;r<this.checks.length;r++)this.checks[r](this,t)},i.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(var e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},i.prototype.setBlend=function(t){this.updateCheck(i.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)},i.prototype.setOffset=function(t){this.updateCheck(i.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},i.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},i.prototype.setDepthMask=function(t){this.gl.depthMask(t)},i.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},i.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},i.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}},i.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},i.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)},i.prototype.updateCheck=function(t,e){var r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)},i.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},i.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},i.prototype.destroy=function(){this.gl=null},i}(),ia=function(){function i(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=z.GC_MAX_IDLE,this.checkCountMax=z.GC_MAX_CHECK_COUNT,this.mode=z.GC_MODE}return i.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==Br.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},i.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,n=0;n<e.length;n++){var s=e[n];!s.framebuffer&&this.count-s.touched>this.maxIdle&&(t.destroyTexture(s,!0),e[n]=null,r=!0)}if(r){for(var a=0,n=0;n<e.length;n++)e[n]!==null&&(e[a++]=e[n]);e.length=a}},i.prototype.unload=function(t){var e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(var n=t.children.length-1;n>=0;n--)this.unload(t.children[n])},i.prototype.destroy=function(){this.renderer=null},i}();function c_(i){var t,e,r,n,s,a,o,h,u,l,c,f,d,v,_,p,g,y,T,I,m,S,x;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?x=(t={},t[Q.UNSIGNED_BYTE]=(e={},e[H.RGBA]=i.RGBA8,e[H.RGB]=i.RGB8,e[H.RG]=i.RG8,e[H.RED]=i.R8,e[H.RGBA_INTEGER]=i.RGBA8UI,e[H.RGB_INTEGER]=i.RGB8UI,e[H.RG_INTEGER]=i.RG8UI,e[H.RED_INTEGER]=i.R8UI,e[H.ALPHA]=i.ALPHA,e[H.LUMINANCE]=i.LUMINANCE,e[H.LUMINANCE_ALPHA]=i.LUMINANCE_ALPHA,e),t[Q.BYTE]=(r={},r[H.RGBA]=i.RGBA8_SNORM,r[H.RGB]=i.RGB8_SNORM,r[H.RG]=i.RG8_SNORM,r[H.RED]=i.R8_SNORM,r[H.RGBA_INTEGER]=i.RGBA8I,r[H.RGB_INTEGER]=i.RGB8I,r[H.RG_INTEGER]=i.RG8I,r[H.RED_INTEGER]=i.R8I,r),t[Q.UNSIGNED_SHORT]=(n={},n[H.RGBA_INTEGER]=i.RGBA16UI,n[H.RGB_INTEGER]=i.RGB16UI,n[H.RG_INTEGER]=i.RG16UI,n[H.RED_INTEGER]=i.R16UI,n[H.DEPTH_COMPONENT]=i.DEPTH_COMPONENT16,n),t[Q.SHORT]=(s={},s[H.RGBA_INTEGER]=i.RGBA16I,s[H.RGB_INTEGER]=i.RGB16I,s[H.RG_INTEGER]=i.RG16I,s[H.RED_INTEGER]=i.R16I,s),t[Q.UNSIGNED_INT]=(a={},a[H.RGBA_INTEGER]=i.RGBA32UI,a[H.RGB_INTEGER]=i.RGB32UI,a[H.RG_INTEGER]=i.RG32UI,a[H.RED_INTEGER]=i.R32UI,a[H.DEPTH_COMPONENT]=i.DEPTH_COMPONENT24,a),t[Q.INT]=(o={},o[H.RGBA_INTEGER]=i.RGBA32I,o[H.RGB_INTEGER]=i.RGB32I,o[H.RG_INTEGER]=i.RG32I,o[H.RED_INTEGER]=i.R32I,o),t[Q.FLOAT]=(h={},h[H.RGBA]=i.RGBA32F,h[H.RGB]=i.RGB32F,h[H.RG]=i.RG32F,h[H.RED]=i.R32F,h[H.DEPTH_COMPONENT]=i.DEPTH_COMPONENT32F,h),t[Q.HALF_FLOAT]=(u={},u[H.RGBA]=i.RGBA16F,u[H.RGB]=i.RGB16F,u[H.RG]=i.RG16F,u[H.RED]=i.R16F,u),t[Q.UNSIGNED_SHORT_5_6_5]=(l={},l[H.RGB]=i.RGB565,l),t[Q.UNSIGNED_SHORT_4_4_4_4]=(c={},c[H.RGBA]=i.RGBA4,c),t[Q.UNSIGNED_SHORT_5_5_5_1]=(f={},f[H.RGBA]=i.RGB5_A1,f),t[Q.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[H.RGBA]=i.RGB10_A2,d[H.RGBA_INTEGER]=i.RGB10_A2UI,d),t[Q.UNSIGNED_INT_10F_11F_11F_REV]=(v={},v[H.RGB]=i.R11F_G11F_B10F,v),t[Q.UNSIGNED_INT_5_9_9_9_REV]=(_={},_[H.RGB]=i.RGB9_E5,_),t[Q.UNSIGNED_INT_24_8]=(p={},p[H.DEPTH_STENCIL]=i.DEPTH24_STENCIL8,p),t[Q.FLOAT_32_UNSIGNED_INT_24_8_REV]=(g={},g[H.DEPTH_STENCIL]=i.DEPTH32F_STENCIL8,g),t):x=(y={},y[Q.UNSIGNED_BYTE]=(T={},T[H.RGBA]=i.RGBA,T[H.RGB]=i.RGB,T[H.ALPHA]=i.ALPHA,T[H.LUMINANCE]=i.LUMINANCE,T[H.LUMINANCE_ALPHA]=i.LUMINANCE_ALPHA,T),y[Q.UNSIGNED_SHORT_5_6_5]=(I={},I[H.RGB]=i.RGB,I),y[Q.UNSIGNED_SHORT_4_4_4_4]=(m={},m[H.RGBA]=i.RGBA,m),y[Q.UNSIGNED_SHORT_5_5_5_1]=(S={},S[H.RGBA]=i.RGBA,S),y),x}var Hi=function(){function i(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=Q.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}return i}(),na=function(){function i(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new lt,this.hasIntegerTextures=!1}return i.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=c_(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};var n=new Hi(t.createTexture());t.bindTexture(t.TEXTURE_2D,n.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]=n,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Hi(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(var r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,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(var r=0;r<this.boundTextures.length;r++)this.bind(null,r)},i.prototype.bind=function(t,e){e===void 0&&(e=0);var r=this.gl;if(t=t==null?void 0:t.castToBaseTexture(),t&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var n=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,n.texture)),n.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):n.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null},i.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},i.prototype.unbind=function(t){var e=this,r=e.gl,n=e.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var s=0;s<n.length;s++)n[s]===this.unknownTexture&&this.bind(null,s)}for(var s=0;s<n.length;s++)n[s]===t&&(this.currentLocation!==s&&(r.activeTexture(r.TEXTURE0+s),this.currentLocation=s),r.bindTexture(t.target,this.emptyTextures[t.target].texture),n[s]=null)},i.prototype.ensureSamplerType=function(t){var e=this,r=e.boundTextures,n=e.hasIntegerTextures,s=e.CONTEXT_UID;if(n)for(var a=t-1;a>=0;--a){var o=r[a];if(o){var h=o._glTextures[s];h.samplerType!==Lr.FLOAT&&this.renderer.texture.unbind(o)}}},i.prototype.initTexture=function(t){var e=new Hi(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},i.prototype.initTextureType=function(t,e){var r,n;e.internalFormat=(n=(r=this.internalFormats[t.type])===null||r===void 0?void 0:r[t.format])!==null&&n!==void 0?n:t.format,this.webGLVersion===2&&t.type===Q.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},i.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(e){var r=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(r,t,e))e.samplerType!==Lr.FLOAT&&(this.hasIntegerTextures=!0);else{var n=t.realWidth,s=t.realHeight,a=r.gl;(e.width!==n||e.height!==s||e.dirtyId<0)&&(e.width=n,e.height=s,a.texImage2D(t.target,0,e.internalFormat,n,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},i.prototype.destroyTexture=function(t,e){var r=this.gl;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var n=this.managedTextures.indexOf(t);n!==-1&&Ve(this.managedTextures,n,1)}},i.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===zt.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ne.CLAMP:e.wrapMode=t.wrapMode,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},i.prototype.setStyle=function(t,e){var r=this.gl;if(e.mipmap&&t.mipmap!==zt.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ie.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&t.anisotropicLevel>0&&t.scaleMode===ie.LINEAR){var s=Math.min(t.anisotropicLevel,r.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ie.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===ie.LINEAR?r.LINEAR:r.NEAREST)},i.prototype.destroy=function(){this.renderer=null},i}(),Mu={__proto__:null,FilterSystem:Ns,BatchSystem:Us,ContextSystem:ks,FramebufferSystem:Gs,GeometrySystem:Hs,MaskSystem:Ks,ScissorSystem:Zs,StencilSystem:Js,ProjectionSystem:Qs,RenderTextureSystem:ta,ShaderSystem:ea,StateSystem:ra,TextureGCSystem:ia,TextureSystem:na},sa=new bt,Ru=function(i){mt(t,i);function t(e,r){e===void 0&&(e=cr.UNKNOWN);var n=i.call(this)||this;return r=Object.assign({},z.RENDER_OPTIONS,r),n.options=r,n.type=e,n.screen=new ut(0,0,r.width,r.height),n.view=r.view||z.ADAPTER.createCanvas(),n.resolution=r.resolution||z.RESOLUTION,n.useContextAlpha=r.useContextAlpha,n.autoDensity=!!r.autoDensity,n.preserveDrawingBuffer=r.preserveDrawingBuffer,n.clearBeforeRender=r.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=r.backgroundColor||n._backgroundColor,n.backgroundAlpha=r.backgroundAlpha,r.transparent!==void 0&&(Bt("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),n.useContextAlpha=r.transparent,n.backgroundAlpha=r.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return t.prototype.initPlugins=function(e){for(var r in e)this.plugins[r]=new e[r](this)},Object.defineProperty(t.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,r){this.view.width=Math.round(e*this.resolution),this.view.height=Math.round(r*this.resolution);var n=this.view.width/this.resolution,s=this.view.height/this.resolution;this.screen.width=n,this.screen.height=s,this.autoDensity&&(this.view.style.width=n+"px",this.view.style.height=s+"px"),this.emit("resize",n,s)},t.prototype.generateTexture=function(e,r,n,s){r===void 0&&(r={}),typeof r=="number"&&(Bt("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),r={scaleMode:r,resolution:n,region:s});var a=r.region,o=Cv(r,["region"]);s=a||e.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var h=Me.create(Ps({width:s.width,height:s.height},o));return sa.tx=-s.x,sa.ty=-s.y,this.render(e,{renderTexture:h,clear:!1,transform:sa,skipUpdateTransform:!!e.parent}),h},t.prototype.destroy=function(e){for(var r in this.plugins)this.plugins[r].destroy(),this.plugins[r]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var n=this;n.plugins=null,n.type=cr.UNKNOWN,n.view=null,n.screen=null,n._tempDisplayObjectParent=null,n.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._backgroundColorString=cs(e),He(e,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(e){this._backgroundColorRgba[3]=e},enumerable:!1,configurable:!0}),t}(xe),d_=function(){function i(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return i}(),p_=function(){function i(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}return i.prototype.destroy=function(){this.renderer=null},i.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},i.prototype.bind=function(t){var e=this,r=e.gl,n=e.CONTEXT_UID,s=t._glBuffers[n]||this.createGLBuffer(t);r.bindBuffer(t.type,s.buffer)},i.prototype.bindBufferBase=function(t,e){var r=this,n=r.gl,s=r.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var a=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,n.bindBufferBase(n.UNIFORM_BUFFER,e,a.buffer)}},i.prototype.bindBufferRange=function(t,e,r){var n=this,s=n.gl,a=n.CONTEXT_UID;r=r||0;var o=t._glBuffers[a]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,r*256,256)},i.prototype.update=function(t){var e=this,r=e.gl,n=e.CONTEXT_UID,s=t._glBuffers[n];if(t._updateID!==s.updateID)if(s.updateID=t._updateID,r.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)r.bufferSubData(t.type,0,t.data);else{var a=t.static?r.STATIC_DRAW:r.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,r.bufferData(t.type,t.data,a)}},i.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var r=t._glBuffers[this.CONTEXT_UID],n=this.gl;t.disposeRunner.remove(this),r&&(e||n.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}},i.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)},i.prototype.createGLBuffer=function(t){var e=this,r=e.CONTEXT_UID,n=e.gl;return t._glBuffers[r]=new d_(n.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[r]},i}(),aa=function(i){mt(t,i);function t(e){var r=i.call(this,cr.WEBGL,e)||this;return e=r.options,r.gl=null,r.CONTEXT_UID=0,r.runners={destroy:new Dt("destroy"),contextChange:new Dt("contextChange"),reset:new Dt("reset"),update:new Dt("update"),postrender:new Dt("postrender"),prerender:new Dt("prerender"),resize:new Dt("resize")},r.runners.contextChange.add(r),r.globalUniforms=new Re({projectionMatrix:new bt},!0),r.addSystem(Ks,"mask").addSystem(ks,"context").addSystem(ra,"state").addSystem(ea,"shader").addSystem(na,"texture").addSystem(p_,"buffer").addSystem(Hs,"geometry").addSystem(Gs,"framebuffer").addSystem(Zs,"scissor").addSystem(Js,"stencil").addSystem(Qs,"projection").addSystem(ia,"textureGC").addSystem(Ns,"filter").addSystem(ta,"renderTexture").addSystem(Us,"batch"),r.initPlugins(t.__plugins),r.multisample=void 0,e.context?r.context.initFromContext(e.context):r.context.initFromOptions({alpha:!!r.useContextAlpha,antialias:e.antialias,premultipliedAlpha:r.useContextAlpha&&r.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:r.options.powerPreference}),r.renderingToScreen=!0,kh(r.context.webGLVersion===2?"WebGL 2":"WebGL 1"),r.resize(r.options.width,r.options.height),r}return t.create=function(e){if(Gh())return new t(e);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},t.prototype.contextChange=function(){var e=this.gl,r;if(this.context.webGLVersion===1){var n=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,n)}else{var n=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),r=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,n)}r>=xt.HIGH?this.multisample=xt.HIGH:r>=xt.MEDIUM?this.multisample=xt.MEDIUM:r>=xt.LOW?this.multisample=xt.LOW:this.multisample=xt.NONE},t.prototype.addSystem=function(e,r){var n=new e(this);if(this[r])throw new Error('Whoops! The name "'+r+'" is already in use');this[r]=n;for(var s in this.runners)this.runners[s].add(n);return this},t.prototype.render=function(e,r){var n,s,a,o;if(r&&(r instanceof Me?(Bt("6.0.0","Renderer#render arguments changed, use options instead."),n=r,s=arguments[2],a=arguments[3],o=arguments[4]):(n=r.renderTexture,s=r.clear,a=r.transform,o=r.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(n||(this._lastObjectRendered=e),!o){var h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(s!==void 0?s:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.generateTexture=function(e,r,n,s){r===void 0&&(r={});var a=i.prototype.generateTexture.call(this,e,r,n,s);return this.framebuffer.blit(),a},t.prototype.resize=function(e,r){i.prototype.resize.call(this,e,r),this.runners.resize.emit(this.screen.height,this.screen.width)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(e){this.runners.destroy.emit();for(var r in this.runners)this.runners[r].destroy();i.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return Bt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,r){Bt("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Kt.add({name:e,type:dt.RendererPlugin,ref:r})},t.__plugins={},t}(Ru);Kt.handleByMap(dt.RendererPlugin,aa.__plugins);function Ou(i){return aa.create(i)}var v_=`attribute vec2 aVertexPosition;
|
|
419
|
+
attribute vec2 aTextureCoord;
|
|
420
|
+
|
|
421
|
+
uniform mat3 projectionMatrix;
|
|
422
|
+
|
|
423
|
+
varying vec2 vTextureCoord;
|
|
424
|
+
|
|
425
|
+
void main(void)
|
|
426
|
+
{
|
|
427
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
428
|
+
vTextureCoord = aTextureCoord;
|
|
429
|
+
}`,__=`attribute vec2 aVertexPosition;
|
|
430
|
+
|
|
431
|
+
uniform mat3 projectionMatrix;
|
|
432
|
+
|
|
433
|
+
varying vec2 vTextureCoord;
|
|
434
|
+
|
|
435
|
+
uniform vec4 inputSize;
|
|
436
|
+
uniform vec4 outputFrame;
|
|
437
|
+
|
|
438
|
+
vec4 filterVertexPosition( void )
|
|
439
|
+
{
|
|
440
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
441
|
+
|
|
442
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
vec2 filterTextureCoord( void )
|
|
446
|
+
{
|
|
447
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
void main(void)
|
|
451
|
+
{
|
|
452
|
+
gl_Position = filterVertexPosition();
|
|
453
|
+
vTextureCoord = filterTextureCoord();
|
|
454
|
+
}
|
|
455
|
+
`,Du=v_,oa=__,g_=function(){function i(t){Bt("6.1.0","System class is deprecated, implemement ISystem interface instead."),this.renderer=t}return i.prototype.destroy=function(){this.renderer=null},i}(),Vi=function(){function i(){this.texArray=null,this.blend=0,this.type=jt.TRIANGLES,this.start=0,this.size=0,this.data=null}return i}(),ji=function(){function i(){this.elements=[],this.ids=[],this.count=0}return i.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},i}(),zi=function(){function i(t){typeof t=="number"?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(i.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),i.prototype.view=function(t){return this[t+"View"]},i.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},i.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")}},i}(),Fu=function(i){mt(t,i);function t(e){var r=i.call(this,e)||this;return r.shaderGenerator=null,r.geometryClass=null,r.vertexSize=null,r.state=Oe.for2d(),r.size=z.SPRITE_BATCH_SIZE*4,r._vertexCount=0,r._indexCount=0,r._bufferedElements=[],r._bufferedTextures=[],r._bufferSize=0,r._shader=null,r._packedGeometries=[],r._packedGeometryPoolSize=2,r._flushId=0,r._aBuffers={},r._iBuffers={},r.MAX_TEXTURES=1,r.renderer.on("prerender",r.onPrerender,r),e.runners.contextChange.add(r),r._dcIndex=0,r._aIndex=0,r._iIndex=0,r._attributeBuffer=null,r._indexBuffer=null,r._tempBoundTextures=[],r}return t.prototype.contextChange=function(){var e=this.renderer.gl;z.PREFER_ENV===Ut.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),z.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=mu(this.MAX_TEXTURES,e)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var r=0;r<this._packedGeometryPoolSize;r++)this._packedGeometries[r]=new this.geometryClass;this.initFlushBuffers()},t.prototype.initFlushBuffers=function(){for(var e=t._drawCallPool,r=t._textureArrayPool,n=this.size/4,s=Math.floor(n/this.MAX_TEXTURES)+1;e.length<n;)e.push(new Vi);for(;r.length<s;)r.push(new ji);for(var a=0;a<this.MAX_TEXTURES;a++)this._tempBoundTextures[a]=null},t.prototype.onPrerender=function(){this._flushId=0},t.prototype.render=function(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},t.prototype.buildTexturesAndDrawCalls=function(){var e=this,r=e._bufferedTextures,n=e.MAX_TEXTURES,s=t._textureArrayPool,a=this.renderer.batch,o=this._tempBoundTextures,h=this.renderer.textureGC.count,u=++lt._globalBatch,l=0,c=s[0],f=0;a.copyBoundTextures(o,n);for(var d=0;d<this._bufferSize;++d){var v=r[d];r[d]=null,v._batchEnabled!==u&&(c.count>=n&&(a.boundArray(c,o,u,n),this.buildDrawCalls(c,f,d),f=d,c=s[++l],++u),v._batchEnabled=u,v.touched=h,c.elements[c.count++]=v)}c.count>0&&(a.boundArray(c,o,u,n),this.buildDrawCalls(c,f,this._bufferSize),++l,++u);for(var d=0;d<o.length;d++)o[d]=null;lt._globalBatch=u},t.prototype.buildDrawCalls=function(e,r,n){var s=this,a=s._bufferedElements,o=s._attributeBuffer,h=s._indexBuffer,u=s.vertexSize,l=t._drawCallPool,c=this._dcIndex,f=this._aIndex,d=this._iIndex,v=l[c];v.start=this._iIndex,v.texArray=e;for(var _=r;_<n;++_){var p=a[_],g=p._texture.baseTexture,y=ps[g.alphaMode?1:0][p.blendMode];a[_]=null,r<_&&v.blend!==y&&(v.size=d-v.start,r=_,v=l[++c],v.texArray=e,v.start=d),this.packInterleavedGeometry(p,o,h,f,d),f+=p.vertexData.length/2*u,d+=p.indices.length,v.blend=y}r<n&&(v.size=d-v.start,++c),this._dcIndex=c,this._aIndex=f,this._iIndex=d},t.prototype.bindAndClearTexArray=function(e){for(var r=this.renderer.texture,n=0;n<e.count;n++)r.bind(e.elements[n],e.ids[n]),e.elements[n]=null;e.count=0},t.prototype.updateGeometry=function(){var e=this,r=e._packedGeometries,n=e._attributeBuffer,s=e._indexBuffer;z.CAN_UPLOAD_SAME_BUFFER?(r[this._flushId]._buffer.update(n.rawBinaryData),r[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,r[this._flushId]=new this.geometryClass),r[this._flushId]._buffer.update(n.rawBinaryData),r[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(r[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},t.prototype.drawBatches=function(){for(var e=this._dcIndex,r=this.renderer,n=r.gl,s=r.state,a=t._drawCallPool,o=null,h=0;h<e;h++){var u=a[h],l=u.texArray,c=u.type,f=u.size,d=u.start,v=u.blend;o!==l&&(o=l,this.bindAndClearTexArray(l)),this.state.blendMode=v,s.set(this.state),n.drawElements(c,f,n.UNSIGNED_SHORT,d*2)}},t.prototype.flush=function(){this._vertexCount!==0&&(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)},t.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),z.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},t.prototype.stop=function(){this.flush()},t.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),i.prototype.destroy.call(this)},t.prototype.getAttributeBuffer=function(e){var r=kr(Math.ceil(e/8)),n=ms(r),s=r*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._aBuffers[s];return a||(this._aBuffers[s]=a=new zi(s*this.vertexSize*4)),a},t.prototype.getIndexBuffer=function(e){var r=kr(Math.ceil(e/12)),n=ms(r),s=r*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._iBuffers[n];return a||(this._iBuffers[n]=a=new Uint16Array(s)),a},t.prototype.packInterleavedGeometry=function(e,r,n,s,a){for(var o=r.uint32View,h=r.float32View,u=s/this.vertexSize,l=e.uvs,c=e.indices,f=e.vertexData,d=e._texture.baseTexture._batchLocation,v=Math.min(e.worldAlpha,1),_=v<1&&e._texture.baseTexture.alphaMode?Pi(e._tintRGB,v):e._tintRGB+(v*255<<24),p=0;p<f.length;p+=2)h[s++]=f[p],h[s++]=f[p+1],h[s++]=l[p],h[s++]=l[p+1],o[s++]=_,h[s++]=d;for(var p=0;p<c.length;p++)n[a++]=u+c[p]},t._drawCallPool=[],t._textureArrayPool=[],t}(zr),Lu=function(){function i(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 i.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),r=0;r<t;r++)e[r]=r;this.defaultGroupCache[t]=Re.from({uSamplers:e},!0);var n=this.fragTemplate;n=n.replace(/%count%/gi,""+t),n=n.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new _r(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new bt,default:this.defaultGroupCache[t]};return new be(this.programCache[t],s)},i.prototype.generateSampleSrc=function(t){var e="";e+=`
|
|
456
|
+
`,e+=`
|
|
457
|
+
`;for(var r=0;r<t;r++)r>0&&(e+=`
|
|
458
|
+
else `),r<t-1&&(e+="if(vTextureId < "+r+".5)"),e+=`
|
|
459
|
+
{`,e+=`
|
|
460
|
+
color = texture2D(uSamplers[`+r+"], vTextureCoord);",e+=`
|
|
461
|
+
}`;return e+=`
|
|
462
|
+
`,e+=`
|
|
463
|
+
`,e},i}(),ha=function(i){mt(t,i);function t(e){e===void 0&&(e=!1);var r=i.call(this)||this;return r._buffer=new Mt(null,e,!1),r._indexBuffer=new Mt(null,e,!0),r.addAttribute("aVertexPosition",r._buffer,2,!1,Q.FLOAT).addAttribute("aTextureCoord",r._buffer,2,!1,Q.FLOAT).addAttribute("aColor",r._buffer,4,!0,Q.UNSIGNED_BYTE).addAttribute("aTextureId",r._buffer,1,!0,Q.FLOAT).addIndex(r._indexBuffer),r}return t}(vr),Bu=`precision highp float;
|
|
464
|
+
attribute vec2 aVertexPosition;
|
|
465
|
+
attribute vec2 aTextureCoord;
|
|
466
|
+
attribute vec4 aColor;
|
|
467
|
+
attribute float aTextureId;
|
|
468
|
+
|
|
469
|
+
uniform mat3 projectionMatrix;
|
|
470
|
+
uniform mat3 translationMatrix;
|
|
471
|
+
uniform vec4 tint;
|
|
472
|
+
|
|
473
|
+
varying vec2 vTextureCoord;
|
|
474
|
+
varying vec4 vColor;
|
|
475
|
+
varying float vTextureId;
|
|
476
|
+
|
|
477
|
+
void main(void){
|
|
478
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
479
|
+
|
|
480
|
+
vTextureCoord = aTextureCoord;
|
|
481
|
+
vTextureId = aTextureId;
|
|
482
|
+
vColor = aColor * tint;
|
|
483
|
+
}
|
|
484
|
+
`,Nu=`varying vec2 vTextureCoord;
|
|
485
|
+
varying vec4 vColor;
|
|
486
|
+
varying float vTextureId;
|
|
487
|
+
uniform sampler2D uSamplers[%count%];
|
|
488
|
+
|
|
489
|
+
void main(void){
|
|
490
|
+
vec4 color;
|
|
491
|
+
%forloop%
|
|
492
|
+
gl_FragColor = color * vColor;
|
|
493
|
+
}
|
|
494
|
+
`,Uu=function(){function i(){}return i.create=function(t){var e=Object.assign({vertex:Bu,fragment:Nu,geometryClass:ha,vertexSize:6},t),r=e.vertex,n=e.fragment,s=e.vertexSize,a=e.geometryClass;return function(o){mt(h,o);function h(u){var l=o.call(this,u)||this;return l.shaderGenerator=new Lu(r,n),l.geometryClass=a,l.vertexSize=s,l}return h}(Fu)},Object.defineProperty(i,"defaultVertexSrc",{get:function(){return Bu},enumerable:!1,configurable:!0}),Object.defineProperty(i,"defaultFragmentTemplate",{get:function(){return Nu},enumerable:!1,configurable:!0}),i}(),ua=Uu.create();Object.assign(ua,{extension:{name:"batch",type:dt.RendererPlugin}});var ku={},m_=function(i){Object.defineProperty(ku,i,{get:function(){return Bt("6.0.0","PIXI.systems."+i+" has moved to PIXI."+i),tu[i]}})};for(var la in tu)m_(la);var Gu={},y_=function(i){Object.defineProperty(Gu,i,{get:function(){return Bt("6.0.0","PIXI.resources."+i+" has moved to PIXI."+i),Mu[i]}})};for(var la in Mu)y_(la);var x_="6.5.10";z.SORTABLE_CHILDREN=!1;var $r=function(){function i(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return i.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},i.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},i.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?ut.EMPTY:(t=t||new ut(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},i.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)},i.prototype.addPointMatrix=function(t,e){var r=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,h=t.ty,u=r*e.x+s*e.y+o,l=n*e.x+a*e.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},i.prototype.addQuad=function(t){var e=this.minX,r=this.minY,n=this.maxX,s=this.maxY,a=t[0],o=t[1];e=a<e?a:e,r=o<r?o:r,n=a>n?a:n,s=o>s?o:s,a=t[2],o=t[3],e=a<e?a:e,r=o<r?o:r,n=a>n?a:n,s=o>s?o:s,a=t[4],o=t[5],e=a<e?a:e,r=o<r?o:r,n=a>n?a:n,s=o>s?o:s,a=t[6],o=t[7],e=a<e?a:e,r=o<r?o:r,n=a>n?a:n,s=o>s?o:s,this.minX=e,this.minY=r,this.maxX=n,this.maxY=s},i.prototype.addFrame=function(t,e,r,n,s){this.addFrameMatrix(t.worldTransform,e,r,n,s)},i.prototype.addFrameMatrix=function(t,e,r,n,s){var a=t.a,o=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,f=this.minX,d=this.minY,v=this.maxX,_=this.maxY,p=a*e+h*r+l,g=o*e+u*r+c;f=p<f?p:f,d=g<d?g:d,v=p>v?p:v,_=g>_?g:_,p=a*n+h*r+l,g=o*n+u*r+c,f=p<f?p:f,d=g<d?g:d,v=p>v?p:v,_=g>_?g:_,p=a*e+h*s+l,g=o*e+u*s+c,f=p<f?p:f,d=g<d?g:d,v=p>v?p:v,_=g>_?g:_,p=a*n+h*s+l,g=o*n+u*s+c,f=p<f?p:f,d=g<d?g:d,v=p>v?p:v,_=g>_?g:_,this.minX=f,this.minY=d,this.maxX=v,this.maxY=_},i.prototype.addVertexData=function(t,e,r){for(var n=this.minX,s=this.minY,a=this.maxX,o=this.maxY,h=e;h<r;h+=2){var u=t[h],l=t[h+1];n=u<n?u:n,s=l<s?l:s,a=u>a?u:a,o=l>o?l:o}this.minX=n,this.minY=s,this.maxX=a,this.maxY=o},i.prototype.addVertices=function(t,e,r,n){this.addVerticesMatrix(t.worldTransform,e,r,n)},i.prototype.addVerticesMatrix=function(t,e,r,n,s,a){s===void 0&&(s=0),a===void 0&&(a=s);for(var o=t.a,h=t.b,u=t.c,l=t.d,c=t.tx,f=t.ty,d=this.minX,v=this.minY,_=this.maxX,p=this.maxY,g=r;g<n;g+=2){var y=e[g],T=e[g+1],I=o*y+u*T+c,m=l*T+h*y+f;d=Math.min(d,I-s),_=Math.max(_,I+s),v=Math.min(v,m-a),p=Math.max(p,m+a)}this.minX=d,this.minY=v,this.maxX=_,this.maxY=p},i.prototype.addBounds=function(t){var e=this.minX,r=this.minY,n=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<r?t.minY:r,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>s?t.maxY:s},i.prototype.addBoundsMask=function(t,e){var r=t.minX>e.minX?t.minX:e.minX,n=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(r<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=r<o?r:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},i.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},i.prototype.addBoundsArea=function(t,e){var r=t.minX>e.x?t.minX:e.x,n=t.minY>e.y?t.minY:e.y,s=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(r<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=r<o?r:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},i.prototype.pad=function(t,e){t===void 0&&(t=0),e===void 0&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},i.prototype.addFramePad=function(t,e,r,n,s,a){t-=s,e-=a,r+=s,n+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>r?this.maxX:r,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>n?this.maxY:n},i}();var fa=function(i,t){return fa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},fa(i,t)};function ca(i,t){fa(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Ct=function(i){ca(t,i);function t(){var e=i.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Mi,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 $r,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 t.mixin=function(e){for(var r=Object.keys(e),n=0;n<r.length;++n){var s=r[n];Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(e,s))}},Object.defineProperty(t.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),t.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},t.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},t.prototype.getBounds=function(e,r){return e||(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),r||(this._boundsRect||(this._boundsRect=new ut),r=this._boundsRect),this._bounds.getRectangle(r)},t.prototype.getLocalBounds=function(e){e||(this._localBoundsRect||(this._localBoundsRect=new ut),e=this._localBoundsRect),this._localBounds||(this._localBounds=new $r);var r=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,a=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,e);return this.parent=n,this.transform=r,this._bounds=s,this._bounds.updateID+=this._boundsID-a,o},t.prototype.toGlobal=function(e,r,n){return n===void 0&&(n=!1),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,r)},t.prototype.toLocal=function(e,r,n,s){return r&&(e=r.toGlobal(e,n,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,n)},t.prototype.setParent=function(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e},t.prototype.setTransform=function(e,r,n,s,a,o,h,u,l){return e===void 0&&(e=0),r===void 0&&(r=0),n===void 0&&(n=1),s===void 0&&(s=1),a===void 0&&(a=0),o===void 0&&(o=0),h===void 0&&(h=0),u===void 0&&(u=0),l===void 0&&(l=0),this.position.x=e,this.position.y=r,this.scale.x=n||1,this.scale.y=s||1,this.rotation=a,this.skew.x=o,this.skew.y=h,this.pivot.x=u,this.pivot.y=l,this},t.prototype.destroy=function(e){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(t.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new da),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),t.prototype.enableTempParent=function(){var e=this.parent;return this.parent=this._tempDisplayObjectParent,e},t.prototype.disableTempParent=function(e){this.parent=e},Object.defineProperty(t.prototype,"x",{get:function(){return this.position.x},set:function(e){this.transform.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.position.y},set:function(e){this.transform.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.transform.position},set:function(e){this.transform.position.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this.transform.scale},set:function(e){this.transform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(e){this.transform.pivot.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skew",{get:function(){return this.transform.skew},set:function(e){this.transform.skew.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(e){this.transform.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this.transform.rotation*Yh},set:function(e){this.transform.rotation=e*qh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){this._zIndex=e,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldVisible",{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mask",{get:function(){return this._mask},set:function(e){if(this._mask!==e){if(this._mask){var r=this._mask.isMaskData?this._mask.maskObject:this._mask;r&&(r._maskRefCount--,r._maskRefCount===0&&(r.renderable=!0,r.isMask=!1))}if(this._mask=e,this._mask){var r=this._mask.isMaskData?this._mask.maskObject:this._mask;r&&(r._maskRefCount===0&&(r.renderable=!1,r.isMask=!0),r._maskRefCount++)}}},enumerable:!1,configurable:!0}),t}(xe),da=function(i){ca(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.sortDirty=null,e}return t}(Ct);Ct.prototype.displayObjectUpdateTransform=Ct.prototype.updateTransform;function b_(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}var Zt=function(i){ca(t,i);function t(){var e=i.call(this)||this;return e.children=[],e.sortableChildren=z.SORTABLE_CHILDREN,e.sortDirty=!1,e}return t.prototype.onChildrenChange=function(e){},t.prototype.addChild=function(){for(var e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];if(r.length>1)for(var s=0;s<r.length;s++)this.addChild(r[s]);else{var a=r[0];a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.push(a),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",a,this,this.children.length-1),a.emit("added",this)}return r[0]},t.prototype.addChildAt=function(e,r){if(r<0||r>this.children.length)throw new Error(e+"addChildAt: The index "+r+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(r,0,e),this._boundsID++,this.onChildrenChange(r),e.emit("added",this),this.emit("childAdded",e,this,r),e},t.prototype.swapChildren=function(e,r){if(e!==r){var n=this.getChildIndex(e),s=this.getChildIndex(r);this.children[n]=r,this.children[s]=e,this.onChildrenChange(n<s?n:s)}},t.prototype.getChildIndex=function(e){var r=this.children.indexOf(e);if(r===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return r},t.prototype.setChildIndex=function(e,r){if(r<0||r>=this.children.length)throw new Error("The index "+r+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(e);Ve(this.children,n,1),this.children.splice(r,0,e),this.onChildrenChange(r)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(){for(var e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];if(r.length>1)for(var s=0;s<r.length;s++)this.removeChild(r[s]);else{var a=r[0],o=this.children.indexOf(a);if(o===-1)return null;a.parent=null,a.transform._parentID=-1,Ve(this.children,o,1),this._boundsID++,this.onChildrenChange(o),a.emit("removed",this),this.emit("childRemoved",a,this,o)}return r[0]},t.prototype.removeChildAt=function(e){var r=this.getChildAt(e);return r.parent=null,r.transform._parentID=-1,Ve(this.children,e,1),this._boundsID++,this.onChildrenChange(e),r.emit("removed",this),this.emit("childRemoved",r,this,e),r},t.prototype.removeChildren=function(e,r){e===void 0&&(e=0),r===void 0&&(r=this.children.length);var n=e,s=r,a=s-n,o;if(a>0&&a<=s){o=this.children.splice(n,a);for(var h=0;h<o.length;++h)o[h].parent=null,o[h].transform&&(o[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(var h=0;h<o.length;++h)o[h].emit("removed",this),this.emit("childRemoved",o[h],this,h);return o}else if(a===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},t.prototype.sortChildren=function(){for(var e=!1,r=0,n=this.children.length;r<n;++r){var s=this.children[r];s._lastSortedIndex=r,!e&&s.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(b_),this.sortDirty=!1},t.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 e=0,r=this.children.length;e<r;++e){var n=this.children[e];n.visible&&n.updateTransform()}},t.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var e=0;e<this.children.length;e++){var r=this.children[e];if(!(!r.visible||!r.renderable))if(r.calculateBounds(),r._mask){var n=r._mask.isMaskData?r._mask.maskObject:r._mask;n?(n.calculateBounds(),this._bounds.addBoundsMask(r._bounds,n._bounds)):this._bounds.addBounds(r._bounds)}else r.filterArea?this._bounds.addBoundsArea(r._bounds,r.filterArea):this._bounds.addBounds(r._bounds)}this._bounds.updateID=this._boundsID},t.prototype.getLocalBounds=function(e,r){r===void 0&&(r=!1);var n=i.prototype.getLocalBounds.call(this,e);if(!r)for(var s=0,a=this.children.length;s<a;++s){var o=this.children[s];o.visible&&o.updateTransform()}return n},t.prototype._calculateBounds=function(){},t.prototype._renderWithCulling=function(e){var r=e.renderTexture.sourceFrame;if(r.width>0&&r.height>0){var n,s;if(this.cullArea?(n=this.cullArea,s=this.worldTransform):this._render!==t.prototype._render&&(n=this.getBounds(!0)),n&&r.intersects(n,s))this._render(e);else if(this.cullArea)return;for(var a=0,o=this.children.length;a<o;++a){var h=this.children[a],u=h.cullable;h.cullable=u||!this.cullArea,h.render(e),h.cullable=u}}},t.prototype.render=function(e){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(var r=0,n=this.children.length;r<n;++r)this.children[r].render(e)}},t.prototype.renderAdvanced=function(e){var r=this.filters,n=this._mask;if(r){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var s=0;s<r.length;s++)r[s].enabled&&this._enabledFilters.push(r[s])}var a=r&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==It.NONE));if(a&&e.batch.flush(),r&&this._enabledFilters&&this._enabledFilters.length&&e.filter.push(this,this._enabledFilters),n&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(var s=0,o=this.children.length;s<o;++s)this.children[s].render(e)}a&&e.batch.flush(),n&&e.mask.pop(this),r&&this._enabledFilters&&this._enabledFilters.length&&e.filter.pop()},t.prototype._render=function(e){},t.prototype.destroy=function(e){i.prototype.destroy.call(this),this.sortDirty=!1;var r=typeof e=="boolean"?e:e&&e.children,n=this.removeChildren(0,this.children.length);if(r)for(var s=0;s<n.length;++s)n[s].destroy(e)},Object.defineProperty(t.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(e){var r=this.getLocalBounds().width;r!==0?this.scale.x=e/r:this.scale.x=1,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(e){var r=this.getLocalBounds().height;r!==0?this.scale.y=e/r:this.scale.y=1,this._height=e},enumerable:!1,configurable:!0}),t}(Ct);Zt.prototype.containerUpdateTransform=Zt.prototype.updateTransform;var Qe=Math.pow,St=(i,t,e)=>new Promise((r,n)=>{var s=h=>{try{o(e.next(h))}catch(u){n(u)}},a=h=>{try{o(e.throw(h))}catch(u){n(u)}},o=h=>h.done?r(h.value):Promise.resolve(h.value).then(s,a);o((e=e.apply(i,t)).next())});const Xu=2,Hu=2;var Kr;(i=>{i.supportMoreMaskDivisions=!0,i.setOpacityFromMotion=!1})(Kr||(Kr={}));var Ft;(i=>{i.LOG_LEVEL_VERBOSE=0,i.LOG_LEVEL_WARNING=1,i.LOG_LEVEL_ERROR=2,i.LOG_LEVEL_NONE=999,i.logLevel=i.LOG_LEVEL_WARNING,i.sound=!0,i.motionSync=!0,i.motionFadingDuration=500,i.idleMotionFadingDuration=2e3,i.expressionFadingDuration=500,i.preserveExpressionOnMotion=!0,i.cubism4=Kr})(Ft||(Ft={}));const _t={log(i,...t){Ft.logLevel<=Ft.LOG_LEVEL_VERBOSE&&console.log(`[${i}]`,...t)},warn(i,...t){Ft.logLevel<=Ft.LOG_LEVEL_WARNING&&console.warn(`[${i}]`,...t)},error(i,...t){Ft.logLevel<=Ft.LOG_LEVEL_ERROR&&console.error(`[${i}]`,...t)}};function Wi(i,t,e){return i<t?t:i>e?e:i}function T_(i,t){return Math.random()*(t-i)+i}function Zr(i,t,e,r,n){const s=t[r];s!==null&&typeof s===i&&(e[n]=s)}function Jr(i,t,e,r,n){const s=t[r];Array.isArray(s)&&(e[n]=s.filter(a=>a!==null&&typeof a===i))}function Vu(i,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{r!=="constructor"&&Object.defineProperty(i.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r))})})}function E_(i){let t=i.lastIndexOf("/");return t!=-1&&(i=i.slice(0,t)),t=i.lastIndexOf("/"),t!==-1&&(i=i.slice(t+1)),i}function S_(i,t){const e=i.indexOf(t);e!==-1&&i.splice(e,1)}class pa extends xe{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return St(this,null,function*(){if(!this.definitions[t]){_t.warn(this.tag,`Undefined expression at [${t}]`);return}if(this.expressions[t]===null){_t.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);return}if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return St(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e<this.definitions.length;e++)this.expressions[e]!==null&&this.expressions[e]!==this.currentExpression&&e!==this.reserveExpressionIndex&&t.push(e);if(t.length){const e=Math.floor(Math.random()*t.length);return this.setExpression(e)}}return!1})}resetExpression(){this._setExpression(this.defaultExpression)}restoreExpression(){this._setExpression(this.currentExpression)}setExpression(t){return St(this,null,function*(){if(typeof t!="number"&&(t=this.getExpressionIndex(t)),!(t>-1&&t<this.definitions.length)||t===this.expressions.indexOf(this.currentExpression))return!1;this.reserveExpressionIndex=t;const e=yield this.loadExpression(t);return!e||this.reserveExpressionIndex!==t?!1:(this.reserveExpressionIndex=-1,this.currentExpression=e,this._setExpression(e),!0)})}update(t,e){return this.isFinished()?!1:this.updateParameters(t,e)}destroy(){this.destroyed=!0,this.emit("destroy");const t=this;t.definitions=void 0,t.expressions=void 0}}const ju=.01,P_=40/7.5,w_=1/(.15*1e3);class C_{constructor(){this.targetX=0,this.targetY=0,this.x=0,this.y=0,this.vx=0,this.vy=0}focus(t,e,r=!1){this.targetX=Wi(t,-1,1),this.targetY=Wi(e,-1,1),r&&(this.x=this.targetX,this.y=this.targetY)}update(t){const e=this.targetX-this.x,r=this.targetY-this.y;if(Math.abs(e)<ju&&Math.abs(r)<ju)return;const n=Math.sqrt(Qe(e,2)+Qe(r,2)),s=P_/(1e3/t);let a=s*(e/n)-this.vx,o=s*(r/n)-this.vy;const h=Math.sqrt(Qe(a,2)+Qe(o,2)),u=s*w_*t;h>u&&(a*=u/h,o*=u/h),this.vx+=a,this.vy+=o;const l=Math.sqrt(Qe(this.vx,2)+Qe(this.vy,2)),c=.5*(Math.sqrt(Qe(u,2)+8*u*n)-u);l>c&&(this.vx*=c/l,this.vy*=c/l),this.x+=this.vx,this.y+=this.vy}}class Yi{constructor(t){this.json=t;let e=t.url;if(typeof e!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=E_(this.url)}resolveURL(t){return ce.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),this.pose!==void 0&&(this.pose=t(this.pose,"pose")),this.physics!==void 0&&(this.physics=t(this.physics,"physics"));for(let e=0;e<this.textures.length;e++)this.textures[e]=t(this.textures[e],`textures[${e}]`)}getDefinedFiles(){const t=[];return this.replaceFiles(e=>(t.push(e),e)),t}validateFiles(t){const e=(s,a)=>{const o=this.resolveURL(s);if(!t.includes(o)){if(a)throw new Error(`File "${s}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(s=>e(s,!0)),this.getDefinedFiles().filter(s=>e(s,!1))}}var va=(i=>(i[i.NONE=0]="NONE",i[i.IDLE=1]="IDLE",i[i.NORMAL=2]="NORMAL",i[i.FORCE=3]="FORCE",i))(va||{});class I_{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,r){if(r<=0)return _t.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return _t.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return _t.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(r===1){if(this.currentPriority!==0)return _t.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(this.reservedIdleGroup!==void 0)return _t.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(r<3){if(r<=this.currentPriority)return _t.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(r<=this.reservePriority)return _t.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,r)}return!0}start(t,e,r,n){if(n===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return _t.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,r)),!1}else{if(e!==this.reservedGroup||r!==this.reservedIndex)return _t.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,r)),!1;this.setReserved(void 0,void 0,0)}return t?(this.setCurrent(e,r,n),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,r){this.currentPriority=r,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,r){this.reservePriority=r,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!Ft.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){const r=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return`
|
|
495
|
+
<Requested> group = "${t}", index = ${e}
|
|
496
|
+
`+r.map(n=>"["+n+"] "+this[n]).join(`
|
|
497
|
+
`)}return""}}const A_="SoundManager",M_=.5;class tr{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach(e=>e.volume=this._volume)}static add(t,e,r){const n=new Audio(t);return n.volume=this._volume,n.preload="auto",n.addEventListener("ended",()=>{this.dispose(n),e==null||e()}),n.addEventListener("error",s=>{this.dispose(n),_t.warn(A_,`Error occurred on "${t}"`,s.error),r==null||r(s.error)}),this.audios.push(n),n}static play(t){return new Promise((e,r)=>{var n;(n=t.play())==null||n.catch(s=>{t.dispatchEvent(new ErrorEvent("error",{error:s})),r(s)}),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)})}static dispose(t){t.pause(),t.removeAttribute("src"),S_(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}tr.audios=[],tr._volume=M_;class gr extends xe{constructor(t,e){super(),this.motionGroups={},this.state=new I_,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){t!=null&&t.idleMotionGroup&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const r of Object.keys(this.definitions))this.motionGroups[r]=[];let e;switch(t==null?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;case"IDLE":default:e=[this.groups.idle];break}for(const r of e)if(this.definitions[r])for(let n=0;n<this.definitions[r].length;n++)this.loadMotion(r,n).then()}loadMotion(t,e){return St(this,null,function*(){var r;if(!((r=this.definitions[t])!=null&&r[e])){_t.warn(this.tag,`Undefined motion at "${t}"[${e}]`);return}if(this.motionGroups[t][e]===null){_t.warn(this.tag,`Cannot start motion at "${t}"[${e}] because it's already failed in loading.`);return}if(this.motionGroups[t][e])return this.motionGroups[t][e];const n=yield this._loadMotion(t,e);if(!this.destroyed)return this.motionGroups[t][e]=n??null,n})}_loadMotion(t,e){throw new Error("Not implemented.")}startMotion(t,e){return St(this,arguments,function*(r,n,s=va.NORMAL){var a;if(!this.state.reserve(r,n,s))return!1;const o=(a=this.definitions[r])==null?void 0:a[n];if(!o)return!1;this.currentAudio&&tr.dispose(this.currentAudio);let h;if(Ft.sound){const l=this.getSoundFile(o);if(l)try{h=tr.add(this.settings.resolveURL(l),()=>this.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=h}catch(c){_t.warn(this.tag,"Failed to create audio",l,c)}}const u=yield this.loadMotion(r,n);if(h){const l=tr.play(h).catch(c=>_t.warn(this.tag,"Failed to play audio",h.src,c));Ft.motionSync&&(yield l)}return this.state.start(u,r,n,s)?(_t.log(this.tag,"Start motion:",this.getMotionName(o)),this.emit("motionStart",r,n,h),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(u),!0):(h&&(tr.dispose(h),this.currentAudio=void 0),!1)})}startRandomMotion(t,e){return St(this,null,function*(){const r=this.definitions[t];if(r!=null&&r.length){const n=[];for(let s=0;s<r.length;s++)this.motionGroups[t][s]!==null&&!this.state.isActive(t,s)&&n.push(s);if(n.length){const s=Math.floor(Math.random()*n.length);return this.startMotion(t,n[s],e)}}return!1})}stopAllMotions(){this._stopAllMotions(),this.state.reset(),this.currentAudio&&(tr.dispose(this.currentAudio),this.currentAudio=void 0)}update(t,e){var r;return this.isFinished()&&(this.playing&&(this.playing=!1,this.emit("motionFinish")),this.state.shouldOverrideExpression()&&((r=this.expressionManager)==null||r.restoreExpression()),this.state.complete(),this.state.shouldRequestIdleMotion()&&this.startRandomMotion(this.groups.idle,va.IDLE)),this.updateParameters(t,e)}destroy(){var t;this.destroyed=!0,this.emit("destroy"),this.stopAllMotions(),(t=this.expressionManager)==null||t.destroy();const e=this;e.definitions=void 0,e.motionGroups=void 0}}const R_={x:0,y:0,width:0,height:0};class zu extends xe{constructor(){super(...arguments),this.focusController=new C_,this.originalWidth=0,this.originalHeight=0,this.width=0,this.height=0,this.localTransform=new bt,this.drawingMatrix=new bt,this.hitAreas={},this.textureFlipY=!1,this.viewport=[0,0,0,0],this.destroyed=!1}init(){this.setupLayout(),this.setupHitAreas()}setupLayout(){const t=this,e=this.getSize();t.originalWidth=e[0],t.originalHeight=e[1];const r=Object.assign({width:Xu,height:Hu},this.getLayout());this.localTransform.scale(r.width/Xu,r.height/Hu),t.width=this.originalWidth*this.localTransform.a,t.height=this.originalHeight*this.localTransform.d;const n=r.x!==void 0&&r.x-r.width/2||r.centerX!==void 0&&r.centerX||r.left!==void 0&&r.left-r.width/2||r.right!==void 0&&r.right+r.width/2||0,s=r.y!==void 0&&r.y-r.height/2||r.centerY!==void 0&&r.centerY||r.top!==void 0&&r.top-r.height/2||r.bottom!==void 0&&r.bottom+r.height/2||0;this.localTransform.translate(this.width*n,-this.height*s)}setupHitAreas(){const t=this.getHitAreaDefs().filter(e=>e.index>=0);for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter(r=>this.isHit(r,t,e))}isHit(t,e,r){if(!this.hitAreas[t])return!1;const n=this.hitAreas[t].index,s=this.getDrawableBounds(n,R_);return s.x<=e&&e<=s.x+s.width&&s.y<=r&&r<=s.y+s.height}getDrawableBounds(t,e){const r=this.getDrawableVertices(t);let n=r[0],s=r[0],a=r[1],o=r[1];for(let h=0;h<r.length;h+=2){const u=r[h],l=r[h+1];n=Math.min(u,n),s=Math.max(u,s),a=Math.min(l,a),o=Math.max(l,o)}return e??(e={}),e.x=n,e.y=a,e.width=s-n,e.height=o-a,e}updateTransform(t){this.drawingMatrix.copyFrom(t).append(this.localTransform)}update(t,e){this.focusController.update(t)}destroy(){this.destroyed=!0,this.emit("destroy"),this.motionManager.destroy(),this.motionManager=void 0}}const O_="XHRLoader";class Wu extends Error{constructor(t,e,r,n=!1){super(t),this.url=e,this.status=r,this.aborted=n}}const Nt=class{static createXHR(i,t,e,r,n){const s=new XMLHttpRequest;if(Nt.allXhrSet.add(s),i){let a=Nt.xhrMap.get(i);a?a.add(s):(a=new Set([s]),Nt.xhrMap.set(i,a)),i.listeners("destroy").includes(Nt.cancelXHRs)||i.once("destroy",Nt.cancelXHRs)}return s.open("GET",t),s.responseType=e,s.onload=()=>{(s.status===200||s.status===0)&&s.response?r(s.response):s.onerror()},s.onerror=()=>{_t.warn(O_,`Failed to load resource as ${s.responseType} (Status ${s.status}): ${t}`),n(new Wu("Network error.",t,s.status))},s.onabort=()=>n(new Wu("Aborted.",t,s.status,!0)),s.onloadend=()=>{var a;Nt.allXhrSet.delete(s),i&&((a=Nt.xhrMap.get(i))==null||a.delete(s))},s}static cancelXHRs(){var i;(i=Nt.xhrMap.get(this))==null||i.forEach(t=>{t.abort(),Nt.allXhrSet.delete(t)}),Nt.xhrMap.delete(this)}static release(){Nt.allXhrSet.forEach(i=>i.abort()),Nt.allXhrSet.clear(),Nt.xhrMap=new WeakMap}};let qi=Nt;qi.xhrMap=new WeakMap,qi.allXhrSet=new Set,qi.loader=(i,t)=>new Promise((e,r)=>{Nt.createXHR(i.target,i.settings?i.settings.resolveURL(i.url):i.url,i.type,s=>{i.result=s,e()},r).send()});function Yu(i,t){let e=-1;return r(0);function r(n,s){if(s)return Promise.reject(s);if(n<=e)return Promise.reject(new Error("next() called multiple times"));e=n;const a=i[n];if(!a)return Promise.resolve();try{return Promise.resolve(a(t,r.bind(null,n+1)))}catch(o){return Promise.reject(o)}}}class De{static load(t){return Yu(this.middlewares,t).then(()=>t.result)}}De.middlewares=[qi.loader];function D_(i,t={}){var e;const r={resourceOptions:{crossorigin:t.crossOrigin}};if(it.fromURL)return it.fromURL(i,r).catch(a=>{if(a instanceof Error)throw a;const o=new Error("Texture loading error");throw o.event=a,o});r.resourceOptions.autoLoad=!1;const n=it.from(i,r);if(n.baseTexture.valid)return Promise.resolve(n);const s=n.baseTexture.resource;return(e=s._live2d_load)!=null||(s._live2d_load=new Promise((a,o)=>{const h=u=>{s.source.removeEventListener("error",h);const l=new Error("Texture loading error");l.event=u,o(l)};s.source.addEventListener("error",h),s.load().then(()=>a(n)).catch(h)})),s._live2d_load}const qu="Live2DFactory",$u=(i,t)=>St(void 0,null,function*(){if(typeof i.source=="string"){const e=yield De.load({url:i.source,type:"json",target:i.live2dModel});e.url=i.source,i.source=e,i.live2dModel.emit("settingsJSONLoaded",e)}return t()}),Ku=(i,t)=>St(void 0,null,function*(){if(i.source instanceof Yi)return i.settings=i.source,t();if(typeof i.source=="object"){const e=Et.findRuntime(i.source);if(e){const r=e.createModelSettings(i.source);return i.settings=r,i.live2dModel.emit("settingsLoaded",r),t()}}throw new TypeError("Unknown settings format.")}),Zu=(i,t)=>{if(i.settings){const e=Et.findRuntime(i.settings);if(e)return e.ready().then(t)}return t()},Ju=(i,t)=>St(void 0,null,function*(){yield t();const e=i.internalModel;if(e){const r=i.settings,n=Et.findRuntime(r);if(n){const s=[];r.pose&&s.push(De.load({settings:r,url:r.pose,type:"json",target:e}).then(a=>{e.pose=n.createPose(e.coreModel,a),i.live2dModel.emit("poseLoaded",e.pose)}).catch(a=>{i.live2dModel.emit("poseLoadError",a),_t.warn(qu,"Failed to load pose.",a)})),r.physics&&s.push(De.load({settings:r,url:r.physics,type:"json",target:e}).then(a=>{e.physics=n.createPhysics(e.coreModel,a),i.live2dModel.emit("physicsLoaded",e.physics)}).catch(a=>{i.live2dModel.emit("physicsLoadError",a),_t.warn(qu,"Failed to load physics.",a)})),s.length&&(yield Promise.all(s))}}}),Qu=(i,t)=>St(void 0,null,function*(){if(i.settings){const e=i.live2dModel,r=i.settings.textures.map(n=>{const s=i.settings.resolveURL(n);return D_(s,{crossOrigin:i.options.crossOrigin})});if(yield t(),i.internalModel)e.internalModel=i.internalModel,e.emit("modelLoaded",i.internalModel);else throw new TypeError("Missing internal model.");e.textures=yield Promise.all(r),e.emit("textureLoaded",e.textures)}else throw new TypeError("Missing settings.")}),tl=(i,t)=>St(void 0,null,function*(){const e=i.settings;if(e instanceof Yi){const r=Et.findRuntime(e);if(!r)throw new TypeError("Unknown model settings.");const n=yield De.load({settings:e,url:e.moc,type:"arraybuffer",target:i.live2dModel});if(!r.isValidMoc(n))throw new Error("Invalid moc data");const s=r.createCoreModel(n);return i.internalModel=r.createInternalModel(s,e,i.options),t()}throw new TypeError("Missing settings.")}),Lt=class{static registerRuntime(i){Lt.runtimes.push(i),Lt.runtimes.sort((t,e)=>e.version-t.version)}static findRuntime(i){for(const t of Lt.runtimes)if(t.test(i))return t}static setupLive2DModel(i,t,e){return St(this,null,function*(){const r=new Promise(a=>i.once("textureLoaded",a)),n=new Promise(a=>i.once("modelLoaded",a)),s=Promise.all([r,n]).then(()=>i.emit("ready"));yield Yu(Lt.live2DModelMiddlewares,{live2dModel:i,source:t,options:e||{}}),yield s,i.emit("load")})}static loadMotion(i,t,e){var r,n;const s=a=>i.emit("motionLoadError",t,e,a);try{const a=(r=i.definitions[t])==null?void 0:r[e];if(!a)return Promise.resolve(void 0);i.listeners("destroy").includes(Lt.releaseTasks)||i.once("destroy",Lt.releaseTasks);let o=Lt.motionTasksMap.get(i);o||(o={},Lt.motionTasksMap.set(i,o));let h=o[t];h||(h=[],o[t]=h);const u=i.getMotionFile(a);return(n=h[e])!=null||(h[e]=De.load({url:u,settings:i.settings,type:i.motionDataType,target:i}).then(l=>{var c;const f=(c=Lt.motionTasksMap.get(i))==null?void 0:c[t];f&&delete f[e];const d=i.createMotion(l,t,a);return i.emit("motionLoaded",t,e,d),d}).catch(l=>{_t.warn(i.tag,`Failed to load motion: ${u}
|
|
498
|
+
`,l),s(l)})),h[e]}catch(a){_t.warn(i.tag,`Failed to load motion at "${t}"[${e}]
|
|
499
|
+
`,a),s(a)}return Promise.resolve(void 0)}static loadExpression(i,t){var e;const r=n=>i.emit("expressionLoadError",t,n);try{const n=i.definitions[t];if(!n)return Promise.resolve(void 0);i.listeners("destroy").includes(Lt.releaseTasks)||i.once("destroy",Lt.releaseTasks);let s=Lt.expressionTasksMap.get(i);s||(s=[],Lt.expressionTasksMap.set(i,s));const a=i.getExpressionFile(n);return(e=s[t])!=null||(s[t]=De.load({url:a,settings:i.settings,type:"json",target:i}).then(o=>{const h=Lt.expressionTasksMap.get(i);h&&delete h[t];const u=i.createExpression(o,n);return i.emit("expressionLoaded",t,u),u}).catch(o=>{_t.warn(i.tag,`Failed to load expression: ${a}
|
|
500
|
+
`,o),r(o)})),s[t]}catch(n){_t.warn(i.tag,`Failed to load expression at [${t}]
|
|
501
|
+
`,n),r(n)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof gr?Lt.motionTasksMap.delete(this):Lt.expressionTasksMap.delete(this)}};let Et=Lt;Et.runtimes=[],Et.urlToJSON=$u,Et.jsonToSettings=Ku,Et.waitUntilReady=Zu,Et.setupOptionals=Ju,Et.setupEssentials=Qu,Et.createInternalModel=tl,Et.live2DModelMiddlewares=[$u,Ku,Zu,Ju,Qu,tl],Et.motionTasksMap=new WeakMap,Et.expressionTasksMap=new WeakMap,gr.prototype._loadMotion=function(i,t){return Et.loadMotion(this,i,t)},pa.prototype._loadExpression=function(i){return Et.loadExpression(this,i)};class F_{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",el,this):this.off("pointertap",el,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",rl,this)))}unregisterInteraction(){var t;this.interactionManager&&((t=this.interactionManager)==null||t.off("pointermove",rl,this),this.interactionManager=void 0)}}function el(i){this.tap(i.data.global.x,i.data.global.y)}function rl(i){this.focus(i.data.global.x,i.data.global.y)}class L_ extends Mi{}const Jt=new vt,B_=new bt;let Fe;class Qr extends Zt{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new L_,this.anchor=new Ae(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(t))}static from(t,e){const r=new this(e);return Et.setupLive2DModel(r,t,e).then(()=>r)}static fromSync(t,e){const r=new this(e);return Et.setupLive2DModel(r,t,e).then(e==null?void 0:e.onLoad).catch(e==null?void 0:e.onError),r}static registerTicker(t){Fe=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;Fe||(Fe=(e=window.PIXI)==null?void 0:e.Ticker),t?this._destroyed||(Fe?(Fe.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):_t.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(Fe==null||Fe.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,r){return e===void 0?this.internalModel.motionManager.startRandomMotion(t,r):this.internalModel.motionManager.startMotion(t,e,r)}expression(t){return this.internalModel.motionManager.expressionManager?t===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,r=!1){Jt.x=t,Jt.y=e,this.toModelPosition(Jt,Jt,!0);let n=Jt.x/this.internalModel.originalWidth*2-1,s=Jt.y/this.internalModel.originalHeight*2-1,a=Math.atan2(s,n);this.internalModel.focusController.focus(Math.cos(a),-Math.sin(a),r)}tap(t,e){const r=this.hitTest(t,e);r.length&&(_t.log(this.tag,"Hit",r),this.emit("hit",r))}hitTest(t,e){return Jt.x=t,Jt.y=e,this.toModelPosition(Jt,Jt),this.internalModel.hitTest(Jt.x,Jt.y)}toModelPosition(t,e=t.clone(),r){return r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(Fe.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let s=0;s<this.textures.length;s++){const a=this.textures[s];a.valid&&((e||!a.baseTexture._glTextures[this.glContextID])&&(t.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL,this.internalModel.textureFlipY),t.texture.bind(a.baseTexture,0)),this.internalModel.bindTexture(s,a.baseTexture._glTextures[this.glContextID].texture),a.baseTexture.touched=t.textureGC.count)}const r=t.framebuffer.viewport;this.internalModel.viewport=[r.x,r.y,r.width,r.height],this.deltaTime&&(this.internalModel.update(this.deltaTime,this.elapsedTime),this.deltaTime=0);const n=B_.copyFrom(t.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform);this.internalModel.updateTransform(n),this.internalModel.draw(t.gl),t.state.reset(),t.texture.reset()}destroy(t){this.emit("destroy"),this.autoUpdate=!1,this.unregisterInteraction(),t!=null&&t.texture&&this.textures.forEach(e=>e.destroy(t.baseTexture)),this.internalModel.destroy(),super.destroy(t)}}Vu(Qr,[F_]);const ve=class{static resolveURL(i,t){var e;const r=(e=ve.filesMap[i])==null?void 0:e[t];if(r===void 0)throw new Error("Cannot find this file from uploaded files: "+t);return r}static upload(i,t){return St(this,null,function*(){const e={};for(const r of t.getDefinedFiles()){const n=decodeURI(ce.resolve(t.url,r)),s=i.find(a=>a.webkitRelativePath===n);s&&(e[r]=URL.createObjectURL(s))}ve.filesMap[t._objectURL]=e})}static createSettings(i){return St(this,null,function*(){const t=i.find(a=>a.name.endsWith("model.json")||a.name.endsWith("model3.json"));if(!t)throw new TypeError("Settings file not found");const e=yield ve.readText(t),r=JSON.parse(e);r.url=t.webkitRelativePath;const n=Et.findRuntime(r);if(!n)throw new Error("Unknown settings JSON");const s=n.createModelSettings(r);return s._objectURL=URL.createObjectURL(t),s})}static readText(i){return St(this,null,function*(){return new Promise((t,e)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=e,r.readAsText(i,"utf8")})})}};let _a=ve;_a.filesMap={},_a.factory=(i,t)=>St(void 0,null,function*(){if(Array.isArray(i.source)&&i.source[0]instanceof File){const e=i.source;let r=e.settings;if(!r)r=yield ve.createSettings(e);else if(!r._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');r.validateFiles(e.map(n=>encodeURI(n.webkitRelativePath))),yield ve.upload(e,r),r.resolveURL=function(n){return ve.resolveURL(this._objectURL,n)},i.source=r,i.live2dModel.once("modelLoaded",n=>{n.once("destroy",function(){const s=this.settings._objectURL;if(URL.revokeObjectURL(s),ve.filesMap[s])for(const a of Object.values(ve.filesMap[s]))URL.revokeObjectURL(a);delete ve.filesMap[s]})})}return t()}),Et.live2DModelMiddlewares.unshift(_a.factory);const Xt=class{static unzip(i,t){return St(this,null,function*(){const e=yield Xt.getFilePaths(i),r=[];for(const s of t.getDefinedFiles()){const a=decodeURI(ce.resolve(t.url,s));e.includes(a)&&r.push(a)}const n=yield Xt.getFiles(i,r);for(let s=0;s<n.length;s++){const a=r[s],o=n[s];Object.defineProperty(o,"webkitRelativePath",{value:a})}return n})}static createSettings(i){return St(this,null,function*(){const e=(yield Xt.getFilePaths(i)).find(a=>a.endsWith("model.json")||a.endsWith("model3.json"));if(!e)throw new Error("Settings file not found");const r=yield Xt.readText(i,e);if(!r)throw new Error("Empty settings file: "+e);const n=JSON.parse(r);n.url=e;const s=Et.findRuntime(n);if(!s)throw new Error("Unknown settings JSON");return s.createModelSettings(n)})}static zipReader(i,t){return St(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(i){return St(this,null,function*(){throw new Error("Not implemented")})}static getFiles(i,t){return St(this,null,function*(){throw new Error("Not implemented")})}static readText(i,t){return St(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(i){}};let $i=Xt;if($i.ZIP_PROTOCOL="zip://",$i.uid=0,$i.factory=(i,t)=>St(void 0,null,function*(){const e=i.source;let r,n,s;if(typeof e=="string"&&(e.endsWith(".zip")||e.startsWith(Xt.ZIP_PROTOCOL))?(e.startsWith(Xt.ZIP_PROTOCOL)?r=e.slice(Xt.ZIP_PROTOCOL.length):r=e,n=yield De.load({url:r,type:"blob",target:i.live2dModel})):Array.isArray(e)&&e.length===1&&e[0]instanceof File&&e[0].name.endsWith(".zip")&&(n=e[0],r=URL.createObjectURL(n),s=e.settings),n){if(!n.size)throw new Error("Empty zip file");const a=yield Xt.zipReader(n,r);s||(s=yield Xt.createSettings(a)),s._objectURL=Xt.ZIP_PROTOCOL+Xt.uid+"/"+s.url;const o=yield Xt.unzip(a,s);o.settings=s,i.source=o,r.startsWith("blob:")&&i.live2dModel.once("modelLoaded",h=>{h.once("destroy",function(){URL.revokeObjectURL(r)})}),Xt.releaseReader(a)}return t()}),Et.live2DModelMiddlewares.unshift($i.factory),!window.Live2D)throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded.");const N_=Live2DMotion.prototype.updateParam;Live2DMotion.prototype.updateParam=function(i,t){N_.call(this,i,t),t.isFinished()&&this.onFinishHandler&&(this.onFinishHandler(this),delete this.onFinishHandler)};class U_ extends AMotion{constructor(t){super(),this.params=[],this.setFadeIn(t.fade_in>0?t.fade_in:Ft.expressionFadingDuration),this.setFadeOut(t.fade_out>0?t.fade_out:Ft.expressionFadingDuration),Array.isArray(t.params)&&t.params.forEach(e=>{const r=e.calc||"add";if(r==="add"){const n=e.def||0;e.val-=n}else if(r==="mult"){const n=e.def||1;e.val/=n}this.params.push({calc:r,val:e.val,id:e.id})})}updateParamExe(t,e,r,n){this.params.forEach(s=>{t.setParamFloat(s.id,s.val*r)})}}class k_ extends pa{constructor(t,e){var r;super(t,e),this.queueManager=new MotionQueueManager,this.definitions=(r=this.settings.expressions)!=null?r:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.name===t)}getExpressionFile(t){return t.file}createExpression(t,e){return new U_(t)}_setExpression(t){return this.queueManager.startMotion(t)}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}}class G_ extends gr{constructor(t,e){super(t,e),this.groups={idle:"idle"},this.motionDataType="arraybuffer",this.queueManager=new MotionQueueManager,this.definitions=this.settings.motions,this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new k_(this.settings,t))}isFinished(){return this.queueManager.isFinished()}createMotion(t,e,r){const n=Live2DMotion.loadMotion(t),s=e===this.groups.idle?Ft.idleMotionFadingDuration:Ft.motionFadingDuration;return n.setFadeIn(r.fade_in>0?r.fade_in:s),n.setFadeOut(r.fade_out>0?r.fade_out:s),n}getMotionFile(t){return t.file}getMotionName(t){return t.file}getSoundFile(t){return t.sound}_startMotion(t,e){return t.onFinishHandler=e,this.queueManager.stopAllMotions(),this.queueManager.startMotion(t)}_stopAllMotions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}destroy(){super.destroy(),this.queueManager=void 0}}class X_{constructor(t){this.coreModel=t,this.blinkInterval=4e3,this.closingDuration=100,this.closedDuration=50,this.openingDuration=150,this.eyeState=0,this.eyeParamValue=1,this.closedTimer=0,this.nextBlinkTimeLeft=this.blinkInterval,this.leftParam=t.getParamIndex("PARAM_EYE_L_OPEN"),this.rightParam=t.getParamIndex("PARAM_EYE_R_OPEN")}setEyeParams(t){this.eyeParamValue=Wi(t,0,1),this.coreModel.setParamFloat(this.leftParam,this.eyeParamValue),this.coreModel.setParamFloat(this.rightParam,this.eyeParamValue)}update(t){switch(this.eyeState){case 0:this.nextBlinkTimeLeft-=t,this.nextBlinkTimeLeft<0&&(this.eyeState=1,this.nextBlinkTimeLeft=this.blinkInterval+this.closingDuration+this.closedDuration+this.openingDuration+T_(0,2e3));break;case 1:this.setEyeParams(this.eyeParamValue+t/this.closingDuration),this.eyeParamValue<=0&&(this.eyeState=2,this.closedTimer=0);break;case 2:this.closedTimer+=t,this.closedTimer>=this.closedDuration&&(this.eyeState=3);break;case 3:this.setEyeParams(this.eyeParamValue+t/this.openingDuration),this.eyeParamValue>=1&&(this.eyeState=0)}}}const er=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class H_ extends zu{constructor(t,e,r){super(),this.textureFlipY=!0,this.drawDataCount=0,this.disableCulling=!1,this.coreModel=t,this.settings=e,this.motionManager=new G_(e,r),this.eyeBlink=new X_(t),this.eyeballXParamIndex=t.getParamIndex("PARAM_EYE_BALL_X"),this.eyeballYParamIndex=t.getParamIndex("PARAM_EYE_BALL_Y"),this.angleXParamIndex=t.getParamIndex("PARAM_ANGLE_X"),this.angleYParamIndex=t.getParamIndex("PARAM_ANGLE_Y"),this.angleZParamIndex=t.getParamIndex("PARAM_ANGLE_Z"),this.bodyAngleXParamIndex=t.getParamIndex("PARAM_BODY_ANGLE_X"),this.breathParamIndex=t.getParamIndex("PARAM_BREATH"),this.init()}init(){super.init(),this.settings.initParams&&this.settings.initParams.forEach(({id:s,value:a})=>this.coreModel.setParamFloat(s,a)),this.settings.initOpacities&&this.settings.initOpacities.forEach(({id:s,value:a})=>this.coreModel.setPartsOpacity(s,a)),this.coreModel.saveParam();const t=this.coreModel.getModelContext()._$aS;t!=null&&t.length&&(this.drawDataCount=t.length);let e=this.coreModel.drawParamWebGL.culling;Object.defineProperty(this.coreModel.drawParamWebGL,"culling",{set:s=>e=s,get:()=>this.disableCulling?!1:e});const r=this.coreModel.getModelContext().clipManager,n=r.setupClip;r.setupClip=(s,a)=>{n.call(r,s,a),a.gl.viewport(...this.viewport)}}getSize(){return[this.coreModel.getCanvasWidth(),this.coreModel.getCanvasHeight()]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){let r=e;e==="center_x"?r="centerX":e==="center_y"&&(r="centerY"),t[r]=this.settings.layout[e]}return t}updateWebGLContext(t,e){const r=this.coreModel.drawParamWebGL;r.firstDraw=!0,r.setGL(t),r.glno=e;for(const a in r)r.hasOwnProperty(a)&&r[a]instanceof WebGLBuffer&&(r[a]=null);const n=this.coreModel.getModelContext().clipManager;n.curFrameNo=e;const s=t.getParameter(t.FRAMEBUFFER_BINDING);n.getMaskRenderTexture(),t.bindFramebuffer(t.FRAMEBUFFER,s)}bindTexture(t,e){this.coreModel.setTexture(t,e)}getHitAreaDefs(){var t;return((t=this.settings.hitAreas)==null?void 0:t.map(e=>({id:e.id,name:e.name,index:this.coreModel.getDrawDataIndex(e.id)})))||[]}getDrawableIDs(){const t=this.coreModel.getModelContext(),e=[];for(let r=0;r<this.drawDataCount;r++){const n=t.getDrawData(r);n&&e.push(n.getDrawDataID().id)}return e}getDrawableIndex(t){return this.coreModel.getDrawDataIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawDataIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);return this.coreModel.getTransformedPoints(t).slice()}update(t,e){var r,n,s,a;super.update(t,e);const o=this.coreModel;this.emit("beforeMotionUpdate");const h=this.motionManager.update(this.coreModel,e);this.emit("afterMotionUpdate"),o.saveParam(),(r=this.motionManager.expressionManager)==null||r.update(o,e),h||(n=this.eyeBlink)==null||n.update(t),this.updateFocus(),this.updateNaturalMovements(t,e),(s=this.physics)==null||s.update(e),(a=this.pose)==null||a.update(t),this.emit("beforeModelUpdate"),o.update(),o.loadParam()}updateFocus(){this.coreModel.addToParamFloat(this.eyeballXParamIndex,this.focusController.x),this.coreModel.addToParamFloat(this.eyeballYParamIndex,this.focusController.y),this.coreModel.addToParamFloat(this.angleXParamIndex,this.focusController.x*30),this.coreModel.addToParamFloat(this.angleYParamIndex,this.focusController.y*30),this.coreModel.addToParamFloat(this.angleZParamIndex,this.focusController.x*this.focusController.y*-30),this.coreModel.addToParamFloat(this.bodyAngleXParamIndex,this.focusController.x*10)}updateNaturalMovements(t,e){const r=e/1e3*2*Math.PI;this.coreModel.addToParamFloat(this.angleXParamIndex,15*Math.sin(r/6.5345)*.5),this.coreModel.addToParamFloat(this.angleYParamIndex,8*Math.sin(r/3.5345)*.5),this.coreModel.addToParamFloat(this.angleZParamIndex,10*Math.sin(r/5.5345)*.5),this.coreModel.addToParamFloat(this.bodyAngleXParamIndex,4*Math.sin(r/15.5345)*.5),this.coreModel.setParamFloat(this.breathParamIndex,.5+.5*Math.sin(r/3.2345))}draw(t){const e=this.disableCulling;t.getParameter(t.FRAMEBUFFER_BINDING)&&(this.disableCulling=!0);const r=this.drawingMatrix;er[0]=r.a,er[1]=r.b,er[4]=r.c,er[5]=r.d,er[12]=r.tx,er[13]=r.ty,this.coreModel.setMatrix(er),this.coreModel.draw(),this.disableCulling=e}destroy(){super.destroy(),this.coreModel=void 0}}class ti extends Yi{constructor(t){if(super(t),this.motions={},!ti.isValidJSON(t))throw new TypeError("Invalid JSON.");this.moc=t.model,Jr("string",t,this,"textures","textures"),this.copy(t)}static isValidJSON(t){var e;return!!t&&typeof t.model=="string"&&((e=t.textures)==null?void 0:e.length)>0&&t.textures.every(r=>typeof r=="string")}copy(t){Zr("string",t,this,"name","name"),Zr("string",t,this,"pose","pose"),Zr("string",t,this,"physics","physics"),Zr("object",t,this,"layout","layout"),Zr("object",t,this,"motions","motions"),Jr("object",t,this,"hit_areas","hitAreas"),Jr("object",t,this,"expressions","expressions"),Jr("object",t,this,"init_params","initParams"),Jr("object",t,this,"init_opacities","initOpacities")}replaceFiles(t){super.replaceFiles(t);for(const[e,r]of Object.entries(this.motions))for(let n=0;n<r.length;n++)r[n].file=t(r[n].file,`motions.${e}[${n}].file`),r[n].sound!==void 0&&(r[n].sound=t(r[n].sound,`motions.${e}[${n}].sound`));if(this.expressions)for(let e=0;e<this.expressions.length;e++)this.expressions[e].file=t(this.expressions[e].file,`expressions[${e}].file`)}}const V_={x:PhysicsHair.Src.SRC_TO_X,y:PhysicsHair.Src.SRC_TO_Y,angle:PhysicsHair.Src.SRC_TO_G_ANGLE},j_={x:PhysicsHair.Src.SRC_TO_X,y:PhysicsHair.Src.SRC_TO_Y,angle:PhysicsHair.Src.SRC_TO_G_ANGLE};class z_{constructor(t,e){this.coreModel=t,this.physicsHairs=[],e.physics_hair&&(this.physicsHairs=e.physics_hair.map(r=>{const n=new PhysicsHair;return n.setup(r.setup.length,r.setup.regist,r.setup.mass),r.src.forEach(({id:s,ptype:a,scale:o,weight:h})=>{const u=V_[a];u&&n.addSrcParam(u,s,o,h)}),r.targets.forEach(({id:s,ptype:a,scale:o,weight:h})=>{const u=j_[a];u&&n.addTargetParam(u,s,o,h)}),n}))}update(t){this.physicsHairs.forEach(e=>e.update(this.coreModel,t))}}class il{constructor(t){this.id=t,this.paramIndex=-1,this.partsIndex=-1,this.link=[]}initIndex(t){this.paramIndex=t.getParamIndex("VISIBLE:"+this.id),this.partsIndex=t.getPartsDataIndex(PartsDataID.getID(this.id)),t.setParamFloat(this.paramIndex,1)}}class W_{constructor(t,e){this.coreModel=t,this.opacityAnimDuration=500,this.partsGroups=[],e.parts_visible&&(this.partsGroups=e.parts_visible.map(({group:r})=>r.map(({id:n,link:s})=>{const a=new il(n);return s&&(a.link=s.map(o=>new il(o))),a})),this.init())}init(){this.partsGroups.forEach(t=>{t.forEach(e=>{if(e.initIndex(this.coreModel),e.paramIndex>=0){const r=this.coreModel.getParamFloat(e.paramIndex)!==0;this.coreModel.setPartsOpacity(e.partsIndex,r?1:0),this.coreModel.setParamFloat(e.paramIndex,r?1:0),e.link.length>0&&e.link.forEach(n=>n.initIndex(this.coreModel))}})})}normalizePartsOpacityGroup(t,e){const r=this.coreModel,n=.5,s=.15;let a=1,o=t.findIndex(({paramIndex:h,partsIndex:u})=>u>=0&&r.getParamFloat(h)!==0);if(o>=0){const h=r.getPartsOpacity(t[o].partsIndex);a=Wi(h+e/this.opacityAnimDuration,0,1)}else o=0,a=1;t.forEach(({partsIndex:h},u)=>{if(h>=0)if(o==u)r.setPartsOpacity(h,a);else{let l=r.getPartsOpacity(h),c;a<n?c=a*(n-1)/n+1:c=(1-a)*n/(1-n),(1-c)*(1-a)>s&&(c=1-s/(1-a)),l>c&&(l=c),r.setPartsOpacity(h,l)}})}copyOpacity(t){const e=this.coreModel;t.forEach(({partsIndex:r,link:n})=>{if(r>=0&&n){const s=e.getPartsOpacity(r);n.forEach(({partsIndex:a})=>{a>=0&&e.setPartsOpacity(a,s)})}})}update(t){this.partsGroups.forEach(e=>{this.normalizePartsOpacityGroup(e,t),this.copyOpacity(e)})}}if(Et.registerRuntime({version:2,test(i){return i instanceof ti||ti.isValidJSON(i)},ready(){return Promise.resolve()},isValidMoc(i){if(i.byteLength<3)return!1;const t=new Int8Array(i,0,3);return String.fromCharCode(...t)==="moc"},createModelSettings(i){return new ti(i)},createCoreModel(i){const t=Live2DModelWebGL.loadModel(i),e=Live2D.getError();if(e)throw e;return t},createInternalModel(i,t,e){return new H_(i,t,e)},createPose(i,t){return new W_(i,t)},createPhysics(i,t){return new z_(i,t)}}),!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class st{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new st(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new st(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new st(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new st(t,t))}division(t){const e=new st(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new st(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const Ki=class{static range(i,t,e){return i<t?i=t:i>e&&(i=e),i}static sin(i){return Math.sin(i)}static cos(i){return Math.cos(i)}static abs(i){return Math.abs(i)}static sqrt(i){return Math.sqrt(i)}static cbrt(i){if(i===0)return i;let t=i;const e=t<0;e&&(t=-t);let r;return t===1/0?r=1/0:(r=Math.exp(Math.log(t)/3),r=(t/(r*r)+2*r)/3),e?-r:r}static getEasingSine(i){return i<0?0:i>1?1:.5-.5*this.cos(i*Math.PI)}static max(i,t){return i>t?i:t}static min(i,t){return i>t?t:i}static degreesToRadian(i){return i/180*Math.PI}static radianToDegrees(i){return i*180/Math.PI}static directionToRadian(i,t){const e=Math.atan2(t.y,t.x),r=Math.atan2(i.y,i.x);let n=e-r;for(;n<-Math.PI;)n+=Math.PI*2;for(;n>Math.PI;)n-=Math.PI*2;return n}static directionToDegrees(i,t){const e=this.directionToRadian(i,t);let r=this.radianToDegrees(e);return t.x-i.x>0&&(r=-r),r}static radianToDirection(i){const t=new st;return t.x=this.sin(i),t.y=this.cos(i),t}static quadraticEquation(i,t,e){return this.abs(i)<Ki.Epsilon?this.abs(t)<Ki.Epsilon?-e:-e/t:-(t+this.sqrt(t*t-4*i*e))/(2*i)}static cardanoAlgorithmForBezier(i,t,e,r){if(this.sqrt(i)<Ki.Epsilon)return this.range(this.quadraticEquation(t,e,r),0,1);const n=t/i,s=e/i,a=r/i,o=(3*s-n*n)/3,h=o/3,u=(2*n*n*n-9*n*s+27*a)/27,l=u/2,c=l*l+h*h*h,f=.5,d=f+.01;if(c<0){const y=-o/3,T=y*y*y,I=this.sqrt(T),m=-u/(2*I),S=this.range(m,-1,1),x=Math.acos(S),D=2*this.cbrt(I),F=D*this.cos(x/3)-n/3;if(this.abs(F-f)<d)return this.range(F,0,1);const k=D*this.cos((x+2*Math.PI)/3)-n/3;if(this.abs(k-f)<d)return this.range(k,0,1);const L=D*this.cos((x+4*Math.PI)/3)-n/3;return this.range(L,0,1)}if(c==0){let y;l<0?y=this.cbrt(-l):y=-this.cbrt(l);const T=2*y-n/3;if(this.abs(T-f)<d)return this.range(T,0,1);const I=-y-n/3;return this.range(I,0,1)}const v=this.sqrt(c),_=this.cbrt(v-l),p=this.cbrt(v+l),g=_-p-n/3;return this.range(g,0,1)}constructor(){}};let yt=Ki;yt.Epsilon=1e-5;class Qt{constructor(){this._tr=new Float32Array(16),this.loadIdentity()}static multiply(t,e,r){const n=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s=4;for(let a=0;a<s;++a)for(let o=0;o<s;++o)for(let h=0;h<s;++h)n[o+a*4]+=t[h+a*4]*e[o+h*4];for(let a=0;a<16;++a)r[a]=n[a]}loadIdentity(){const t=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);this.setMatrix(t)}setMatrix(t){for(let e=0;e<16;++e)this._tr[e]=t[e]}getArray(){return this._tr}getScaleX(){return this._tr[0]}getScaleY(){return this._tr[5]}getTranslateX(){return this._tr[12]}getTranslateY(){return this._tr[13]}transformX(t){return this._tr[0]*t+this._tr[12]}transformY(t){return this._tr[5]*t+this._tr[13]}invertTransformX(t){return(t-this._tr[12])/this._tr[0]}invertTransformY(t){return(t-this._tr[13])/this._tr[5]}translateRelative(t,e){const r=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1]);Qt.multiply(r,this._tr,this._tr)}translate(t,e){this._tr[12]=t,this._tr[13]=e}translateX(t){this._tr[12]=t}translateY(t){this._tr[13]=t}scaleRelative(t,e){const r=new Float32Array([t,0,0,0,0,e,0,0,0,0,1,0,0,0,0,1]);Qt.multiply(r,this._tr,this._tr)}scale(t,e){this._tr[0]=t,this._tr[5]=e}multiplyByMatrix(t){Qt.multiply(t.getArray(),this._tr,this._tr)}clone(){const t=new Qt;for(let e=0;e<this._tr.length;e++)t._tr[e]=this._tr[e];return t}}class ga{initialize(t){this._model=t}drawModel(){this.getModel()!=null&&this.doDrawModel()}setMvpMatrix(t){this._mvpMatrix4x4.setMatrix(t.getArray())}getMvpMatrix(){return this._mvpMatrix4x4}setModelColor(t,e,r,n){t<0?t=0:t>1&&(t=1),e<0?e=0:e>1&&(e=1),r<0?r=0:r>1&&(r=1),n<0?n=0:n>1&&(n=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=r,this._modelColor.A=n}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new ei,this._mvpMatrix4x4=new Qt,this._mvpMatrix4x4.loadIdentity()}}var Le=(i=>(i[i.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",i[i.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",i[i.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",i))(Le||{});class ei{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let _e=!1,mr=!1,yr;const ma={vertexOffset:0,vertexStep:2};class ri{static startUp(t){if(_e)return ii("CubismFramework.startUp() is already done."),_e;if(Live2DCubismCore._isStarted)return _e=!0,!0;if(Live2DCubismCore._isStarted=!0,yr=t,yr&&Live2DCubismCore.Logging.csmSetLogFunction(yr.logFunction),_e=!0,_e){const e=Live2DCubismCore.Version.csmGetVersion(),r=(e&4278190080)>>24,n=(e&16711680)>>16,s=e&65535,a=e;ii("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+r).slice(-2),("00"+n).slice(-2),("0000"+s).slice(-4),a)}return ii("CubismFramework.startUp() is complete."),_e}static cleanUp(){_e=!1,mr=!1,yr=void 0}static initialize(){if(!_e){ni("CubismFramework is not started.");return}if(mr){ni("CubismFramework.initialize() skipped, already initialized.");return}mr=!0,ii("CubismFramework.initialize() is complete.")}static dispose(){if(!_e){ni("CubismFramework is not started.");return}if(!mr){ni("CubismFramework.dispose() skipped, not initialized.");return}ga.staticRelease(),mr=!1,ii("CubismFramework.dispose() is complete.")}static isStarted(){return _e}static isInitialized(){return mr}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return yr!=null?yr.loggingLevel:rr.LogLevel_Off}constructor(){}}var rr=(i=>(i[i.LogLevel_Verbose=0]="LogLevel_Verbose",i[i.LogLevel_Debug=1]="LogLevel_Debug",i[i.LogLevel_Info=2]="LogLevel_Info",i[i.LogLevel_Warning=3]="LogLevel_Warning",i[i.LogLevel_Error=4]="LogLevel_Error",i[i.LogLevel_Off=5]="LogLevel_Off",i))(rr||{});const Zi=()=>{};function nl(i,...t){Ji.print(rr.LogLevel_Debug,"[CSM][D]"+i+`
|
|
502
|
+
`,t)}function ii(i,...t){Ji.print(rr.LogLevel_Info,"[CSM][I]"+i+`
|
|
503
|
+
`,t)}function ni(i,...t){Ji.print(rr.LogLevel_Warning,"[CSM][W]"+i+`
|
|
504
|
+
`,t)}function xr(i,...t){Ji.print(rr.LogLevel_Error,"[CSM][E]"+i+`
|
|
505
|
+
`,t)}class Ji{static print(t,e,r){if(t<ri.getLoggingLevel())return;const n=ri.coreLogFunction;if(!n)return;const s=e.replace(/{(\d+)}/g,(a,o)=>r[o]);n(s)}static dumpBytes(t,e,r){for(let n=0;n<r;n++)n%16==0&&n>0?this.print(t,`
|
|
506
|
+
`):n%8==0&&n>0&&this.print(t," "),this.print(t,"{0} ",[e[n]&255]);this.print(t,`
|
|
507
|
+
`)}constructor(){}}class sl{constructor(){this._fadeInSeconds=-1,this._fadeOutSeconds=-1,this._weight=1,this._offsetSeconds=0,this._firedEventValues=[]}release(){this._weight=0}updateParameters(t,e,r){if(!e.isAvailable()||e.isFinished())return;if(!e.isStarted()){e.setIsStarted(!0),e.setStartTime(r-this._offsetSeconds),e.setFadeInStartTime(r);const o=this.getDuration();e.getEndTime()<0&&e.setEndTime(o<=0?-1:e.getStartTime()+o)}let n=this._weight;const s=this._fadeInSeconds==0?1:yt.getEasingSine((r-e.getFadeInStartTime())/this._fadeInSeconds),a=this._fadeOutSeconds==0||e.getEndTime()<0?1:yt.getEasingSine((e.getEndTime()-r)/this._fadeOutSeconds);n=n*s*a,e.setState(r,n),this.doUpdateParameters(t,r,n,e),e.getEndTime()>0&&e.getEndTime()<r&&e.setIsFinished(!0)}setFadeInTime(t){this._fadeInSeconds=t}setFadeOutTime(t){this._fadeOutSeconds=t}getFadeOutTime(){return this._fadeOutSeconds}getFadeInTime(){return this._fadeInSeconds}setWeight(t){this._weight=t}getWeight(){return this._weight}getDuration(){return-1}getLoopDuration(){return-1}setOffsetTime(t){this._offsetSeconds=t}getFiredEvent(t,e){return this._firedEventValues}setFinishedMotionHandler(t){this._onFinishedMotion=t}getFinishedMotionHandler(){return this._onFinishedMotion}}const al=1;class ya extends sl{constructor(){super(),this._parameters=[]}static create(t){const e=new ya,r=t.FadeInTime,n=t.FadeOutTime;e.setFadeInTime(r!==void 0?r:al),e.setFadeOutTime(n!==void 0?n:al);const s=t.Parameters||[];for(let a=0;a<s.length;++a){const o=s[a],h=o.Id,u=o.Value;let l;switch(o.Blend){case"Multiply":l=ir.ExpressionBlendType_Multiply;break;case"Overwrite":l=ir.ExpressionBlendType_Overwrite;break;case"Add":default:l=ir.ExpressionBlendType_Add;break}const c={parameterId:h,blendType:l,value:u};e._parameters.push(c)}return e}doUpdateParameters(t,e,r,n){for(let s=0;s<this._parameters.length;++s){const a=this._parameters[s];switch(a.blendType){case ir.ExpressionBlendType_Add:{t.addParameterValueById(a.parameterId,a.value,r);break}case ir.ExpressionBlendType_Multiply:{t.multiplyParameterValueById(a.parameterId,a.value,r);break}case ir.ExpressionBlendType_Overwrite:{t.setParameterValueById(a.parameterId,a.value,r);break}}}}}var ir=(i=>(i[i.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",i[i.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",i[i.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",i))(ir||{});class Y_{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const r=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||r<this._endTimeSeconds)&&(this._endTimeSeconds=r)}isFinished(){return this._finished}isStarted(){return this._started}getStartTime(){return this._startTimeSeconds}getFadeInStartTime(){return this._fadeInStartTimeSeconds}getEndTime(){return this._endTimeSeconds}setStartTime(t){this._startTimeSeconds=t}setFadeInStartTime(t){this._fadeInStartTimeSeconds=t}setEndTime(t){this._endTimeSeconds=t}setIsFinished(t){this._finished=t}setIsStarted(t){this._started=t}isAvailable(){return this._available}setIsAvailable(t){this._available=t}setState(t,e){this._stateTimeSeconds=t,this._stateWeight=e}getStateTime(){return this._stateTimeSeconds}getStateWeight(){return this._stateWeight}getLastCheckEventSeconds(){return this._lastEventCheckSeconds}setLastCheckEventSeconds(t){this._lastEventCheckSeconds=t}isTriggeredFadeOut(){return this._isTriggeredFadeOut}getFadeOutSeconds(){return this._fadeOutSeconds}}class ol{constructor(){this._userTimeSeconds=0,this._eventCustomData=null,this._motions=[]}release(){for(let t=0;t<this._motions.length;++t)this._motions[t]&&this._motions[t].release();this._motions=void 0}startMotion(t,e,r){if(t==null)return q_;let n;for(let s=0;s<this._motions.length;++s)n=this._motions[s],n!=null&&n.setFadeOut(n._motion.getFadeOutTime());return n=new Y_,n._autoDelete=e,n._motion=t,this._motions.push(n),n._motionQueueEntryHandle}isFinished(){let t=0;for(;t<this._motions.length;){const e=this._motions[t];if(e==null){this._motions.splice(t,1);continue}if(e._motion==null){e.release(),this._motions.splice(t,1);continue}if(!e.isFinished())return!1;t++}return!0}isFinishedByHandle(t){for(let e=0;e<this._motions.length;e++){const r=this._motions[e];if(r!=null&&r._motionQueueEntryHandle==t&&!r.isFinished())return!1}return!0}stopAllMotions(){for(let t=0;t<this._motions.length;t++){const e=this._motions[t];e!=null&&e.release()}this._motions=[]}getCubismMotionQueueEntry(t){return this._motions.find(e=>e!=null&&e._motionQueueEntryHandle==t)}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let r=!1,n=0;for(;n<this._motions.length;){const s=this._motions[n];if(s==null){this._motions.splice(n,1);continue}const a=s._motion;if(a==null){s.release(),this._motions.splice(n,1);continue}a.updateParameters(t,s,e),r=!0;const o=a.getFiredEvent(s.getLastCheckEventSeconds()-s.getStartTime(),e-s.getStartTime());for(let h=0;h<o.length;++h)this._eventCallBack(this,o[h],this._eventCustomData);s.setLastCheckEventSeconds(e),s.isFinished()?(s.release(),this._motions.splice(n,1)):(s.isTriggeredFadeOut()&&s.startFadeOut(s.getFadeOutSeconds(),e),n++)}return r}}const q_=-1;class $_ extends pa{constructor(t,e){var r;super(t,e),this.queueManager=new ol,this.definitions=(r=t.expressions)!=null?r:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.Name===t)}getExpressionFile(t){return t.File}createExpression(t,e){return ya.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class hl{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(r=>r.Name==="EyeBlink"))==null?void 0:e.Ids}getLipSyncParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(r=>r.Name==="LipSync"))==null?void 0:e.Ids}}class br extends Yi{constructor(t){if(super(t),!br.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new hl(t))}static isValidJSON(t){var e;return!!(t!=null&&t.FileReferences)&&typeof t.FileReferences.Moc=="string"&&((e=t.FileReferences.Textures)==null?void 0:e.length)>0&&t.FileReferences.Textures.every(r=>typeof r=="string")}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,r]of Object.entries(this.motions))for(let n=0;n<r.length;n++)r[n].File=t(r[n].File,`motions.${e}[${n}].File`),r[n].Sound!==void 0&&(r[n].Sound=t(r[n].Sound,`motions.${e}[${n}].Sound`));if(this.expressions)for(let e=0;e<this.expressions.length;e++)this.expressions[e].File=t(this.expressions[e].File,`expressions[${e}].File`)}}Vu(br,[hl]);var nr=(i=>(i[i.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",i[i.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",i[i.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",i))(nr||{}),ge=(i=>(i[i.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",i[i.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",i[i.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",i[i.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",i))(ge||{});class Be{constructor(t=0,e=0){this.time=t,this.value=e}}class K_{constructor(){this.basePointIndex=0,this.segmentType=0}}class Z_{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class J_{constructor(){this.fireTime=0,this.value=""}}class Q_{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class ul{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return xa.EvaluationOptionFlag_AreBeziersRistricted==t?!!this._json.Meta.AreBeziersRestricted:!1}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var xa=(i=>(i[i.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",i))(xa||{});const tg="EyeBlink",eg="LipSync",rg="Model",ig="Parameter",ng="PartOpacity",sg=!1;function te(i,t,e){const r=new Be;return r.time=i.time+(t.time-i.time)*e,r.value=i.value+(t.value-i.value)*e,r}function ag(i,t){let e=(t-i[0].time)/(i[1].time-i[0].time);return e<0&&(e=0),i[0].value+(i[1].value-i[0].value)*e}function og(i,t){let e=(t-i[0].time)/(i[3].time-i[0].time);e<0&&(e=0);const r=te(i[0],i[1],e),n=te(i[1],i[2],e),s=te(i[2],i[3],e),a=te(r,n,e),o=te(n,s,e);return te(a,o,e).value}function hg(i,t){const e=t,r=i[0].time,n=i[3].time,s=i[1].time,a=i[2].time,o=n-3*a+3*s-r,h=3*a-6*s+3*r,u=3*s-3*r,l=r-e,c=yt.cardanoAlgorithmForBezier(o,h,u,l),f=te(i[0],i[1],c),d=te(i[1],i[2],c),v=te(i[2],i[3],c),_=te(f,d,c),p=te(d,v,c);return te(_,p,c).value}function ug(i,t){return i[0].value}function lg(i,t){return i[1].value}function ba(i,t,e){const r=i.curves[t];let n=-1;const s=r.baseSegmentIndex+r.segmentCount;let a=0;for(let h=r.baseSegmentIndex;h<s;++h)if(a=i.segments[h].basePointIndex+(i.segments[h].segmentType==ge.CubismMotionSegmentType_Bezier?3:1),i.points[a].time>e){n=h;break}if(n==-1)return i.points[a].value;const o=i.segments[n];return o.evaluate(i.points.slice(o.basePointIndex),e)}class Ta extends sl{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const r=new Ta;return r.parse(t),r._sourceFrameRate=r._motionData.fps,r._loopDurationSeconds=r._motionData.duration,r._onFinishedMotion=e,r}doUpdateParameters(t,e,r,n){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=tg),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=eg);let s=e-n.getStartTime();s<0&&(s=0);let a=Number.MAX_VALUE,o=Number.MAX_VALUE;const h=64;let u=0,l=0;this._eyeBlinkParameterIds.length>h&&nl("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>h&&nl("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const c=this._fadeInSeconds<=0?1:yt.getEasingSine((e-n.getFadeInStartTime())/this._fadeInSeconds),f=this._fadeOutSeconds<=0||n.getEndTime()<0?1:yt.getEasingSine((n.getEndTime()-e)/this._fadeOutSeconds);let d,v,_,p=s;if(this._isLoop)for(;p>this._motionData.duration;)p-=this._motionData.duration;const g=this._motionData.curves;for(v=0;v<this._motionData.curveCount&&g[v].type==nr.CubismMotionCurveTarget_Model;++v)d=ba(this._motionData,v,p),g[v].id==this._modelCurveIdEyeBlink?o=d:g[v].id==this._modelCurveIdLipSync&&(a=d);for(;v<this._motionData.curveCount&&g[v].type==nr.CubismMotionCurveTarget_Parameter;++v){if(_=t.getParameterIndex(g[v].id),_==-1)continue;const y=t.getParameterValueByIndex(_);if(d=ba(this._motionData,v,p),o!=Number.MAX_VALUE){for(let I=0;I<this._eyeBlinkParameterIds.length&&I<h;++I)if(this._eyeBlinkParameterIds[I]==g[v].id){d*=o,l|=1<<I;break}}if(a!=Number.MAX_VALUE){for(let I=0;I<this._lipSyncParameterIds.length&&I<h;++I)if(this._lipSyncParameterIds[I]==g[v].id){d+=a,u|=1<<I;break}}let T;if(g[v].fadeInTime<0&&g[v].fadeOutTime<0)T=y+(d-y)*r;else{let I,m;g[v].fadeInTime<0?I=c:I=g[v].fadeInTime==0?1:yt.getEasingSine((e-n.getFadeInStartTime())/g[v].fadeInTime),g[v].fadeOutTime<0?m=f:m=g[v].fadeOutTime==0||n.getEndTime()<0?1:yt.getEasingSine((n.getEndTime()-e)/g[v].fadeOutTime);const S=this._weight*I*m;T=y+(d-y)*S}t.setParameterValueByIndex(_,T,1)}{if(o!=Number.MAX_VALUE)for(let y=0;y<this._eyeBlinkParameterIds.length&&y<h;++y){const T=t.getParameterValueById(this._eyeBlinkParameterIds[y]);if(l>>y&1)continue;const I=T+(o-T)*r;t.setParameterValueById(this._eyeBlinkParameterIds[y],I)}if(a!=Number.MAX_VALUE)for(let y=0;y<this._lipSyncParameterIds.length&&y<h;++y){const T=t.getParameterValueById(this._lipSyncParameterIds[y]);if(u>>y&1)continue;const I=T+(a-T)*r;t.setParameterValueById(this._lipSyncParameterIds[y],I)}}for(;v<this._motionData.curveCount&&g[v].type==nr.CubismMotionCurveTarget_PartOpacity;++v)if(d=ba(this._motionData,v,p),Kr.setOpacityFromMotion)t.setPartOpacityById(g[v].id,d);else{if(_=t.getParameterIndex(g[v].id),_==-1)continue;t.setParameterValueByIndex(_,d)}s>=this._motionData.duration&&(this._isLoop?(n.setStartTime(e),this._isLoopFadeIn&&n.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),n.setIsFinished(!0))),this._lastWeight=r}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const r=this._motionData.curves;for(let n=0;n<this._motionData.curveCount;++n)if(t==r[n].id){r[n].fadeInTime=e;return}}setParameterFadeOutTime(t,e){const r=this._motionData.curves;for(let n=0;n<this._motionData.curveCount;++n)if(t==r[n].id){r[n].fadeOutTime=e;return}}getParameterFadeInTime(t){const e=this._motionData.curves;for(let r=0;r<this._motionData.curveCount;++r)if(t==e[r].id)return e[r].fadeInTime;return-1}getParameterFadeOutTime(t){const e=this._motionData.curves;for(let r=0;r<this._motionData.curveCount;++r)if(t==e[r].id)return e[r].fadeOutTime;return-1}setEffectIds(t,e){this._eyeBlinkParameterIds=t,this._lipSyncParameterIds=e}release(){this._motionData=void 0}parse(t){this._motionData=new Q_;let e=new ul(t);this._motionData.duration=e.getMotionDuration(),this._motionData.loop=e.isMotionLoop(),this._motionData.curveCount=e.getMotionCurveCount(),this._motionData.fps=e.getMotionFps(),this._motionData.eventCount=e.getEventCount();const r=e.getEvaluationOptionFlag(xa.EvaluationOptionFlag_AreBeziersRistricted),n=e.getMotionFadeInTime(),s=e.getMotionFadeOutTime();n!==void 0?this._fadeInSeconds=n<0?1:n:this._fadeInSeconds=1,s!==void 0?this._fadeOutSeconds=s<0?1:s:this._fadeOutSeconds=1,this._motionData.curves=Array.from({length:this._motionData.curveCount}).map(()=>new Z_),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map(()=>new K_),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new J_),this._motionData.points=[];let a=0,o=0;for(let h=0;h<this._motionData.curveCount;++h){const u=this._motionData.curves[h];switch(e.getMotionCurveTarget(h)){case rg:u.type=nr.CubismMotionCurveTarget_Model;break;case ig:u.type=nr.CubismMotionCurveTarget_Parameter;break;case ng:u.type=nr.CubismMotionCurveTarget_PartOpacity;break;default:ni('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!')}u.id=e.getMotionCurveId(h),u.baseSegmentIndex=o;const l=e.getMotionCurveFadeInTime(h),c=e.getMotionCurveFadeOutTime(h);u.fadeInTime=l!==void 0?l:-1,u.fadeOutTime=c!==void 0?c:-1;for(let f=0;f<e.getMotionCurveSegmentCount(h);){switch(f==0?(this._motionData.segments[o].basePointIndex=a,this._motionData.points[a]=new Be(e.getMotionCurveSegment(h,f),e.getMotionCurveSegment(h,f+1)),a+=1,f+=2):this._motionData.segments[o].basePointIndex=a-1,e.getMotionCurveSegment(h,f)){case ge.CubismMotionSegmentType_Linear:{this._motionData.segments[o].segmentType=ge.CubismMotionSegmentType_Linear,this._motionData.segments[o].evaluate=ag,this._motionData.points[a]=new Be(e.getMotionCurveSegment(h,f+1),e.getMotionCurveSegment(h,f+2)),a+=1,f+=3;break}case ge.CubismMotionSegmentType_Bezier:{this._motionData.segments[o].segmentType=ge.CubismMotionSegmentType_Bezier,r||sg?this._motionData.segments[o].evaluate=og:this._motionData.segments[o].evaluate=hg,this._motionData.points[a]=new Be(e.getMotionCurveSegment(h,f+1),e.getMotionCurveSegment(h,f+2)),this._motionData.points[a+1]=new Be(e.getMotionCurveSegment(h,f+3),e.getMotionCurveSegment(h,f+4)),this._motionData.points[a+2]=new Be(e.getMotionCurveSegment(h,f+5),e.getMotionCurveSegment(h,f+6)),a+=3,f+=7;break}case ge.CubismMotionSegmentType_Stepped:{this._motionData.segments[o].segmentType=ge.CubismMotionSegmentType_Stepped,this._motionData.segments[o].evaluate=ug,this._motionData.points[a]=new Be(e.getMotionCurveSegment(h,f+1),e.getMotionCurveSegment(h,f+2)),a+=1,f+=3;break}case ge.CubismMotionSegmentType_InverseStepped:{this._motionData.segments[o].segmentType=ge.CubismMotionSegmentType_InverseStepped,this._motionData.segments[o].evaluate=lg,this._motionData.points[a]=new Be(e.getMotionCurveSegment(h,f+1),e.getMotionCurveSegment(h,f+2)),a+=1,f+=3;break}}++u.segmentCount,++o}this._motionData.curves.push(u)}for(let h=0;h<e.getEventCount();++h)this._motionData.events[h].fireTime=e.getEventTime(h),this._motionData.events[h].value=e.getEventValue(h);e.release()}getFiredEvent(t,e){this._firedEventValues.length=0;for(let r=0;r<this._motionData.eventCount;++r)this._motionData.events[r].fireTime>t&&this._motionData.events[r].fireTime<=e&&this._firedEventValues.push(this._motionData.events[r].value);return this._firedEventValues}}class fg extends gr{constructor(t,e){var r;super(t,e),this.groups={idle:"Idle"},this.motionDataType="json",this.queueManager=new ol,this.definitions=(r=t.motions)!=null?r:{},this.eyeBlinkIds=t.getEyeBlinkParameters()||[],this.lipSyncIds=t.getLipSyncParameters()||[],this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new $_(this.settings,t)),this.queueManager.setEventCallback((e,r,n)=>{this.emit("motion:"+r)})}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(t,e,r){const n=Ta.create(t),s=new ul(t),a=(e===this.groups.idle?Ft.idleMotionFadingDuration:Ft.motionFadingDuration)/1e3;return s.getMotionFadeInTime()===void 0&&n.setFadeInTime(r.FadeInTime>0?r.FadeInTime:a),s.getMotionFadeOutTime()===void 0&&n.setFadeOutTime(r.FadeOutTime>0?r.FadeOutTime:a),n.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),n}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const cg="ParamAngleX",dg="ParamAngleY",pg="ParamAngleZ",vg="ParamEyeBallX",_g="ParamEyeBallY",gg="ParamBodyAngleX",mg="ParamBreath";class Ea{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new Ea}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const r=this._currentTime*2*3.14159;for(let n=0;n<this._breathParameters.length;++n){const s=this._breathParameters[n];t.addParameterValueById(s.parameterId,s.offset+s.peak*Math.sin(r/s.cycle),s.weight)}}}class si{constructor(t,e,r,n,s){this.parameterId=t??void 0,this.offset=e??0,this.peak=r??0,this.cycle=n??0,this.weight=s??0}}const Sa=class{static create(i){return new Sa(i)}setBlinkingInterval(i){this._blinkingIntervalSeconds=i}setBlinkingSetting(i,t,e){this._closingSeconds=i,this._closedSeconds=t,this._openingSeconds=e}setParameterIds(i){this._parameterIds=i}getParameterIds(){return this._parameterIds}updateParameters(i,t){this._userTimeSeconds+=t;let e,r=0;switch(this._blinkingState){case ee.EyeState_Closing:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closingSeconds,r>=1&&(r=1,this._blinkingState=ee.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),e=1-r;break;case ee.EyeState_Closed:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,r>=1&&(this._blinkingState=ee.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),e=0;break;case ee.EyeState_Opening:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,r>=1&&(r=1,this._blinkingState=ee.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),e=r;break;case ee.EyeState_Interval:this._nextBlinkingTime<this._userTimeSeconds&&(this._blinkingState=ee.EyeState_Closing,this._stateStartTimeSeconds=this._userTimeSeconds),e=1;break;case ee.EyeState_First:default:this._blinkingState=ee.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming(),e=1;break}Sa.CloseIfZero||(e=-e);for(let n=0;n<this._parameterIds.length;++n)i.setParameterValueById(this._parameterIds[n],e)}constructor(i){var t,e;this._blinkingState=ee.EyeState_First,this._nextBlinkingTime=0,this._stateStartTimeSeconds=0,this._blinkingIntervalSeconds=4,this._closingSeconds=.1,this._closedSeconds=.05,this._openingSeconds=.15,this._userTimeSeconds=0,this._parameterIds=[],i!=null&&(this._parameterIds=(e=(t=i.getEyeBlinkParameters())==null?void 0:t.slice())!=null?e:this._parameterIds)}determinNextBlinkingTiming(){const i=Math.random();return this._userTimeSeconds+i*(2*this._blinkingIntervalSeconds-1)}};let ll=Sa;ll.CloseIfZero=!0;var ee=(i=>(i[i.EyeState_First=0]="EyeState_First",i[i.EyeState_Interval=1]="EyeState_Interval",i[i.EyeState_Closing=2]="EyeState_Closing",i[i.EyeState_Closed=3]="EyeState_Closed",i[i.EyeState_Opening=4]="EyeState_Opening",i))(ee||{});class Pa{constructor(t=0,e=0,r=0,n=0){this.x=t,this.y=e,this.width=r,this.height=n}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2}}const wa=4,yg=10;let sr,ai,Ca;class Ia{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),t==0){const e=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,Ca),this._maskTexture=new xg(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let r=Number.MAX_VALUE,n=Number.MAX_VALUE,s=Number.MIN_VALUE,a=Number.MIN_VALUE;const o=e._clippedDrawableIndexList.length;for(let h=0;h<o;h++){const u=e._clippedDrawableIndexList[h],l=t.getDrawableVertexCount(u),c=t.getDrawableVertices(u);let f=Number.MAX_VALUE,d=Number.MAX_VALUE,v=Number.MIN_VALUE,_=Number.MIN_VALUE;const p=l*ma.vertexStep;for(let g=ma.vertexOffset;g<p;g+=ma.vertexStep){const y=c[g],T=c[g+1];y<f&&(f=y),y>v&&(v=y),T<d&&(d=T),T>_&&(_=T)}if(f!=Number.MAX_VALUE)if(f<r&&(r=f),d<n&&(n=d),v>s&&(s=v),_>a&&(a=_),r==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const g=s-r,y=a-n;e._allClippedDrawRect.x=r,e._allClippedDrawRect.y=n,e._allClippedDrawRect.width=g,e._allClippedDrawRect.height=y}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new Pa,this._tmpMatrix=new Qt,this._tmpMatrixForMask=new Qt,this._tmpMatrixForDraw=new Qt;let t=new ei;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new ei,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new ei,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new ei,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,r;const n=this;for(let s=0;s<this._clippingContextListForMask.length;s++)this._clippingContextListForMask[s]&&((t=this._clippingContextListForMask[s])==null||t.release());n._clippingContextListForMask=void 0,n._clippingContextListForDraw=void 0,this._maskTexture&&((e=this.gl)==null||e.deleteFramebuffer(this._maskTexture.texture),n._maskTexture=void 0),n._channelColors=void 0,(r=this.gl)==null||r.deleteTexture(this._colorBuffer),this._colorBuffer=null}initialize(t,e,r,n){for(let s=0;s<e;s++){if(n[s]<=0){this._clippingContextListForDraw.push(null);continue}let a=this.findSameClip(r[s],n[s]);a==null&&(a=new bg(this,r[s],n[s]),this._clippingContextListForMask.push(a)),a.addClippedDrawable(s),this._clippingContextListForDraw.push(a)}}setupClippingContext(t,e){this._currentFrameNo++;let r=0;for(let n=0;n<this._clippingContextListForMask.length;n++){const s=this._clippingContextListForMask[n];this.calcClippedDrawTotalBounds(t,s),s._isUsing&&r++}if(r>0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.preDraw(),this.setupLayoutBounds(r),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let n=0;n<this._clippingContextListForMask.length;n++){const s=this._clippingContextListForMask[n],a=s._allClippedDrawRect,o=s._layoutBounds,h=.05;this._tmpBoundsOnModel.setRect(a),this._tmpBoundsOnModel.expand(a.width*h,a.height*h);const u=o.width/this._tmpBoundsOnModel.width,l=o.height/this._tmpBoundsOnModel.height;this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(-1,-1),this._tmpMatrix.scaleRelative(2,2),this._tmpMatrix.translateRelative(o.x,o.y),this._tmpMatrix.scaleRelative(u,l),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()),this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(o.x,o.y),this._tmpMatrix.scaleRelative(u,l),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()),s._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()),s._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());const c=s._clippingIdCount;for(let f=0;f<c;f++){const d=s._clippingIdList[f];t.getDrawableDynamicFlagVertexPositionsDidChange(d)&&(e.setIsCulling(t.getDrawableCulling(d)!=!1),e.setClippingContextBufferForMask(s),e.drawMesh(t.getDrawableTextureIndices(d),t.getDrawableVertexIndexCount(d),t.getDrawableVertexCount(d),t.getDrawableVertexIndices(d),t.getDrawableVertices(d),t.getDrawableVertexUvs(d),t.getDrawableOpacity(d),Le.CubismBlendMode_Normal,!1))}}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,Ca),e.setClippingContextBufferForMask(null),this.gl.viewport(ai[0],ai[1],ai[2],ai[3])}}findSameClip(t,e){for(let r=0;r<this._clippingContextListForMask.length;r++){const n=this._clippingContextListForMask[r],s=n._clippingIdCount;if(s!=e)continue;let a=0;for(let o=0;o<s;o++){const h=n._clippingIdList[o];for(let u=0;u<s;u++)if(t[u]==h){a++;break}}if(a==s)return n}return null}setupLayoutBounds(t){let e=t/wa,r=t%wa;e=~~e,r=~~r;let n=0;for(let s=0;s<wa;s++){const a=e+(s<r?1:0);if(a!=0)if(a==1){const o=this._clippingContextListForMask[n++];o._layoutChannelNo=s,o._layoutBounds.x=0,o._layoutBounds.y=0,o._layoutBounds.width=1,o._layoutBounds.height=1}else if(a==2)for(let o=0;o<a;o++){let h=o%2;h=~~h;const u=this._clippingContextListForMask[n++];u._layoutChannelNo=s,u._layoutBounds.x=h*.5,u._layoutBounds.y=0,u._layoutBounds.width=.5,u._layoutBounds.height=1}else if(a<=4)for(let o=0;o<a;o++){let h=o%2,u=o/2;h=~~h,u=~~u;const l=this._clippingContextListForMask[n++];l._layoutChannelNo=s,l._layoutBounds.x=h*.5,l._layoutBounds.y=u*.5,l._layoutBounds.width=.5,l._layoutBounds.height=.5}else if(a<=9)for(let o=0;o<a;o++){let h=o%3,u=o/3;h=~~h,u=~~u;const l=this._clippingContextListForMask[n++];l._layoutChannelNo=s,l._layoutBounds.x=h/3,l._layoutBounds.y=u/3,l._layoutBounds.width=1/3,l._layoutBounds.height=1/3}else if(Kr.supportMoreMaskDivisions&&a<=16)for(let o=0;o<a;o++){let h=o%4,u=o/4;h=~~h,u=~~u;const l=this._clippingContextListForMask[n++];l._layoutChannelNo=s,l._layoutBounds.x=h/4,l._layoutBounds.y=u/4,l._layoutBounds.width=1/4,l._layoutBounds.height=1/4}else xr("not supported mask count : {0}",a)}}getColorBuffer(){return this._colorBuffer}getClippingContextListForDraw(){return this._clippingContextListForDraw}setClippingMaskBufferSize(t){this._clippingMaskBufferSize=t}getClippingMaskBufferSize(){return this._clippingMaskBufferSize}}class xg{constructor(t,e){this.frameNo=t,this.texture=e}}class bg{constructor(t,e,r){this._isUsing=!1,this._owner=t,this._clippingIdList=e,this._clippingIdCount=r,this._allClippedDrawRect=new Pa,this._layoutBounds=new Pa,this._clippedDrawableIndexList=[],this._matrixForMask=new Qt,this._matrixForDraw=new Qt}release(){const t=this;t._layoutBounds=void 0,t._allClippedDrawRect=void 0,t._clippedDrawableIndexList=void 0}addClippedDrawable(t){this._clippedDrawableIndexList.push(t)}getClippingManager(){return this._owner}setGl(t){this._owner.setGL(t)}}class Tr{static getInstance(){return sr==null&&(sr=new Tr),sr}static deleteInstance(){sr&&(sr.release(),sr=void 0)}constructor(){this._shaderSets=[]}release(){this.releaseShaderProgram()}setupShaderProgram(t,e,r,n,s,a,o,h,u,l,c,f,d){c||xr("NoPremultipliedAlpha is not allowed"),this._shaderSets.length==0&&this.generateShaders();let v,_,p,g;const y=t.getClippingContextBufferForMask();if(y!=null){const T=this._shaderSets[oi.ShaderNames_SetupMask];this.gl.useProgram(T.shaderProgram),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.uniform1i(T.samplerTexture0Location,0),o.vertex==null&&(o.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(T.attributePositionLocation),this.gl.vertexAttribPointer(T.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),o.uv==null&&(o.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,a,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(T.attributeTexCoordLocation),this.gl.vertexAttribPointer(T.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0);const I=y._layoutChannelNo,m=y.getClippingManager().getChannelFlagAsColor(I);this.gl.uniform4f(T.uniformChannelFlagLocation,m.R,m.G,m.B,m.A),this.gl.uniformMatrix4fv(T.uniformClipMatrixLocation,!1,y._matrixForMask.getArray());const S=y._layoutBounds;this.gl.uniform4f(T.uniformBaseColorLocation,S.x*2-1,S.y*2-1,S.getRight()*2-1,S.getBottom()*2-1),v=this.gl.ZERO,_=this.gl.ONE_MINUS_SRC_COLOR,p=this.gl.ZERO,g=this.gl.ONE_MINUS_SRC_ALPHA}else{const T=t.getClippingContextBufferForDraw(),m=T!=null?d?2:1:0;let S;switch(u){case Le.CubismBlendMode_Normal:default:S=this._shaderSets[oi.ShaderNames_NormalPremultipliedAlpha+m],v=this.gl.ONE,_=this.gl.ONE_MINUS_SRC_ALPHA,p=this.gl.ONE,g=this.gl.ONE_MINUS_SRC_ALPHA;break;case Le.CubismBlendMode_Additive:S=this._shaderSets[oi.ShaderNames_AddPremultipliedAlpha+m],v=this.gl.ONE,_=this.gl.ONE,p=this.gl.ZERO,g=this.gl.ONE;break;case Le.CubismBlendMode_Multiplicative:S=this._shaderSets[oi.ShaderNames_MultPremultipliedAlpha+m],v=this.gl.DST_COLOR,_=this.gl.ONE_MINUS_SRC_ALPHA,p=this.gl.ZERO,g=this.gl.ONE;break}if(this.gl.useProgram(S.shaderProgram),o.vertex==null&&(o.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(S.attributePositionLocation),this.gl.vertexAttribPointer(S.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),o.uv==null&&(o.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,a,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(S.attributeTexCoordLocation),this.gl.vertexAttribPointer(S.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0),T!=null){this.gl.activeTexture(this.gl.TEXTURE1);const x=T.getClippingManager().getColorBuffer();this.gl.bindTexture(this.gl.TEXTURE_2D,x),this.gl.uniform1i(S.samplerTexture1Location,1),this.gl.uniformMatrix4fv(S.uniformClipMatrixLocation,!1,T._matrixForDraw.getArray());const N=T._layoutChannelNo,D=T.getClippingManager().getChannelFlagAsColor(N);this.gl.uniform4f(S.uniformChannelFlagLocation,D.R,D.G,D.B,D.A)}this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.uniform1i(S.samplerTexture0Location,0),this.gl.uniformMatrix4fv(S.uniformMatrixLocation,!1,f.getArray()),this.gl.uniform4f(S.uniformBaseColorLocation,l.R,l.G,l.B,l.A)}o.index==null&&(o.index=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,o.index),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,s,this.gl.DYNAMIC_DRAW),this.gl.blendFuncSeparate(v,_,p,g)}releaseShaderProgram(){for(let t=0;t<this._shaderSets.length;t++)this.gl.deleteProgram(this._shaderSets[t].shaderProgram),this._shaderSets[t].shaderProgram=0;this._shaderSets=[]}generateShaders(){for(let t=0;t<yg;t++)this._shaderSets.push({});this._shaderSets[0].shaderProgram=this.loadShaderProgram(Tg,Eg),this._shaderSets[1].shaderProgram=this.loadShaderProgram(Sg,Pg),this._shaderSets[2].shaderProgram=this.loadShaderProgram(fl,wg),this._shaderSets[3].shaderProgram=this.loadShaderProgram(fl,Cg),this._shaderSets[4].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[5].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[6].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[7].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[8].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[9].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[0].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_position"),this._shaderSets[0].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_texCoord"),this._shaderSets[0].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"s_texture0"),this._shaderSets[0].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_clipMatrix"),this._shaderSets[0].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_channelFlag"),this._shaderSets[0].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_baseColor"),this._shaderSets[1].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_position"),this._shaderSets[1].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_texCoord"),this._shaderSets[1].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"s_texture0"),this._shaderSets[1].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_matrix"),this._shaderSets[1].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_baseColor"),this._shaderSets[2].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_position"),this._shaderSets[2].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_texCoord"),this._shaderSets[2].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture0"),this._shaderSets[2].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture1"),this._shaderSets[2].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_matrix"),this._shaderSets[2].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_clipMatrix"),this._shaderSets[2].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_channelFlag"),this._shaderSets[2].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_baseColor"),this._shaderSets[3].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_position"),this._shaderSets[3].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_texCoord"),this._shaderSets[3].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture0"),this._shaderSets[3].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture1"),this._shaderSets[3].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_matrix"),this._shaderSets[3].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_clipMatrix"),this._shaderSets[3].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_channelFlag"),this._shaderSets[3].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_baseColor"),this._shaderSets[4].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_position"),this._shaderSets[4].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_texCoord"),this._shaderSets[4].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"s_texture0"),this._shaderSets[4].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_matrix"),this._shaderSets[4].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_baseColor"),this._shaderSets[5].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_position"),this._shaderSets[5].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_texCoord"),this._shaderSets[5].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture0"),this._shaderSets[5].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture1"),this._shaderSets[5].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_matrix"),this._shaderSets[5].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_clipMatrix"),this._shaderSets[5].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_channelFlag"),this._shaderSets[5].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_baseColor"),this._shaderSets[6].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_position"),this._shaderSets[6].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_texCoord"),this._shaderSets[6].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture0"),this._shaderSets[6].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture1"),this._shaderSets[6].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_matrix"),this._shaderSets[6].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_clipMatrix"),this._shaderSets[6].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_channelFlag"),this._shaderSets[6].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_baseColor"),this._shaderSets[7].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_position"),this._shaderSets[7].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_texCoord"),this._shaderSets[7].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"s_texture0"),this._shaderSets[7].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_matrix"),this._shaderSets[7].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_baseColor"),this._shaderSets[8].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_position"),this._shaderSets[8].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_texCoord"),this._shaderSets[8].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture0"),this._shaderSets[8].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture1"),this._shaderSets[8].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_matrix"),this._shaderSets[8].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_clipMatrix"),this._shaderSets[8].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_channelFlag"),this._shaderSets[8].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_baseColor"),this._shaderSets[9].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_position"),this._shaderSets[9].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_texCoord"),this._shaderSets[9].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture0"),this._shaderSets[9].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture1"),this._shaderSets[9].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_matrix"),this._shaderSets[9].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_clipMatrix"),this._shaderSets[9].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_channelFlag"),this._shaderSets[9].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_baseColor")}loadShaderProgram(t,e){let r=this.gl.createProgram(),n=this.compileShaderSource(this.gl.VERTEX_SHADER,t);if(!n)return xr("Vertex shader compile error!"),0;let s=this.compileShaderSource(this.gl.FRAGMENT_SHADER,e);return s?(this.gl.attachShader(r,n),this.gl.attachShader(r,s),this.gl.linkProgram(r),this.gl.getProgramParameter(r,this.gl.LINK_STATUS)?(this.gl.deleteShader(n),this.gl.deleteShader(s),r):(xr("Failed to link program: {0}",r),this.gl.deleteShader(n),this.gl.deleteShader(s),r&&this.gl.deleteProgram(r),0)):(xr("Vertex shader compile error!"),0)}compileShaderSource(t,e){const r=e,n=this.gl.createShader(t);if(this.gl.shaderSource(n,r),this.gl.compileShader(n),!n){const a=this.gl.getShaderInfoLog(n);xr("Shader compile log: {0} ",a)}return this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS)?n:(this.gl.deleteShader(n),null)}setGl(t){this.gl=t}}var oi=(i=>(i[i.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",i[i.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",i[i.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",i[i.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",i[i.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",i[i.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",i[i.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",i[i.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",i[i.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",i[i.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",i))(oi||{});const Tg="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Eg="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",Sg="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",fl="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Pg="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",wg="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",Cg="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class cl extends ga{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new Ia,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new Ia,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new Ia,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,r;const n=this;this._clippingManager.release(),n._clippingManager=void 0,(t=this.gl)==null||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(e=this.gl)==null||e.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,(r=this.gl)==null||r.deleteBuffer(this._bufferData.index),this._bufferData.index=null,n._bufferData=void 0,n._textures=void 0}doDrawModel(){this.preDraw(),this._clippingManager!=null&&this._clippingManager.setupClippingContext(this.getModel(),this);const t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let r=0;r<t;++r){const n=e[r];this._sortedDrawableIndexList[n]=r}for(let r=0;r<t;++r){const n=this._sortedDrawableIndexList[r];this.getModel().getDrawableDynamicFlagIsVisible(n)&&(this.setClippingContextBufferForDraw(this._clippingManager!=null?this._clippingManager.getClippingContextListForDraw()[n]:null),this.setIsCulling(this.getModel().getDrawableCulling(n)),this.drawMesh(this.getModel().getDrawableTextureIndices(n),this.getModel().getDrawableVertexIndexCount(n),this.getModel().getDrawableVertexCount(n),this.getModel().getDrawableVertexIndices(n),this.getModel().getDrawableVertices(n),this.getModel().getDrawableVertexUvs(n),this.getModel().getDrawableOpacity(n),this.getModel().getDrawableBlendMode(n),this.getModel().getDrawableInvertedMaskBit(n)))}}drawMesh(t,e,r,n,s,a,o,h,u){this.isCulling()?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this.gl.frontFace(this.gl.CCW);const l=this.getModelColor();this.getClippingContextBufferForMask()==null&&(l.A*=o,this.isPremultipliedAlpha()&&(l.R*=l.A,l.G*=l.A,l.B*=l.A));let c=null;this._textures[t]!=null&&(c=this._textures[t]),Tr.getInstance().setupShaderProgram(this,c,r,s,n,a,this._bufferData,o,h,l,this.isPremultipliedAlpha(),this.getMvpMatrix(),u),this.gl.drawElements(this.gl.TRIANGLES,e,this.gl.UNSIGNED_SHORT,0),this.gl.useProgram(null),this.setClippingContextBufferForDraw(null),this.setClippingContextBufferForMask(null)}static doStaticRelease(){Tr.deleteInstance()}setRenderState(t,e){Ca=t,ai=e}preDraw(){this.firstDraw&&(this.firstDraw=!1,this._anisortopy=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.disable(this.gl.STENCIL_TEST),this.gl.disable(this.gl.DEPTH_TEST),this.gl.frontFace(this.gl.CW),this.gl.enable(this.gl.BLEND),this.gl.colorMask(!0,!0,!0,!0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null)}setClippingContextBufferForMask(t){this._clippingContextBufferForMask=t}getClippingContextBufferForMask(){return this._clippingContextBufferForMask}setClippingContextBufferForDraw(t){this._clippingContextBufferForDraw=t}getClippingContextBufferForDraw(){return this._clippingContextBufferForDraw}startUp(t){this.gl=t,this._clippingManager.setGL(t),Tr.getInstance().setGl(t)}}ga.staticRelease=()=>{cl.doStaticRelease()};const dl=new Qt;class Ig extends zu{constructor(t,e,r){super(),this.lipSync=!0,this.breath=Ea.create(),this.renderer=new cl,this.idParamAngleX=cg,this.idParamAngleY=dg,this.idParamAngleZ=pg,this.idParamEyeBallX=vg,this.idParamEyeBallY=_g,this.idParamBodyAngleX=gg,this.idParamBreath=mg,this.pixelsPerUnit=1,this.centeringTransform=new bt,this.coreModel=t,this.settings=e,this.motionManager=new fg(e,r),this.init()}init(){var t;super.init(),((t=this.settings.getEyeBlinkParameters())==null?void 0:t.length)>0&&(this.eyeBlink=ll.create(this.settings)),this.breath.setParameters([new si(this.idParamAngleX,0,15,6.5345,.5),new si(this.idParamAngleY,0,8,3.5345,.5),new si(this.idParamAngleZ,0,10,5.5345,.5),new si(this.idParamBodyAngleX,0,4,15.5345,.5),new si(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){const r=e.charAt(0).toLowerCase()+e.slice(1);t[r]=this.settings.layout[e]}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,Tr.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return(e=(t=this.settings.hitAreas)==null?void 0:t.map(r=>({id:r.Id,name:r.Name,index:this.coreModel.getDrawableIndex(r.Id)})))!=null?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawableIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let r=0;r<e.length;r+=2)e[r]=e[r]*this.pixelsPerUnit+this.originalWidth/2,e[r+1]=-e[r+1]*this.pixelsPerUnit+this.originalHeight/2;return e}updateTransform(t){this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(t)}update(t,e){var r,n,s,a;super.update(t,e),t/=1e3,e/=1e3;const o=this.coreModel;this.emit("beforeMotionUpdate");const h=this.motionManager.update(this.coreModel,e);this.emit("afterMotionUpdate"),o.saveParameters(),(r=this.motionManager.expressionManager)==null||r.update(o,e),h||(n=this.eyeBlink)==null||n.updateParameters(o,t),this.updateFocus(),this.updateNaturalMovements(t*1e3,e*1e3),(s=this.physics)==null||s.evaluate(o,t),(a=this.pose)==null||a.updateParameters(o,t),this.emit("beforeModelUpdate"),o.update(),o.loadParameters()}updateFocus(){this.coreModel.addParameterValueById(this.idParamEyeBallX,this.focusController.x),this.coreModel.addParameterValueById(this.idParamEyeBallY,this.focusController.y),this.coreModel.addParameterValueById(this.idParamAngleX,this.focusController.x*30),this.coreModel.addParameterValueById(this.idParamAngleY,this.focusController.y*30),this.coreModel.addParameterValueById(this.idParamAngleZ,this.focusController.x*this.focusController.y*-30),this.coreModel.addParameterValueById(this.idParamBodyAngleX,this.focusController.x*10)}updateNaturalMovements(t,e){var r;(r=this.breath)==null||r.updateParameters(this.coreModel,t/1e3)}draw(t){const e=this.drawingMatrix,r=dl.getArray();r[0]=e.a,r[1]=e.b,r[4]=-e.c,r[5]=-e.d,r[12]=e.tx,r[13]=e.ty,this.renderer.setMvpMatrix(dl),this.renderer.setRenderState(t.getParameter(t.FRAMEBUFFER_BINDING),this.viewport),this.renderer.drawModel()}destroy(){super.destroy(),this.renderer.release(),this.coreModel.release(),this.renderer=void 0,this.coreModel=void 0}}let Qi,pl=20;function Ag(){return ri.isStarted()?Promise.resolve():(Qi??(Qi=new Promise((i,t)=>{function e(){try{Mg(),i()}catch(r){if(pl--,pl<0){const n=new Error("Failed to start up Cubism 4 framework.");n.cause=r,t(n);return}_t.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(e,10)}}e()})),Qi)}function Mg(i){i=Object.assign({logFunction:console.log,loggingLevel:rr.LogLevel_Verbose},i),ri.startUp(i),ri.initialize()}const Rg=.001,vl=.5;class Aa{static create(t){const e=new Aa;typeof t.FadeInTime=="number"&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=vl));const r=t.Groups,n=r.length;for(let s=0;s<n;++s){const a=r[s],o=a.length;let h=0;for(let u=0;u<o;++u){const l=a[u],c=new tn;c.partId=l.Id;const f=l.Link;if(f){const d=f.length;for(let v=0;v<d;++v){const _=new tn;_.partId=f[v],c.link.push(_)}}e._partGroups.push(c),++h}e._partGroupCounts.push(h)}return e}updateParameters(t,e){t!=this._lastModel&&this.reset(t),this._lastModel=t,e<0&&(e=0);let r=0;for(let n=0;n<this._partGroupCounts.length;n++){const s=this._partGroupCounts[n];this.doFade(t,e,r,s),r+=s}this.copyPartOpacities(t)}reset(t){let e=0;for(let r=0;r<this._partGroupCounts.length;++r){const n=this._partGroupCounts[r];for(let s=e;s<e+n;++s){this._partGroups[s].initialize(t);const a=this._partGroups[s].partIndex,o=this._partGroups[s].parameterIndex;if(!(a<0)){t.setPartOpacityByIndex(a,s==e?1:0),t.setParameterValueByIndex(o,s==e?1:0);for(let h=0;h<this._partGroups[s].link.length;++h)this._partGroups[s].link[h].initialize(t)}}e+=n}}copyPartOpacities(t){for(let e=0;e<this._partGroups.length;++e){const r=this._partGroups[e];if(r.link.length==0)continue;const n=this._partGroups[e].partIndex,s=t.getPartOpacityByIndex(n);for(let a=0;a<r.link.length;++a){const h=r.link[a].partIndex;h<0||t.setPartOpacityByIndex(h,s)}}}doFade(t,e,r,n){let s=-1,a=1;const o=.5,h=.15;for(let u=r;u<r+n;++u){const l=this._partGroups[u].partIndex,c=this._partGroups[u].parameterIndex;if(t.getParameterValueByIndex(c)>Rg){if(s>=0)break;s=u,a=t.getPartOpacityByIndex(l),a+=e/this._fadeTimeSeconds,a>1&&(a=1)}}s<0&&(s=0,a=1);for(let u=r;u<r+n;++u){const l=this._partGroups[u].partIndex;if(s==u)t.setPartOpacityByIndex(l,a);else{let c=t.getPartOpacityByIndex(l),f;a<o?f=a*(o-1)/o+1:f=(1-a)*o/(1-o),(1-f)*(1-a)>h&&(f=1-h/(1-a)),c>f&&(c=f),t.setPartOpacityByIndex(l,c)}}}constructor(){this._fadeTimeSeconds=vl,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class tn{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],t!=null&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(e=>e.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new tn;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(e=>e.clone()),t}}class Og{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,e=this._savedParameters.length;for(let r=0;r<t;++r)r<e?this._savedParameters[r]=this._parameterValues[r]:this._savedParameters.push(this._parameterValues[r])}getModel(){return this._model}getPartIndex(t){let e;const r=this._model.parts.count;for(e=0;e<r;++e)if(t==this._partIds[e])return e;return t in this._notExistPartId?this._notExistPartId[t]:(e=r+this._notExistPartId.length,this._notExistPartId[t]=e,this._notExistPartOpacities[e]=0,e)}getPartCount(){return this._model.parts.count}setPartOpacityByIndex(t,e){if(t in this._notExistPartOpacities){this._notExistPartOpacities[t]=e;return}Zi(0<=t&&t<this.getPartCount()),this._partOpacities[t]=e}setPartOpacityById(t,e){const r=this.getPartIndex(t);r<0||this.setPartOpacityByIndex(r,e)}getPartOpacityByIndex(t){return t in this._notExistPartOpacities?this._notExistPartOpacities[t]:(Zi(0<=t&&t<this.getPartCount()),this._partOpacities[t])}getPartOpacityById(t){const e=this.getPartIndex(t);return e<0?0:this.getPartOpacityByIndex(e)}getParameterIndex(t){let e;const r=this._model.parameters.count;for(e=0;e<r;++e)if(t==this._parameterIds[e])return e;return t in this._notExistParameterId?this._notExistParameterId[t]:(e=this._model.parameters.count+Object.keys(this._notExistParameterId).length,this._notExistParameterId[t]=e,this._notExistParameterValues[e]=0,e)}getParameterCount(){return this._model.parameters.count}getParameterMaximumValue(t){return this._model.parameters.maximumValues[t]}getParameterMinimumValue(t){return this._model.parameters.minimumValues[t]}getParameterDefaultValue(t){return this._model.parameters.defaultValues[t]}getParameterValueByIndex(t){return t in this._notExistParameterValues?this._notExistParameterValues[t]:(Zi(0<=t&&t<this.getParameterCount()),this._parameterValues[t])}getParameterValueById(t){const e=this.getParameterIndex(t);return this.getParameterValueByIndex(e)}setParameterValueByIndex(t,e,r=1){if(t in this._notExistParameterValues){this._notExistParameterValues[t]=r==1?e:this._notExistParameterValues[t]*(1-r)+e*r;return}Zi(0<=t&&t<this.getParameterCount()),this._model.parameters.maximumValues[t]<e&&(e=this._model.parameters.maximumValues[t]),this._model.parameters.minimumValues[t]>e&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=r==1?e:this._parameterValues[t]=this._parameterValues[t]*(1-r)+e*r}setParameterValueById(t,e,r=1){const n=this.getParameterIndex(t);this.setParameterValueByIndex(n,e,r)}addParameterValueByIndex(t,e,r=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*r)}addParameterValueById(t,e,r=1){const n=this.getParameterIndex(t);this.addParameterValueByIndex(n,e,r)}multiplyParameterValueById(t,e,r=1){const n=this.getParameterIndex(t);this.multiplyParameterValueByIndex(n,e,r)}multiplyParameterValueByIndex(t,e,r=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*r))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let r=0;r<e;++r)if(this._drawableIds[r]==t)return r;return-1}getDrawableCount(){return this._model.drawables.count}getDrawableId(t){return this._model.drawables.ids[t]}getDrawableRenderOrders(){return this._model.drawables.renderOrders}getDrawableTextureIndices(t){return this._model.drawables.textureIndices[t]}getDrawableDynamicFlagVertexPositionsDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(e[t])}getDrawableVertexIndexCount(t){return this._model.drawables.indexCounts[t]}getDrawableVertexCount(t){return this._model.drawables.vertexCounts[t]}getDrawableVertices(t){return this.getDrawableVertexPositions(t)}getDrawableVertexIndices(t){return this._model.drawables.indices[t]}getDrawableVertexPositions(t){return this._model.drawables.vertexPositions[t]}getDrawableVertexUvs(t){return this._model.drawables.vertexUvs[t]}getDrawableOpacity(t){return this._model.drawables.opacities[t]}getDrawableCulling(t){const e=this._model.drawables.constantFlags;return!Live2DCubismCore.Utils.hasIsDoubleSidedBit(e[t])}getDrawableBlendMode(t){const e=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasBlendAdditiveBit(e[t])?Le.CubismBlendMode_Additive:Live2DCubismCore.Utils.hasBlendMultiplicativeBit(e[t])?Le.CubismBlendMode_Multiplicative:Le.CubismBlendMode_Normal}getDrawableInvertedMaskBit(t){const e=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasIsInvertedMaskBit(e[t])}getDrawableMasks(){return this._model.drawables.masks}getDrawableMaskCounts(){return this._model.drawables.maskCounts}isUsingMasking(){for(let t=0;t<this._model.drawables.count;++t)if(!(this._model.drawables.maskCounts[t]<=0))return!0;return!1}getDrawableDynamicFlagIsVisible(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasIsVisibleBit(e[t])}getDrawableDynamicFlagVisibilityDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(e[t])}getDrawableDynamicFlagOpacityDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasOpacityDidChangeBit(e[t])}getDrawableDynamicFlagRenderOrderDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(e[t])}loadParameters(){let t=this._model.parameters.count;const e=this._savedParameters.length;t>e&&(t=e);for(let r=0;r<t;++r)this._parameterValues[r]=this._savedParameters[r]}initialize(){this._parameterValues=this._model.parameters.values,this._partOpacities=this._model.parts.opacities,this._parameterMaximumValues=this._model.parameters.maximumValues,this._parameterMinimumValues=this._model.parameters.minimumValues;{const t=this._model.parameters.ids,e=this._model.parameters.count;for(let r=0;r<e;++r)this._parameterIds.push(t[r])}{const t=this._model.parts.ids,e=this._model.parts.count;for(let r=0;r<e;++r)this._partIds.push(t[r])}{const t=this._model.drawables.ids,e=this._model.drawables.count;for(let r=0;r<e;++r)this._drawableIds.push(t[r])}}constructor(t){this._model=t,this._savedParameters=[],this._parameterIds=[],this._drawableIds=[],this._partIds=[],this._notExistPartId={},this._notExistParameterId={},this._notExistParameterValues={},this._notExistPartOpacities={},this.initialize()}release(){this._model.release(),this._model=void 0}}class Ma{static create(t){const e=Live2DCubismCore.Moc.fromArrayBuffer(t);if(e)return new Ma(e);throw new Error("Unknown error")}createModel(){let t;const e=Live2DCubismCore.Model.fromMoc(this._moc);if(e)return t=new Og(e),++this._modelCount,t;throw new Error("Unknown error")}deleteModel(t){t!=null&&--this._modelCount}constructor(t){this._moc=t,this._modelCount=0}release(){this._moc._release(),this._moc=void 0}}var Ra=(i=>(i[i.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",i))(Ra||{}),ar=(i=>(i[i.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",i[i.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",i[i.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",i))(ar||{});class Dg{constructor(){this.initialPosition=new st(0,0),this.position=new st(0,0),this.lastPosition=new st(0,0),this.lastGravity=new st(0,0),this.force=new st(0,0),this.velocity=new st(0,0)}}class Fg{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class Lg{constructor(){this.source={}}}class Bg{constructor(){this.destination={},this.translationScale=new st(0,0)}}class Ng{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new st(0,0),this.wind=new st(0,0)}}class Ug{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new st(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new st(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const r=new st(0,0);return r.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,r.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,r}}const _l="X",gl="Y",ml="Angle",kg=5,yl=100,Gg=.001;class Oa{static create(t){const e=new Oa;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let r,n,s,a;const o=new st;let h,u,l,c,f,d,v,_;f=t.getModel().parameters.values,d=t.getModel().parameters.maximumValues,v=t.getModel().parameters.minimumValues,_=t.getModel().parameters.defaultValues;for(let p=0;p<this._physicsRig.subRigCount;++p){r={angle:0},o.x=0,o.y=0,h=this._physicsRig.settings[p],u=this._physicsRig.inputs.slice(h.baseInputIndex),l=this._physicsRig.outputs.slice(h.baseOutputIndex),c=this._physicsRig.particles.slice(h.baseParticleIndex);for(let g=0;g<h.inputCount;++g)n=u[g].weight/yl,u[g].sourceParameterIndex==-1&&(u[g].sourceParameterIndex=t.getParameterIndex(u[g].source.id)),u[g].getNormalizedParameterValue(o,r,f[u[g].sourceParameterIndex],v[u[g].sourceParameterIndex],d[u[g].sourceParameterIndex],_[u[g].sourceParameterIndex],h.normalizationPosition,h.normalizationAngle,u[g].reflect,n);s=yt.degreesToRadian(-r.angle),o.x=o.x*yt.cos(s)-o.y*yt.sin(s),o.y=o.x*yt.sin(s)+o.y*yt.cos(s),Qg(c,h.particleCount,o,r.angle,this._options.wind,Gg*h.normalizationPosition.maximum,e,kg);for(let g=0;g<h.outputCount;++g){const y=l[g].vertexIndex;if(y<1||y>=h.particleCount)break;l[g].destinationParameterIndex==-1&&(l[g].destinationParameterIndex=t.getParameterIndex(l[g].destination.id));const T=new st;T.x=c[y].position.x-c[y-1].position.x,T.y=c[y].position.y-c[y-1].position.y,a=l[g].getValue(T,c,y,l[g].reflect,this._options.gravity);const I=l[g].destinationParameterIndex,m=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(f.subarray(I))):f.slice(I);tm(m,v[I],d[I],a,l[g]);for(let S=I,x=0;S<f.length;S++,x++)f[S]=m[x]}}}setOptions(t){this._options=t}getOption(){return this._options}constructor(){this._options=new Xg,this._options.gravity.y=-1,this._options.gravity.x=0,this._options.wind.x=0,this._options.wind.y=0}release(){this._physicsRig=void 0}parse(t){this._physicsRig=new Ng;let e=new Ug(t);this._physicsRig.gravity=e.getGravity(),this._physicsRig.wind=e.getWind(),this._physicsRig.subRigCount=e.getSubRigCount();let r=0,n=0,s=0;for(let a=0;a<this._physicsRig.subRigCount;++a){const o=new Fg;o.normalizationPosition.minimum=e.getNormalizationPositionMinimumValue(a),o.normalizationPosition.maximum=e.getNormalizationPositionMaximumValue(a),o.normalizationPosition.defalut=e.getNormalizationPositionDefaultValue(a),o.normalizationAngle.minimum=e.getNormalizationAngleMinimumValue(a),o.normalizationAngle.maximum=e.getNormalizationAngleMaximumValue(a),o.normalizationAngle.defalut=e.getNormalizationAngleDefaultValue(a),o.inputCount=e.getInputCount(a),o.baseInputIndex=r,r+=o.inputCount;for(let h=0;h<o.inputCount;++h){const u=new Lg;switch(u.sourceParameterIndex=-1,u.weight=e.getInputWeight(a,h),u.reflect=e.getInputReflect(a,h),e.getInputType(a,h)){case _l:u.type=ar.CubismPhysicsSource_X,u.getNormalizedParameterValue=Hg;break;case gl:u.type=ar.CubismPhysicsSource_Y,u.getNormalizedParameterValue=Vg;break;case ml:u.type=ar.CubismPhysicsSource_Angle,u.getNormalizedParameterValue=jg;break}u.source.targetType=Ra.CubismPhysicsTargetType_Parameter,u.source.id=e.getInputSourceId(a,h),this._physicsRig.inputs.push(u)}o.outputCount=e.getOutputCount(a),o.baseOutputIndex=n,n+=o.outputCount;for(let h=0;h<o.outputCount;++h){const u=new Bg;switch(u.destinationParameterIndex=-1,u.vertexIndex=e.getOutputVertexIndex(a,h),u.angleScale=e.getOutputAngleScale(a,h),u.weight=e.getOutputWeight(a,h),u.destination.targetType=Ra.CubismPhysicsTargetType_Parameter,u.destination.id=e.getOutputDestinationId(a,h),e.getOutputType(a,h)){case _l:u.type=ar.CubismPhysicsSource_X,u.getValue=zg,u.getScale=Kg;break;case gl:u.type=ar.CubismPhysicsSource_Y,u.getValue=Wg,u.getScale=Zg;break;case ml:u.type=ar.CubismPhysicsSource_Angle,u.getValue=Yg,u.getScale=Jg;break}u.reflect=e.getOutputReflect(a,h),this._physicsRig.outputs.push(u)}o.particleCount=e.getParticleCount(a),o.baseParticleIndex=s,s+=o.particleCount;for(let h=0;h<o.particleCount;++h){const u=new Dg;u.mobility=e.getParticleMobility(a,h),u.delay=e.getParticleDelay(a,h),u.acceleration=e.getParticleAcceleration(a,h),u.radius=e.getParticleRadius(a,h),u.position=e.getParticlePosition(a,h),this._physicsRig.particles.push(u)}this._physicsRig.settings.push(o)}this.initialize(),e.release()}initialize(){let t,e,r;for(let n=0;n<this._physicsRig.subRigCount;++n){e=this._physicsRig.settings[n],t=this._physicsRig.particles.slice(e.baseParticleIndex),t[0].initialPosition=new st(0,0),t[0].lastPosition=new st(t[0].initialPosition.x,t[0].initialPosition.y),t[0].lastGravity=new st(0,-1),t[0].lastGravity.y*=-1,t[0].velocity=new st(0,0),t[0].force=new st(0,0);for(let s=1;s<e.particleCount;++s)r=new st(0,0),r.y=t[s].radius,t[s].initialPosition=new st(t[s-1].initialPosition.x+r.x,t[s-1].initialPosition.y+r.y),t[s].position=new st(t[s].initialPosition.x,t[s].initialPosition.y),t[s].lastPosition=new st(t[s].initialPosition.x,t[s].initialPosition.y),t[s].lastGravity=new st(0,-1),t[s].lastGravity.y*=-1,t[s].velocity=new st(0,0),t[s].force=new st(0,0)}}}class Xg{constructor(){this.gravity=new st(0,0),this.wind=new st(0,0)}}function Hg(i,t,e,r,n,s,a,o,h,u){i.x+=Da(e,r,n,s,a.minimum,a.maximum,a.defalut,h)*u}function Vg(i,t,e,r,n,s,a,o,h,u){i.y+=Da(e,r,n,s,a.minimum,a.maximum,a.defalut,h)*u}function jg(i,t,e,r,n,s,a,o,h,u){t.angle+=Da(e,r,n,s,o.minimum,o.maximum,o.defalut,h)*u}function zg(i,t,e,r,n){let s=i.x;return r&&(s*=-1),s}function Wg(i,t,e,r,n){let s=i.y;return r&&(s*=-1),s}function Yg(i,t,e,r,n){let s;return e>=2?n=t[e-1].position.substract(t[e-2].position):n=n.multiplyByScaler(-1),s=yt.directionToRadian(n,i),r&&(s*=-1),s}function qg(i,t){return Math.abs(Math.max(i,t)-Math.min(i,t))}function $g(i,t){return Math.min(i,t)+qg(i,t)/2}function Kg(i,t){return i.x}function Zg(i,t){return i.y}function Jg(i,t){return t}function Qg(i,t,e,r,n,s,a,o){let h,u,l,c,f=new st(0,0),d=new st(0,0),v=new st(0,0),_=new st(0,0);i[0].position=new st(e.x,e.y),h=yt.degreesToRadian(r),c=yt.radianToDirection(h),c.normalize();for(let p=1;p<t;++p)i[p].force=c.multiplyByScaler(i[p].acceleration).add(n),i[p].lastPosition=new st(i[p].position.x,i[p].position.y),u=i[p].delay*a*30,f=i[p].position.substract(i[p-1].position),l=yt.directionToRadian(i[p].lastGravity,c)/o,f.x=yt.cos(l)*f.x-f.y*yt.sin(l),f.y=yt.sin(l)*f.x+f.y*yt.cos(l),i[p].position=i[p-1].position.add(f),d=i[p].velocity.multiplyByScaler(u),v=i[p].force.multiplyByScaler(u).multiplyByScaler(u),i[p].position=i[p].position.add(d).add(v),_=i[p].position.substract(i[p-1].position),_.normalize(),i[p].position=i[p-1].position.add(_.multiplyByScaler(i[p].radius)),yt.abs(i[p].position.x)<s&&(i[p].position.x=0),u!=0&&(i[p].velocity=i[p].position.substract(i[p].lastPosition),i[p].velocity=i[p].velocity.divisionByScalar(u),i[p].velocity=i[p].velocity.multiplyByScaler(i[p].mobility)),i[p].force=new st(0,0),i[p].lastGravity=new st(c.x,c.y)}function tm(i,t,e,r,n){let s,a,o;s=n.getScale(n.translationScale,n.angleScale),a=r*s,a<t?(a<n.valueBelowMinimum&&(n.valueBelowMinimum=a),a=t):a>e&&(a>n.valueExceededMaximum&&(n.valueExceededMaximum=a),a=e),o=n.weight/yl,o>=1||(a=i[0]*(1-o)+a*o),i[0]=a}function Da(i,t,e,r,n,s,a,o){let h=0;const u=yt.max(e,t);u<i&&(i=u);const l=yt.min(e,t);l>i&&(i=l);const c=yt.min(n,s),f=yt.max(n,s),d=a,v=$g(l,u),_=i-v;switch(Math.sign(_)){case 1:{const p=f-d,g=u-v;g!=0&&(h=_*(p/g),h+=d);break}case-1:{const p=c-d,g=l-v;g!=0&&(h=_*(p/g),h+=d);break}case 0:{h=d;break}}return o?h:h*-1}Et.registerRuntime({version:4,ready:Ag,test(i){return i instanceof br||br.isValidJSON(i)},isValidMoc(i){if(i.byteLength<4)return!1;const t=new Int8Array(i,0,4);return String.fromCharCode(...t)==="MOC3"},createModelSettings(i){return new br(i)},createCoreModel(i){const t=Ma.create(i);try{const e=t.createModel();return e.__moc=t,e}catch(e){try{t.release()}catch{}throw e}},createInternalModel(i,t,e){const r=new Ig(i,t,e),n=i;return n.__moc&&(r.__moc=n.__moc,delete n.__moc,r.once("destroy",em)),r},createPhysics(i,t){return Oa.create(t)},createPose(i,t){return Aa.create(t)}});function em(){var i;(i=this.__moc)==null||i.release()}function rm(i){var t=this.constructor;return this.then(function(e){return t.resolve(i()).then(function(){return e})},function(e){return t.resolve(i()).then(function(){return t.reject(e)})})}function im(i){var t=this;return new t(function(e,r){if(!(i&&typeof i.length<"u"))return r(new TypeError(typeof i+" "+i+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(i);if(n.length===0)return e([]);var s=n.length;function a(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(c){a(h,c)},function(c){n[h]={status:"rejected",reason:c},--s===0&&e(n)});return}}n[h]={status:"fulfilled",value:u},--s===0&&e(n)}for(var o=0;o<n.length;o++)a(o,n[o])})}function xl(i,t){this.name="AggregateError",this.errors=i,this.message=t||""}xl.prototype=Error.prototype;function nm(i){var t=this;return new t(function(e,r){if(!(i&&typeof i.length<"u"))return r(new TypeError("Promise.any accepts an array"));var n=Array.prototype.slice.call(i);if(n.length===0)return r();for(var s=[],a=0;a<n.length;a++)try{t.resolve(n[a]).then(e).catch(function(o){s.push(o),s.length===n.length&&r(new xl(s,"All promises were rejected"))})}catch(o){r(o)}})}var sm=setTimeout;function bl(i){return!!(i&&typeof i.length<"u")}function am(){}function om(i,t){return function(){i.apply(t,arguments)}}function Pt(i){if(!(this instanceof Pt))throw new TypeError("Promises must be constructed via new");if(typeof i!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],El(i,this)}function Tl(i,t){for(;i._state===3;)i=i._value;if(i._state===0){i._deferreds.push(t);return}i._handled=!0,Pt._immediateFn(function(){var e=i._state===1?t.onFulfilled:t.onRejected;if(e===null){(i._state===1?Fa:hi)(t.promise,i._value);return}var r;try{r=e(i._value)}catch(n){hi(t.promise,n);return}Fa(t.promise,r)})}function Fa(i,t){try{if(t===i)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var e=t.then;if(t instanceof Pt){i._state=3,i._value=t,La(i);return}else if(typeof e=="function"){El(om(e,t),i);return}}i._state=1,i._value=t,La(i)}catch(r){hi(i,r)}}function hi(i,t){i._state=2,i._value=t,La(i)}function La(i){i._state===2&&i._deferreds.length===0&&Pt._immediateFn(function(){i._handled||Pt._unhandledRejectionFn(i._value)});for(var t=0,e=i._deferreds.length;t<e;t++)Tl(i,i._deferreds[t]);i._deferreds=null}function hm(i,t,e){this.onFulfilled=typeof i=="function"?i:null,this.onRejected=typeof t=="function"?t:null,this.promise=e}function El(i,t){var e=!1;try{i(function(r){e||(e=!0,Fa(t,r))},function(r){e||(e=!0,hi(t,r))})}catch(r){if(e)return;e=!0,hi(t,r)}}Pt.prototype.catch=function(i){return this.then(null,i)},Pt.prototype.then=function(i,t){var e=new this.constructor(am);return Tl(this,new hm(i,t,e)),e},Pt.prototype.finally=rm,Pt.all=function(i){return new Pt(function(t,e){if(!bl(i))return e(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(i);if(r.length===0)return t([]);var n=r.length;function s(o,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(o,l)},e);return}}r[o]=h,--n===0&&t(r)}catch(l){e(l)}}for(var a=0;a<r.length;a++)s(a,r[a])})},Pt.any=nm,Pt.allSettled=im,Pt.resolve=function(i){return i&&typeof i=="object"&&i.constructor===Pt?i:new Pt(function(t){t(i)})},Pt.reject=function(i){return new Pt(function(t,e){e(i)})},Pt.race=function(i){return new Pt(function(t,e){if(!bl(i))return e(new TypeError("Promise.race accepts an array"));for(var r=0,n=i.length;r<n;r++)Pt.resolve(i[r]).then(t,e)})},Pt._immediateFn=typeof setImmediate=="function"&&function(i){setImmediate(i)}||function(i){sm(i,0)},Pt._unhandledRejectionFn=function(t){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var Ba,Sl;function um(){if(Sl)return Ba;Sl=1;var i=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function n(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var a={},o=0;o<10;o++)a["_"+String.fromCharCode(o)]=o;var h=Object.getOwnPropertyNames(a).map(function(l){return a[l]});if(h.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(l){u[l]=l}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ba=n()?Object.assign:function(s,a){for(var o,h=r(s),u,l=1;l<arguments.length;l++){o=Object(arguments[l]);for(var c in o)t.call(o,c)&&(h[c]=o[c]);if(i){u=i(o);for(var f=0;f<u.length;f++)e.call(o,u[f])&&(h[u[f]]=o[u[f]])}}return h},Ba}var lm=um();const fm=An(lm);typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=Pt),Object.assign||(Object.assign=fm);var cm=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var dm=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-dm}}for(var Na=Date.now(),Pl=["ms","moz","webkit","o"],Ua=0;Ua<Pl.length&&!globalThis.requestAnimationFrame;++Ua){var ka=Pl[Ua];globalThis.requestAnimationFrame=globalThis[ka+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[ka+"CancelAnimationFrame"]||globalThis[ka+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(i){if(typeof i!="function")throw new TypeError(i+"is not a function");var t=Date.now(),e=cm+Na-t;return e<0&&(e=0),Na=t,globalThis.self.setTimeout(function(){Na=Date.now(),i(performance.now())},e)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(i){return clearTimeout(i)}),Math.sign||(Math.sign=function(t){return t=Number(t),t===0||isNaN(t)?t:t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return typeof t=="number"&&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 wl={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ct.mixin(wl);var pm=9,en=100,vm=0,_m=0,Cl=2,Il=1,gm=-1e3,mm=-1e3,ym=2,Al=function(){function i(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(qt.tablet||qt.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width=en+"px",e.style.height=en+"px",e.style.position="absolute",e.style.top=vm+"px",e.style.left=_m+"px",e.style.zIndex=Cl.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(i.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),i.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width=Il+"px",e.style.height=Il+"px",e.style.position="absolute",e.style.top=gm+"px",e.style.left=mm+"px",e.style.zIndex=ym.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e},i.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},i.prototype.activate=function(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)===null||t===void 0||t.appendChild(this.div))},i.prototype.deactivate=function(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)===null||t===void 0||t.removeChild(this.div))},i.prototype.updateAccessibleObjects=function(t){if(!(!t.visible||!t.accessibleChildren)){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);var e=t.children;if(e)for(var r=0;r<e.length;r++)this.updateAccessibleObjects(e[r])}},i.prototype.update=function(){var t=performance.now();if(!(qt.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,!!this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),r=e.left,n=e.top,s=e.width,a=e.height,o=this.renderer,h=o.width,u=o.height,l=o.resolution,c=s/h*l,f=a/u*l,d=this.div;d.style.left=r+"px",d.style.top=n+"px",d.style.width=h+"px",d.style.height=u+"px";for(var v=0;v<this.children.length;v++){var _=this.children[v];if(_.renderId!==this.renderId)_._accessibleActive=!1,Ve(this.children,v,1),this.div.removeChild(_._accessibleDiv),this.pool.push(_._accessibleDiv),_._accessibleDiv=null,v--;else{d=_._accessibleDiv;var p=_.hitArea,g=_.worldTransform;_.hitArea?(d.style.left=(g.tx+p.x*g.a)*c+"px",d.style.top=(g.ty+p.y*g.d)*f+"px",d.style.width=p.width*g.a*c+"px",d.style.height=p.height*g.d*f+"px"):(p=_.getBounds(),this.capHitArea(p),d.style.left=p.x*c+"px",d.style.top=p.y*f+"px",d.style.width=p.width*c+"px",d.style.height=p.height*f+"px",d.title!==_.accessibleTitle&&_.accessibleTitle!==null&&(d.title=_.accessibleTitle),d.getAttribute("aria-label")!==_.accessibleHint&&_.accessibleHint!==null&&d.setAttribute("aria-label",_.accessibleHint)),(_.accessibleTitle!==d.title||_.tabIndex!==d.tabIndex)&&(d.title=_.accessibleTitle,d.tabIndex=_.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},i.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},i.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,r=e.width,n=e.height;t.x+t.width>r&&(t.width=r-t.x),t.y+t.height>n&&(t.height=n-t.y)},i.prototype.addChild=function(t){var e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=en+"px",e.style.height=en+"px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Cl.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title="displayObject "+t.tabIndex),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},i.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,r=t.target.displayObject,n=e.eventData;e.dispatchEvent(r,"click",n),e.dispatchEvent(r,"pointertap",n),e.dispatchEvent(r,"tap",n)},i.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,r=t.target.displayObject,n=e.eventData;e.dispatchEvent(r,"mouseover",n)},i.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,r=t.target.displayObject,n=e.eventData;e.dispatchEvent(r,"mouseout",n)},i.prototype._onKeyDown=function(t){t.keyCode===pm&&this.activate()},i.prototype._onMouseMove=function(t){t.movementX===0&&t.movementY===0||this.deactivate()},i.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},i.extension={name:"accessibility",type:[dt.RendererPlugin,dt.CanvasRendererPlugin]},i}();var Ga=function(){function i(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new vt,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(i.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),i.prototype.getLocalPosition=function(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)},i.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},i.prototype.reset=function(){this.isPrimary=!1},i}();var Xa=function(i,t){return Xa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Xa(i,t)};function xm(i,t){Xa(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Ml=function(){function i(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return i.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},i.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},i}(),rn=function(){function i(t){this._pointerId=t,this._flags=i.FLAGS.NONE}return i.prototype._doSet=function(t,e){e?this._flags=this._flags|t:this._flags=this._flags&~t},Object.defineProperty(i.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"none",{get:function(){return this._flags===i.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"over",{get:function(){return(this._flags&i.FLAGS.OVER)!==0},set:function(t){this._doSet(i.FLAGS.OVER,t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"rightDown",{get:function(){return(this._flags&i.FLAGS.RIGHT_DOWN)!==0},set:function(t){this._doSet(i.FLAGS.RIGHT_DOWN,t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"leftDown",{get:function(){return(this._flags&i.FLAGS.LEFT_DOWN)!==0},set:function(t){this._doSet(i.FLAGS.LEFT_DOWN,t)},enumerable:!1,configurable:!0}),i.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),i}(),bm=function(){function i(){this._tempPoint=new vt}return i.prototype.recursiveFindHit=function(t,e,r,n,s){var a;if(!e||!e.visible)return!1;var o=t.data.global;s=e.interactive||s;var h=!1,u=s,l=!0;if(e.hitArea)n&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?h=!0:(n=!1,l=!1)),u=!1;else if(e._mask&&n){var c=e._mask.isMaskData?e._mask.maskObject:e._mask;c&&!(!((a=c.containsPoint)===null||a===void 0)&&a.call(c,o))&&(n=!1)}if(l&&e.interactiveChildren&&e.children)for(var f=e.children,d=f.length-1;d>=0;d--){var v=f[d],_=this.recursiveFindHit(t,v,r,n,u);if(_){if(!v.parent)continue;u=!1,_&&(t.target&&(n=!1),h=!0)}}return s&&(n&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(h=!0),e.interactive&&(h&&!t.target&&(t.target=e),r&&r(t,e,!!h))),h},i.prototype.findHit=function(t,e,r,n){this.recursiveFindHit(t,e,r,n,!1)},i}(),Rl={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(i){i?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Ct.mixin(Rl);var nn=1,sn={target:null,data:{global:null}},Ha=function(i){xm(t,i);function t(e,r){var n=i.call(this)||this;return r=r||{},n.renderer=e,n.autoPreventDefault=r.autoPreventDefault!==void 0?r.autoPreventDefault:!0,n.interactionFrequency=r.interactionFrequency||10,n.mouse=new Ga,n.mouse.identifier=nn,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[nn]=n.mouse,n.interactionDataPool=[],n.eventData=new Ml,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new bm,n._tempDisplayObject=new da,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=r.useSystemTicker!==void 0?r.useSystemTicker:!0,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return Object.defineProperty(t.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(e){this._useSystemTicker=e,e?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),t.prototype.hitTest=function(e,r){return sn.target=null,sn.data.global=e,r||(r=this.lastObjectRendered),this.processInteractive(sn,r,null,!0),sn.target},t.prototype.setTargetElement=function(e,r){r===void 0&&(r=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=e,this.resolution=r,this.addEvents(),this.addTickerListener()},t.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(Ot.system.add(this.tickerUpdate,this,de.INTERACTION),this.tickerAdded=!0)},t.prototype.removeTickerListener=function(){this.tickerAdded&&(Ot.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},t.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.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}},t.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.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}},t.prototype.tickerUpdate=function(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())},t.prototype.update=function(){if(this.interactionDOMElement){if(this._didMove){this._didMove=!1;return}this.cursor=null;for(var e in this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(e)){var r=this.activeInteractionData[e];if(r.originalEvent&&r.pointerType!=="touch"){var n=this.configureInteractionEventForDOMEvent(this.eventData,r.originalEvent,r);this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},t.prototype.setCursorMode=function(e){e=e||"default";var r=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(r=!1),this.currentCursorMode!==e){this.currentCursorMode=e;var n=this.cursorStyles[e];if(n)switch(typeof n){case"string":r&&(this.interactionDOMElement.style.cursor=n);break;case"function":n(e);break;case"object":r&&Object.assign(this.interactionDOMElement.style,n);break}else r&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.interactionDOMElement.style.cursor=e)}},t.prototype.dispatchEvent=function(e,r,n){(!n.stopPropagationHint||e===n.stopsPropagatingAt)&&(n.currentTarget=e,n.type=r,e.emit(r,n),e[r]&&e[r](n))},t.prototype.delayDispatchEvent=function(e,r,n){this.delayedEvents.push({displayObject:e,eventString:r,eventData:n})},t.prototype.mapPositionToPoint=function(e,r,n){var s;this.interactionDOMElement.parentElement?s=this.interactionDOMElement.getBoundingClientRect():s={x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var a=1/this.resolution;e.x=(r-s.left)*(this.interactionDOMElement.width/s.width)*a,e.y=(n-s.top)*(this.interactionDOMElement.height/s.height)*a},t.prototype.processInteractive=function(e,r,n,s){var a=this.search.findHit(e,r,n,s),o=this.delayedEvents;if(!o.length)return a;e.stopPropagationHint=!1;var h=o.length;this.delayedEvents=[];for(var u=0;u<h;u++){var l=o[u],c=l.displayObject,f=l.eventString,d=l.eventData;d.stopsPropagatingAt===c&&(d.stopPropagationHint=!0),this.dispatchEvent(c,f,d)}return a},t.prototype.onPointerDown=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var r=this.normalizeToPointerData(e);if(this.autoPreventDefault&&r[0].isNormalized){var n=e.cancelable||!("cancelable"in e);n&&e.preventDefault()}for(var s=r.length,a=0;a<s;a++){var o=r[a],h=this.getInteractionDataForPointerId(o),u=this.configureInteractionEventForDOMEvent(this.eventData,o,h);if(u.data.originalEvent=e,this.processInteractive(u,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",u),o.pointerType==="touch")this.emit("touchstart",u);else if(o.pointerType==="mouse"||o.pointerType==="pen"){var l=o.button===2;this.emit(l?"rightdown":"mousedown",this.eventData)}}}},t.prototype.processPointerDown=function(e,r,n){var s=e.data,a=e.data.identifier;if(n){if(r.trackedPointers[a]||(r.trackedPointers[a]=new rn(a)),this.dispatchEvent(r,"pointerdown",e),s.pointerType==="touch")this.dispatchEvent(r,"touchstart",e);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;o?r.trackedPointers[a].rightDown=!0:r.trackedPointers[a].leftDown=!0,this.dispatchEvent(r,o?"rightdown":"mousedown",e)}}},t.prototype.onPointerComplete=function(e,r,n){var s=this.normalizeToPointerData(e),a=s.length,o=e.target;e.composedPath&&e.composedPath().length>0&&(o=e.composedPath()[0]);for(var h=o!==this.interactionDOMElement?"outside":"",u=0;u<a;u++){var l=s[u],c=this.getInteractionDataForPointerId(l),f=this.configureInteractionEventForDOMEvent(this.eventData,l,c);if(f.data.originalEvent=e,this.processInteractive(f,this.lastObjectRendered,n,r||!h),this.emit(r?"pointercancel":"pointerup"+h,f),l.pointerType==="mouse"||l.pointerType==="pen"){var d=l.button===2;this.emit(d?"rightup"+h:"mouseup"+h,f)}else l.pointerType==="touch"&&(this.emit(r?"touchcancel":"touchend"+h,f),this.releaseInteractionDataForPointerId(l.pointerId))}},t.prototype.onPointerCancel=function(e){this.supportsTouchEvents&&e.pointerType==="touch"||this.onPointerComplete(e,!0,this.processPointerCancel)},t.prototype.processPointerCancel=function(e,r){var n=e.data,s=e.data.identifier;r.trackedPointers[s]!==void 0&&(delete r.trackedPointers[s],this.dispatchEvent(r,"pointercancel",e),n.pointerType==="touch"&&this.dispatchEvent(r,"touchcancel",e))},t.prototype.onPointerUp=function(e){this.supportsTouchEvents&&e.pointerType==="touch"||this.onPointerComplete(e,!1,this.processPointerUp)},t.prototype.processPointerUp=function(e,r,n){var s=e.data,a=e.data.identifier,o=r.trackedPointers[a],h=s.pointerType==="touch",u=s.pointerType==="mouse"||s.pointerType==="pen",l=!1;if(u){var c=s.button===2,f=rn.FLAGS,d=c?f.RIGHT_DOWN:f.LEFT_DOWN,v=o!==void 0&&o.flags&d;n?(this.dispatchEvent(r,c?"rightup":"mouseup",e),v&&(this.dispatchEvent(r,c?"rightclick":"click",e),l=!0)):v&&this.dispatchEvent(r,c?"rightupoutside":"mouseupoutside",e),o&&(c?o.rightDown=!1:o.leftDown=!1)}n?(this.dispatchEvent(r,"pointerup",e),h&&this.dispatchEvent(r,"touchend",e),o&&((!u||l)&&this.dispatchEvent(r,"pointertap",e),h&&(this.dispatchEvent(r,"tap",e),o.over=!1))):o&&(this.dispatchEvent(r,"pointerupoutside",e),h&&this.dispatchEvent(r,"touchendoutside",e)),o&&o.none&&delete r.trackedPointers[a]},t.prototype.onPointerMove=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var r=this.normalizeToPointerData(e);(r[0].pointerType==="mouse"||r[0].pointerType==="pen")&&(this._didMove=!0,this.cursor=null);for(var n=r.length,s=0;s<n;s++){var a=r[s],o=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,o);h.data.originalEvent=e,this.processInteractive(h,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",h),a.pointerType==="touch"&&this.emit("touchmove",h),(a.pointerType==="mouse"||a.pointerType==="pen")&&this.emit("mousemove",h)}r[0].pointerType==="mouse"&&this.setCursorMode(this.cursor)}},t.prototype.processPointerMove=function(e,r,n){var s=e.data,a=s.pointerType==="touch",o=s.pointerType==="mouse"||s.pointerType==="pen";o&&this.processPointerOverOut(e,r,n),(!this.moveWhenInside||n)&&(this.dispatchEvent(r,"pointermove",e),a&&this.dispatchEvent(r,"touchmove",e),o&&this.dispatchEvent(r,"mousemove",e))},t.prototype.onPointerOut=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var r=this.normalizeToPointerData(e),n=r[0];n.pointerType==="mouse"&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,this.processInteractive(a,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",a),n.pointerType==="mouse"||n.pointerType==="pen"?this.emit("mouseout",a):this.releaseInteractionDataForPointerId(s.identifier)}},t.prototype.processPointerOverOut=function(e,r,n){var s=e.data,a=e.data.identifier,o=s.pointerType==="mouse"||s.pointerType==="pen",h=r.trackedPointers[a];n&&!h&&(h=r.trackedPointers[a]=new rn(a)),h!==void 0&&(n&&this.mouseOverRenderer?(h.over||(h.over=!0,this.delayDispatchEvent(r,"pointerover",e),o&&this.delayDispatchEvent(r,"mouseover",e)),o&&this.cursor===null&&(this.cursor=r.cursor)):h.over&&(h.over=!1,this.dispatchEvent(r,"pointerout",this.eventData),o&&this.dispatchEvent(r,"mouseout",e),h.none&&delete r.trackedPointers[a]))},t.prototype.onPointerOver=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var r=this.normalizeToPointerData(e),n=r[0],s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,n.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",a),(n.pointerType==="mouse"||n.pointerType==="pen")&&this.emit("mouseover",a)}},t.prototype.getInteractionDataForPointerId=function(e){var r=e.pointerId,n;return r===nn||e.pointerType==="mouse"?n=this.mouse:this.activeInteractionData[r]?n=this.activeInteractionData[r]:(n=this.interactionDataPool.pop()||new Ga,n.identifier=r,this.activeInteractionData[r]=n),n.copyEvent(e),n},t.prototype.releaseInteractionDataForPointerId=function(e){var r=this.activeInteractionData[e];r&&(delete this.activeInteractionData[e],r.reset(),this.interactionDataPool.push(r))},t.prototype.configureInteractionEventForDOMEvent=function(e,r,n){return e.data=n,this.mapPositionToPoint(n.global,r.clientX,r.clientY),r.pointerType==="touch"&&(r.globalX=n.global.x,r.globalY=n.global.y),n.originalEvent=r,e.reset(),e},t.prototype.normalizeToPointerData=function(e){var r=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(var n=0,s=e.changedTouches.length;n<s;n++){var a=e.changedTouches[n];typeof a.button>"u"&&(a.button=e.touches.length?1:0),typeof a.buttons>"u"&&(a.buttons=e.touches.length?1:0),typeof a.isPrimary>"u"&&(a.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof a.width>"u"&&(a.width=a.radiusX||1),typeof a.height>"u"&&(a.height=a.radiusY||1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="touch"),typeof a.pointerId>"u"&&(a.pointerId=a.identifier||0),typeof a.pressure>"u"&&(a.pressure=a.force||.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),typeof a.layerX>"u"&&(a.layerX=a.offsetX=a.clientX),typeof a.layerY>"u"&&(a.layerY=a.offsetY=a.clientY),a.isNormalized=!0,r.push(a)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){var o=e;typeof o.isPrimary>"u"&&(o.isPrimary=!0),typeof o.width>"u"&&(o.width=1),typeof o.height>"u"&&(o.height=1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="mouse"),typeof o.pointerId>"u"&&(o.pointerId=nn),typeof o.pressure>"u"&&(o.pressure=.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),o.isNormalized=!0,r.push(o)}else r.push(e);return r},t.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},t.extension={name:"interaction",type:[dt.RendererPlugin,dt.CanvasRendererPlugin]},t}(xe);var Tm=new ut,Em=4,Ol=function(){function i(t){this.renderer=t}return i.prototype.image=function(t,e,r){var n=new Image;return n.src=this.base64(t,e,r),n},i.prototype.base64=function(t,e,r){return this.canvas(t).toDataURL(e,r)},i.prototype.canvas=function(t,e){var r=this._rawPixels(t,e),n=r.pixels,s=r.width,a=r.height,o=r.flipY,h=new xs(s,a,1),u=h.context.getImageData(0,0,s,a);if(i.arrayPostDivide(n,u.data),h.context.putImageData(u,0,0),o){var l=new xs(h.width,h.height,1);l.context.scale(1,-1),l.context.drawImage(h.canvas,0,-a),h.destroy(),h=l}return h.canvas},i.prototype.pixels=function(t,e){var r=this._rawPixels(t,e).pixels;return i.arrayPostDivide(r,r),r},i.prototype._rawPixels=function(t,e){var r=this.renderer,n,s=!1,a,o=!1;if(t)if(t instanceof Me)a=t;else{var h=r.context.webGLVersion>=2?r.multisample:xt.NONE;if(a=this.renderer.generateTexture(t,{multisample:h}),h!==xt.NONE){var u=Me.create({width:a.width,height:a.height});r.framebuffer.bind(a.framebuffer),r.framebuffer.blit(u.framebuffer),r.framebuffer.bind(null),a.destroy(!0),a=u}o=!0}a?(n=a.baseTexture.resolution,e=e??a.frame,s=!1,r.renderTexture.bind(a)):(n=r.resolution,e||(e=Tm,e.width=r.width,e.height=r.height),s=!0,r.renderTexture.bind(null));var l=Math.round(e.width*n),c=Math.round(e.height*n),f=new Uint8Array(Em*l*c),d=r.gl;return d.readPixels(Math.round(e.x*n),Math.round(e.y*n),l,c,d.RGBA,d.UNSIGNED_BYTE,f),o&&a.destroy(!0),{pixels:f,width:l,height:c,flipY:s}},i.prototype.destroy=function(){this.renderer=null},i.arrayPostDivide=function(t,e){for(var r=0;r<t.length;r+=4){var n=e[r+3]=t[r+3];n!==0?(e[r]=Math.round(Math.min(t[r]*255/n,255)),e[r+1]=Math.round(Math.min(t[r+1]*255/n,255)),e[r+2]=Math.round(Math.min(t[r+2]*255/n,255))):(e[r]=t[r],e[r+1]=t[r+1],e[r+2]=t[r+2])}},i.extension={name:"extract",type:dt.RendererPlugin},i}();var an=function(){function i(t,e,r){e===void 0&&(e=!1),this._fn=t,this._once=e,this._thisArg=r,this._next=this._prev=this._owner=null}return i.prototype.detach=function(){return this._owner===null?!1:(this._owner.detach(this),!0)},i}();function Dl(i,t){return i._head?(i._tail._next=t,t._prev=i._tail,i._tail=t):(i._head=t,i._tail=t),t._owner=i,t}var Ee=function(){function i(){this._head=this._tail=void 0}return i.prototype.handlers=function(t){t===void 0&&(t=!1);var e=this._head;if(t)return!!e;for(var r=[];e;)r.push(e),e=e._next;return r},i.prototype.has=function(t){if(!(t instanceof an))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},i.prototype.dispatch=function(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];var n=this._head;if(!n)return!1;for(;n;)n._once&&this.detach(n),n._fn.apply(n._thisArg,e),n=n._next;return!0},i.prototype.add=function(t,e){if(e===void 0&&(e=null),typeof t!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return Dl(this,new an(t,!1,e))},i.prototype.once=function(t,e){if(e===void 0&&(e=null),typeof t!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return Dl(this,new an(t,!0,e))},i.prototype.detach=function(t){if(!(t instanceof an))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return t._owner!==this?this:(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,t._next===null&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null,this)},i.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},i}();function Fl(i,t){t=t||{};for(var e={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=e.parser[t.strictMode?"strict":"loose"].exec(i),n={},s=14;s--;)n[e.key[s]]=r[s]||"";return n[e.q.name]={},n[e.key[12]].replace(e.q.parser,function(a,o,h){o&&(n[e.q.name][o]=h)}),n}var Va,on=null,Sm=0,Ll=200,Pm=204,wm=1223,Cm=2;function Bl(){}function Nl(i,t,e){t&&t.indexOf(".")===0&&(t=t.substring(1)),t&&(i[t]=e)}function ja(i){return i.toString().replace("object ","")}var wt=function(){function i(t,e,r){if(this._dequeue=Bl,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,typeof t!="string"||typeof e!="string")throw new Error("Both name and url are required for constructing a resource.");r=r||{},this._flags=0,this._setFlag(i.STATUS_FLAGS.DATA_URL,e.indexOf("data:")===0),this.name=t,this.url=e,this.extension=this._getExtension(),this.data=null,this.crossOrigin=r.crossOrigin===!0?"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=i.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=Bl,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 Ee,this.onProgress=new Ee,this.onComplete=new Ee,this.onAfterMiddleware=new Ee}return i.setExtensionLoadType=function(t,e){Nl(i._loadTypeMap,t,e)},i.setExtensionXhrType=function(t,e){Nl(i._xhrTypeMap,t,e)},Object.defineProperty(i.prototype,"isDataUrl",{get:function(){return this._hasFlag(i.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isComplete",{get:function(){return this._hasFlag(i.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isLoading",{get:function(){return this._hasFlag(i.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),i.prototype.complete=function(){this._clearEvents(),this._finish()},i.prototype.abort=function(t){if(!this.error){if(this.error=new Error(t),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=i.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},i.prototype.load=function(t){var e=this;if(!this.isLoading){if(this.isComplete){t&&setTimeout(function(){return t(e)},1);return}else t&&this.onComplete.once(t);switch(this._setFlag(i.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),(this.crossOrigin===!1||typeof this.crossOrigin!="string")&&(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case i.LOAD_TYPE.IMAGE:this.type=i.TYPE.IMAGE,this._loadElement("image");break;case i.LOAD_TYPE.AUDIO:this.type=i.TYPE.AUDIO,this._loadSourceElement("audio");break;case i.LOAD_TYPE.VIDEO:this.type=i.TYPE.VIDEO,this._loadSourceElement("video");break;case i.LOAD_TYPE.XHR:default:typeof Va>"u"&&(Va=!!(globalThis.XDomainRequest&&!("withCredentials"in new XMLHttpRequest))),Va&&this.crossOrigin?this._loadXdr():this._loadXhr();break}}},i.prototype._hasFlag=function(t){return(this._flags&t)!==0},i.prototype._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},i.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))},i.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(i.STATUS_FLAGS.COMPLETE,!0),this._setFlag(i.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},i.prototype._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:t==="image"&&typeof globalThis.Image<"u"?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))},i.prototype._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:t==="audio"&&typeof globalThis.Audio<"u"?this.data=new Audio:this.data=document.createElement(t),this.data===null){this.abort("Unsupported element: "+t);return}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,r=0;r<this.url.length;++r)this.data.appendChild(this._createSource(t,this.url[r],Array.isArray(e)?e[r]:e));else{var 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))},i.prototype._loadXhr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var t=this.xhr=new XMLHttpRequest;this.crossOrigin==="use-credentials"&&(t.withCredentials=!0),t.open("GET",this.url,!0),t.timeout=this.timeout,this.xhrType===i.XHR_RESPONSE_TYPE.JSON||this.xhrType===i.XHR_RESPONSE_TYPE.DOCUMENT?t.responseType=i.XHR_RESPONSE_TYPE.TEXT:t.responseType=this.xhrType,t.addEventListener("error",this._boundXhrOnError,!1),t.addEventListener("timeout",this._boundXhrOnTimeout,!1),t.addEventListener("abort",this._boundXhrOnAbort,!1),t.addEventListener("progress",this._boundOnProgress,!1),t.addEventListener("load",this._boundXhrOnLoad,!1),t.send()},i.prototype._loadXdr=function(){typeof this.xhrType!="string"&&(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)},i.prototype._createSource=function(t,e,r){r||(r=t+"/"+this._getExtension(e));var n=document.createElement("source");return n.src=e,n.type=r,n},i.prototype._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},i.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},i.prototype._onTimeout=function(){this.abort("Load timed out.")},i.prototype._xhrOnError=function(){var t=this.xhr;this.abort(ja(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},i.prototype._xhrOnTimeout=function(){var t=this.xhr;this.abort(ja(t)+" Request timed out.")},i.prototype._xhrOnAbort=function(){var t=this.xhr;this.abort(ja(t)+" Request was aborted by the user.")},i.prototype._xhrOnLoad=function(){var t=this.xhr,e="",r=typeof t.status>"u"?Ll:t.status;(t.responseType===""||t.responseType==="text"||typeof t.responseType>"u")&&(e=t.responseText),r===Sm&&(e.length>0||t.responseType===i.XHR_RESPONSE_TYPE.BUFFER)?r=Ll:r===wm&&(r=Pm);var n=r/100|0;if(n===Cm)if(this.xhrType===i.XHR_RESPONSE_TYPE.TEXT)this.data=e,this.type=i.TYPE.TEXT;else if(this.xhrType===i.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(e),this.type=i.TYPE.JSON}catch(o){this.abort("Error trying to parse loaded json: "+o);return}else if(this.xhrType===i.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var s=new DOMParser;this.data=s.parseFromString(e,"text/xml")}else{var a=document.createElement("div");a.innerHTML=e,this.data=a}this.type=i.TYPE.XML}catch(o){this.abort("Error trying to parse loaded xml: "+o);return}else this.data=t.response||e;else{this.abort("["+t.status+"] "+t.statusText+": "+t.responseURL);return}this.complete()},i.prototype._determineCrossOrigin=function(t,e){if(t.indexOf("data:")===0)return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,on||(on=document.createElement("a")),on.href=t;var r=Fl(on.href,{strictMode:!0}),n=!r.port&&e.port===""||r.port===e.port,s=r.protocol?r.protocol+":":"";return r.host!==e.hostname||!n||s!==e.protocol?"anonymous":""},i.prototype._determineXhrType=function(){return i._xhrTypeMap[this.extension]||i.XHR_RESPONSE_TYPE.TEXT},i.prototype._determineLoadType=function(){return i._loadTypeMap[this.extension]||i.LOAD_TYPE.XHR},i.prototype._getExtension=function(t){t===void 0&&(t=this.url);var e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var n=t.indexOf("?"),s=t.indexOf("#"),a=Math.min(n>-1?n:t.length,s>-1?s:t.length);t=t.substring(0,a),e=t.substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},i.prototype._getMimeFromXhrType=function(t){switch(t){case i.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case i.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case i.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case i.XHR_RESPONSE_TYPE.JSON:return"application/json";case i.XHR_RESPONSE_TYPE.DEFAULT:case i.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},i}();(function(i){(function(t){t[t.NONE=0]="NONE",t[t.DATA_URL=1]="DATA_URL",t[t.COMPLETE=2]="COMPLETE",t[t.LOADING=4]="LOADING"})(i.STATUS_FLAGS||(i.STATUS_FLAGS={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.JSON=1]="JSON",t[t.XML=2]="XML",t[t.IMAGE=3]="IMAGE",t[t.AUDIO=4]="AUDIO",t[t.VIDEO=5]="VIDEO",t[t.TEXT=6]="TEXT"}(i.TYPE||(i.TYPE={})),function(t){t[t.XHR=1]="XHR",t[t.IMAGE=2]="IMAGE",t[t.AUDIO=3]="AUDIO",t[t.VIDEO=4]="VIDEO"}(i.LOAD_TYPE||(i.LOAD_TYPE={})),function(t){t.DEFAULT="text",t.BUFFER="arraybuffer",t.BLOB="blob",t.DOCUMENT="document",t.JSON="json",t.TEXT="text"}(i.XHR_RESPONSE_TYPE||(i.XHR_RESPONSE_TYPE={})),i._loadTypeMap={gif:i.LOAD_TYPE.IMAGE,png:i.LOAD_TYPE.IMAGE,bmp:i.LOAD_TYPE.IMAGE,jpg:i.LOAD_TYPE.IMAGE,jpeg:i.LOAD_TYPE.IMAGE,tif:i.LOAD_TYPE.IMAGE,tiff:i.LOAD_TYPE.IMAGE,webp:i.LOAD_TYPE.IMAGE,tga:i.LOAD_TYPE.IMAGE,avif:i.LOAD_TYPE.IMAGE,svg:i.LOAD_TYPE.IMAGE,"svg+xml":i.LOAD_TYPE.IMAGE,mp3:i.LOAD_TYPE.AUDIO,ogg:i.LOAD_TYPE.AUDIO,wav:i.LOAD_TYPE.AUDIO,mp4:i.LOAD_TYPE.VIDEO,webm:i.LOAD_TYPE.VIDEO},i._xhrTypeMap={xhtml:i.XHR_RESPONSE_TYPE.DOCUMENT,html:i.XHR_RESPONSE_TYPE.DOCUMENT,htm:i.XHR_RESPONSE_TYPE.DOCUMENT,xml:i.XHR_RESPONSE_TYPE.DOCUMENT,tmx:i.XHR_RESPONSE_TYPE.DOCUMENT,svg:i.XHR_RESPONSE_TYPE.DOCUMENT,tsx:i.XHR_RESPONSE_TYPE.DOCUMENT,gif:i.XHR_RESPONSE_TYPE.BLOB,png:i.XHR_RESPONSE_TYPE.BLOB,bmp:i.XHR_RESPONSE_TYPE.BLOB,jpg:i.XHR_RESPONSE_TYPE.BLOB,jpeg:i.XHR_RESPONSE_TYPE.BLOB,tif:i.XHR_RESPONSE_TYPE.BLOB,tiff:i.XHR_RESPONSE_TYPE.BLOB,webp:i.XHR_RESPONSE_TYPE.BLOB,tga:i.XHR_RESPONSE_TYPE.BLOB,avif:i.XHR_RESPONSE_TYPE.BLOB,json:i.XHR_RESPONSE_TYPE.JSON,text:i.XHR_RESPONSE_TYPE.TEXT,txt:i.XHR_RESPONSE_TYPE.TEXT,ttf:i.XHR_RESPONSE_TYPE.BUFFER,otf:i.XHR_RESPONSE_TYPE.BUFFER},i.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})(wt||(wt={}));function or(){}function Im(i){return function(){for(var e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];if(i===null)throw new Error("Callback was already called.");var s=i;i=null,s.apply(this,r)}}var Am=function(){function i(t,e){this.data=t,this.callback=e}return i}(),za=function(){function i(t,e){var r=this;if(e===void 0&&(e=1),this.workers=0,this.saturated=or,this.unsaturated=or,this.empty=or,this.drain=or,this.error=or,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(n,s,a){if(a&&typeof a!="function")throw new Error("task callback must be a function");if(r.started=!0,n==null&&r.idle()){setTimeout(function(){return r.drain()},1);return}var o=new Am(n,typeof a=="function"?a:or);s?r._tasks.unshift(o):r._tasks.push(o),setTimeout(r.process,1)},this.process=function(){for(;!r.paused&&r.workers<r.concurrency&&r._tasks.length;){var n=r._tasks.shift();r._tasks.length===0&&r.empty(),r.workers+=1,r.workers===r.concurrency&&r.saturated(),r._worker(n.data,Im(r._next(n)))}},this._worker=t,e===0)throw new Error("Concurrency must not be zero");this.concurrency=e,this.buffer=e/4}return i.prototype._next=function(t){var e=this;return function(){for(var r=arguments,n=[],s=0;s<arguments.length;s++)n[s]=r[s];e.workers-=1,t.callback.apply(t,n),n[0]!=null&&e.error(n[0],t.data),e.workers<=e.concurrency-e.buffer&&e.unsaturated(),e.idle()&&e.drain(),e.process()}},i.prototype.push=function(t,e){this._insert(t,!1,e)},i.prototype.kill=function(){this.workers=0,this.drain=or,this.started=!1,this._tasks=[]},i.prototype.unshift=function(t,e){this._insert(t,!0,e)},i.prototype.length=function(){return this._tasks.length},i.prototype.running=function(){return this.workers},i.prototype.idle=function(){return this._tasks.length+this.workers===0},i.prototype.pause=function(){this.paused!==!0&&(this.paused=!0)},i.prototype.resume=function(){if(this.paused!==!1){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},i.eachSeries=function(t,e,r,n){var s=0,a=t.length;function o(h){if(h||s===a){r&&r(h);return}n?setTimeout(function(){e(t[s++],o)},1):e(t[s++],o)}o()},i.queue=function(t,e){return new i(t,e)},i}(),Wa=100,Mm=/(#[\w-]+)?$/,ui=function(){function i(t,e){var r=this;t===void 0&&(t=""),e===void 0&&(e=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return r._loadResource(h,u)},this.resources={},this.baseUrl=t,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return r._loadResource(h,u)},this._queue=za.queue(this._boundLoadResource,e),this._queue.pause(),this.resources={},this.onProgress=new Ee,this.onError=new Ee,this.onLoad=new Ee,this.onStart=new Ee,this.onComplete=new Ee;for(var n=0;n<i._plugins.length;++n){var s=i._plugins[n],a=s.pre,o=s.use;a&&this.pre(a),o&&this.use(o)}this._protected=!1}return i.prototype._add=function(t,e,r,n){if(this.loading&&(!r||!r.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 wt(t,e,r),typeof n=="function"&&this.resources[t].onAfterMiddleware.once(n),this.loading){for(var s=r.parentResource,a=[],o=0;o<s.children.length;++o)s.children[o].isComplete||a.push(s.children[o]);var h=s.progressChunk*(a.length+1),u=h/(a.length+2);s.children.push(this.resources[t]),s.progressChunk=u;for(var o=0;o<a.length;++o)a[o].progressChunk=u;this.resources[t].progressChunk=u}return this._queue.push(this.resources[t]),this},i.prototype.pre=function(t){return this._beforeMiddleware.push(t),this},i.prototype.use=function(t){return this._afterMiddleware.push(t),this},i.prototype.reset=function(){this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause();for(var t in this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort("loader reset")}return this.resources={},this},i.prototype.load=function(t){if(Bt("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),typeof t=="function"&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=this._queue._tasks.length,r=Wa/e,n=0;n<this._queue._tasks.length;++n)this._queue._tasks[n].data.progressChunk=r;this._onStart(),this._queue.resume()}return this},Object.defineProperty(i.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!1,configurable:!0}),i.prototype._prepareUrl=function(t){var e=Fl(t,{strictMode:!0}),r;if(e.protocol||!e.path||t.indexOf("//")===0?r=t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&t.charAt(0)!=="/"?r=this.baseUrl+"/"+t:r=this.baseUrl+t,this.defaultQueryString){var n=Mm.exec(r)[0];r=r.slice(0,r.length-n.length),r.indexOf("?")!==-1?r+="&"+this.defaultQueryString:r+="?"+this.defaultQueryString,r+=n}return r},i.prototype._loadResource=function(t,e){var r=this;t._dequeue=e,za.eachSeries(this._beforeMiddleware,function(n,s){n.call(r,t,function(){s(t.isComplete?{}:null)})},function(){t.isComplete?r._onLoad(t):(t._onLoadBinding=t.onComplete.once(r._onLoad,r),t.load())},!0)},i.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},i.prototype._onComplete=function(){this.progress=Wa,this.loading=!1,this.onComplete.dispatch(this,this.resources)},i.prototype._onLoad=function(t){var e=this;t._onLoadBinding=null,this._resourcesParsing.push(t),t._dequeue(),za.eachSeries(this._afterMiddleware,function(r,n){r.call(e,t,n)},function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(Wa,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()&&e._resourcesParsing.length===0&&e._onComplete()},!0)},i.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(i,"shared",{get:function(){var t=i._shared;return t||(t=new i,t._protected=!0,i._shared=t),t},enumerable:!1,configurable:!0}),i.registerPlugin=function(t){return Bt("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),Kt.add({type:dt.Loader,ref:t}),i},i._plugins=[],i}();Kt.handleByList(dt.Loader,ui._plugins),ui.prototype.add=function(t,e,r,n){if(Array.isArray(t)){for(var s=0;s<t.length;++s)this.add(t[s]);return this}if(typeof t=="object"&&(r=t,n=e||r.callback||r.onComplete,e=r.url,t=r.name||r.key||r.url),typeof e!="string"&&(n=r,r=e,e=t),typeof e!="string")throw new Error("No url passed to add resource to loader.");return typeof r=="function"&&(n=r,r=null),this._add(t,e,r,n)};var Ul=function(){function i(){}return i.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?ui.shared:new ui},i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.extension=dt.Application,i}(),kl=function(){function i(){}return i.add=function(){wt.setExtensionLoadType("svg",wt.LOAD_TYPE.XHR),wt.setExtensionXhrType("svg",wt.XHR_RESPONSE_TYPE.TEXT)},i.use=function(t,e){if(t.data&&(t.type===wt.TYPE.IMAGE||t.extension==="svg")){var r=t.data,n=t.url,s=t.name,a=t.metadata;it.fromLoader(r,n,s,a).then(function(o){t.texture=o,e()}).catch(e)}else e()},i.extension=dt.Loader,i}(),Rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Om(i){for(var t="",e=0;e<i.length;){for(var r=[0,0,0],n=[0,0,0,0],s=0;s<r.length;++s)e<i.length?r[s]=i.charCodeAt(e++)&255:r[s]=0;n[0]=r[0]>>2,n[1]=(r[0]&3)<<4|r[1]>>4,n[2]=(r[1]&15)<<2|r[2]>>6,n[3]=r[2]&63;var a=e-(i.length-1);switch(a){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64;break}for(var s=0;s<n.length;++s)t+=Rm.charAt(n[s])}return t}function Dm(i,t){if(!i.data){t();return}if(i.xhr&&i.xhrType===wt.XHR_RESPONSE_TYPE.BLOB){if(!self.Blob||typeof i.data=="string"){var e=i.xhr.getResponseHeader("content-type");if(e&&e.indexOf("image")===0){i.data=new Image,i.data.src="data:"+e+";base64,"+Om(i.xhr.responseText),i.type=wt.TYPE.IMAGE,i.data.onload=function(){i.data.onload=null,t()};return}}else if(i.data.type.indexOf("image")===0){var r=globalThis.URL||globalThis.webkitURL,n=r.createObjectURL(i.data);i.blob=i.data,i.data=new Image,i.data.src=n,i.type=wt.TYPE.IMAGE,i.data.onload=function(){r.revokeObjectURL(n),i.data.onload=null,t()};return}}t()}var Fm=function(){function i(){}return i.extension=dt.Loader,i.use=Dm,i}();Kt.add(kl,Fm);var pt,at;(function(i){i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR"})(at||(at={}));var li=(pt={},pt[at.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,pt[at.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,pt[at.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,pt[at.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,pt[at.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,pt[at.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,pt[at.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,pt[at.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,pt[at.COMPRESSED_R11_EAC]=.5,pt[at.COMPRESSED_SIGNED_R11_EAC]=.5,pt[at.COMPRESSED_RG11_EAC]=1,pt[at.COMPRESSED_SIGNED_RG11_EAC]=1,pt[at.COMPRESSED_RGB8_ETC2]=.5,pt[at.COMPRESSED_RGBA8_ETC2_EAC]=1,pt[at.COMPRESSED_SRGB8_ETC2]=.5,pt[at.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,pt[at.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,pt[at.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,pt[at.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,pt[at.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,pt[at.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,pt[at.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,pt[at.COMPRESSED_RGB_ETC1_WEBGL]=.5,pt[at.COMPRESSED_RGB_ATC_WEBGL]=.5,pt[at.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,pt[at.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,pt[at.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,pt);var Ya=function(i,t){return Ya=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Ya(i,t)};function Gl(i,t){Ya(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Lm(i,t,e,r){function n(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function o(l){try{u(r.next(l))}catch(c){a(c)}}function h(l){try{u(r.throw(l))}catch(c){a(c)}}function u(l){l.done?s(l.value):n(l.value).then(o,h)}u((r=r.apply(i,[])).next())})}function Bm(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(l){return h([u,l])}}function h(u){if(r)throw new TypeError("Generator is already executing.");for(;e;)try{if(r=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return e.label++,{value:u[1],done:!1};case 5:e.label++,n=u[1],u=[0];continue;case 7:u=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){e.label=u[1];break}if(u[0]===6&&e.label<s[1]){e.label=s[1],s=u;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(u);break}s[2]&&e.ops.pop(),e.trys.pop();continue}u=t.call(i,e)}catch(l){u=[6,l],n=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var Xl=function(i){Gl(t,i);function t(e,r){r===void 0&&(r={width:1,height:1,autoLoad:!0});var n=this,s,a;return typeof e=="string"?(s=e,a=new Uint8Array):(s=null,a=e),n=i.call(this,a,r)||this,n.origin=s,n.buffer=a?new zi(a):null,n.origin&&r.autoLoad!==!1&&n.load(),a&&a.length&&(n.loaded=!0,n.onBlobLoaded(n.buffer.rawBinaryData)),n}return t.prototype.onBlobLoaded=function(e){},t.prototype.load=function(){return Lm(this,void 0,Promise,function(){var e,r,n;return Bm(this,function(s){switch(s.label){case 0:return[4,fetch(this.origin)];case 1:return e=s.sent(),[4,e.blob()];case 2:return r=s.sent(),[4,r.arrayBuffer()];case 3:return n=s.sent(),this.data=new Uint32Array(n),this.buffer=new zi(n),this.loaded=!0,this.onBlobLoaded(n),this.update(),[2,this]}})})},t}(Ke),hn=function(i){Gl(t,i);function t(e,r){var n=i.call(this,e,r)||this;return n.format=r.format,n.levels=r.levels||1,n._width=r.width,n._height=r.height,n._extension=t._formatToExtension(n.format),(r.levelBuffers||n.buffer)&&(n._levelBuffers=r.levelBuffers||t._createLevelBuffers(e instanceof Uint8Array?e:n.buffer.uint8View,n.format,n.levels,4,4,n.width,n.height)),n}return t.prototype.upload=function(e,r,n){var s=e.gl,a=e.context.extensions[this._extension];if(!a)throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var o=0,h=this.levels;o<h;o++){var u=this._levelBuffers[o],l=u.levelID,c=u.levelWidth,f=u.levelHeight,d=u.levelBuffer;s.compressedTexImage2D(s.TEXTURE_2D,l,this.format,c,f,0,d)}return!0},t.prototype.onBlobLoaded=function(){this._levelBuffers=t._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},t._formatToExtension=function(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e>=36196)return"etc1";if(e>=35986&&e<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},t._createLevelBuffers=function(e,r,n,s,a,o,h){for(var u=new Array(n),l=e.byteOffset,c=o,f=h,d=c+s-1&~(s-1),v=f+a-1&~(a-1),_=d*v*li[r],p=0;p<n;p++)u[p]={levelID:p,levelWidth:n>1?c:d,levelHeight:n>1?f:v,levelBuffer:new Uint8Array(e.buffer,l,_)},l+=_,c=c>>1||1,f=f>>1||1,d=c+s-1&~(s-1),v=f+a-1&~(a-1),_=d*v*li[r];return u},t}(Xl),Hl=function(){function i(){}return i.use=function(t,e){var r=t.data,n=this;if(t.type===wt.TYPE.JSON&&r&&r.cacheID&&r.textures){for(var s=r.textures,a=void 0,o=void 0,h=0,u=s.length;h<u;h++){var l=s[h],c=l.src,f=l.format;if(f||(o=c),i.textureFormats[f]){a=c;break}}if(a=a||o,!a){e(new Error("Cannot load compressed-textures in "+t.url+", make sure you provide a fallback"));return}if(a===t.url){e(new Error("URL of compressed texture cannot be the same as the manifest's URL"));return}var d={crossOrigin:t.crossOrigin,metadata:t.metadata.imageMetadata,parentResource:t},v=ce.resolve(t.url.replace(n.baseUrl,""),a),_=r.cacheID;n.add(_,v,d,function(p){if(p.error){e(p.error);return}var g=p.texture,y=g===void 0?null:g,T=p.textures,I=T===void 0?{}:T;Object.assign(t,{texture:y,textures:I}),e()})}else e()},Object.defineProperty(i,"textureExtensions",{get:function(){if(!i._textureExtensions){var t=z.ADAPTER.createCanvas(),e=t.getContext("webgl");if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var r={s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};i._textureExtensions=r}return i._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(i,"textureFormats",{get:function(){if(!i._textureFormats){var t=i.textureExtensions;i._textureFormats={};for(var e in t){var r=t[e];r&&Object.assign(i._textureFormats,Object.getPrototypeOf(r))}}return i._textureFormats},enumerable:!1,configurable:!0}),i.extension=dt.Loader,i}();function Vl(i,t,e){var r={textures:{},texture:null};if(!t)return r;var n=t.map(function(s){return new it(new lt(s,Object.assign({mipmap:zt.OFF,alphaMode:Wt.NO_PREMULTIPLIED_ALPHA},e)))});return n.forEach(function(s,a){var o=s.baseTexture,h=i+"-"+(a+1);lt.addToCache(o,h),it.addToCache(s,h),a===0&&(lt.addToCache(o,i),it.addToCache(s,i),r.texture=s),r.textures[h]=s}),r}var fi,oe,qa=4,un=124,Nm=32,jl=20,Um=542327876,ln={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},km={FOURCC:2},fn={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},he;(function(i){i[i.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",i[i.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",i[i.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",i[i.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",i[i.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",i[i.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",i[i.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",i[i.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",i[i.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",i[i.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",i[i.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",i[i.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",i[i.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",i[i.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",i[i.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",i[i.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",i[i.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",i[i.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",i[i.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",i[i.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",i[i.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",i[i.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",i[i.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",i[i.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",i[i.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",i[i.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",i[i.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",i[i.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",i[i.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",i[i.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",i[i.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",i[i.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",i[i.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",i[i.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",i[i.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",i[i.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",i[i.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",i[i.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",i[i.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",i[i.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",i[i.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",i[i.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",i[i.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",i[i.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",i[i.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",i[i.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",i[i.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",i[i.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",i[i.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",i[i.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",i[i.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",i[i.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",i[i.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",i[i.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",i[i.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",i[i.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",i[i.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",i[i.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",i[i.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",i[i.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",i[i.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",i[i.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",i[i.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",i[i.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",i[i.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",i[i.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",i[i.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",i[i.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",i[i.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",i[i.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",i[i.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",i[i.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",i[i.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",i[i.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",i[i.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",i[i.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",i[i.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",i[i.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",i[i.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",i[i.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",i[i.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",i[i.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",i[i.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",i[i.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",i[i.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",i[i.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",i[i.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",i[i.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",i[i.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",i[i.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",i[i.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",i[i.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",i[i.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",i[i.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",i[i.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",i[i.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",i[i.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",i[i.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",i[i.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",i[i.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",i[i.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",i[i.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",i[i.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",i[i.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",i[i.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",i[i.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",i[i.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",i[i.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",i[i.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",i[i.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",i[i.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",i[i.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",i[i.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",i[i.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",i[i.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",i[i.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",i[i.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",i[i.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",i[i.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",i[i.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",i[i.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",i[i.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"})(he||(he={}));var $a;(function(i){i[i.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",i[i.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",i[i.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"})($a||($a={}));var Gm=1,Xm=2,Hm=4,Vm=64,jm=512,zm=131072,Wm=827611204,Ym=861165636,qm=894720068,$m=808540228,Km=4,Zm=(fi={},fi[Wm]=at.COMPRESSED_RGBA_S3TC_DXT1_EXT,fi[Ym]=at.COMPRESSED_RGBA_S3TC_DXT3_EXT,fi[qm]=at.COMPRESSED_RGBA_S3TC_DXT5_EXT,fi),Jm=(oe={},oe[he.DXGI_FORMAT_BC1_TYPELESS]=at.COMPRESSED_RGBA_S3TC_DXT1_EXT,oe[he.DXGI_FORMAT_BC1_UNORM]=at.COMPRESSED_RGBA_S3TC_DXT1_EXT,oe[he.DXGI_FORMAT_BC2_TYPELESS]=at.COMPRESSED_RGBA_S3TC_DXT3_EXT,oe[he.DXGI_FORMAT_BC2_UNORM]=at.COMPRESSED_RGBA_S3TC_DXT3_EXT,oe[he.DXGI_FORMAT_BC3_TYPELESS]=at.COMPRESSED_RGBA_S3TC_DXT5_EXT,oe[he.DXGI_FORMAT_BC3_UNORM]=at.COMPRESSED_RGBA_S3TC_DXT5_EXT,oe[he.DXGI_FORMAT_BC1_UNORM_SRGB]=at.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,oe[he.DXGI_FORMAT_BC2_UNORM_SRGB]=at.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,oe[he.DXGI_FORMAT_BC3_UNORM_SRGB]=at.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,oe);function zl(i){var t=new Uint32Array(i),e=t[0];if(e!==Um)throw new Error("Invalid DDS file magic word");var r=new Uint32Array(i,0,un/Uint32Array.BYTES_PER_ELEMENT),n=r[ln.HEIGHT],s=r[ln.WIDTH],a=r[ln.MIPMAP_COUNT],o=new Uint32Array(i,ln.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Nm/Uint32Array.BYTES_PER_ELEMENT),h=o[Gm];if(h&Hm){var u=o[km.FOURCC];if(u!==$m){var l=Zm[u],c=qa+un,f=new Uint8Array(i,c),d=new hn(f,{format:l,width:s,height:n,levels:a});return[d]}var v=qa+un,_=new Uint32Array(t.buffer,v,jl/Uint32Array.BYTES_PER_ELEMENT),p=_[fn.DXGI_FORMAT],g=_[fn.RESOURCE_DIMENSION],y=_[fn.MISC_FLAG],T=_[fn.ARRAY_SIZE],I=Jm[p];if(I===void 0)throw new Error("DDSParser cannot parse texture data with DXGI format "+p);if(y===Km)throw new Error("DDSParser does not support cubemap textures");if(g===$a.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var m=new Array,S=qa+un+jl;if(T===1)m.push(new Uint8Array(i,S));else{for(var x=li[I],N=0,D=s,F=n,k=0;k<a;k++){var L=Math.max(1,D+3&-4),q=Math.max(1,F+3&-4),Z=L*q*x;N+=Z,D=D>>>1,F=F>>>1}for(var G=S,k=0;k<T;k++)m.push(new Uint8Array(i,G,N)),G+=N}return m.map(function(b){return new hn(b,{format:I,width:s,height:n,levels:a})})}throw h&Vm?new Error("DDSParser does not support uncompressed texture data."):h&jm?new Error("DDSParser does not supported YUV uncompressed texture data."):h&zm?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&Xm?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}var Ne,Se,ci,Wl=[171,75,84,88,32,49,49,187,13,10,26,10],Qm=67305985,ue={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Ka=64,Za=(Ne={},Ne[Q.UNSIGNED_BYTE]=1,Ne[Q.UNSIGNED_SHORT]=2,Ne[Q.INT]=4,Ne[Q.UNSIGNED_INT]=4,Ne[Q.FLOAT]=4,Ne[Q.HALF_FLOAT]=8,Ne),Yl=(Se={},Se[H.RGBA]=4,Se[H.RGB]=3,Se[H.RG]=2,Se[H.RED]=1,Se[H.LUMINANCE]=1,Se[H.LUMINANCE_ALPHA]=2,Se[H.ALPHA]=1,Se),ql=(ci={},ci[Q.UNSIGNED_SHORT_4_4_4_4]=2,ci[Q.UNSIGNED_SHORT_5_5_5_1]=2,ci[Q.UNSIGNED_SHORT_5_6_5]=2,ci);function $l(i,t,e){e===void 0&&(e=!1);var r=new DataView(t);if(!ty(i,r))return null;var n=r.getUint32(ue.ENDIANNESS,!0)===Qm,s=r.getUint32(ue.GL_TYPE,n),a=r.getUint32(ue.GL_FORMAT,n),o=r.getUint32(ue.GL_INTERNAL_FORMAT,n),h=r.getUint32(ue.PIXEL_WIDTH,n),u=r.getUint32(ue.PIXEL_HEIGHT,n)||1,l=r.getUint32(ue.PIXEL_DEPTH,n)||1,c=r.getUint32(ue.NUMBER_OF_ARRAY_ELEMENTS,n)||1,f=r.getUint32(ue.NUMBER_OF_FACES,n),d=r.getUint32(ue.NUMBER_OF_MIPMAP_LEVELS,n),v=r.getUint32(ue.BYTES_OF_KEY_VALUE_DATA,n);if(u===0||l!==1)throw new Error("Only 2D textures are supported");if(f!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");var _=4,p=4,g=h+3&-4,y=u+3&-4,T=new Array(c),I=h*u;s===0&&(I=g*y);var m;if(s!==0?Za[s]?m=Za[s]*Yl[a]:m=ql[s]:m=li[o],m===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var S=e?ry(r,v,n):null,x=I*m,N=x,D=h,F=u,k=g,L=y,q=Ka+v,Z=0;Z<d;Z++){for(var G=r.getUint32(q,n),b=q+4,P=0;P<c;P++){var E=T[P];E||(E=T[P]=new Array(d)),E[Z]={levelID:Z,levelWidth:d>1||s!==0?D:k,levelHeight:d>1||s!==0?F:L,levelBuffer:new Uint8Array(t,b,N)},b+=N}q+=G+4,q=q%4!==0?q+4-q%4:q,D=D>>1||1,F=F>>1||1,k=D+_-1&-4,L=F+p-1&-4,N=k*L*m}return s!==0?{uncompressed:T.map(function(A){var C=A[0].levelBuffer,w=!1;return s===Q.FLOAT?C=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):s===Q.UNSIGNED_INT?(w=!0,C=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):s===Q.INT&&(w=!0,C=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Ke(C,{width:A[0].levelWidth,height:A[0].levelHeight}),type:s,format:w?ey(a):a}}),kvData:S}:{compressed:T.map(function(A){return new hn(null,{format:o,width:h,height:u,levels:d,levelBuffers:A})}),kvData:S}}function ty(i,t){for(var e=0;e<Wl.length;e++)if(t.getUint8(e)!==Wl[e])return console.error(i+" is not a valid *.ktx file!"),!1;return!0}function ey(i){switch(i){case H.RGBA:return H.RGBA_INTEGER;case H.RGB:return H.RGB_INTEGER;case H.RG:return H.RG_INTEGER;case H.RED:return H.RED_INTEGER;default:return i}}function ry(i,t,e){for(var r=new Map,n=0;n<t;){var s=i.getUint32(Ka+n,e),a=Ka+n+4,o=3-(s+3)%4;if(s===0||s>t-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var h=0;h<s&&i.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var u=new TextDecoder().decode(new Uint8Array(i.buffer,a,h)),l=new DataView(i.buffer,a+h+1,s-h-1);r.set(u,l),n+=4+s+o}return r}wt.setExtensionXhrType("dds",wt.XHR_RESPONSE_TYPE.BUFFER);var Kl=function(){function i(){}return i.use=function(t,e){if(t.extension==="dds"&&t.data)try{Object.assign(t,Vl(t.name||t.url,zl(t.data),t.metadata))}catch(r){e(r);return}e()},i.extension=dt.Loader,i}();wt.setExtensionXhrType("ktx",wt.XHR_RESPONSE_TYPE.BUFFER);var Zl=function(){function i(){}return i.use=function(t,e){if(t.extension==="ktx"&&t.data)try{var r=t.name||t.url,n=$l(r,t.data,this.loadKeyValueData),s=n.compressed,a=n.uncompressed,o=n.kvData;if(s){var h=Vl(r,s,t.metadata);if(o&&h.textures)for(var u in h.textures)h.textures[u].baseTexture.ktxKeyValueData=o;Object.assign(t,h)}else if(a){var l={};a.forEach(function(c,f){var d=new it(new lt(c.resource,{mipmap:zt.OFF,alphaMode:Wt.NO_PREMULTIPLIED_ALPHA,type:c.type,format:c.format})),v=r+"-"+(f+1);o&&(d.baseTexture.ktxKeyValueData=o),lt.addToCache(d.baseTexture,v),it.addToCache(d,v),f===0&&(l[r]=d,lt.addToCache(d.baseTexture,r),it.addToCache(d,r)),l[v]=d}),Object.assign(t,{textures:l})}}catch(c){e(c);return}e()},i.extension=dt.Loader,i.loadKeyValueData=!1,i}();var Ja=function(i,t){return Ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Ja(i,t)};function Jl(i,t){Ja(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var iy=function(i){Jl(t,i);function t(e,r,n,s){e===void 0&&(e=1500),n===void 0&&(n=16384),s===void 0&&(s=!1);var a=i.call(this)||this,o=16384;return n>o&&(n=o),a._properties=[!1,!0,!1,!1,!1],a._maxSize=e,a._batchSize=n,a._buffers=null,a._bufferUpdateIDs=[],a._updateID=0,a.interactiveChildren=!1,a.blendMode=tt.NORMAL,a.autoResize=s,a.roundPixels=!0,a.baseTexture=null,a.setProperties(r),a._tint=0,a.tintRgb=new Float32Array(4),a.tint=16777215,a}return t.prototype.setProperties=function(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])},t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e,He(e,this.tintRgb)},enumerable:!1,configurable:!0}),t.prototype.render=function(e){var r=this;!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return r.onChildrenChange(0)})),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))},t.prototype.onChildrenChange=function(e){for(var r=Math.floor(e/this._batchSize);this._bufferUpdateIDs.length<r;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[r]=++this._updateID},t.prototype.dispose=function(){if(this._buffers){for(var e=0;e<this._buffers.length;++e)this._buffers[e].destroy();this._buffers=null}},t.prototype.destroy=function(e){i.prototype.destroy.call(this,e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},t}(Zt),Ql=function(){function i(t,e,r){this.geometry=new vr,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var n=0;n<t.length;++n){var s=t[n];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||Q.FLOAT,offset:s.offset},e[n]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return i.prototype.initBuffers=function(){var t=this.geometry,e=0;this.indexBuffer=new Mt(Hh(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var r=0;r<this.dynamicProperties.length;++r){var n=this.dynamicProperties[r];n.offset=e,e+=n.size,this.dynamicStride+=n.size}var s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Mt(this.dynamicData,!1,!1);var a=0;this.staticStride=0;for(var r=0;r<this.staticProperties.length;++r){var n=this.staticProperties[r];n.offset=a,a+=n.size,this.staticStride+=n.size}var o=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(o),this.staticDataUint32=new Uint32Array(o),this.staticBuffer=new Mt(this.staticData,!0,!1);for(var r=0;r<this.dynamicProperties.length;++r){var n=this.dynamicProperties[r];t.addAttribute(n.attributeName,this.dynamicBuffer,0,n.type===Q.UNSIGNED_BYTE,n.type,this.dynamicStride*4,n.offset*4)}for(var r=0;r<this.staticProperties.length;++r){var n=this.staticProperties[r];t.addAttribute(n.attributeName,this.staticBuffer,0,n.type===Q.UNSIGNED_BYTE,n.type,this.staticStride*4,n.offset*4)}},i.prototype.uploadDynamic=function(t,e,r){for(var n=0;n<this.dynamicProperties.length;n++){var s=this.dynamicProperties[n];s.uploadFunction(t,e,r,s.type===Q.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++},i.prototype.uploadStatic=function(t,e,r){for(var n=0;n<this.staticProperties.length;n++){var s=this.staticProperties[n];s.uploadFunction(t,e,r,s.type===Q.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++},i.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},i}(),ny=`varying vec2 vTextureCoord;
|
|
508
|
+
varying vec4 vColor;
|
|
509
|
+
|
|
510
|
+
uniform sampler2D uSampler;
|
|
511
|
+
|
|
512
|
+
void main(void){
|
|
513
|
+
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
514
|
+
gl_FragColor = color;
|
|
515
|
+
}`,sy=`attribute vec2 aVertexPosition;
|
|
516
|
+
attribute vec2 aTextureCoord;
|
|
517
|
+
attribute vec4 aColor;
|
|
518
|
+
|
|
519
|
+
attribute vec2 aPositionCoord;
|
|
520
|
+
attribute float aRotation;
|
|
521
|
+
|
|
522
|
+
uniform mat3 translationMatrix;
|
|
523
|
+
uniform vec4 uColor;
|
|
524
|
+
|
|
525
|
+
varying vec2 vTextureCoord;
|
|
526
|
+
varying vec4 vColor;
|
|
527
|
+
|
|
528
|
+
void main(void){
|
|
529
|
+
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
|
530
|
+
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
|
531
|
+
|
|
532
|
+
vec2 v = vec2(x, y);
|
|
533
|
+
v = v + aPositionCoord;
|
|
534
|
+
|
|
535
|
+
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
536
|
+
|
|
537
|
+
vTextureCoord = aTextureCoord;
|
|
538
|
+
vColor = aColor * uColor;
|
|
539
|
+
}
|
|
540
|
+
`,tf=function(i){Jl(t,i);function t(e){var r=i.call(this,e)||this;return r.shader=null,r.properties=null,r.tempMatrix=new bt,r.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:r.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:r.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:r.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:r.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:Q.UNSIGNED_BYTE,uploadFunction:r.uploadTint,offset:0}],r.shader=be.from(sy,ny,{}),r.state=Oe.for2d(),r}return t.prototype.render=function(e){var r=e.children,n=e._maxSize,s=e._batchSize,a=this.renderer,o=r.length;if(o!==0){o>n&&!e.autoResize&&(o=n);var h=e._buffers;h||(h=e._buffers=this.generateBuffers(e));var u=r[0]._texture.baseTexture,l=u.alphaMode>0;this.state.blendMode=vs(e.blendMode,l),a.state.set(this.state);var c=a.gl,f=e.worldTransform.copyTo(this.tempMatrix);f.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=f.toArray(!0),this.shader.uniforms.uColor=Xh(e.tintRgb,e.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var d=!1,v=0,_=0;v<o;v+=s,_+=1){var p=o-v;p>s&&(p=s),_>=h.length&&h.push(this._generateOneMoreBuffer(e));var g=h[_];g.uploadDynamic(r,v,p);var y=e._bufferUpdateIDs[_]||0;d=d||g._updateID<y,d&&(g._updateID=e._updateID,g.uploadStatic(r,v,p)),a.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,p*6,c.UNSIGNED_SHORT,0)}}},t.prototype.generateBuffers=function(e){for(var r=[],n=e._maxSize,s=e._batchSize,a=e._properties,o=0;o<n;o+=s)r.push(new Ql(this.properties,a,s));return r},t.prototype._generateOneMoreBuffer=function(e){var r=e._batchSize,n=e._properties;return new Ql(this.properties,n,r)},t.prototype.uploadVertices=function(e,r,n,s,a,o){for(var h=0,u=0,l=0,c=0,f=0;f<n;++f){var d=e[r+f],v=d._texture,_=d.scale.x,p=d.scale.y,g=v.trim,y=v.orig;g?(u=g.x-d.anchor.x*y.width,h=u+g.width,c=g.y-d.anchor.y*y.height,l=c+g.height):(h=y.width*(1-d.anchor.x),u=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[o]=u*_,s[o+1]=c*p,s[o+a]=h*_,s[o+a+1]=c*p,s[o+a*2]=h*_,s[o+a*2+1]=l*p,s[o+a*3]=u*_,s[o+a*3+1]=l*p,o+=a*4}},t.prototype.uploadPosition=function(e,r,n,s,a,o){for(var h=0;h<n;h++){var u=e[r+h].position;s[o]=u.x,s[o+1]=u.y,s[o+a]=u.x,s[o+a+1]=u.y,s[o+a*2]=u.x,s[o+a*2+1]=u.y,s[o+a*3]=u.x,s[o+a*3+1]=u.y,o+=a*4}},t.prototype.uploadRotation=function(e,r,n,s,a,o){for(var h=0;h<n;h++){var u=e[r+h].rotation;s[o]=u,s[o+a]=u,s[o+a*2]=u,s[o+a*3]=u,o+=a*4}},t.prototype.uploadUvs=function(e,r,n,s,a,o){for(var h=0;h<n;++h){var u=e[r+h]._texture._uvs;u?(s[o]=u.x0,s[o+1]=u.y0,s[o+a]=u.x1,s[o+a+1]=u.y1,s[o+a*2]=u.x2,s[o+a*2+1]=u.y2,s[o+a*3]=u.x3,s[o+a*3+1]=u.y3,o+=a*4):(s[o]=0,s[o+1]=0,s[o+a]=0,s[o+a+1]=0,s[o+a*2]=0,s[o+a*2+1]=0,s[o+a*3]=0,s[o+a*3+1]=0,o+=a*4)}},t.prototype.uploadTint=function(e,r,n,s,a,o){for(var h=0;h<n;++h){var u=e[r+h],l=u._texture.baseTexture.alphaMode>0,c=u.alpha,f=c<1&&l?Pi(u._tintRGB,c):u._tintRGB+(c*255<<24);s[o]=f,s[o+a]=f,s[o+a*2]=f,s[o+a*3]=f,o+=a*4}},t.prototype.destroy=function(){i.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},t.extension={name:"particle",type:dt.RendererPlugin},t}(zr);var me;(function(i){i.MITER="miter",i.BEVEL="bevel",i.ROUND="round"})(me||(me={}));var Pe;(function(i){i.BUTT="butt",i.ROUND="round",i.SQUARE="square"})(Pe||(Pe={}));var Er={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(i,t){if(t===void 0&&(t=20),!this.adaptive||!i||isNaN(i))return t;var e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},Qa=function(){function i(){this.color=16777215,this.alpha=1,this.texture=it.WHITE,this.matrix=null,this.visible=!1,this.reset()}return i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},i.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=it.WHITE,this.matrix=null,this.visible=!1},i.prototype.destroy=function(){this.texture=null,this.matrix=null},i}();var to=function(i,t){return to=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},to(i,t)};function eo(i,t){to(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ef(i,t){var e,r;t===void 0&&(t=!1);var n=i.length;if(!(n<6)){for(var s=0,a=0,o=i[n-2],h=i[n-1];a<n;a+=2){var u=i[a],l=i[a+1];s+=(u-o)*(l+h),o=u,h=l}if(!t&&s>0||t&&s<=0)for(var c=n/2,a=c+c%2;a<n;a+=2){var f=n-a-2,d=n-a-1,v=a,_=a+1;e=[i[v],i[f]],i[f]=e[0],i[v]=e[1],r=[i[_],i[d]],i[d]=r[0],i[_]=r[1]}}}var ro={build:function(i){i.points=i.shape.points.slice()},triangulate:function(i,t){var e=i.points,r=i.holes,n=t.points,s=t.indices;if(e.length>=6){ef(e,!1);for(var a=[],o=0;o<r.length;o++){var h=r[o];ef(h.points,!0),a.push(e.length/2),e=e.concat(h.points)}var u=Rn(e,a,2);if(!u)return;for(var l=n.length/2,o=0;o<u.length;o+=3)s.push(u[o]+l),s.push(u[o+1]+l),s.push(u[o+2]+l);for(var o=0;o<e.length;o++)n.push(e[o])}}},di={build:function(i){var t=i.points,e,r,n,s,a,o;if(i.type===Rt.CIRC){var h=i.shape;e=h.x,r=h.y,a=o=h.radius,n=s=0}else if(i.type===Rt.ELIP){var u=i.shape;e=u.x,r=u.y,a=u.width,o=u.height,n=s=0}else{var l=i.shape,c=l.width/2,f=l.height/2;e=l.x+c,r=l.y+f,a=o=Math.max(0,Math.min(l.radius,Math.min(c,f))),n=c-a,s=f-o}if(!(a>=0&&o>=0&&n>=0&&s>=0)){t.length=0;return}var d=Math.ceil(2.3*Math.sqrt(a+o)),v=d*8+(n?4:0)+(s?4:0);if(t.length=v,v!==0){if(d===0){t.length=8,t[0]=t[6]=e+n,t[1]=t[3]=r+s,t[2]=t[4]=e-n,t[5]=t[7]=r-s;return}var _=0,p=d*4+(n?2:0)+2,g=p,y=v;{var T=n+a,I=s,m=e+T,S=e-T,x=r+I;if(t[_++]=m,t[_++]=x,t[--p]=x,t[--p]=S,s){var N=r-I;t[g++]=S,t[g++]=N,t[--y]=N,t[--y]=m}}for(var D=1;D<d;D++){var F=Math.PI/2*(D/d),T=n+Math.cos(F)*a,I=s+Math.sin(F)*o,m=e+T,S=e-T,x=r+I,N=r-I;t[_++]=m,t[_++]=x,t[--p]=x,t[--p]=S,t[g++]=S,t[g++]=N,t[--y]=N,t[--y]=m}{var T=n,I=s+o,m=e+T,S=e-T,x=r+I,N=r-I;t[_++]=m,t[_++]=x,t[--y]=N,t[--y]=m,n&&(t[_++]=S,t[_++]=x,t[--y]=N,t[--y]=S)}}},triangulate:function(i,t){var e=i.points,r=t.points,n=t.indices;if(e.length!==0){var s=r.length/2,a=s,o,h;if(i.type!==Rt.RREC){var u=i.shape;o=u.x,h=u.y}else{var l=i.shape;o=l.x+l.width/2,h=l.y+l.height/2}var c=i.matrix;r.push(i.matrix?c.a*o+c.c*h+c.tx:o,i.matrix?c.b*o+c.d*h+c.ty:h),s++,r.push(e[0],e[1]);for(var f=2;f<e.length;f+=2)r.push(e[f],e[f+1]),n.push(s++,a,s);n.push(a+1,a,s)}}},rf={build:function(i){var t=i.shape,e=t.x,r=t.y,n=t.width,s=t.height,a=i.points;a.length=0,a.push(e,r,e+n,r,e+n,r+s,e,r+s)},triangulate:function(i,t){var e=i.points,r=t.points,n=r.length/2;r.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function Sr(i,t,e){var r=t-i;return i+r*e}function cn(i,t,e,r,n,s,a){a===void 0&&(a=[]);for(var o=20,h=a,u=0,l=0,c=0,f=0,d=0,v=0,_=0,p=0;_<=o;++_)p=_/o,u=Sr(i,e,p),l=Sr(t,r,p),c=Sr(e,n,p),f=Sr(r,s,p),d=Sr(u,c,p),v=Sr(l,f,p),!(_===0&&h[h.length-2]===d&&h[h.length-1]===v)&&h.push(d,v);return h}var nf={build:function(i){if(vi.nextRoundedRectBehavior){di.build(i);return}var t=i.shape,e=i.points,r=t.x,n=t.y,s=t.width,a=t.height,o=Math.max(0,Math.min(t.radius,Math.min(s,a)/2));e.length=0,o?(cn(r,n+o,r,n,r+o,n,e),cn(r+s-o,n,r+s,n,r+s,n+o,e),cn(r+s,n+a-o,r+s,n+a,r+s-o,n+a,e),cn(r+o,n+a,r,n+a,r,n+a-o,e)):e.push(r,n,r+s,n,r+s,n+a,r,n+a)},triangulate:function(i,t){if(vi.nextRoundedRectBehavior){di.triangulate(i,t);return}for(var e=i.points,r=t.points,n=t.indices,s=r.length/2,a=Rn(e,null,2),o=0,h=a.length;o<h;o+=3)n.push(a[o]+s),n.push(a[o+1]+s),n.push(a[o+2]+s);for(var o=0,h=e.length;o<h;o++)r.push(e[o],e[++o])}};function sf(i,t,e,r,n,s,a,o){var h=i-e*n,u=t-r*n,l=i+e*s,c=t+r*s,f,d;a?(f=r,d=-e):(f=-r,d=e);var v=h+f,_=u+d,p=l+f,g=c+d;return o.push(v,_),o.push(p,g),2}function hr(i,t,e,r,n,s,a,o){var h=e-i,u=r-t,l=Math.atan2(h,u),c=Math.atan2(n-i,s-t);o&&l<c?l+=Math.PI*2:!o&&l>c&&(c+=Math.PI*2);var f=l,d=c-l,v=Math.abs(d),_=Math.sqrt(h*h+u*u),p=(15*v*Math.sqrt(_)/Math.PI>>0)+1,g=d/p;if(f+=g,o){a.push(i,t),a.push(e,r);for(var y=1,T=f;y<p;y++,T+=g)a.push(i,t),a.push(i+Math.sin(T)*_,t+Math.cos(T)*_);a.push(i,t),a.push(n,s)}else{a.push(e,r),a.push(i,t);for(var y=1,T=f;y<p;y++,T+=g)a.push(i+Math.sin(T)*_,t+Math.cos(T)*_),a.push(i,t);a.push(n,s),a.push(i,t)}return p*2}function ay(i,t){var e=i.shape,r=i.points||e.points.slice(),n=t.closePointEps;if(r.length!==0){var s=i.lineStyle,a=new vt(r[0],r[1]),o=new vt(r[r.length-2],r[r.length-1]),h=e.type!==Rt.POLY||e.closeStroke,u=Math.abs(a.x-o.x)<n&&Math.abs(a.y-o.y)<n;if(h){r=r.slice(),u&&(r.pop(),r.pop(),o.set(r[r.length-2],r[r.length-1]));var l=(a.x+o.x)*.5,c=(o.y+a.y)*.5;r.unshift(l,c),r.push(l,c)}var f=t.points,d=r.length/2,v=r.length,_=f.length/2,p=s.width/2,g=p*p,y=s.miterLimit*s.miterLimit,T=r[0],I=r[1],m=r[2],S=r[3],x=0,N=0,D=-(I-S),F=T-m,k=0,L=0,q=Math.sqrt(D*D+F*F);D/=q,F/=q,D*=p,F*=p;var Z=s.alignment,G=(1-Z)*2,b=Z*2;h||(s.cap===Pe.ROUND?v+=hr(T-D*(G-b)*.5,I-F*(G-b)*.5,T-D*G,I-F*G,T+D*b,I+F*b,f,!0)+2:s.cap===Pe.SQUARE&&(v+=sf(T,I,D,F,G,b,!0,f))),f.push(T-D*G,I-F*G),f.push(T+D*b,I+F*b);for(var P=1;P<d-1;++P){T=r[(P-1)*2],I=r[(P-1)*2+1],m=r[P*2],S=r[P*2+1],x=r[(P+1)*2],N=r[(P+1)*2+1],D=-(I-S),F=T-m,q=Math.sqrt(D*D+F*F),D/=q,F/=q,D*=p,F*=p,k=-(S-N),L=m-x,q=Math.sqrt(k*k+L*L),k/=q,L/=q,k*=p,L*=p;var E=m-T,A=I-S,C=m-x,w=N-S,M=E*C+A*w,R=A*C-w*E,U=R<0;if(Math.abs(R)<.001*Math.abs(M)){f.push(m-D*G,S-F*G),f.push(m+D*b,S+F*b),M>=0&&(s.join===me.ROUND?v+=hr(m,S,m-D*G,S-F*G,m-k*G,S-L*G,f,!1)+4:v+=2,f.push(m-k*b,S-L*b),f.push(m+k*G,S+L*G));continue}var X=(-D+T)*(-F+S)-(-D+m)*(-F+I),W=(-k+x)*(-L+S)-(-k+m)*(-L+N),V=(E*W-C*X)/R,Y=(w*X-A*W)/R,K=(V-m)*(V-m)+(Y-S)*(Y-S),j=m+(V-m)*G,et=S+(Y-S)*G,nt=m-(V-m)*b,ft=S-(Y-S)*b,J=Math.min(E*E+A*A,C*C+w*w),$=U?G:b,rt=J+$*$*g,ot=K<=rt;ot?s.join===me.BEVEL||K/g>y?(U?(f.push(j,et),f.push(m+D*b,S+F*b),f.push(j,et),f.push(m+k*b,S+L*b)):(f.push(m-D*G,S-F*G),f.push(nt,ft),f.push(m-k*G,S-L*G),f.push(nt,ft)),v+=2):s.join===me.ROUND?U?(f.push(j,et),f.push(m+D*b,S+F*b),v+=hr(m,S,m+D*b,S+F*b,m+k*b,S+L*b,f,!0)+4,f.push(j,et),f.push(m+k*b,S+L*b)):(f.push(m-D*G,S-F*G),f.push(nt,ft),v+=hr(m,S,m-D*G,S-F*G,m-k*G,S-L*G,f,!1)+4,f.push(m-k*G,S-L*G),f.push(nt,ft)):(f.push(j,et),f.push(nt,ft)):(f.push(m-D*G,S-F*G),f.push(m+D*b,S+F*b),s.join===me.ROUND?U?v+=hr(m,S,m+D*b,S+F*b,m+k*b,S+L*b,f,!0)+2:v+=hr(m,S,m-D*G,S-F*G,m-k*G,S-L*G,f,!1)+2:s.join===me.MITER&&K/g<=y&&(U?(f.push(nt,ft),f.push(nt,ft)):(f.push(j,et),f.push(j,et)),v+=2),f.push(m-k*G,S-L*G),f.push(m+k*b,S+L*b),v+=2)}T=r[(d-2)*2],I=r[(d-2)*2+1],m=r[(d-1)*2],S=r[(d-1)*2+1],D=-(I-S),F=T-m,q=Math.sqrt(D*D+F*F),D/=q,F/=q,D*=p,F*=p,f.push(m-D*G,S-F*G),f.push(m+D*b,S+F*b),h||(s.cap===Pe.ROUND?v+=hr(m-D*(G-b)*.5,S-F*(G-b)*.5,m-D*G,S-F*G,m+D*b,S+F*b,f,!1)+2:s.cap===Pe.SQUARE&&(v+=sf(m,S,D,F,G,b,!1,f)));for(var Ht=t.indices,Ue=Er.epsilon*Er.epsilon,P=_;P<v+_-2;++P)T=f[P*2],I=f[P*2+1],m=f[(P+1)*2],S=f[(P+1)*2+1],x=f[(P+2)*2],N=f[(P+2)*2+1],!(Math.abs(T*(S-N)+m*(N-I)+x*(I-S))<Ue)&&Ht.push(P,P+1,P+2)}}function oy(i,t){var e=0,r=i.shape,n=i.points||r.points,s=r.type!==Rt.POLY||r.closeStroke;if(n.length!==0){var a=t.points,o=t.indices,h=n.length/2,u=a.length/2,l=u;for(a.push(n[0],n[1]),e=1;e<h;e++)a.push(n[e*2],n[e*2+1]),o.push(l,l+1),l++;s&&o.push(l,u)}}function io(i,t){i.lineStyle.native?oy(i,t):ay(i,t)}var no=function(){function i(){}return i.curveTo=function(t,e,r,n,s,a){var o=a[a.length-2],h=a[a.length-1],u=h-e,l=o-t,c=n-e,f=r-t,d=Math.abs(u*f-l*c);if(d<1e-8||s===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;var v=u*u+l*l,_=c*c+f*f,p=u*c+l*f,g=s*Math.sqrt(v)/d,y=s*Math.sqrt(_)/d,T=g*p/v,I=y*p/_,m=g*f+y*l,S=g*c+y*u,x=l*(y+T),N=u*(y+T),D=f*(g+I),F=c*(g+I),k=Math.atan2(N-S,x-m),L=Math.atan2(F-S,D-m);return{cx:m+t,cy:S+e,radius:s,startAngle:k,endAngle:L,anticlockwise:l*c>f*u}},i.arc=function(t,e,r,n,s,a,o,h,u){for(var l=o-a,c=Er._segmentsCount(Math.abs(l)*s,Math.ceil(Math.abs(l)/Xr)*40),f=l/(c*2),d=f*2,v=Math.cos(f),_=Math.sin(f),p=c-1,g=p%1/p,y=0;y<=p;++y){var T=y+g*y,I=f+a+d*T,m=Math.cos(I),S=-Math.sin(I);u.push((v*m+_*S)*s+r,(v*-S+_*m)*s+n)}},i}(),af=function(){function i(){}return i.curveLength=function(t,e,r,n,s,a,o,h){for(var u=10,l=0,c=0,f=0,d=0,v=0,_=0,p=0,g=0,y=0,T=0,I=0,m=t,S=e,x=1;x<=u;++x)c=x/u,f=c*c,d=f*c,v=1-c,_=v*v,p=_*v,g=p*t+3*_*c*r+3*v*f*s+d*o,y=p*e+3*_*c*n+3*v*f*a+d*h,T=m-g,I=S-y,m=g,S=y,l+=Math.sqrt(T*T+I*I);return l},i.curveTo=function(t,e,r,n,s,a,o){var h=o[o.length-2],u=o[o.length-1];o.length-=2;var l=Er._segmentsCount(i.curveLength(h,u,t,e,r,n,s,a)),c=0,f=0,d=0,v=0,_=0;o.push(h,u);for(var p=1,g=0;p<=l;++p)g=p/l,c=1-g,f=c*c,d=f*c,v=g*g,_=v*g,o.push(d*h+3*f*g*t+3*c*v*r+_*s,d*u+3*f*g*e+3*c*v*n+_*a)},i}(),of=function(){function i(){}return i.curveLength=function(t,e,r,n,s,a){var o=t-2*r+s,h=e-2*n+a,u=2*r-2*t,l=2*n-2*e,c=4*(o*o+h*h),f=4*(o*u+h*l),d=u*u+l*l,v=2*Math.sqrt(c+f+d),_=Math.sqrt(c),p=2*c*_,g=2*Math.sqrt(d),y=f/_;return(p*v+_*f*(v-g)+(4*d*c-f*f)*Math.log((2*_+y+v)/(y+g)))/(4*p)},i.curveTo=function(t,e,r,n,s){for(var a=s[s.length-2],o=s[s.length-1],h=Er._segmentsCount(i.curveLength(a,o,t,e,r,n)),u=0,l=0,c=1;c<=h;++c){var f=c/h;u=a+(t-a)*f,l=o+(e-o)*f,s.push(u+(t+(r-t)*f-u)*f,l+(e+(n-e)*f-l)*f)}},i}(),hf=function(){function i(){this.reset()}return i.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},i.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},i.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},i}(),ur,dn=(ur={},ur[Rt.POLY]=ro,ur[Rt.CIRC]=di,ur[Rt.ELIP]=di,ur[Rt.RECT]=rf,ur[Rt.RREC]=nf,ur),so=[],pi=[],ao=function(){function i(t,e,r,n){e===void 0&&(e=null),r===void 0&&(r=null),n===void 0&&(n=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=n,this.type=t.type}return i.prototype.clone=function(){return new i(this.shape,this.fillStyle,this.lineStyle,this.matrix)},i.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},i}(),Pr=new vt,uf=function(i){eo(t,i);function t(){var e=i.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 $r,e.boundsDirty=-1,e}return Object.defineProperty(t.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),t.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 e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),pi.push(this.drawCalls[e]);this.drawCalls.length=0;for(var e=0;e<this.batches.length;e++){var r=this.batches[e];r.reset(),so.push(r)}this.batches.length=0},t.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},t.prototype.drawShape=function(e,r,n,s){r===void 0&&(r=null),n===void 0&&(n=null),s===void 0&&(s=null);var a=new ao(e,r,n,s);return this.graphicsData.push(a),this.dirty++,this},t.prototype.drawHole=function(e,r){if(r===void 0&&(r=null),!this.graphicsData.length)return null;var n=new ao(e,null,null,r),s=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=s.lineStyle,s.holes.push(n),this.dirty++,this},t.prototype.destroy=function(){i.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},t.prototype.containsPoint=function(e){for(var r=this.graphicsData,n=0;n<r.length;++n){var s=r[n];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(e,Pr):Pr.copyFrom(e),s.shape.contains(Pr.x,Pr.y))){var a=!1;if(s.holes)for(var o=0;o<s.holes.length;o++){var h=s.holes[o];if(h.shape.contains(Pr.x,Pr.y)){a=!0;break}}if(!a)return!0}}return!1},t.prototype.updateBatches=function(){if(!this.graphicsData.length){this.batchable=!0;return}if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,r=this.graphicsData,n=null,s=null;this.batches.length>0&&(n=this.batches[this.batches.length-1],s=n.style);for(var a=this.shapeIndex;a<r.length;a++){this.shapeIndex++;var o=r[a],h=o.fillStyle,u=o.lineStyle,l=dn[o.type];l.build(o),o.matrix&&this.transformPoints(o.points,o.matrix),(h.visible||u.visible)&&this.processHoles(o.holes);for(var c=0;c<2;c++){var f=c===0?h:u;if(f.visible){var d=f.texture.baseTexture,v=this.indices.length,_=this.points.length/2;d.wrapMode=ne.REPEAT,c===0?this.processFill(o):this.processLine(o);var p=this.points.length/2-_;p!==0&&(n&&!this._compareStyles(s,f)&&(n.end(v,_),n=null),n||(n=so.pop()||new hf,n.begin(f,v,_),this.batches.push(n),s=f),this.addUvs(this.points,e,f.texture,_,p,f.matrix))}}}var g=this.indices.length,y=this.points.length/2;if(n&&n.end(g,y),this.batches.length===0){this.batchable=!0;return}var T=y>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&T===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=T?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}},t.prototype._compareStyles=function(e,r){return!(!e||!r||e.texture.baseTexture!==r.texture.baseTexture||e.color+e.alpha!==r.color+r.alpha||!!e.native!=!!r.native)},t.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var e=0,r=this.graphicsData.length;e<r;e++){var n=this.graphicsData[e],s=n.fillStyle,a=n.lineStyle;if(s&&!s.texture.baseTexture.valid||a&&!a.texture.baseTexture.valid)return!1}return!0},t.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var e=this.batches,r=0,n=e.length;r<n;r++)for(var s=e[r],a=0;a<s.size;a++){var o=s.start+a;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}},t.prototype.isBatchable=function(){if(this.points.length>65535*2)return!1;for(var e=this.batches,r=0;r<e.length;r++)if(e[r].style.native)return!1;return this.points.length<t.BATCHABLE_SIZE*2},t.prototype.buildDrawCalls=function(){for(var e=++lt._globalBatch,r=0;r<this.drawCalls.length;r++)this.drawCalls[r].texArray.clear(),pi.push(this.drawCalls[r]);this.drawCalls.length=0;var n=this.colors,s=this.textureIds,a=pi.pop();a||(a=new Vi,a.texArray=new ji),a.texArray.count=0,a.start=0,a.size=0,a.type=jt.TRIANGLES;var o=0,h=null,u=0,l=!1,c=jt.TRIANGLES,f=0;this.drawCalls.push(a);for(var r=0;r<this.batches.length;r++){var d=this.batches[r],v=8,_=d.style,p=_.texture.baseTexture;l!==!!_.native&&(l=!!_.native,c=l?jt.LINES:jt.TRIANGLES,h=null,o=v,e++),h!==p&&(h=p,p._batchEnabled!==e&&(o===v&&(e++,o=0,a.size>0&&(a=pi.pop(),a||(a=new Vi,a.texArray=new ji),this.drawCalls.push(a)),a.start=f,a.size=0,a.texArray.count=0,a.type=c),p.touched=1,p._batchEnabled=e,p._batchLocation=o,p.wrapMode=ne.REPEAT,a.texArray.elements[a.texArray.count++]=p,o++)),a.size+=d.size,f+=d.size,u=p._batchLocation,this.addColors(n,_.color,_.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,u,d.attribSize,d.attribStart)}lt._globalBatch=e,this.packAttributes()},t.prototype.packAttributes=function(){for(var e=this.points,r=this.uvs,n=this.colors,s=this.textureIds,a=new ArrayBuffer(e.length*3*4),o=new Float32Array(a),h=new Uint32Array(a),u=0,l=0;l<e.length/2;l++)o[u++]=e[l*2],o[u++]=e[l*2+1],o[u++]=r[l*2],o[u++]=r[l*2+1],h[u++]=n[l],o[u++]=s[l];this._buffer.update(a),this._indexBuffer.update(this.indicesUint16)},t.prototype.processFill=function(e){if(e.holes.length)ro.triangulate(e,this);else{var r=dn[e.type];r.triangulate(e,this)}},t.prototype.processLine=function(e){io(e,this);for(var r=0;r<e.holes.length;r++)io(e.holes[r],this)},t.prototype.processHoles=function(e){for(var r=0;r<e.length;r++){var n=e[r],s=dn[n.type];s.build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}},t.prototype.calculateBounds=function(){var e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)},t.prototype.transformPoints=function(e,r){for(var n=0;n<e.length/2;n++){var s=e[n*2],a=e[n*2+1];e[n*2]=r.a*s+r.c*a+r.tx,e[n*2+1]=r.b*s+r.d*a+r.ty}},t.prototype.addColors=function(e,r,n,s,a){a===void 0&&(a=0);var o=(r>>16)+(r&65280)+((r&255)<<16),h=Pi(o,n);e.length=Math.max(e.length,a+s);for(var u=0;u<s;u++)e[a+u]=h},t.prototype.addTextureIds=function(e,r,n,s){s===void 0&&(s=0),e.length=Math.max(e.length,s+n);for(var a=0;a<n;a++)e[s+a]=r},t.prototype.addUvs=function(e,r,n,s,a,o){o===void 0&&(o=null);for(var h=0,u=r.length,l=n.frame;h<a;){var c=e[(s+h)*2],f=e[(s+h)*2+1];if(o){var d=o.a*c+o.c*f+o.tx;f=o.b*c+o.d*f+o.ty,c=d}h++,r.push(c/l.width,f/l.height)}var v=n.baseTexture;(l.width<v.width||l.height<v.height)&&this.adjustUvs(r,n,u,a)},t.prototype.adjustUvs=function(e,r,n,s){for(var a=r.baseTexture,o=1e-6,h=n+s*2,u=r.frame,l=u.width/a.width,c=u.height/a.height,f=u.x/u.width,d=u.y/u.height,v=Math.floor(e[n]+o),_=Math.floor(e[n+1]+o),p=n+2;p<h;p+=2)v=Math.min(v,Math.floor(e[p]+o)),_=Math.min(_,Math.floor(e[p+1]+o));f-=v,d-=_;for(var p=n;p<h;p+=2)e[p]=(e[p]+f)*l,e[p+1]=(e[p+1]+d)*c},t.BATCHABLE_SIZE=100,t}(ha),lf=function(i){eo(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=Pe.BUTT,e.join=me.MITER,e.miterLimit=10,e}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.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e},t.prototype.reset=function(){i.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},t}(Qa),hy=new Float32Array(3),oo={},vi=function(i){eo(t,i);function t(e){e===void 0&&(e=null);var r=i.call(this)||this;return r.shader=null,r.pluginName="batch",r.currentPath=null,r.batches=[],r.batchTint=-1,r.batchDirty=-1,r.vertexData=null,r._fillStyle=new Qa,r._lineStyle=new lf,r._matrix=null,r._holeMode=!1,r.state=Oe.for2d(),r._geometry=e||new uf,r._geometry.refCount++,r._transformID=-1,r.tint=16777215,r.blendMode=tt.NORMAL,r}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return this.finishPoly(),new t(this._geometry)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),t.prototype.lineStyle=function(e,r,n,s,a){return e===void 0&&(e=null),r===void 0&&(r=0),n===void 0&&(n=1),s===void 0&&(s=.5),a===void 0&&(a=!1),typeof e=="number"&&(e={width:e,color:r,alpha:n,alignment:s,native:a}),this.lineTextureStyle(e)},t.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:it.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:Pe.BUTT,join:me.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var r=e.width>0&&e.alpha>0;return r?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:r},e)):this._lineStyle.reset(),this},t.prototype.startPoly=function(){if(this.currentPath){var e=this.currentPath.points,r=this.currentPath.points.length;r>2&&(this.drawShape(this.currentPath),this.currentPath=new Hr,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[r-2],e[r-1]))}else this.currentPath=new Hr,this.currentPath.closeStroke=!1},t.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},t.prototype.moveTo=function(e,r){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=r,this},t.prototype.lineTo=function(e,r){this.currentPath||this.moveTo(0,0);var n=this.currentPath.points,s=n[n.length-2],a=n[n.length-1];return(s!==e||a!==r)&&n.push(e,r),this},t.prototype._initCurve=function(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,r]):this.moveTo(e,r)},t.prototype.quadraticCurveTo=function(e,r,n,s){this._initCurve();var a=this.currentPath.points;return a.length===0&&this.moveTo(0,0),of.curveTo(e,r,n,s,a),this},t.prototype.bezierCurveTo=function(e,r,n,s,a,o){return this._initCurve(),af.curveTo(e,r,n,s,a,o,this.currentPath.points),this},t.prototype.arcTo=function(e,r,n,s,a){this._initCurve(e,r);var o=this.currentPath.points,h=no.curveTo(e,r,n,s,a,o);if(h){var u=h.cx,l=h.cy,c=h.radius,f=h.startAngle,d=h.endAngle,v=h.anticlockwise;this.arc(u,l,c,f,d,v)}return this},t.prototype.arc=function(e,r,n,s,a,o){if(o===void 0&&(o=!1),s===a)return this;!o&&a<=s?a+=Xr:o&&s<=a&&(s+=Xr);var h=a-s;if(h===0)return this;var u=e+Math.cos(s)*n,l=r+Math.sin(s)*n,c=this._geometry.closePointEps,f=this.currentPath?this.currentPath.points:null;if(f){var d=Math.abs(f[f.length-2]-u),v=Math.abs(f[f.length-1]-l);d<c&&v<c||f.push(u,l)}else this.moveTo(u,l),f=this.currentPath.points;return no.arc(u,l,e,r,n,s,a,o,f),this},t.prototype.beginFill=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=1),this.beginTextureFill({texture:it.WHITE,color:e,alpha:r})},t.prototype.beginTextureFill=function(e){e=Object.assign({texture:it.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var r=e.alpha>0;return r?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:r},e)):this._fillStyle.reset(),this},t.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},t.prototype.drawRect=function(e,r,n,s){return this.drawShape(new ut(e,r,n,s))},t.prototype.drawRoundedRect=function(e,r,n,s,a){return this.drawShape(new Zh(e,r,n,s,a))},t.prototype.drawCircle=function(e,r,n){return this.drawShape(new $h(e,r,n))},t.prototype.drawEllipse=function(e,r,n,s){return this.drawShape(new Kh(e,r,n,s))},t.prototype.drawPolygon=function(){for(var e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];var s,a=!0,o=r[0];o.points?(a=o.closeStroke,s=o.points):Array.isArray(r[0])?s=r[0]:s=r;var h=new Hr(s);return h.closeStroke=a,this.drawShape(h),this},t.prototype.drawShape=function(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},t.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},t.prototype.isFastRect=function(){var e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===Rt.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)},t.prototype._render=function(e){this.finishPoly();var r=this._geometry;r.updateBatches(),r.batchable?(this.batchDirty!==r.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))},t.prototype._populateBatches=function(){var e=this._geometry,r=this.blendMode,n=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(e.points);for(var s=0;s<n;s++){var a=e.batches[s],o=a.style.color,h=new Float32Array(this.vertexData.buffer,a.attribStart*4*2,a.attribSize*2),u=new Float32Array(e.uvsFloat32.buffer,a.attribStart*4*2,a.attribSize*2),l=new Uint16Array(e.indicesUint16.buffer,a.start*2,a.size),c={vertexData:h,blendMode:r,indices:l,uvs:u,_batchRGB:He(o),_tintRGB:o,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[s]=c}},t.prototype._renderBatched=function(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var r=0,n=this.batches.length;r<n;r++){var s=this.batches[r];s.worldAlpha=this.worldAlpha*s.alpha,e.plugins[this.pluginName].render(s)}}},t.prototype._renderDirect=function(e){var r=this._resolveDirectShader(e),n=this._geometry,s=this.tint,a=this.worldAlpha,o=r.uniforms,h=n.drawCalls;o.translationMatrix=this.transform.worldTransform,o.tint[0]=(s>>16&255)/255*a,o.tint[1]=(s>>8&255)/255*a,o.tint[2]=(s&255)/255*a,o.tint[3]=a,e.shader.bind(r),e.geometry.bind(n,r),e.state.set(this.state);for(var u=0,l=h.length;u<l;u++)this._renderDrawCallDirect(e,n.drawCalls[u])},t.prototype._renderDrawCallDirect=function(e,r){for(var n=r.texArray,s=r.type,a=r.size,o=r.start,h=n.count,u=0;u<h;u++)e.texture.bind(n.elements[u],u);e.geometry.draw(s,a,o)},t.prototype._resolveDirectShader=function(e){var r=this.shader,n=this.pluginName;if(!r){if(!oo[n]){for(var s=e.plugins[n].MAX_TEXTURES,a=new Int32Array(s),o=0;o<s;o++)a[o]=o;var h={tint:new Float32Array([1,1,1,1]),translationMatrix:new bt,default:Re.from({uSamplers:a},!0)},u=e.plugins[n]._shader.program;oo[n]=new be(u,h)}r=oo[n]}return r},t.prototype._calculateBounds=function(){this.finishPoly();var e=this._geometry;if(e.graphicsData.length){var r=e.bounds,n=r.minX,s=r.minY,a=r.maxX,o=r.maxY;this._bounds.addFrame(this.transform,n,s,a,o)}},t.prototype.containsPoint=function(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)},t.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var e=He(this.tint,hy),r=0;r<this.batches.length;r++){var n=this.batches[r],s=n._batchRGB,a=e[0]*s[0]*255,o=e[1]*s[1]*255,h=e[2]*s[2]*255,u=(a<<16)+(o<<8)+(h|0);n._tintRGB=(u>>16)+(u&65280)+((u&255)<<16)}}},t.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var r=this.transform.worldTransform,n=r.a,s=r.b,a=r.c,o=r.d,h=r.tx,u=r.ty,l=this._geometry.points,c=this.vertexData,f=0,d=0;d<l.length;d+=2){var v=l[d],_=l[d+1];c[f++]=n*v+a*_+h,c[f++]=o*_+s*v+u}}},t.prototype.closePath=function(){var e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this},t.prototype.setMatrix=function(e){return this._matrix=e,this},t.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},t.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},t.prototype.destroy=function(e){this._geometry.refCount--,this._geometry.refCount===0&&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,i.prototype.destroy.call(this,e)},t.nextRoundedRectBehavior=!1,t._TEMP_POINT=new vt,t}(Zt),uy={buildPoly:ro,buildCircle:di,buildRectangle:rf,buildRoundedRectangle:nf,buildLine:io,ArcUtils:no,BezierUtils:af,QuadraticUtils:of,BatchPart:hf,FILL_COMMANDS:dn,BATCH_POOL:so,DRAW_CALL_POOL:pi};var ho=function(i,t){return ho=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},ho(i,t)};function ly(i,t){ho(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var _i=new vt,fy=new Uint16Array([0,1,2,0,2,3]),wr=function(i){ly(t,i);function t(e){var r=i.call(this)||this;return r._anchor=new Ae(r._onAnchorUpdate,r,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),r._texture=null,r._width=0,r._height=0,r._tint=null,r._tintRGB=null,r.tint=16777215,r.blendMode=tt.NORMAL,r._cachedTint=16777215,r.uvs=null,r.texture=e||it.EMPTY,r.vertexData=new Float32Array(8),r.vertexTrimmedData=null,r._transformID=-1,r._textureID=-1,r._transformTrimmedID=-1,r._textureTrimmedID=-1,r.indices=fy,r.pluginName="batch",r.isSprite=!0,r._roundPixels=z.ROUND_PIXELS,r}return t.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=je(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=je(this.scale.y)*this._height/this._texture.orig.height)},t.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},t.prototype.calculateVertices=function(){var e=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===e._updateID)){this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;var r=this.transform.worldTransform,n=r.a,s=r.b,a=r.c,o=r.d,h=r.tx,u=r.ty,l=this.vertexData,c=e.trim,f=e.orig,d=this._anchor,v=0,_=0,p=0,g=0;if(c?(_=c.x-d._x*f.width,v=_+c.width,g=c.y-d._y*f.height,p=g+c.height):(_=-d._x*f.width,v=_+f.width,g=-d._y*f.height,p=g+f.height),l[0]=n*_+a*g+h,l[1]=o*g+s*_+u,l[2]=n*v+a*g+h,l[3]=o*g+s*v+u,l[4]=n*v+a*p+h,l[5]=o*p+s*v+u,l[6]=n*_+a*p+h,l[7]=o*p+s*_+u,this._roundPixels)for(var y=z.RESOLUTION,T=0;T<l.length;++T)l[T]=Math.round((l[T]*y|0)/y)}},t.prototype.calculateTrimmedVertices=function(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var e=this._texture,r=this.vertexTrimmedData,n=e.orig,s=this._anchor,a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,c=a.tx,f=a.ty,d=-s._x*n.width,v=d+n.width,_=-s._y*n.height,p=_+n.height;r[0]=o*d+u*_+c,r[1]=l*_+h*d+f,r[2]=o*v+u*_+c,r[3]=l*_+h*v+f,r[4]=o*v+u*p+c,r[5]=l*p+h*v+f,r[6]=o*d+u*p+c,r[7]=l*p+h*d+f},t.prototype._render=function(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)},t.prototype._calculateBounds=function(){var e=this._texture.trim,r=this._texture.orig;!e||e.width===r.width&&e.height===r.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},t.prototype.getLocalBounds=function(e){return this.children.length===0?(this._localBounds||(this._localBounds=new $r),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 ut),e=this._localBoundsRect),this._localBounds.getRectangle(e)):i.prototype.getLocalBounds.call(this,e)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,_i);var r=this._texture.orig.width,n=this._texture.orig.height,s=-r*this.anchor.x,a=0;return _i.x>=s&&_i.x<s+r&&(a=-n*this.anchor.y,_i.y>=a&&_i.y<a+n)},t.prototype.destroy=function(e){i.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var r=typeof e=="boolean"?e:e&&e.texture;if(r){var n=typeof e=="boolean"?e:e&&e.baseTexture;this._texture.destroy(!!n)}this._texture=null},t.from=function(e,r){var n=e instanceof it?e:it.from(e,r);return new t(n)},Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(e){var r=je(this.scale.x)||1;this.scale.x=r*e/this._texture.orig.width,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(e){var r=je(this.scale.y)||1;this.scale.y=r*e/this._texture.orig.height,this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anchor",{get:function(){return this._anchor},set:function(e){this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e,this._tintRGB=(e>>16)+(e&65280)+((e&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||it.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),t}(Zt);var uo=function(i,t){return uo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},uo(i,t)};function cy(i,t){uo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Cr;(function(i){i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(Cr||(Cr={}));var lo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Cr.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},dy=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],lr=function(){function i(t){this.styleID=0,this.reset(),co(this,t,t)}return i.prototype.clone=function(){var t={};return co(t,this,lo),new i(t)},i.prototype.reset=function(){co(this,lo,lo)},Object.defineProperty(i.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=fo(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=fo(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){py(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=fo(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),i.prototype.toFontString=function(){var t=typeof this.fontSize=="number"?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var r=e.length-1;r>=0;r--){var n=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&dy.indexOf(n)<0&&(n='"'+n+'"'),e[r]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},i}();function ff(i){return typeof i=="number"?cs(i):(typeof i=="string"&&i.indexOf("0x")===0&&(i=i.replace("0x","#")),i)}function fo(i){if(Array.isArray(i)){for(var t=0;t<i.length;++t)i[t]=ff(i[t]);return i}else return ff(i)}function py(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(var e=0;e<i.length;++e)if(i[e]!==t[e])return!1;return!0}function co(i,t,e){for(var r in e)Array.isArray(t[r])?i[r]=t[r].slice():i[r]=t[r]}var pn={willReadFrequently:!0},le=function(){function i(t,e,r,n,s,a,o,h,u){this.text=t,this.style=e,this.width=r,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=u}return i.measureText=function(t,e,r,n){n===void 0&&(n=i._canvas),r=r??e.wordWrap;var s=e.toFontString(),a=i.measureFont(s);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);var o=n.getContext("2d",pn);o.font=s;for(var h=r?i.wordWrap(t,e,n):t,u=h.split(/(?:\r\n|\r|\n)/),l=new Array(u.length),c=0,f=0;f<u.length;f++){var d=o.measureText(u[f]).width+(u[f].length-1)*e.letterSpacing;l[f]=d,c=Math.max(c,d)}var v=c+e.strokeThickness;e.dropShadow&&(v+=e.dropShadowDistance);var _=e.lineHeight||a.fontSize+e.strokeThickness,p=Math.max(_,a.fontSize+e.strokeThickness)+(u.length-1)*(_+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new i(t,e,v,p,u,l,_+e.leading,c,a)},i.wordWrap=function(t,e,r){r===void 0&&(r=i._canvas);for(var n=r.getContext("2d",pn),s=0,a="",o="",h=Object.create(null),u=e.letterSpacing,l=e.whiteSpace,c=i.collapseSpaces(l),f=i.collapseNewlines(l),d=!c,v=e.wordWrapWidth+u,_=i.tokenize(t),p=0;p<_.length;p++){var g=_[p];if(i.isNewline(g)){if(!f){o+=i.addLine(a),d=!c,a="",s=0;continue}g=" "}if(c){var y=i.isBreakingSpace(g),T=i.isBreakingSpace(a[a.length-1]);if(y&&T)continue}var I=i.getFromCache(g,u,h,n);if(I>v)if(a!==""&&(o+=i.addLine(a),a="",s=0),i.canBreakWords(g,e.breakWords))for(var m=i.wordWrapSplit(g),S=0;S<m.length;S++){for(var x=m[S],N=1;m[S+N];){var D=m[S+N],F=x[x.length-1];if(!i.canBreakChars(F,D,g,S,e.breakWords))x+=D;else break;N++}S+=x.length-1;var k=i.getFromCache(x,u,h,n);k+s>v&&(o+=i.addLine(a),d=!1,a="",s=0),a+=x,s+=k}else{a.length>0&&(o+=i.addLine(a),a="",s=0);var L=p===_.length-1;o+=i.addLine(g,!L),d=!1,a="",s=0}else I+s>v&&(d=!1,o+=i.addLine(a),a="",s=0),(a.length>0||!i.isBreakingSpace(g)||d)&&(a+=g,s+=I)}return o+=i.addLine(a,!1),o},i.addLine=function(t,e){return e===void 0&&(e=!0),t=i.trimRight(t),t=e?t+`
|
|
541
|
+
`:t,t},i.getFromCache=function(t,e,r,n){var s=r[t];if(typeof s!="number"){var a=t.length*e;s=n.measureText(t).width+a,r[t]=s}return s},i.collapseSpaces=function(t){return t==="normal"||t==="pre-line"},i.collapseNewlines=function(t){return t==="normal"},i.trimRight=function(t){if(typeof t!="string")return"";for(var e=t.length-1;e>=0;e--){var r=t[e];if(!i.isBreakingSpace(r))break;t=t.slice(0,-1)}return t},i.isNewline=function(t){return typeof t!="string"?!1:i._newlines.indexOf(t.charCodeAt(0))>=0},i.isBreakingSpace=function(t,e){return typeof t!="string"?!1:i._breakingSpaces.indexOf(t.charCodeAt(0))>=0},i.tokenize=function(t){var e=[],r="";if(typeof t!="string")return e;for(var n=0;n<t.length;n++){var s=t[n],a=t[n+1];if(i.isBreakingSpace(s,a)||i.isNewline(s)){r!==""&&(e.push(r),r=""),e.push(s);continue}r+=s}return r!==""&&e.push(r),e},i.canBreakWords=function(t,e){return e},i.canBreakChars=function(t,e,r,n,s){return!0},i.wordWrapSplit=function(t){return t.split("")},i.measureFont=function(t){if(i._fonts[t])return i._fonts[t];var e={ascent:0,descent:0,fontSize:0},r=i._canvas,n=i._context;n.font=t;var s=i.METRICS_STRING+i.BASELINE_SYMBOL,a=Math.ceil(n.measureText(s).width),o=Math.ceil(n.measureText(i.BASELINE_SYMBOL).width),h=Math.ceil(i.HEIGHT_MULTIPLIER*o);o=o*i.BASELINE_MULTIPLIER|0,r.width=a,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,a,h),n.font=t,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,o);var u=n.getImageData(0,0,a,h).data,l=u.length,c=a*4,f=0,d=0,v=!1;for(f=0;f<o;++f){for(var _=0;_<c;_+=4)if(u[d+_]!==255){v=!0;break}if(!v)d+=c;else break}for(e.ascent=o-f,d=l-c,v=!1,f=h;f>o;--f){for(var _=0;_<c;_+=4)if(u[d+_]!==255){v=!0;break}if(!v)d-=c;else break}return e.descent=f-o,e.fontSize=e.ascent+e.descent,i._fonts[t]=e,e},i.clearMetrics=function(t){t===void 0&&(t=""),t?delete i._fonts[t]:i._fonts={}},Object.defineProperty(i,"_canvas",{get:function(){if(!i.__canvas){var t=void 0;try{var e=new OffscreenCanvas(0,0),r=e.getContext("2d",pn);if(r&&r.measureText)return i.__canvas=e,e;t=z.ADAPTER.createCanvas()}catch{t=z.ADAPTER.createCanvas()}t.width=t.height=10,i.__canvas=t}return i.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(i,"_context",{get:function(){return i.__context||(i.__context=i._canvas.getContext("2d",pn)),i.__context},enumerable:!1,configurable:!0}),i}();le._fonts={},le.METRICS_STRING="|ÉqÅ",le.BASELINE_SYMBOL="M",le.BASELINE_MULTIPLIER=1.4,le.HEIGHT_MULTIPLIER=2,le._newlines=[10,13],le._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var vy={texture:!0,children:!1,baseTexture:!0},po=function(i){cy(t,i);function t(e,r,n){var s=this,a=!1;n||(n=z.ADAPTER.createCanvas(),a=!0),n.width=3,n.height=3;var o=it.from(n);return o.orig=new ut,o.trim=new ut,s=i.call(this,o)||this,s._ownCanvas=a,s.canvas=n,s.context=n.getContext("2d",{willReadFrequently:!0}),s._resolution=z.RESOLUTION,s._autoResolution=!0,s._text=null,s._style=null,s._styleListener=null,s._font="",s.text=e,s.style=r,s.localStyleID=-1,s}return t.prototype.updateText=function(e){var r=this._style;if(this.localStyleID!==r.styleID&&(this.dirty=!0,this.localStyleID=r.styleID),!(!this.dirty&&e)){this._font=this._style.toFontString();var n=this.context,s=le.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,o=s.height,h=s.lines,u=s.lineHeight,l=s.lineWidths,c=s.maxLineWidth,f=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+r.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+r.padding*2)*this._resolution),n.scale(this._resolution,this._resolution),n.clearRect(0,0,this.canvas.width,this.canvas.height),n.font=this._font,n.lineWidth=r.strokeThickness,n.textBaseline=r.textBaseline,n.lineJoin=r.lineJoin,n.miterLimit=r.miterLimit;for(var d,v,_=r.dropShadow?2:1,p=0;p<_;++p){var g=r.dropShadow&&p===0,y=g?Math.ceil(Math.max(1,o)+r.padding*2):0,T=y*this._resolution;if(g){n.fillStyle="black",n.strokeStyle="black";var I=r.dropShadowColor,m=He(typeof I=="number"?I:ds(I)),S=r.dropShadowBlur*this._resolution,x=r.dropShadowDistance*this._resolution;n.shadowColor="rgba("+m[0]*255+","+m[1]*255+","+m[2]*255+","+r.dropShadowAlpha+")",n.shadowBlur=S,n.shadowOffsetX=Math.cos(r.dropShadowAngle)*x,n.shadowOffsetY=Math.sin(r.dropShadowAngle)*x+T}else n.fillStyle=this._generateFillStyle(r,h,s),n.strokeStyle=r.stroke,n.shadowColor="black",n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0;var N=(u-f.fontSize)/2;(!t.nextLineHeightBehavior||u-f.fontSize<0)&&(N=0);for(var D=0;D<h.length;D++)d=r.strokeThickness/2,v=r.strokeThickness/2+D*u+f.ascent+N,r.align==="right"?d+=c-l[D]:r.align==="center"&&(d+=(c-l[D])/2),r.stroke&&r.strokeThickness&&this.drawLetterSpacing(h[D],d+r.padding,v+r.padding-y,!0),r.fill&&this.drawLetterSpacing(h[D],d+r.padding,v+r.padding-y)}this.updateTexture()}},t.prototype.drawLetterSpacing=function(e,r,n,s){s===void 0&&(s=!1);var a=this._style,o=a.letterSpacing,h=t.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(o===0||h){h&&(this.context.letterSpacing=o,this.context.textLetterSpacing=o),s?this.context.strokeText(e,r,n):this.context.fillText(e,r,n);return}for(var u=r,l=Array.from?Array.from(e):e.split(""),c=this.context.measureText(e).width,f=0,d=0;d<l.length;++d){var v=l[d];s?this.context.strokeText(v,u,n):this.context.fillText(v,u,n);for(var _="",p=d+1;p<l.length;++p)_+=l[p];f=this.context.measureText(_).width,u+=c-f+o,c=f}},t.prototype.updateTexture=function(){var e=this.canvas;if(this._style.trim){var r=jh(e);r.data&&(e.width=r.width,e.height=r.height,this.context.putImageData(r.data,0,0))}var n=this._texture,s=this._style,a=s.trim?0:s.padding,o=n.baseTexture;n.trim.width=n._frame.width=e.width/this._resolution,n.trim.height=n._frame.height=e.height/this._resolution,n.trim.x=-a,n.trim.y=-a,n.orig.width=n._frame.width-a*2,n.orig.height=n._frame.height-a*2,this._onTextureUpdate(),o.setRealSize(e.width,e.height,this._resolution),n.updateUvs(),this.dirty=!1},t.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),i.prototype._render.call(this,e)},t.prototype.updateTransform=function(){this.updateText(!0),i.prototype.updateTransform.call(this)},t.prototype.getBounds=function(e,r){return this.updateText(!0),this._textureID===-1&&(e=!1),i.prototype.getBounds.call(this,e,r)},t.prototype.getLocalBounds=function(e){return this.updateText(!0),i.prototype.getLocalBounds.call(this,e)},t.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},t.prototype._generateFillStyle=function(e,r,n){var s=e.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;var a,o=e.dropShadow?e.dropShadowDistance:0,h=e.padding||0,u=this.canvas.width/this._resolution-o-h*2,l=this.canvas.height/this._resolution-o-h*2,c=s.slice(),f=e.fillGradientStops.slice();if(!f.length)for(var d=c.length+1,v=1;v<d;++v)f.push(v/d);if(c.unshift(s[0]),f.unshift(0),c.push(s[s.length-1]),f.push(1),e.fillGradientType===Cr.LINEAR_VERTICAL){a=this.context.createLinearGradient(u/2,h,u/2,l+h);for(var _=n.fontProperties.fontSize+e.strokeThickness,v=0;v<r.length;v++){var p=n.lineHeight*(v-1)+_,g=n.lineHeight*v,y=g;v>0&&p>g&&(y=(g+p)/2);var T=g+_,I=n.lineHeight*(v+1),m=T;v+1<r.length&&I<T&&(m=(T+I)/2);for(var S=(m-y)/l,x=0;x<c.length;x++){var N=0;typeof f[x]=="number"?N=f[x]:N=x/c.length;var D=Math.min(1,Math.max(0,y/l+N*S));D=Number(D.toFixed(5)),a.addColorStop(D,c[x])}}}else{a=this.context.createLinearGradient(h,l/2,u+h,l/2);for(var F=c.length+1,k=1,v=0;v<c.length;v++){var L=void 0;typeof f[v]=="number"?L=f[v]:L=k/F,a.addColorStop(L,c[v]),k++}}return a},t.prototype.destroy=function(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},vy,e),i.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(t.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(e){this.updateText(!0);var r=je(this.scale.x)||1;this.scale.x=r*e/this._texture.orig.width,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(e){this.updateText(!0);var r=je(this.scale.y)||1;this.scale.y=r*e/this._texture.orig.height,this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(e){e=e||{},e instanceof lr?this._style=e:this._style=new lr(e),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),t.nextLineHeightBehavior=!1,t.experimentalLetterSpacing=!1,t}(wr);z.UPLOADS_PER_FRAME=4;var vo=function(i,t){return vo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},vo(i,t)};function _y(i,t){vo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var cf=function(){function i(t){this.maxItemsPerFrame=t,this.itemsLeft=0}return i.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},i.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},i}();function gy(i,t){var e=!1;if(i&&i._textures&&i._textures.length){for(var r=0;r<i._textures.length;r++)if(i._textures[r]instanceof it){var n=i._textures[r].baseTexture;t.indexOf(n)===-1&&(t.push(n),e=!0)}}return e}function my(i,t){if(i.baseTexture instanceof lt){var e=i.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function yy(i,t){if(i._texture&&i._texture instanceof it){var e=i._texture.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function xy(i,t){return t instanceof po?(t.updateText(!0),!0):!1}function by(i,t){if(t instanceof lr){var e=t.toFontString();return le.measureFont(e),!0}return!1}function Ty(i,t){if(i instanceof po){t.indexOf(i.style)===-1&&t.push(i.style),t.indexOf(i)===-1&&t.push(i);var e=i._texture.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function Ey(i,t){return i instanceof lr?(t.indexOf(i)===-1&&t.push(i),!0):!1}var df=function(){function i(t){var e=this;this.limiter=new cf(z.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(Ty),this.registerFindHook(Ey),this.registerFindHook(gy),this.registerFindHook(my),this.registerFindHook(yy),this.registerUploadHook(xy),this.registerUploadHook(by)}return i.prototype.upload=function(t,e){var r=this;return typeof t=="function"&&(e=t,t=null),e&&Bt("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(n){t&&r.add(t);var s=function(){e==null||e(),n()};r.queue.length?(r.completes.push(s),r.ticking||(r.ticking=!0,Ot.system.addOnce(r.tick,r,de.UTILITY))):s()})},i.prototype.tick=function(){setTimeout(this.delayedTick,0)},i.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed){for(var r=0,n=this.uploadHooks.length;r<n;r++)if(this.uploadHooks[r](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Ot.system.addOnce(this.tick,this,de.UTILITY);else{this.ticking=!1;var s=this.completes.slice(0);this.completes.length=0;for(var r=0,n=s.length;r<n;r++)s[r]()}},i.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},i.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},i.prototype.add=function(t){for(var e=0,r=this.addHooks.length;e<r&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Zt)for(var e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this},i.prototype.destroy=function(){this.ticking&&Ot.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},i}();function pf(i,t){return t instanceof lt?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function Sy(i,t){if(!(t instanceof vi))return!1;var e=t.geometry;t.finishPoly(),e.updateBatches();for(var r=e.batches,n=0;n<r.length;n++){var s=r[n].style.texture;s&&pf(i,s.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function Py(i,t){return i instanceof vi?(t.push(i),!0):!1}var vf=function(i){_y(t,i);function t(e){var r=i.call(this,e)||this;return r.uploadHookHelper=r.renderer,r.registerFindHook(Py),r.registerUploadHook(pf),r.registerUploadHook(Sy),r}return t.extension={name:"prepare",type:dt.RendererPlugin},t}(df),wy=function(){function i(t){this.maxMilliseconds=t,this.frameStart=0}return i.prototype.beginFrame=function(){this.frameStart=Date.now()},i.prototype.allowedToUpload=function(){return Date.now()-this.frameStart<this.maxMilliseconds},i}();var _f=function(){function i(t,e,r){r===void 0&&(r=null),this.linkedSheets=[],this._texture=t instanceof it?t:null,this.baseTexture=t instanceof lt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var n=this.baseTexture.resource;this.resolution=this._updateResolution(r||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return i.prototype._updateResolution=function(t){t===void 0&&(t=null);var e=this.data.meta.scale,r=Gr(t,null);return r===null&&(r=e!==void 0?parseFloat(e):1),r!==1&&this.baseTexture.setResolution(r),r},i.prototype.parse=function(t){var e=this;return t&&Bt("6.5.0","Spritesheet.parse callback is deprecated, use the return Promise instead."),new Promise(function(r){e._callback=function(n){t==null||t(n),r(n)},e._batchIndex=0,e._frameKeys.length<=i.BATCH_SIZE?(e._processFrames(0),e._processAnimations(),e._parseComplete()):e._nextBatch()})},i.prototype._processFrames=function(t){for(var e=t,r=i.BATCH_SIZE;e-t<r&&e<this._frameKeys.length;){var n=this._frameKeys[e],s=this._frames[n],a=s.frame;if(a){var o=null,h=null,u=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,l=new ut(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);s.rotated?o=new ut(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new ut(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),s.trimmed!==!1&&s.spriteSourceSize&&(h=new ut(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new it(this.baseTexture,o,l,h,s.rotated?2:0,s.anchor),it.addToCache(this.textures[n],n)}e++}},i.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var r=0;r<t[e].length;r++){var n=t[e][r];this.animations[e].push(this.textures[n])}}},i.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},i.prototype._nextBatch=function(){var t=this;this._processFrames(this._batchIndex*i.BATCH_SIZE),this._batchIndex++,setTimeout(function(){t._batchIndex*i.BATCH_SIZE<t._frameKeys.length?t._nextBatch():(t._processAnimations(),t._parseComplete())},0)},i.prototype.destroy=function(t){var e;t===void 0&&(t=!1);for(var r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)===null||e===void 0||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]},i.BATCH_SIZE=1e3,i}(),gf=function(){function i(){}return i.use=function(t,e){var r,n,s=this,a=t.name+"_image";if(!t.data||t.type!==wt.TYPE.JSON||!t.data.frames||s.resources[a]){e();return}var o=(n=(r=t.data)===null||r===void 0?void 0:r.meta)===null||n===void 0?void 0:n.related_multi_packs;if(Array.isArray(o))for(var h=function(v){if(typeof v!="string")return"continue";var _=v.replace(".json",""),p=ce.resolve(t.url.replace(s.baseUrl,""),v);if(s.resources[_]||Object.values(s.resources).some(function(y){return ce.format(ce.parse(y.url))===p}))return"continue";var g={crossOrigin:t.crossOrigin,loadType:wt.LOAD_TYPE.XHR,xhrType:wt.XHR_RESPONSE_TYPE.JSON,parentResource:t,metadata:t.metadata};s.add(_,p,g)},u=0,l=o;u<l.length;u++){var c=l[u];h(c)}var f={crossOrigin:t.crossOrigin,metadata:t.metadata.imageMetadata,parentResource:t},d=i.getResourcePath(t,s.baseUrl);s.add(a,d,f,function(_){if(_.error){e(_.error);return}var p=new _f(_.texture,t.data,t.url);p.parse().then(function(){t.spritesheet=p,t.textures=p.textures,e()})})},i.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:ce.resolve(t.url.replace(e,""),t.data.meta.image)},i.extension=dt.Loader,i}();var _o=function(i,t){return _o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},_o(i,t)};function mf(i,t){_o(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var gi=new vt,Cy=function(i){mf(t,i);function t(e,r,n){r===void 0&&(r=100),n===void 0&&(n=100);var s=i.call(this,e)||this;return s.tileTransform=new Mi,s._width=r,s._height=n,s.uvMatrix=s.texture.uvMatrix||new Gi(e),s.pluginName="tilingSprite",s.uvRespectAnchor=!1,s}return Object.defineProperty(t.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),t.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},t.prototype._render=function(e){var r=this._texture;!r||!r.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},t.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,r=this._height*-this._anchor._y,n=this._width*(1-this._anchor._x),s=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,r,n,s)},t.prototype.getLocalBounds=function(e){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new ut),e=this._localBoundsRect),this._bounds.getRectangle(e)):i.prototype.getLocalBounds.call(this,e)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,gi);var r=this._width,n=this._height,s=-r*this.anchor._x;if(gi.x>=s&&gi.x<s+r){var a=-n*this.anchor._y;if(gi.y>=a&&gi.y<a+n)return!0}return!1},t.prototype.destroy=function(e){i.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},t.from=function(e,r){var n=e instanceof it?e:it.from(e,r);return new t(n,r.width,r.height)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),t}(wr),Iy=`#version 100
|
|
542
|
+
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
543
|
+
|
|
544
|
+
precision lowp float;
|
|
545
|
+
|
|
546
|
+
varying vec2 vTextureCoord;
|
|
547
|
+
|
|
548
|
+
uniform sampler2D uSampler;
|
|
549
|
+
uniform vec4 uColor;
|
|
550
|
+
|
|
551
|
+
void main(void)
|
|
552
|
+
{
|
|
553
|
+
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
554
|
+
gl_FragColor = texSample * uColor;
|
|
555
|
+
}
|
|
556
|
+
`,yf=`#version 100
|
|
557
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
558
|
+
|
|
559
|
+
precision lowp float;
|
|
560
|
+
|
|
561
|
+
attribute vec2 aVertexPosition;
|
|
562
|
+
attribute vec2 aTextureCoord;
|
|
563
|
+
|
|
564
|
+
uniform mat3 projectionMatrix;
|
|
565
|
+
uniform mat3 translationMatrix;
|
|
566
|
+
uniform mat3 uTransform;
|
|
567
|
+
|
|
568
|
+
varying vec2 vTextureCoord;
|
|
569
|
+
|
|
570
|
+
void main(void)
|
|
571
|
+
{
|
|
572
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
573
|
+
|
|
574
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
575
|
+
}
|
|
576
|
+
`,Ay=`#version 100
|
|
577
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
578
|
+
#extension GL_EXT_shader_texture_lod : enable
|
|
579
|
+
#endif
|
|
580
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
581
|
+
|
|
582
|
+
precision lowp float;
|
|
583
|
+
|
|
584
|
+
varying vec2 vTextureCoord;
|
|
585
|
+
|
|
586
|
+
uniform sampler2D uSampler;
|
|
587
|
+
uniform vec4 uColor;
|
|
588
|
+
uniform mat3 uMapCoord;
|
|
589
|
+
uniform vec4 uClampFrame;
|
|
590
|
+
uniform vec2 uClampOffset;
|
|
591
|
+
|
|
592
|
+
void main(void)
|
|
593
|
+
{
|
|
594
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
595
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
596
|
+
vec2 unclamped = coord;
|
|
597
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
598
|
+
|
|
599
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
600
|
+
vec4 texSample = unclamped == coord
|
|
601
|
+
? texture2D(uSampler, coord)
|
|
602
|
+
: texture2DLodEXT(uSampler, coord, 0);
|
|
603
|
+
#else
|
|
604
|
+
vec4 texSample = texture2D(uSampler, coord);
|
|
605
|
+
#endif
|
|
606
|
+
|
|
607
|
+
gl_FragColor = texSample * uColor;
|
|
608
|
+
}
|
|
609
|
+
`,My=`#version 300 es
|
|
610
|
+
#define SHADER_NAME Tiling-Sprite-300
|
|
611
|
+
|
|
612
|
+
precision lowp float;
|
|
613
|
+
|
|
614
|
+
in vec2 aVertexPosition;
|
|
615
|
+
in vec2 aTextureCoord;
|
|
616
|
+
|
|
617
|
+
uniform mat3 projectionMatrix;
|
|
618
|
+
uniform mat3 translationMatrix;
|
|
619
|
+
uniform mat3 uTransform;
|
|
620
|
+
|
|
621
|
+
out vec2 vTextureCoord;
|
|
622
|
+
|
|
623
|
+
void main(void)
|
|
624
|
+
{
|
|
625
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
626
|
+
|
|
627
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
628
|
+
}
|
|
629
|
+
`,Ry=`#version 300 es
|
|
630
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
631
|
+
|
|
632
|
+
precision lowp float;
|
|
633
|
+
|
|
634
|
+
in vec2 vTextureCoord;
|
|
635
|
+
|
|
636
|
+
out vec4 fragmentColor;
|
|
637
|
+
|
|
638
|
+
uniform sampler2D uSampler;
|
|
639
|
+
uniform vec4 uColor;
|
|
640
|
+
uniform mat3 uMapCoord;
|
|
641
|
+
uniform vec4 uClampFrame;
|
|
642
|
+
uniform vec2 uClampOffset;
|
|
643
|
+
|
|
644
|
+
void main(void)
|
|
645
|
+
{
|
|
646
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
647
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
648
|
+
vec2 unclamped = coord;
|
|
649
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
650
|
+
|
|
651
|
+
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
|
652
|
+
|
|
653
|
+
fragmentColor = texSample * uColor;
|
|
654
|
+
}
|
|
655
|
+
`,vn=new bt,xf=function(i){mf(t,i);function t(e){var r=i.call(this,e)||this;return e.runners.contextChange.add(r),r.quad=new Ls,r.state=Oe.for2d(),r}return t.prototype.contextChange=function(){var e=this.renderer,r={globals:e.globalUniforms};this.simpleShader=be.from(yf,Iy,r),this.shader=e.context.webGLVersion>1?be.from(My,Ry,r):be.from(yf,Ay,r)},t.prototype.render=function(e){var r=this.renderer,n=this.quad,s=n.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);var a=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;s=n.uvs,s[0]=s[6]=-a,s[1]=s[3]=-o,s[2]=s[4]=1-a,s[5]=s[7]=1-o,n.invalidate();var h=e._texture,u=h.baseTexture,l=u.alphaMode>0,c=e.tileTransform.localTransform,f=e.uvMatrix,d=u.isPowerOfTwo&&h.frame.width===u.width&&h.frame.height===u.height;d&&(u._glTextures[r.CONTEXT_UID]?d=u.wrapMode!==ne.CLAMP:u.wrapMode===ne.CLAMP&&(u.wrapMode=ne.REPEAT));var v=d?this.simpleShader:this.shader,_=h.width,p=h.height,g=e._width,y=e._height;vn.set(c.a*_/g,c.b*_/y,c.c*p/g,c.d*p/y,c.tx/g,c.ty/y),vn.invert(),d?vn.prepend(f.mapCoord):(v.uniforms.uMapCoord=f.mapCoord.toArray(!0),v.uniforms.uClampFrame=f.uClampFrame,v.uniforms.uClampOffset=f.uClampOffset),v.uniforms.uTransform=vn.toArray(!0),v.uniforms.uColor=_s(e.tint,e.worldAlpha,v.uniforms.uColor,l),v.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),v.uniforms.uSampler=h,r.shader.bind(v),r.geometry.bind(n),this.state.blendMode=vs(e.blendMode,l),r.state.set(this.state),r.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},t.extension={name:"tilingSprite",type:dt.RendererPlugin},t}(zr);var go=function(i,t){return go=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},go(i,t)};function mo(i,t){go(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var bf=function(){function i(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return i.prototype.update=function(t){if(!(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},i}(),yo=new vt,Tf=new Hr,Ir=function(i){mo(t,i);function t(e,r,n,s){s===void 0&&(s=jt.TRIANGLES);var a=i.call(this)||this;return a.geometry=e,a.shader=r,a.state=n||Oe.for2d(),a.drawMode=s,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=z.ROUND_PIXELS,a.batchUvs=null,a}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},set:function(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this.shader},set:function(e){this.shader=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(e){this.shader.tint=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(e){this.shader.texture=e},enumerable:!1,configurable:!0}),t.prototype._render=function(e){var r=this.geometry.buffers[0].data,n=this.shader;n.batchable&&this.drawMode===jt.TRIANGLES&&r.length<t.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)},t.prototype._renderDefault=function(e){var r=this.shader;r.alpha=this.worldAlpha,r.update&&r.update(),e.batch.flush(),r.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(r),e.state.set(this.state),e.geometry.bind(this.geometry,r),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},t.prototype._renderToBatch=function(e){var r=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=r.indexBuffer.data,this._tintRGB=n._tintRGB,this._texture=n.texture;var s=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[s]),e.plugins[s].render(this)},t.prototype.calculateVertices=function(){var e=this.geometry,r=e.buffers[0],n=r.data,s=r._updateID;if(!(s===this.vertexDirty&&this._transformID===this.transform._worldID)){this._transformID=this.transform._worldID,this.vertexData.length!==n.length&&(this.vertexData=new Float32Array(n.length));for(var a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,c=a.tx,f=a.ty,d=this.vertexData,v=0;v<d.length/2;v++){var _=n[v*2],p=n[v*2+1];d[v*2]=o*_+u*p+c,d[v*2+1]=h*_+l*p+f}if(this._roundPixels)for(var g=z.RESOLUTION,v=0;v<d.length;++v)d[v]=Math.round((d[v]*g|0)/g);this.vertexDirty=s}},t.prototype.calculateUvs=function(){var e=this.geometry.buffers[1],r=this.shader;r.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new bf(e,r.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},t.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},t.prototype.containsPoint=function(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,yo);for(var r=this.geometry.getBuffer("aVertexPosition").data,n=Tf.points,s=this.geometry.getIndex().data,a=s.length,o=this.drawMode===4?3:1,h=0;h+2<a;h+=o){var u=s[h]*2,l=s[h+1]*2,c=s[h+2]*2;if(n[0]=r[u],n[1]=r[u+1],n[2]=r[l],n[3]=r[l+1],n[4]=r[c],n[5]=r[c+1],Tf.contains(yo.x,yo.y))return!0}return!1},t.prototype.destroy=function(e){i.prototype.destroy.call(this,e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},t.BATCHABLE_SIZE=100,t}(Zt),Oy=`varying vec2 vTextureCoord;
|
|
656
|
+
uniform vec4 uColor;
|
|
657
|
+
|
|
658
|
+
uniform sampler2D uSampler;
|
|
659
|
+
|
|
660
|
+
void main(void)
|
|
661
|
+
{
|
|
662
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
663
|
+
}
|
|
664
|
+
`,Dy=`attribute vec2 aVertexPosition;
|
|
665
|
+
attribute vec2 aTextureCoord;
|
|
666
|
+
|
|
667
|
+
uniform mat3 projectionMatrix;
|
|
668
|
+
uniform mat3 translationMatrix;
|
|
669
|
+
uniform mat3 uTextureMatrix;
|
|
670
|
+
|
|
671
|
+
varying vec2 vTextureCoord;
|
|
672
|
+
|
|
673
|
+
void main(void)
|
|
674
|
+
{
|
|
675
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
676
|
+
|
|
677
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
678
|
+
}
|
|
679
|
+
`,Ar=function(i){mo(t,i);function t(e,r){var n=this,s={uSampler:e,alpha:1,uTextureMatrix:bt.IDENTITY,uColor:new Float32Array([1,1,1,1])};return r=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},r),r.uniforms&&Object.assign(s,r.uniforms),n=i.call(this,r.program||_r.from(Dy,Oy),s)||this,n._colorDirty=!1,n.uvMatrix=new Gi(e),n.batchable=r.program===void 0,n.pluginName=r.pluginName,n.tint=r.tint,n.alpha=r.alpha,n}return Object.defineProperty(t.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){e!==this._tint&&(this._tint=e,this._tintRGB=(e>>16)+(e&65280)+((e&255)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),t.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;_s(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},t}(be),mi=function(i){mo(t,i);function t(e,r,n){var s=i.call(this)||this,a=new Mt(e),o=new Mt(r,!0),h=new Mt(n,!0,!0);return s.addAttribute("aVertexPosition",a,2,!1,Q.FLOAT).addAttribute("aTextureCoord",o,2,!1,Q.FLOAT).addIndex(h),s._updateId=-1,s}return Object.defineProperty(t.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),t}(vr);var xo=function(i,t){return xo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},xo(i,t)};function Fy(i,t){xo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var yi=function(){function i(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}return i}(),Ef=function(){function i(){}return i.test=function(t){return typeof t=="string"&&t.indexOf("info face=")===0},i.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var n in e){var s=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var h in a){var u=a[h].split("="),l=u[0],c=u[1].replace(/"/gm,""),f=parseFloat(c),d=isNaN(f)?c:f;o[l]=d}r[s].push(o)}var v=new yi;return r.info.forEach(function(_){return v.info.push({face:_.face,size:parseInt(_.size,10)})}),r.common.forEach(function(_){return v.common.push({lineHeight:parseInt(_.lineHeight,10)})}),r.page.forEach(function(_){return v.page.push({id:parseInt(_.id,10),file:_.file})}),r.char.forEach(function(_){return v.char.push({id:parseInt(_.id,10),page:parseInt(_.page,10),x:parseInt(_.x,10),y:parseInt(_.y,10),width:parseInt(_.width,10),height:parseInt(_.height,10),xoffset:parseInt(_.xoffset,10),yoffset:parseInt(_.yoffset,10),xadvance:parseInt(_.xadvance,10)})}),r.kerning.forEach(function(_){return v.kerning.push({first:parseInt(_.first,10),second:parseInt(_.second,10),amount:parseInt(_.amount,10)})}),r.distanceField.forEach(function(_){return v.distanceField.push({distanceRange:parseInt(_.distanceRange,10),fieldType:_.fieldType})}),v},i}(),_n=function(){function i(){}return i.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},i.parse=function(t){for(var e=new yi,r=t.getElementsByTagName("info"),n=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField"),u=0;u<r.length;u++)e.info.push({face:r[u].getAttribute("face"),size:parseInt(r[u].getAttribute("size"),10)});for(var u=0;u<n.length;u++)e.common.push({lineHeight:parseInt(n[u].getAttribute("lineHeight"),10)});for(var u=0;u<s.length;u++)e.page.push({id:parseInt(s[u].getAttribute("id"),10)||0,file:s[u].getAttribute("file")});for(var u=0;u<a.length;u++){var l=a[u];e.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(var u=0;u<o.length;u++)e.kerning.push({first:parseInt(o[u].getAttribute("first"),10),second:parseInt(o[u].getAttribute("second"),10),amount:parseInt(o[u].getAttribute("amount"),10)});for(var u=0;u<h.length;u++)e.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return e},i}(),Sf=function(){function i(){}return i.test=function(t){if(typeof t=="string"&&t.indexOf("<font>")>-1){var e=new globalThis.DOMParser().parseFromString(t,"text/xml");return _n.test(e)}return!1},i.parse=function(t){var e=new globalThis.DOMParser().parseFromString(t,"text/xml");return _n.parse(e)},i}(),bo=[Ef,_n,Sf];function To(i){for(var t=0;t<bo.length;t++)if(bo[t].test(i))return bo[t];return null}function Ly(i,t,e,r,n,s){var a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;var o,h=e.dropShadow?e.dropShadowDistance:0,u=e.padding||0,l=i.width/r-h-u*2,c=i.height/r-h-u*2,f=a.slice(),d=e.fillGradientStops.slice();if(!d.length)for(var v=f.length+1,_=1;_<v;++_)d.push(_/v);if(f.unshift(a[0]),d.unshift(0),f.push(a[a.length-1]),d.push(1),e.fillGradientType===Cr.LINEAR_VERTICAL){o=t.createLinearGradient(l/2,u,l/2,c+u);for(var p=0,g=s.fontProperties.fontSize+e.strokeThickness,y=g/c,_=0;_<n.length;_++)for(var T=s.lineHeight*_,I=0;I<f.length;I++){var m=0;typeof d[I]=="number"?m=d[I]:m=I/f.length;var S=T/c+m*y,x=Math.max(p,S);x=Math.min(x,1),o.addColorStop(x,f[I]),p=x}}else{o=t.createLinearGradient(u,c/2,l+u,c/2);for(var N=f.length+1,D=1,_=0;_<f.length;_++){var F=void 0;typeof d[_]=="number"?F=d[_]:F=D/N,o.addColorStop(F,f[_]),D++}}return o}function By(i,t,e,r,n,s,a){var o=e.text,h=e.fontProperties;t.translate(r,n),t.scale(s,s);var u=a.strokeThickness/2,l=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=Ly(i,t,a,s,[o],e),t.strokeStyle=a.stroke,a.dropShadow){var c=a.dropShadowColor,f=He(typeof c=="number"?c:ds(c)),d=a.dropShadowBlur*s,v=a.dropShadowDistance*s;t.shadowColor="rgba("+f[0]*255+","+f[1]*255+","+f[2]*255+","+a.dropShadowAlpha+")",t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*v,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*v}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(o,u,l+e.lineHeight-h.descent),a.fill&&t.fillText(o,u,l+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Pf(i){return Array.from?Array.from(i):i.split("")}function Ny(i){typeof i=="string"&&(i=[i]);for(var t=[],e=0,r=i.length;e<r;e++){var n=i[e];if(Array.isArray(n)){if(n.length!==2)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(var o=s,h=a;o<=h;o++)t.push(String.fromCharCode(o))}else t.push.apply(t,Pf(n))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}function gn(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}var we=function(){function i(t,e,r){var n,s,a=t.info[0],o=t.common[0],h=t.page[0],u=t.distanceField[0],l=Gr(h.file),c={};this._ownsTextures=r,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/l,this.chars={},this.pageTextures=c;for(var f=0;f<t.page.length;f++){var d=t.page[f],v=d.id,_=d.file;c[v]=e instanceof Array?e[f]:e[_],u!=null&&u.fieldType&&u.fieldType!=="none"&&(c[v].baseTexture.alphaMode=Wt.NO_PREMULTIPLIED_ALPHA,c[v].baseTexture.mipmap=zt.OFF)}for(var f=0;f<t.char.length;f++){var p=t.char[f],v=p.id,g=p.page,y=t.char[f],T=y.x,I=y.y,m=y.width,S=y.height,x=y.xoffset,N=y.yoffset,D=y.xadvance;T/=l,I/=l,m/=l,S/=l,x/=l,N/=l,D/=l;var F=new ut(T+c[g].frame.x/l,I+c[g].frame.y/l,m,S);this.chars[v]={xOffset:x,yOffset:N,xAdvance:D,kerning:{},texture:new it(c[g].baseTexture,F),page:g}}for(var f=0;f<t.kerning.length;f++){var k=t.kerning[f],L=k.first,q=k.second,Z=k.amount;L/=l,q/=l,Z/=l,this.chars[q]&&(this.chars[q].kerning[L]=Z)}this.distanceFieldRange=u==null?void 0:u.distanceRange,this.distanceFieldType=(s=(n=u==null?void 0:u.fieldType)===null||n===void 0?void 0:n.toLowerCase())!==null&&s!==void 0?s:"none"}return i.prototype.destroy=function(){for(var t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(var t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null},i.install=function(t,e,r){var n;if(t instanceof yi)n=t;else{var s=To(t);if(!s)throw new Error("Unrecognized data format for font.");n=s.parse(t)}e instanceof it&&(e=[e]);var a=new i(n,e,r);return i.available[a.font]=a,a},i.uninstall=function(t){var e=i.available[t];if(!e)throw new Error("No font found named '"+t+"'");e.destroy(),delete i.available[t]},i.from=function(t,e,r){if(!t)throw new Error("[BitmapFont] Property `name` is required.");var n=Object.assign({},i.defaultOptions,r),s=n.chars,a=n.padding,o=n.resolution,h=n.textureWidth,u=n.textureHeight,l=Ny(s),c=e instanceof lr?e:new lr(e),f=h,d=new yi;d.info[0]={face:c.fontFamily,size:c.fontSize},d.common[0]={lineHeight:c.fontSize};for(var v=0,_=0,p,g,y,T=0,I=[],m=0;m<l.length;m++){p||(p=z.ADAPTER.createCanvas(),p.width=h,p.height=u,g=p.getContext("2d"),y=new lt(p,{resolution:o}),I.push(new it(y)),d.page.push({id:I.length-1,file:""}));var S=l[m],x=le.measureText(S,c,!1,p),N=x.width,D=Math.ceil(x.height),F=Math.ceil((c.fontStyle==="italic"?2:1)*N);if(_>=u-D*o){if(_===0)throw new Error("[BitmapFont] textureHeight "+u+"px is too small "+("(fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+S+"')"));--m,p=null,g=null,y=null,_=0,v=0,T=0;continue}if(T=Math.max(D+x.fontProperties.descent,T),F*o+v>=f){if(v===0)throw new Error("[BitmapFont] textureWidth "+h+"px is too small "+("(fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+S+"')"));--m,_+=T*o,_=Math.ceil(_),v=0,T=0;continue}By(p,g,x,v,_,o,c);var k=gn(x.text);d.char.push({id:k,page:I.length-1,x:v/o,y:_/o,width:F,height:D,xoffset:0,yoffset:0,xadvance:Math.ceil(N-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),v+=(F+2*a)*o,v=Math.ceil(v)}if(!(r!=null&&r.skipKerning))for(var m=0,L=l.length;m<L;m++)for(var q=l[m],Z=0;Z<L;Z++){var G=l[Z],b=g.measureText(q).width,P=g.measureText(G).width,E=g.measureText(q+G).width,A=E-(b+P);A&&d.kerning.push({first:gn(q),second:gn(G),amount:A})}var C=new i(d,I,!0);return i.available[t]!==void 0&&i.uninstall(t),i.available[t]=C,C},i.ALPHA=[["a","z"],["A","Z"]," "],i.NUMERIC=[["0","9"]],i.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],i.ASCII=[[" ","~"]],i.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:i.ALPHANUMERIC},i.available={},i}(),Uy=`// Pixi texture info\r
|
|
680
|
+
varying vec2 vTextureCoord;\r
|
|
681
|
+
uniform sampler2D uSampler;\r
|
|
682
|
+
\r
|
|
683
|
+
// Tint\r
|
|
684
|
+
uniform vec4 uColor;\r
|
|
685
|
+
\r
|
|
686
|
+
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
|
687
|
+
uniform float uFWidth;\r
|
|
688
|
+
\r
|
|
689
|
+
void main(void) {\r
|
|
690
|
+
\r
|
|
691
|
+
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
|
692
|
+
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
|
693
|
+
\r
|
|
694
|
+
// MSDF\r
|
|
695
|
+
float median = texColor.r + texColor.g + texColor.b -\r
|
|
696
|
+
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
|
697
|
+
max(texColor.r, max(texColor.g, texColor.b));\r
|
|
698
|
+
// SDF\r
|
|
699
|
+
median = min(median, texColor.a);\r
|
|
700
|
+
\r
|
|
701
|
+
float screenPxDistance = uFWidth * (median - 0.5);\r
|
|
702
|
+
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
|
703
|
+
if (median < 0.01) {\r
|
|
704
|
+
alpha = 0.0;\r
|
|
705
|
+
} else if (median > 0.99) {\r
|
|
706
|
+
alpha = 1.0;\r
|
|
707
|
+
}\r
|
|
708
|
+
\r
|
|
709
|
+
// NPM Textures, NPM outputs\r
|
|
710
|
+
gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r
|
|
711
|
+
\r
|
|
712
|
+
}\r
|
|
713
|
+
`,ky=`// Mesh material default fragment\r
|
|
714
|
+
attribute vec2 aVertexPosition;\r
|
|
715
|
+
attribute vec2 aTextureCoord;\r
|
|
716
|
+
\r
|
|
717
|
+
uniform mat3 projectionMatrix;\r
|
|
718
|
+
uniform mat3 translationMatrix;\r
|
|
719
|
+
uniform mat3 uTextureMatrix;\r
|
|
720
|
+
\r
|
|
721
|
+
varying vec2 vTextureCoord;\r
|
|
722
|
+
\r
|
|
723
|
+
void main(void)\r
|
|
724
|
+
{\r
|
|
725
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
|
726
|
+
\r
|
|
727
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
728
|
+
}\r
|
|
729
|
+
`,wf=[],Cf=[],If=[],Gy=function(i){Fy(t,i);function t(e,r){r===void 0&&(r={});var n=i.call(this)||this;n._tint=16777215;var s=Object.assign({},t.styleDefaults,r),a=s.align,o=s.tint,h=s.maxWidth,u=s.letterSpacing,l=s.fontName,c=s.fontSize;if(!we.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=a,n._tint=o,n._font=void 0,n._fontName=l,n._fontSize=c,n.text=e,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Ae(function(){n.dirty=!0},n,0,0),n._roundPixels=z.ROUND_PIXELS,n.dirty=!0,n._resolution=z.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}return t.prototype.updateText=function(){for(var e,r=we.available[this._fontName],n=this.fontSize,s=n/r.size,a=new vt,o=[],h=[],u=[],l=this._text.replace(/(?:\r\n|\r)/g,`
|
|
730
|
+
`)||" ",c=Pf(l),f=this._maxWidth*r.size/n,d=r.distanceFieldType==="none"?wf:Cf,v=null,_=0,p=0,g=0,y=-1,T=0,I=0,m=0,S=0,x=0;x<c.length;x++){var N=c[x],D=gn(N);if(/(?:\s)/.test(N)&&(y=x,T=_,S++),N==="\r"||N===`
|
|
731
|
+
`){h.push(_),u.push(-1),p=Math.max(p,_),++g,++I,a.x=0,a.y+=r.lineHeight,v=null,S=0;continue}var F=r.chars[D];if(F){v&&F.kerning[v]&&(a.x+=F.kerning[v]);var k=If.pop()||{texture:it.EMPTY,line:0,charCode:0,prevSpaces:0,position:new vt};k.texture=F.texture,k.line=g,k.charCode=D,k.position.x=a.x+F.xOffset+this._letterSpacing/2,k.position.y=a.y+F.yOffset,k.prevSpaces=S,o.push(k),_=k.position.x+Math.max(F.xAdvance-F.xOffset,F.texture.orig.width),a.x+=F.xAdvance+this._letterSpacing,m=Math.max(m,F.yOffset+F.texture.height),v=D,y!==-1&&f>0&&a.x>f&&(++I,Ve(o,1+y-I,1+x-y),x=y,y=-1,h.push(T),u.push(o.length>0?o[o.length-1].prevSpaces:0),p=Math.max(p,T),g++,a.x=0,a.y+=r.lineHeight,v=null,S=0)}}var L=c[c.length-1];L!=="\r"&&L!==`
|
|
732
|
+
`&&(/(?:\s)/.test(L)&&(_=T),h.push(_),p=Math.max(p,_),u.push(-1));for(var q=[],x=0;x<=g;x++){var Z=0;this._align==="right"?Z=p-h[x]:this._align==="center"?Z=(p-h[x])/2:this._align==="justify"&&(Z=u[x]<0?0:(p-h[x])/u[x]),q.push(Z)}var G=o.length,b={},P=[],E=this._activePagesMeshData;d.push.apply(d,E);for(var x=0;x<G;x++){var A=o[x].texture,C=A.baseTexture.uid;if(!b[C]){var w=d.pop();if(!w){var M=new mi,R=void 0,U=void 0;r.distanceFieldType==="none"?(R=new Ar(it.EMPTY),U=tt.NORMAL):(R=new Ar(it.EMPTY,{program:_r.from(ky,Uy),uniforms:{uFWidth:0}}),U=tt.NORMAL_NPM);var X=new Ir(M,R);X.blendMode=U,w={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}}w.index=0,w.indexCount=0,w.vertexCount=0,w.uvsCount=0,w.total=0;var W=this._textureCache;W[C]=W[C]||new it(A.baseTexture),w.mesh.texture=W[C],w.mesh.tint=this._tint,P.push(w),b[C]=w}b[C].total++}for(var x=0;x<E.length;x++)P.indexOf(E[x])===-1&&this.removeChild(E[x].mesh);for(var x=0;x<P.length;x++)P[x].mesh.parent!==this&&this.addChild(P[x].mesh);this._activePagesMeshData=P;for(var x in b){var w=b[x],V=w.total;if(!(((e=w.indices)===null||e===void 0?void 0:e.length)>6*V)||w.vertices.length<Ir.BATCHABLE_SIZE*2)w.vertices=new Float32Array(4*2*V),w.uvs=new Float32Array(4*2*V),w.indices=new Uint16Array(6*V);else for(var Y=w.total,K=w.vertices,j=Y*4*2;j<K.length;j++)K[j]=0;w.mesh.size=6*V}for(var x=0;x<G;x++){var N=o[x],et=N.position.x+q[N.line]*(this._align==="justify"?N.prevSpaces:1);this._roundPixels&&(et=Math.round(et));var nt=et*s,ft=N.position.y*s,A=N.texture,J=b[A.baseTexture.uid],$=A.frame,rt=A._uvs,ot=J.index++;J.indices[ot*6+0]=0+ot*4,J.indices[ot*6+1]=1+ot*4,J.indices[ot*6+2]=2+ot*4,J.indices[ot*6+3]=0+ot*4,J.indices[ot*6+4]=2+ot*4,J.indices[ot*6+5]=3+ot*4,J.vertices[ot*8+0]=nt,J.vertices[ot*8+1]=ft,J.vertices[ot*8+2]=nt+$.width*s,J.vertices[ot*8+3]=ft,J.vertices[ot*8+4]=nt+$.width*s,J.vertices[ot*8+5]=ft+$.height*s,J.vertices[ot*8+6]=nt,J.vertices[ot*8+7]=ft+$.height*s,J.uvs[ot*8+0]=rt.x0,J.uvs[ot*8+1]=rt.y0,J.uvs[ot*8+2]=rt.x1,J.uvs[ot*8+3]=rt.y1,J.uvs[ot*8+4]=rt.x2,J.uvs[ot*8+5]=rt.y2,J.uvs[ot*8+6]=rt.x3,J.uvs[ot*8+7]=rt.y3}this._textWidth=p*s,this._textHeight=(a.y+r.lineHeight)*s;for(var x in b){var w=b[x];if(this.anchor.x!==0||this.anchor.y!==0)for(var Ht=0,Ue=this._textWidth*this.anchor.x,Rr=this._textHeight*this.anchor.y,yn=0;yn<w.total;yn++)w.vertices[Ht++]-=Ue,w.vertices[Ht++]-=Rr,w.vertices[Ht++]-=Ue,w.vertices[Ht++]-=Rr,w.vertices[Ht++]-=Ue,w.vertices[Ht++]-=Rr,w.vertices[Ht++]-=Ue,w.vertices[Ht++]-=Rr;this._maxLineHeight=m*s;var xn=w.mesh.geometry.getBuffer("aVertexPosition"),bn=w.mesh.geometry.getBuffer("aTextureCoord"),xi=w.mesh.geometry.getIndex();xn.data=w.vertices,bn.data=w.uvs,xi.data=w.indices,xn.update(),bn.update(),xi.update()}for(var x=0;x<o.length;x++)If.push(o[x]);this._font=r,this.dirty=!1},t.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},t.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);var r=we.available[this._fontName],n=r.distanceFieldRange,s=r.distanceFieldType,a=r.size;if(s!=="none")for(var o=this.worldTransform,h=o.a,u=o.b,l=o.c,c=o.d,f=Math.sqrt(h*h+u*u),d=Math.sqrt(l*l+c*c),v=(Math.abs(f)+Math.abs(d))/2,_=this.fontSize/a,p=0,g=this._activePagesMeshData;p<g.length;p++){var y=g[p];y.mesh.shader.uniforms.uFWidth=v*n*_*this._resolution}i.prototype._render.call(this,e)},t.prototype.getLocalBounds=function(){return this.validate(),i.prototype.getLocalBounds.call(this)},t.prototype.validate=function(){var e=we.available[this._fontName];if(!e)throw new Error('Missing BitmapFont "'+this._fontName+'"');this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()},Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var r=0;r<this._activePagesMeshData.length;r++)this._activePagesMeshData[r].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!we.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){var e;return(e=this._fontSize)!==null&&e!==void 0?e:we.available[this._fontName].size},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anchor",{get:function(){return this._anchor},set:function(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e){var r=this._textureCache,n=we.available[this._fontName],s=n.distanceFieldType==="none"?wf:Cf;s.push.apply(s,this._activePagesMeshData);for(var a=0,o=this._activePagesMeshData;a<o.length;a++){var h=o[a];this.removeChild(h.mesh)}this._activePagesMeshData=[],s.filter(function(c){return r[c.mesh.texture.baseTexture.uid]}).forEach(function(c){c.mesh.texture=it.EMPTY});for(var u in r){var l=r[u];l.destroy(),delete r[u]}this._font=null,this._textureCache=null,i.prototype.destroy.call(this,e)},t.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},t}(Zt),Af=function(){function i(){}return i.add=function(){wt.setExtensionXhrType("fnt",wt.XHR_RESPONSE_TYPE.TEXT)},i.use=function(t,e){var r=To(t.data);if(!r){e();return}for(var n=i.getBaseUrl(this,t),s=r.parse(t.data),a={},o=function(_){a[_.metadata.pageFile]=_.texture,Object.keys(a).length===s.page.length&&(t.bitmapFont=we.install(s,a,!0),e())},h=0;h<s.page.length;++h){var u=s.page[h].file,l=n+u,c=!1;for(var f in this.resources){var d=this.resources[f];if(d.url===l){d.metadata.pageFile=u,d.texture?o(d):d.onAfterMiddleware.add(o),c=!0;break}}if(!c){var v={crossOrigin:t.crossOrigin,loadType:wt.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},t.metadata.imageMetadata),parentResource:t};this.add(l,v,o)}}},i.getBaseUrl=function(t,e){var r=e.isDataUrl?"":i.dirname(e.url);return e.isDataUrl&&(r==="."&&(r=""),t.baseUrl&&r&&t.baseUrl.charAt(t.baseUrl.length-1)==="/"&&(r+="/")),r=r.replace(t.baseUrl,""),r&&r.charAt(r.length-1)!=="/"&&(r+="/"),r},i.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":e===""?"/":e},i.extension=dt.Loader,i}();var Eo=function(i,t){return Eo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Eo(i,t)};function Xy(i,t){Eo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Hy=`varying vec2 vTextureCoord;
|
|
733
|
+
|
|
734
|
+
uniform sampler2D uSampler;
|
|
735
|
+
uniform float uAlpha;
|
|
736
|
+
|
|
737
|
+
void main(void)
|
|
738
|
+
{
|
|
739
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
740
|
+
}
|
|
741
|
+
`,Vy=function(i){Xy(t,i);function t(e){e===void 0&&(e=1);var r=i.call(this,Du,Hy,{uAlpha:1})||this;return r.alpha=e,r}return Object.defineProperty(t.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0}),t}(Te);var So=function(i,t){return So=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},So(i,t)};function Mf(i,t){So(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var jy=`
|
|
742
|
+
attribute vec2 aVertexPosition;
|
|
743
|
+
|
|
744
|
+
uniform mat3 projectionMatrix;
|
|
745
|
+
|
|
746
|
+
uniform float strength;
|
|
747
|
+
|
|
748
|
+
varying vec2 vBlurTexCoords[%size%];
|
|
749
|
+
|
|
750
|
+
uniform vec4 inputSize;
|
|
751
|
+
uniform vec4 outputFrame;
|
|
752
|
+
|
|
753
|
+
vec4 filterVertexPosition( void )
|
|
754
|
+
{
|
|
755
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
756
|
+
|
|
757
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
vec2 filterTextureCoord( void )
|
|
761
|
+
{
|
|
762
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
void main(void)
|
|
766
|
+
{
|
|
767
|
+
gl_Position = filterVertexPosition();
|
|
768
|
+
|
|
769
|
+
vec2 textureCoord = filterTextureCoord();
|
|
770
|
+
%blur%
|
|
771
|
+
}`;function zy(i,t){var e=Math.ceil(i/2),r=jy,n="",s;t?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a<i;a++){var o=s.replace("%index%",a.toString());o=o.replace("%sampleIndex%",a-(e-1)+".0"),n+=o,n+=`
|
|
772
|
+
`}return r=r.replace("%blur%",n),r=r.replace("%size%",i.toString()),r}var Wy={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Yy=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
773
|
+
`);function qy(i){for(var t=Wy[i],e=t.length,r=Yy,n="",s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;",a,o=0;o<i;o++){var h=s.replace("%index%",o.toString());a=o,o>=e&&(a=i-o-1),h=h.replace("%value%",t[a].toString()),n+=h,n+=`
|
|
774
|
+
`}return r=r.replace("%blur%",n),r=r.replace("%size%",i.toString()),r}var Po=function(i){Mf(t,i);function t(e,r,n,s,a){r===void 0&&(r=8),n===void 0&&(n=4),s===void 0&&(s=z.FILTER_RESOLUTION),a===void 0&&(a=5);var o=this,h=zy(a,e),u=qy(a);return o=i.call(this,h,u)||this,o.horizontal=e,o.resolution=s,o._quality=0,o.quality=n,o.blur=r,o}return t.prototype.apply=function(e,r,n,s){if(n?this.horizontal?this.uniforms.strength=1/n.width*(n.width/r.width):this.uniforms.strength=1/n.height*(n.height/r.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/r.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/r.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,r,n,s);else{var a=e.getFilterTexture(),o=e.renderer,h=r,u=a;this.state.blend=!1,e.applyFilter(this,h,u,Yt.CLEAR);for(var l=1;l<this.passes-1;l++){e.bindAndClear(h,Yt.BLIT),this.uniforms.uSampler=u;var c=u;u=h,h=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,u,n,s),e.returnFilterTexture(a)}},Object.defineProperty(t.prototype,"blur",{get:function(){return this.strength},set:function(e){this.padding=1+Math.abs(e)*2,this.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quality",{get:function(){return this._quality},set:function(e){this._quality=e,this.passes=e},enumerable:!1,configurable:!0}),t}(Te),$y=function(i){Mf(t,i);function t(e,r,n,s){e===void 0&&(e=8),r===void 0&&(r=4),n===void 0&&(n=z.FILTER_RESOLUTION),s===void 0&&(s=5);var a=i.call(this)||this;return a.blurXFilter=new Po(!0,e,r,n,s),a.blurYFilter=new Po(!1,e,r,n,s),a.resolution=n,a.quality=r,a.blur=e,a.repeatEdgePixels=!1,a}return t.prototype.apply=function(e,r,n,s){var a=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(a&&o){var h=e.getFilterTexture();this.blurXFilter.apply(e,r,h,Yt.CLEAR),this.blurYFilter.apply(e,h,n,s),e.returnFilterTexture(h)}else o?this.blurYFilter.apply(e,r,n,s):this.blurXFilter.apply(e,r,n,s)},t.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2},Object.defineProperty(t.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(e){this.blurXFilter.quality=this.blurYFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(e){this.blurYFilter.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(e){this._repeatEdgePixels=e,this.updatePadding()},enumerable:!1,configurable:!0}),t}(Te);var wo=function(i,t){return wo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},wo(i,t)};function Ky(i,t){wo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Zy=`varying vec2 vTextureCoord;
|
|
775
|
+
uniform sampler2D uSampler;
|
|
776
|
+
uniform float m[20];
|
|
777
|
+
uniform float uAlpha;
|
|
778
|
+
|
|
779
|
+
void main(void)
|
|
780
|
+
{
|
|
781
|
+
vec4 c = texture2D(uSampler, vTextureCoord);
|
|
782
|
+
|
|
783
|
+
if (uAlpha == 0.0) {
|
|
784
|
+
gl_FragColor = c;
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
789
|
+
if (c.a > 0.0) {
|
|
790
|
+
c.rgb /= c.a;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
vec4 result;
|
|
794
|
+
|
|
795
|
+
result.r = (m[0] * c.r);
|
|
796
|
+
result.r += (m[1] * c.g);
|
|
797
|
+
result.r += (m[2] * c.b);
|
|
798
|
+
result.r += (m[3] * c.a);
|
|
799
|
+
result.r += m[4];
|
|
800
|
+
|
|
801
|
+
result.g = (m[5] * c.r);
|
|
802
|
+
result.g += (m[6] * c.g);
|
|
803
|
+
result.g += (m[7] * c.b);
|
|
804
|
+
result.g += (m[8] * c.a);
|
|
805
|
+
result.g += m[9];
|
|
806
|
+
|
|
807
|
+
result.b = (m[10] * c.r);
|
|
808
|
+
result.b += (m[11] * c.g);
|
|
809
|
+
result.b += (m[12] * c.b);
|
|
810
|
+
result.b += (m[13] * c.a);
|
|
811
|
+
result.b += m[14];
|
|
812
|
+
|
|
813
|
+
result.a = (m[15] * c.r);
|
|
814
|
+
result.a += (m[16] * c.g);
|
|
815
|
+
result.a += (m[17] * c.b);
|
|
816
|
+
result.a += (m[18] * c.a);
|
|
817
|
+
result.a += m[19];
|
|
818
|
+
|
|
819
|
+
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
|
820
|
+
|
|
821
|
+
// Premultiply alpha again.
|
|
822
|
+
rgb *= result.a;
|
|
823
|
+
|
|
824
|
+
gl_FragColor = vec4(rgb, result.a);
|
|
825
|
+
}
|
|
826
|
+
`,Co=function(i){Ky(t,i);function t(){var e=this,r={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return e=i.call(this,oa,Zy,r)||this,e.alpha=1,e}return t.prototype._loadMatrix=function(e,r){r===void 0&&(r=!1);var n=e;r&&(this._multiply(n,this.uniforms.m,e),n=this._colorMatrix(n)),this.uniforms.m=n},t.prototype._multiply=function(e,r,n){return e[0]=r[0]*n[0]+r[1]*n[5]+r[2]*n[10]+r[3]*n[15],e[1]=r[0]*n[1]+r[1]*n[6]+r[2]*n[11]+r[3]*n[16],e[2]=r[0]*n[2]+r[1]*n[7]+r[2]*n[12]+r[3]*n[17],e[3]=r[0]*n[3]+r[1]*n[8]+r[2]*n[13]+r[3]*n[18],e[4]=r[0]*n[4]+r[1]*n[9]+r[2]*n[14]+r[3]*n[19]+r[4],e[5]=r[5]*n[0]+r[6]*n[5]+r[7]*n[10]+r[8]*n[15],e[6]=r[5]*n[1]+r[6]*n[6]+r[7]*n[11]+r[8]*n[16],e[7]=r[5]*n[2]+r[6]*n[7]+r[7]*n[12]+r[8]*n[17],e[8]=r[5]*n[3]+r[6]*n[8]+r[7]*n[13]+r[8]*n[18],e[9]=r[5]*n[4]+r[6]*n[9]+r[7]*n[14]+r[8]*n[19]+r[9],e[10]=r[10]*n[0]+r[11]*n[5]+r[12]*n[10]+r[13]*n[15],e[11]=r[10]*n[1]+r[11]*n[6]+r[12]*n[11]+r[13]*n[16],e[12]=r[10]*n[2]+r[11]*n[7]+r[12]*n[12]+r[13]*n[17],e[13]=r[10]*n[3]+r[11]*n[8]+r[12]*n[13]+r[13]*n[18],e[14]=r[10]*n[4]+r[11]*n[9]+r[12]*n[14]+r[13]*n[19]+r[14],e[15]=r[15]*n[0]+r[16]*n[5]+r[17]*n[10]+r[18]*n[15],e[16]=r[15]*n[1]+r[16]*n[6]+r[17]*n[11]+r[18]*n[16],e[17]=r[15]*n[2]+r[16]*n[7]+r[17]*n[12]+r[18]*n[17],e[18]=r[15]*n[3]+r[16]*n[8]+r[17]*n[13]+r[18]*n[18],e[19]=r[15]*n[4]+r[16]*n[9]+r[17]*n[14]+r[18]*n[19]+r[19],e},t.prototype._colorMatrix=function(e){var r=new Float32Array(e);return r[4]/=255,r[9]/=255,r[14]/=255,r[19]/=255,r},t.prototype.brightness=function(e,r){var n=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(n,r)},t.prototype.tint=function(e,r){var n=e>>16&255,s=e>>8&255,a=e&255,o=[n/255,0,0,0,0,0,s/255,0,0,0,0,0,a/255,0,0,0,0,0,1,0];this._loadMatrix(o,r)},t.prototype.greyscale=function(e,r){var n=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(n,r)},t.prototype.blackAndWhite=function(e){var r=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.hue=function(e,r){e=(e||0)/180*Math.PI;var n=Math.cos(e),s=Math.sin(e),a=Math.sqrt,o=1/3,h=a(o),u=n+(1-n)*o,l=o*(1-n)-h*s,c=o*(1-n)+h*s,f=o*(1-n)+h*s,d=n+o*(1-n),v=o*(1-n)-h*s,_=o*(1-n)-h*s,p=o*(1-n)+h*s,g=n+o*(1-n),y=[u,l,c,0,0,f,d,v,0,0,_,p,g,0,0,0,0,0,1,0];this._loadMatrix(y,r)},t.prototype.contrast=function(e,r){var n=(e||0)+1,s=-.5*(n-1),a=[n,0,0,0,s,0,n,0,0,s,0,0,n,0,s,0,0,0,1,0];this._loadMatrix(a,r)},t.prototype.saturate=function(e,r){e===void 0&&(e=0);var n=e*2/3+1,s=(n-1)*-.5,a=[n,s,s,0,0,s,n,s,0,0,s,s,n,0,0,0,0,0,1,0];this._loadMatrix(a,r)},t.prototype.desaturate=function(){this.saturate(-1)},t.prototype.negative=function(e){var r=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.sepia=function(e){var r=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.technicolor=function(e){var r=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.polaroid=function(e){var r=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.toBGR=function(e){var r=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.kodachrome=function(e){var r=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.browni=function(e){var r=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.vintage=function(e){var r=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.colorTone=function(e,r,n,s,a){e=e||.2,r=r||.15,n=n||16770432,s=s||3375104;var o=(n>>16&255)/255,h=(n>>8&255)/255,u=(n&255)/255,l=(s>>16&255)/255,c=(s>>8&255)/255,f=(s&255)/255,d=[.3,.59,.11,0,0,o,h,u,e,0,l,c,f,r,0,o-l,h-c,u-f,0,0];this._loadMatrix(d,a)},t.prototype.night=function(e,r){e=e||.1;var n=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(n,r)},t.prototype.predator=function(e,r){var n=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(n,r)},t.prototype.lsd=function(e){var r=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(r,e)},t.prototype.reset=function(){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(e,!1)},Object.defineProperty(t.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0}),t}(Te);Co.prototype.grayscale=Co.prototype.greyscale;var Io=function(i,t){return Io=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Io(i,t)};function Jy(i,t){Io(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Qy=`varying vec2 vFilterCoord;
|
|
827
|
+
varying vec2 vTextureCoord;
|
|
828
|
+
|
|
829
|
+
uniform vec2 scale;
|
|
830
|
+
uniform mat2 rotation;
|
|
831
|
+
uniform sampler2D uSampler;
|
|
832
|
+
uniform sampler2D mapSampler;
|
|
833
|
+
|
|
834
|
+
uniform highp vec4 inputSize;
|
|
835
|
+
uniform vec4 inputClamp;
|
|
836
|
+
|
|
837
|
+
void main(void)
|
|
838
|
+
{
|
|
839
|
+
vec4 map = texture2D(mapSampler, vFilterCoord);
|
|
840
|
+
|
|
841
|
+
map -= 0.5;
|
|
842
|
+
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
|
843
|
+
|
|
844
|
+
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
845
|
+
}
|
|
846
|
+
`,t0=`attribute vec2 aVertexPosition;
|
|
847
|
+
|
|
848
|
+
uniform mat3 projectionMatrix;
|
|
849
|
+
uniform mat3 filterMatrix;
|
|
850
|
+
|
|
851
|
+
varying vec2 vTextureCoord;
|
|
852
|
+
varying vec2 vFilterCoord;
|
|
853
|
+
|
|
854
|
+
uniform vec4 inputSize;
|
|
855
|
+
uniform vec4 outputFrame;
|
|
856
|
+
|
|
857
|
+
vec4 filterVertexPosition( void )
|
|
858
|
+
{
|
|
859
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
860
|
+
|
|
861
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
vec2 filterTextureCoord( void )
|
|
865
|
+
{
|
|
866
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
void main(void)
|
|
870
|
+
{
|
|
871
|
+
gl_Position = filterVertexPosition();
|
|
872
|
+
vTextureCoord = filterTextureCoord();
|
|
873
|
+
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
874
|
+
}
|
|
875
|
+
`,e0=function(i){Jy(t,i);function t(e,r){var n=this,s=new bt;return e.renderable=!1,n=i.call(this,t0,Qy,{mapSampler:e._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this,n.maskSprite=e,n.maskMatrix=s,r==null&&(r=20),n.scale=new vt(r,r),n}return t.prototype.apply=function(e,r,n,s){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,o=Math.sqrt(a.a*a.a+a.b*a.b),h=Math.sqrt(a.c*a.c+a.d*a.d);o!==0&&h!==0&&(this.uniforms.rotation[0]=a.a/o,this.uniforms.rotation[1]=a.b/o,this.uniforms.rotation[2]=a.c/h,this.uniforms.rotation[3]=a.d/h),e.applyFilter(this,r,n,s)},Object.defineProperty(t.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(e){this.uniforms.mapSampler=e},enumerable:!1,configurable:!0}),t}(Te);var Ao=function(i,t){return Ao=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Ao(i,t)};function r0(i,t){Ao(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var i0=`
|
|
876
|
+
attribute vec2 aVertexPosition;
|
|
877
|
+
|
|
878
|
+
uniform mat3 projectionMatrix;
|
|
879
|
+
|
|
880
|
+
varying vec2 v_rgbNW;
|
|
881
|
+
varying vec2 v_rgbNE;
|
|
882
|
+
varying vec2 v_rgbSW;
|
|
883
|
+
varying vec2 v_rgbSE;
|
|
884
|
+
varying vec2 v_rgbM;
|
|
885
|
+
|
|
886
|
+
varying vec2 vFragCoord;
|
|
887
|
+
|
|
888
|
+
uniform vec4 inputSize;
|
|
889
|
+
uniform vec4 outputFrame;
|
|
890
|
+
|
|
891
|
+
vec4 filterVertexPosition( void )
|
|
892
|
+
{
|
|
893
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
894
|
+
|
|
895
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
void texcoords(vec2 fragCoord, vec2 inverseVP,
|
|
899
|
+
out vec2 v_rgbNW, out vec2 v_rgbNE,
|
|
900
|
+
out vec2 v_rgbSW, out vec2 v_rgbSE,
|
|
901
|
+
out vec2 v_rgbM) {
|
|
902
|
+
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
|
|
903
|
+
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
|
|
904
|
+
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
|
|
905
|
+
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
|
|
906
|
+
v_rgbM = vec2(fragCoord * inverseVP);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
void main(void) {
|
|
910
|
+
|
|
911
|
+
gl_Position = filterVertexPosition();
|
|
912
|
+
|
|
913
|
+
vFragCoord = aVertexPosition * outputFrame.zw;
|
|
914
|
+
|
|
915
|
+
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
916
|
+
}
|
|
917
|
+
`,n0=`varying vec2 v_rgbNW;
|
|
918
|
+
varying vec2 v_rgbNE;
|
|
919
|
+
varying vec2 v_rgbSW;
|
|
920
|
+
varying vec2 v_rgbSE;
|
|
921
|
+
varying vec2 v_rgbM;
|
|
922
|
+
|
|
923
|
+
varying vec2 vFragCoord;
|
|
924
|
+
uniform sampler2D uSampler;
|
|
925
|
+
uniform highp vec4 inputSize;
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
Basic FXAA implementation based on the code on geeks3d.com with the
|
|
930
|
+
modification that the texture2DLod stuff was removed since it's
|
|
931
|
+
unsupported by WebGL.
|
|
932
|
+
|
|
933
|
+
--
|
|
934
|
+
|
|
935
|
+
From:
|
|
936
|
+
https://github.com/mitsuhiko/webgl-meincraft
|
|
937
|
+
|
|
938
|
+
Copyright (c) 2011 by Armin Ronacher.
|
|
939
|
+
|
|
940
|
+
Some rights reserved.
|
|
941
|
+
|
|
942
|
+
Redistribution and use in source and binary forms, with or without
|
|
943
|
+
modification, are permitted provided that the following conditions are
|
|
944
|
+
met:
|
|
945
|
+
|
|
946
|
+
* Redistributions of source code must retain the above copyright
|
|
947
|
+
notice, this list of conditions and the following disclaimer.
|
|
948
|
+
|
|
949
|
+
* Redistributions in binary form must reproduce the above
|
|
950
|
+
copyright notice, this list of conditions and the following
|
|
951
|
+
disclaimer in the documentation and/or other materials provided
|
|
952
|
+
with the distribution.
|
|
953
|
+
|
|
954
|
+
* The names of the contributors may not be used to endorse or
|
|
955
|
+
promote products derived from this software without specific
|
|
956
|
+
prior written permission.
|
|
957
|
+
|
|
958
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
959
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
960
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
961
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
962
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
963
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
964
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
965
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
966
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
967
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
968
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
969
|
+
*/
|
|
970
|
+
|
|
971
|
+
#ifndef FXAA_REDUCE_MIN
|
|
972
|
+
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
|
973
|
+
#endif
|
|
974
|
+
#ifndef FXAA_REDUCE_MUL
|
|
975
|
+
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
|
976
|
+
#endif
|
|
977
|
+
#ifndef FXAA_SPAN_MAX
|
|
978
|
+
#define FXAA_SPAN_MAX 8.0
|
|
979
|
+
#endif
|
|
980
|
+
|
|
981
|
+
//optimized version for mobile, where dependent
|
|
982
|
+
//texture reads can be a bottleneck
|
|
983
|
+
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
|
|
984
|
+
vec2 v_rgbNW, vec2 v_rgbNE,
|
|
985
|
+
vec2 v_rgbSW, vec2 v_rgbSE,
|
|
986
|
+
vec2 v_rgbM) {
|
|
987
|
+
vec4 color;
|
|
988
|
+
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
|
|
989
|
+
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
|
|
990
|
+
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
|
|
991
|
+
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
|
|
992
|
+
vec4 texColor = texture2D(tex, v_rgbM);
|
|
993
|
+
vec3 rgbM = texColor.xyz;
|
|
994
|
+
vec3 luma = vec3(0.299, 0.587, 0.114);
|
|
995
|
+
float lumaNW = dot(rgbNW, luma);
|
|
996
|
+
float lumaNE = dot(rgbNE, luma);
|
|
997
|
+
float lumaSW = dot(rgbSW, luma);
|
|
998
|
+
float lumaSE = dot(rgbSE, luma);
|
|
999
|
+
float lumaM = dot(rgbM, luma);
|
|
1000
|
+
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
|
1001
|
+
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
|
1002
|
+
|
|
1003
|
+
mediump vec2 dir;
|
|
1004
|
+
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
|
1005
|
+
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
|
1006
|
+
|
|
1007
|
+
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
|
1008
|
+
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
|
1009
|
+
|
|
1010
|
+
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
|
1011
|
+
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
|
1012
|
+
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
|
1013
|
+
dir * rcpDirMin)) * inverseVP;
|
|
1014
|
+
|
|
1015
|
+
vec3 rgbA = 0.5 * (
|
|
1016
|
+
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
|
1017
|
+
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
|
1018
|
+
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
|
1019
|
+
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
|
1020
|
+
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
|
1021
|
+
|
|
1022
|
+
float lumaB = dot(rgbB, luma);
|
|
1023
|
+
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
|
1024
|
+
color = vec4(rgbA, texColor.a);
|
|
1025
|
+
else
|
|
1026
|
+
color = vec4(rgbB, texColor.a);
|
|
1027
|
+
return color;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
void main() {
|
|
1031
|
+
|
|
1032
|
+
vec4 color;
|
|
1033
|
+
|
|
1034
|
+
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
1035
|
+
|
|
1036
|
+
gl_FragColor = color;
|
|
1037
|
+
}
|
|
1038
|
+
`,s0=function(i){r0(t,i);function t(){return i.call(this,i0,n0)||this}return t}(Te);var Mo=function(i,t){return Mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Mo(i,t)};function a0(i,t){Mo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var o0=`precision highp float;
|
|
1039
|
+
|
|
1040
|
+
varying vec2 vTextureCoord;
|
|
1041
|
+
varying vec4 vColor;
|
|
1042
|
+
|
|
1043
|
+
uniform float uNoise;
|
|
1044
|
+
uniform float uSeed;
|
|
1045
|
+
uniform sampler2D uSampler;
|
|
1046
|
+
|
|
1047
|
+
float rand(vec2 co)
|
|
1048
|
+
{
|
|
1049
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
void main()
|
|
1053
|
+
{
|
|
1054
|
+
vec4 color = texture2D(uSampler, vTextureCoord);
|
|
1055
|
+
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
1056
|
+
float diff = (randomValue - 0.5) * uNoise;
|
|
1057
|
+
|
|
1058
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1059
|
+
if (color.a > 0.0) {
|
|
1060
|
+
color.rgb /= color.a;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
color.r += diff;
|
|
1064
|
+
color.g += diff;
|
|
1065
|
+
color.b += diff;
|
|
1066
|
+
|
|
1067
|
+
// Premultiply alpha again.
|
|
1068
|
+
color.rgb *= color.a;
|
|
1069
|
+
|
|
1070
|
+
gl_FragColor = color;
|
|
1071
|
+
}
|
|
1072
|
+
`,h0=function(i){a0(t,i);function t(e,r){e===void 0&&(e=.5),r===void 0&&(r=Math.random());var n=i.call(this,oa,o0,{uNoise:0,uSeed:0})||this;return n.noise=e,n.seed=r,n}return Object.defineProperty(t.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0}),t}(Te);var Rf=new bt;Ct.prototype._cacheAsBitmap=!1,Ct.prototype._cacheData=null,Ct.prototype._cacheAsBitmapResolution=null,Ct.prototype._cacheAsBitmapMultisample=xt.NONE;var u0=function(){function i(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return i}();Object.defineProperties(Ct.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(i){if(this._cacheAsBitmap!==i){this._cacheAsBitmap=i;var t;i?(this._cacheData||(this._cacheData=new u0),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}}),Ct.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Ct.prototype._initCachedDisplayObject=function(t){var e;if(!(this._cacheData&&this._cacheData.sprite)){var r=this.alpha;this.alpha=1,t.batch.flush();var n=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var s=this.filters[0].padding;n.pad(s)}n.ceil(z.RESOLUTION);var a=t.renderTexture.current,o=t.renderTexture.sourceFrame.clone(),h=t.renderTexture.destinationFrame.clone(),u=t.projection.transform,l=Me.create({width:n.width,height:n.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:(e=this.cacheAsBitmapMultisample)!==null&&e!==void 0?e:t.multisample}),c="cacheAsBitmap_"+Ie();this._cacheData.textureCacheId=c,lt.addToCache(l.baseTexture,c),it.addToCache(l,c);var f=this.transform.localTransform.copyTo(Rf).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:l,clear:!0,transform:f,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=u,t.renderTexture.bind(a,o,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;var d=new wr(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=r,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},Ct.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Ct.prototype._initCachedDisplayObjectCanvas=function(t){if(!(this._cacheData&&this._cacheData.sprite)){var e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;var n=t.context,s=t._projTransform;e.ceil(z.RESOLUTION);var a=Me.create({width:e.width,height:e.height}),o="cacheAsBitmap_"+Ie();this._cacheData.textureCacheId=o,lt.addToCache(a.baseTexture,o),it.addToCache(a,o);var h=Rf;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),t.context=n,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;var u=new wr(a);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=r,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},Ct.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ct.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ct.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,lt.removeFromCache(this._cacheData.textureCacheId),it.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ct.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)};Ct.prototype.name=null,Zt.prototype.getChildByName=function(t,e){for(var r=0,n=this.children.length;r<n;r++)if(this.children[r].name===t)return this.children[r];if(e)for(var r=0,n=this.children.length;r<n;r++){var s=this.children[r];if(s.getChildByName){var a=s.getChildByName(t,!0);if(a)return a}}return null};Ct.prototype.getGlobalPosition=function(t,e){return t===void 0&&(t=new vt),e===void 0&&(e=!1),this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};var Of=function(){function i(){}return i.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(r){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=r,r&&(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){e.cancelResize();var r,n;if(e._resizeTo===globalThis.window)r=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=e._resizeTo,a=s.clientWidth,o=s.clientHeight;r=a,n=o}e.renderer.resize(r,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},i.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},i.extension=dt.Application,i}(),Ro=function(){function i(t){var e=this;this.stage=new Zt,t=Object.assign({forceCanvas:!1},t),this.renderer=Ou(t),i._plugins.forEach(function(r){r.init.call(e,t)})}return i.registerPlugin=function(t){Bt("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Kt.add({type:dt.Application,ref:t})},i.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(i.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),i.prototype.destroy=function(t,e){var r=this,n=i._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(r)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},i._plugins=[],i}();Kt.handleByList(dt.Application,Ro._plugins),Kt.add(Of);var Oo=function(i,t){return Oo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Oo(i,t)};function Mr(i,t){Oo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Df=function(i){Mr(t,i);function t(e,r,n,s){e===void 0&&(e=100),r===void 0&&(r=100),n===void 0&&(n=10),s===void 0&&(s=10);var a=i.call(this)||this;return a.segWidth=n,a.segHeight=s,a.width=e,a.height=r,a.build(),a}return t.prototype.build=function(){for(var e=this.segWidth*this.segHeight,r=[],n=[],s=[],a=this.segWidth-1,o=this.segHeight-1,h=this.width/a,u=this.height/o,l=0;l<e;l++){var c=l%this.segWidth,f=l/this.segWidth|0;r.push(c*h,f*u),n.push(c/a,f/o)}for(var d=a*o,l=0;l<d;l++){var v=l%a,_=l/a|0,p=_*this.segWidth+v,g=_*this.segWidth+v+1,y=(_+1)*this.segWidth+v,T=(_+1)*this.segWidth+v+1;s.push(p,g,y,g,T,y)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},t}(mi),Ff=function(i){Mr(t,i);function t(e,r,n){e===void 0&&(e=200),n===void 0&&(n=0);var s=i.call(this,new Float32Array(r.length*4),new Float32Array(r.length*4),new Uint16Array((r.length-1)*6))||this;return s.points=r,s._width=e,s.textureScale=n,s.build(),s}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),t.prototype.build=function(){var e=this.points;if(e){var r=this.getBuffer("aVertexPosition"),n=this.getBuffer("aTextureCoord"),s=this.getIndex();if(!(e.length<1)){r.data.length/4!==e.length&&(r.data=new Float32Array(e.length*4),n.data=new Float32Array(e.length*4),s.data=new Uint16Array((e.length-1)*6));var a=n.data,o=s.data;a[0]=0,a[1]=0,a[2]=0,a[3]=1;for(var h=0,u=e[0],l=this._width*this.textureScale,c=e.length,f=0;f<c;f++){var d=f*4;if(this.textureScale>0){var v=u.x-e[f].x,_=u.y-e[f].y,p=Math.sqrt(v*v+_*_);u=e[f],h+=p/l}else h=f/(c-1);a[d]=h,a[d+1]=0,a[d+2]=h,a[d+3]=1}for(var g=0,f=0;f<c-1;f++){var d=f*2;o[g++]=d,o[g++]=d+1,o[g++]=d+2,o[g++]=d+2,o[g++]=d+1,o[g++]=d+3}n.update(),s.update(),this.updateVertices()}}},t.prototype.updateVertices=function(){var e=this.points;if(!(e.length<1)){for(var r=e[0],n,s=0,a=0,o=this.buffers[0].data,h=e.length,u=0;u<h;u++){var l=e[u],c=u*4;u<e.length-1?n=e[u+1]:n=l,a=-(n.x-r.x),s=n.y-r.y;var f=Math.sqrt(s*s+a*a),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=f,a/=f,s*=d,a*=d,o[c]=l.x+s,o[c+1]=l.y+a,o[c+2]=l.x-s,o[c+3]=l.y-a,r=l}this.buffers[0].update()}},t.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},t}(mi),l0=function(i){Mr(t,i);function t(e,r,n){n===void 0&&(n=0);var s=this,a=new Ff(e.height,r,n),o=new Ar(e);return n>0&&(e.baseTexture.wrapMode=ne.REPEAT),s=i.call(this,a,o)||this,s.autoUpdate=!0,s}return t.prototype._render=function(e){var r=this.geometry;(this.autoUpdate||r._width!==this.shader.texture.height)&&(r._width=this.shader.texture.height,r.update()),i.prototype._render.call(this,e)},t}(Ir),Lf=function(i){Mr(t,i);function t(e,r,n){var s=this,a=new Df(e.width,e.height,r,n),o=new Ar(it.WHITE);return s=i.call(this,a,o)||this,s.texture=e,s.autoResize=!0,s}return t.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var e=this.geometry,r=this.shader.texture,n=r.width,s=r.height;this.autoResize&&(e.width!==n||e.height!==s)&&(e.width=this.shader.texture.width,e.height=this.shader.texture.height,e.build())},Object.defineProperty(t.prototype,"texture",{get:function(){return this.shader.texture},set:function(e){this.shader.texture!==e&&(this.shader.texture=e,this._textureID=-1,e.baseTexture.valid?this.textureUpdated():e.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),t.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),i.prototype._render.call(this,e)},t.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),i.prototype.destroy.call(this,e)},t}(Ir),f0=function(i){Mr(t,i);function t(e,r,n,s,a){e===void 0&&(e=it.EMPTY);var o=this,h=new mi(r,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new Ar(e);return o=i.call(this,h,u,null,a)||this,o.autoUpdate=!0,o}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(e){this.geometry.getBuffer("aVertexPosition").data=e},enumerable:!1,configurable:!0}),t.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),i.prototype._render.call(this,e)},t}(Ir),mn=10,c0=function(i){Mr(t,i);function t(e,r,n,s,a){r===void 0&&(r=mn),n===void 0&&(n=mn),s===void 0&&(s=mn),a===void 0&&(a=mn);var o=i.call(this,it.WHITE,4,4)||this;return o._origWidth=e.orig.width,o._origHeight=e.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=r,o._rightWidth=s,o._topHeight=n,o._bottomHeight=a,o.texture=e,o}return t.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(t.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(e){this.geometry.getBuffer("aVertexPosition").data=e},enumerable:!1,configurable:!0}),t.prototype.updateHorizontalVertices=function(){var e=this.vertices,r=this._getMinScale();e[9]=e[11]=e[13]=e[15]=this._topHeight*r,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*r,e[25]=e[27]=e[29]=e[31]=this._height},t.prototype.updateVerticalVertices=function(){var e=this.vertices,r=this._getMinScale();e[2]=e[10]=e[18]=e[26]=this._leftWidth*r,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*r,e[6]=e[14]=e[22]=e[30]=this._width},t.prototype._getMinScale=function(){var e=this._leftWidth+this._rightWidth,r=this._width>e?1:this._width/e,n=this._topHeight+this._bottomHeight,s=this._height>n?1:this._height/n,a=Math.min(r,s);return a},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topHeight",{get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()},enumerable:!1,configurable:!0}),t.prototype._refresh=function(){var e=this.texture,r=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var n=1/this._origWidth,s=1/this._origHeight;r[0]=r[8]=r[16]=r[24]=0,r[1]=r[3]=r[5]=r[7]=0,r[6]=r[14]=r[22]=r[30]=1,r[25]=r[27]=r[29]=r[31]=1,r[2]=r[10]=r[18]=r[26]=n*this._leftWidth,r[4]=r[12]=r[20]=r[28]=1-n*this._rightWidth,r[9]=r[11]=r[13]=r[15]=s*this._topHeight,r[17]=r[19]=r[21]=r[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},t}(Lf);var Do=function(i,t){return Do=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])},Do(i,t)};function d0(i,t){Do(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var p0=function(i){d0(t,i);function t(e,r){r===void 0&&(r=!0);var n=i.call(this,e[0]instanceof it?e[0]:e[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=r,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=e,n}return t.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1))},t.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Ot.shared.add(this.update,this,de.HIGH),this._isConnectedToTicker=!0))},t.prototype.gotoAndStop=function(e){this.stop();var r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this.updateTexture()},t.prototype.gotoAndPlay=function(e){var r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this.updateTexture(),this.play()},t.prototype.update=function(e){if(this._playing){var r=this.animationSpeed*e,n=this.currentFrame;if(this._durations!==null){var s=this._currentTime%1*this._durations[this.currentFrame];for(s+=r/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];var a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=r;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n?this.onLoop():this.animationSpeed<0&&this.currentFrame>n&&this.onLoop()),this.updateTexture())}},t.prototype.updateTexture=function(){var e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},t.prototype.destroy=function(e){this.stop(),i.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},t.fromFrames=function(e){for(var r=[],n=0;n<e.length;++n)r.push(it.from(e[n]));return new t(r)},t.fromImages=function(e){for(var r=[],n=0;n<e.length;++n)r.push(it.from(e[n]));return new t(r)},Object.defineProperty(t.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this._textures},set:function(e){if(e[0]instanceof it)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(var r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentFrame",{get:function(){var e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Ot.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),t}(wr);Kt.add(Al,Ol,Ha,tf,vf,ua,xf,Af,Hl,Kl,Zl,gf,Es,Ul);var v0={AlphaFilter:Vy,BlurFilter:$y,BlurFilterPass:Po,ColorMatrixFilter:Co,DisplacementFilter:e0,FXAAFilter:s0,NoiseFilter:h0};const _0=Object.freeze(Object.defineProperty({__proto__:null,get ALPHA_MODES(){return Wt},AbstractBatchRenderer:Fu,AbstractMultiResource:Oi,AbstractRenderer:Ru,AccessibilityManager:Al,AnimatedSprite:p0,AppLoaderPlugin:Ul,Application:Ro,ArrayResource:ws,Attribute:Fs,get BLEND_MODES(){return tt},get BUFFER_BITS(){return Fr},get BUFFER_TYPE(){return se},BaseImageResource:pe,BasePrepare:df,BaseRenderTexture:Os,BaseTexture:lt,BatchDrawCall:Vi,BatchGeometry:ha,BatchPluginFactory:Uu,BatchRenderer:ua,BatchShaderGenerator:Lu,BatchSystem:Us,BatchTextureArray:ji,BitmapFont:we,BitmapFontData:yi,BitmapFontLoader:Af,BitmapText:Gy,BlobResource:Xl,Bounds:$r,BrowserAdapter:Vo,Buffer:Mt,BufferResource:Ke,get CLEAR_MODES(){return Yt},get COLOR_MASK_BITS(){return Pn},CanvasResource:Cs,Circle:$h,CompressedTextureLoader:Hl,CompressedTextureResource:hn,Container:Zt,ContextSystem:ks,CountLimiter:cf,CubeResource:Is,DDSLoader:Kl,DEG_TO_RAD:qh,get DRAW_MODES(){return jt},DisplayObject:Ct,get ENV(){return Ut},Ellipse:Kh,get ExtensionType(){return dt},Extract:Ol,get FORMATS(){return H},FORMATS_TO_COMPONENTS:Yl,FillStyle:Qa,Filter:Te,FilterState:su,FilterSystem:Ns,Framebuffer:Fi,FramebufferSystem:Gs,get GC_MODES(){return Br},GLFramebuffer:ou,GLProgram:Iu,GLTexture:Hi,GRAPHICS_CURVES:Er,Geometry:vr,GeometrySystem:Hs,Graphics:vi,GraphicsData:ao,GraphicsGeometry:uf,IGLUniformData:e_,INSTALLED:jr,get INTERNAL_FORMATS(){return at},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:li,ImageBitmapResource:Rs,ImageResource:Di,InteractionData:Ga,InteractionEvent:Ml,InteractionManager:Ha,InteractionTrackingData:rn,KTXLoader:Zl,get LINE_CAP(){return Pe},get LINE_JOIN(){return me},LineStyle:lf,Loader:ui,get LoaderResource(){return wt},get MASK_TYPES(){return It},get MIPMAP_MODES(){return zt},get MSAA_QUALITY(){return xt},MaskData:hu,MaskSystem:Ks,Matrix:bt,Mesh:Ir,MeshBatchUvs:bf,MeshGeometry:mi,MeshMaterial:Ar,NineSlicePlane:c0,ObjectRenderer:zr,ObservablePoint:Ae,PI_2:Xr,get PRECISION(){return kt},ParticleContainer:iy,ParticleRenderer:tf,PlaneGeometry:Df,Point:vt,Polygon:Hr,Prepare:vf,Program:_r,ProjectionSystem:Qs,Quad:nu,QuadUv:Ls,RAD_TO_DEG:Yh,get RENDERER_TYPE(){return cr},Rectangle:ut,RenderTexture:Me,RenderTexturePool:ru,RenderTextureSystem:ta,Renderer:aa,ResizePlugin:Of,Resource:$e,RopeGeometry:Ff,RoundedRectangle:Zh,Runner:Dt,get SAMPLER_TYPES(){return Lr},get SCALE_MODES(){return ie},get SHAPES(){return Rt},SVGResource:As,ScissorSystem:Zs,Shader:be,ShaderSystem:ea,SimpleMesh:f0,SimplePlane:Lf,SimpleRope:l0,Sprite:wr,SpriteMaskFilter:xu,Spritesheet:_f,SpritesheetLoader:gf,State:Oe,StateSystem:ra,StencilSystem:Js,System:g_,get TARGETS(){return Ce},get TEXT_GRADIENT(){return Cr},get TYPES(){return Q},TYPES_TO_BYTES_PER_COMPONENT:Za,TYPES_TO_BYTES_PER_PIXEL:ql,TemporaryDisplayObject:da,Text:po,TextFormat:Ef,TextMetrics:le,TextStyle:lr,Texture:it,TextureGCSystem:ia,TextureLoader:kl,TextureMatrix:Gi,TextureSystem:na,TextureUvs:Ds,Ticker:Ot,TickerPlugin:Es,TilingSprite:Cy,TilingSpriteRenderer:xf,TimeLimiter:wy,Transform:Mi,get UPDATE_PRIORITY(){return de},UniformGroup:Re,VERSION:x_,VideoResource:Ms,ViewableBuffer:zi,get WRAP_MODES(){return ne},XMLFormat:_n,XMLStringFormat:Sf,accessibleTarget:wl,autoDetectFormat:To,autoDetectRenderer:Ou,autoDetectResource:Ri,checkMaxIfStatementsInShader:mu,createUBOElements:Pu,defaultFilterVertex:oa,defaultVertex:Du,extensions:Kt,filters:v0,generateProgram:Au,generateUniformBufferSync:Cu,getTestContext:du,getUBOData:wu,graphicsUtils:uy,groupD8:Tt,interactiveTarget:Rl,isMobile:qt,parseDDS:zl,parseKTX:$l,resources:ku,settings:z,systems:Gu,uniformParsers:Ze,utils:Pv},Symbol.toStringTag,{value:"Module"}));async function Bf(i){const{models:t,element_id:e,auto_fit:r=!0,auto_motion:n=!0,mouse_tracking:s=!0}=i,a=new Ro({view:document.getElementById(e),width:300,height:300,backgroundAlpha:0,autoDensity:!0,antialias:!0}),o=await Qr.from(t[0]);if(a.stage.addChild(o),r){const h=Math.min(300/o.width,300/o.height);o.scale.set(h),o.x=(300-o.width*h)/2,o.y=(300-o.height*h)/2}return s&&g0(o,a.view),n&&await m0(o),o}function g0(i,t){document.addEventListener("mousemove",e=>{var h;const r=t.getBoundingClientRect(),n=r.left+r.width/2,s=r.top+r.height/2,a=(e.clientX-n)/r.width,o=(e.clientY-s)/r.height;i.internalModel&&((h=i.internalModel.focusController)==null||h.focus(a,o))})}async function m0(i){var t;try{const e=(t=i.internalModel)==null?void 0:t.motionManager.definitions;if(e)if(e.idle)await i.motion("idle");else if(e.tap_body)await i.motion("tap_body");else{const r=Object.keys(e)[0];r&&await i.motion(r)}}catch(e){console.warn("Failed to start idle animation:",e)}}async function Nf(i){Qr.registerTicker(Ot),Kt.add(Es),Kt.add(Ha)}const y0={createLive2dModel:Bf,initializeLive2D:Nf,Live2DModel:Qr,MotionManager:gr};re.Live2DModel=Qr,re.MotionManager=gr,re.PIXI=_0,re.createLive2dModel=Bf,re.default=y0,re.initializeLive2D=Nf,Object.defineProperties(re,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|