946 lines
603 KiB
JavaScript
946 lines
603 KiB
JavaScript
(function(){var gt='<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg>',Pt='<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';document.addEventListener("nav",()=>{let jt=document.getElementsByTagName("pre");for(let Et=0;Et<jt.length;Et++){let Bt=jt[Et].getElementsByTagName("code")[0];if(Bt){let v=function(){navigator.clipboard.writeText(Ue).then(()=>{ze.blur(),ze.innerHTML=Pt,setTimeout(()=>{ze.innerHTML=gt,ze.style.borderColor=""},2e3)},Rt=>console.error(Rt))};var it=v;let Ue=Bt.innerText.replace(/\n\n/g,`
|
|
`),ze=document.createElement("button");ze.className="clipboard-button",ze.type="button",ze.innerHTML=gt,ze.ariaLabel="Copy source",ze.addEventListener("click",v),window.addCleanup(()=>ze.removeEventListener("click",v)),jt[Et].prepend(ze)}}})})(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(c,g)=>()=>(g||c((g={exports:{}}).exports,g),g.exports),Ue=(c,g,m,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of it(g))!Bt.call(c,w)&&w!==m&&Pt(c,w,{get:()=>g[w],enumerable:!(x=jt(g,w))||x.enumerable});return c},ze=(c,g,m)=>(m=c!=null?gt(Et(c)):{},Ue(g||!c||!c.__esModule?Pt(m,"default",{value:c,enumerable:!0}):m,c)),Rt=v(()=>{}),ht=v((c,g)=>{"use strict";g.exports=x;function m(S){return S instanceof Buffer?Buffer.from(S):new S.constructor(S.buffer.slice(),S.byteOffset,S.length)}function x(S){if(S=S||{},S.circles)return w(S);let k=new Map;if(k.set(Date,V=>new Date(V)),k.set(Map,(V,L)=>new Map(N(Array.from(V),L))),k.set(Set,(V,L)=>new Set(N(Array.from(V),L))),S.constructorHandlers)for(let V of S.constructorHandlers)k.set(V[0],V[1]);let B=null;return S.proto?F:X;function N(V,L){let I=Object.keys(V),D=new Array(I.length);for(let $=0;$<I.length;$++){let se=I[$],xe=V[se];typeof xe!="object"||xe===null?D[se]=xe:xe.constructor!==Object&&(B=k.get(xe.constructor))?D[se]=B(xe,L):ArrayBuffer.isView(xe)?D[se]=m(xe):D[se]=L(xe)}return D}function X(V){if(typeof V!="object"||V===null)return V;if(Array.isArray(V))return N(V,X);if(V.constructor!==Object&&(B=k.get(V.constructor)))return B(V,X);let L={};for(let I in V){if(Object.hasOwnProperty.call(V,I)===!1)continue;let D=V[I];typeof D!="object"||D===null?L[I]=D:D.constructor!==Object&&(B=k.get(D.constructor))?L[I]=B(D,X):ArrayBuffer.isView(D)?L[I]=m(D):L[I]=X(D)}return L}function F(V){if(typeof V!="object"||V===null)return V;if(Array.isArray(V))return N(V,F);if(V.constructor!==Object&&(B=k.get(V.constructor)))return B(V,F);let L={};for(let I in V){let D=V[I];typeof D!="object"||D===null?L[I]=D:D.constructor!==Object&&(B=k.get(D.constructor))?L[I]=B(D,F):ArrayBuffer.isView(D)?L[I]=m(D):L[I]=F(D)}return L}}function w(S){let k=[],B=[],N=new Map;if(N.set(Date,I=>new Date(I)),N.set(Map,(I,D)=>new Map(F(Array.from(I),D))),N.set(Set,(I,D)=>new Set(F(Array.from(I),D))),S.constructorHandlers)for(let I of S.constructorHandlers)N.set(I[0],I[1]);let X=null;return S.proto?L:V;function F(I,D){let $=Object.keys(I),se=new Array($.length);for(let xe=0;xe<$.length;xe++){let Me=$[xe],Ge=I[Me];if(typeof Ge!="object"||Ge===null)se[Me]=Ge;else if(Ge.constructor!==Object&&(X=N.get(Ge.constructor)))se[Me]=X(Ge,D);else if(ArrayBuffer.isView(Ge))se[Me]=m(Ge);else{let ct=k.indexOf(Ge);ct!==-1?se[Me]=B[ct]:se[Me]=D(Ge)}}return se}function V(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return F(I,V);if(I.constructor!==Object&&(X=N.get(I.constructor)))return X(I,V);let D={};k.push(I),B.push(D);for(let $ in I){if(Object.hasOwnProperty.call(I,$)===!1)continue;let se=I[$];if(typeof se!="object"||se===null)D[$]=se;else if(se.constructor!==Object&&(X=N.get(se.constructor)))D[$]=X(se,V);else if(ArrayBuffer.isView(se))D[$]=m(se);else{let xe=k.indexOf(se);xe!==-1?D[$]=B[xe]:D[$]=V(se)}}return k.pop(),B.pop(),D}function L(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return F(I,L);if(I.constructor!==Object&&(X=N.get(I.constructor)))return X(I,L);let D={};k.push(I),B.push(D);for(let $ in I){let se=I[$];if(typeof se!="object"||se===null)D[$]=se;else if(se.constructor!==Object&&(X=N.get(se.constructor)))D[$]=X(se,L);else if(ArrayBuffer.isView(se))D[$]=m(se);else{let xe=k.indexOf(se);xe!==-1?D[$]=B[xe]:D[$]=L(se)}}return k.pop(),B.pop(),D}}}),G;function kt(c){return typeof c<"u"?c:!0}function je(c){let g=Array(c);for(let m=0;m<c;m++)g[m]=pe();return g}function pe(){return Object.create(null)}function te(c,g){return g.length-c.length}function dt(c){return typeof c=="string"}function Nt(c){return typeof c=="object"}function Je(c){return typeof c=="function"}function xt(c,g){var m=Ui;if(c&&(g&&(c=mt(c,g)),this.H&&(c=mt(c,this.H)),this.J&&1<c.length&&(c=mt(c,this.J)),m||m==="")){if(g=c.split(m),this.filter){c=this.filter,m=g.length;let x=[];for(let w=0,S=0;w<m;w++){let k=g[w];k&&!c[k]&&(x[S++]=k)}c=x}else c=g;return c}return c}var Ui=/[\p{Z}\p{S}\p{P}\p{C}]+/u,It=/[\u0300-\u036f]/g;function rt(c,g){let m=Object.keys(c),x=m.length,w=[],S="",k=0;for(let B=0,N,X;B<x;B++)N=m[B],(X=c[N])?(w[k++]=nt(g?"(?!\\b)"+N+"(\\b|_)":N),w[k++]=X):S+=(S?"|":"")+N;return S&&(w[k++]=nt(g?"(?!\\b)("+S+")(\\b|_)":"("+S+")"),w[k]=""),w}function mt(c,g){for(let m=0,x=g.length;m<x&&(c=c.replace(g[m],g[m+1]),c);m+=2);return c}function nt(c){return new RegExp(c,"g")}function Qi(c){let g="",m="";for(let x=0,w=c.length,S;x<w;x++)(S=c[x])!==m&&(g+=m=S);return g}var yi={encode:cr,F:!1,G:""};function cr(c){return xt.call(this,(""+c).toLowerCase(),!1)}var ui={},Gt={};function Fi(c){si(c,"add"),si(c,"append"),si(c,"search"),si(c,"update"),si(c,"remove")}function si(c,g){c[g+"Async"]=function(){let m=this,x=arguments;var w=x[x.length-1];let S;return Je(w)&&(S=w,delete x[x.length-1]),w=new Promise(function(k){setTimeout(function(){m.async=!0;let B=m[g].apply(m,x);m.async=!1,k(B)})}),S?(w.then(S),this):w}}function Ot(c,g,m,x){let w=c.length,S=[],k,B,N=0;x&&(x=[]);for(let X=w-1;0<=X;X--){let F=c[X],V=F.length,L=pe(),I=!k;for(let D=0;D<V;D++){let $=F[D],se=$.length;if(se)for(let xe=0,Me,Ge;xe<se;xe++)if(Ge=$[xe],k){if(k[Ge]){if(!X){if(m)m--;else if(S[N++]=Ge,N===g)return S}(X||x)&&(L[Ge]=1),I=!0}if(x&&(Me=(B[Ge]||0)+1,B[Ge]=Me,Me<w)){let ct=x[Me-2]||(x[Me-2]=[]);ct[ct.length]=Ge}}else L[Ge]=1}if(x)k||(B=L);else if(!I)return[];k=L}if(x)for(let X=x.length-1,F,V;0<=X;X--){F=x[X],V=F.length;for(let L=0,I;L<V;L++)if(I=F[L],!k[I]){if(m)m--;else if(S[N++]=I,N===g)return S;k[I]=1}}return S}function Di(c,g){let m=pe(),x=pe(),w=[];for(let S=0;S<c.length;S++)m[c[S]]=1;for(let S=0,k;S<g.length;S++){k=g[S];for(let B=0,N;B<k.length;B++)N=k[B],m[N]&&!x[N]&&(x[N]=1,w[w.length]=N)}return w}function Kt(c){this.l=c!==!0&&c,this.cache=pe(),this.h=[]}function Li(c,g,m){Nt(c)&&(c=c.query);let x=this.cache.get(c);return x||(x=this.search(c,g,m),this.cache.set(c,x)),x}Kt.prototype.set=function(c,g){if(!this.cache[c]){var m=this.h.length;for(m===this.l?delete this.cache[this.h[m-1]]:m++,--m;0<m;m--)this.h[m]=this.h[m-1];this.h[0]=c}this.cache[c]=g},Kt.prototype.get=function(c){let g=this.cache[c];if(this.l&&g&&(c=this.h.indexOf(c))){let m=this.h[c-1];this.h[c-1]=this.h[c],this.h[c]=m}return g};var er={memory:{charset:"latin:extra",D:3,B:4,m:!1},performance:{D:3,B:3,s:!1,context:{depth:2,D:1}},match:{charset:"latin:extra",G:"reverse"},score:{charset:"latin:advanced",D:20,B:3,context:{depth:3,D:9}},default:{}};function Ai(c,g,m,x,w,S,k,B){setTimeout(function(){let N=c(m?m+"."+x:x,JSON.stringify(k));N&&N.then?N.then(function(){g.export(c,g,m,w,S+1,B)}):g.export(c,g,m,w,S+1,B)})}function Xt(c,g){if(!(this instanceof Xt))return new Xt(c);var m;if(c){dt(c)?c=er[c]:(m=c.preset)&&(c=Object.assign({},m[m],c)),m=c.charset;var x=c.lang;dt(m)&&(m.indexOf(":")===-1&&(m+=":default"),m=Gt[m]),dt(x)&&(x=ui[x])}else c={};let w,S,k=c.context||{};if(this.encode=c.encode||m&&m.encode||cr,this.register=g||pe(),this.D=w=c.resolution||9,this.G=g=m&&m.G||c.tokenize||"strict",this.depth=g==="strict"&&k.depth,this.l=kt(k.bidirectional),this.s=S=kt(c.optimize),this.m=kt(c.fastupdate),this.B=c.minlength||1,this.C=c.boost,this.map=S?je(w):pe(),this.A=w=k.resolution||1,this.h=S?je(w):pe(),this.F=m&&m.F||c.rtl,this.H=(g=c.matcher||x&&x.H)&&rt(g,!1),this.J=(g=c.stemmer||x&&x.J)&&rt(g,!0),m=g=c.filter||x&&x.filter){m=g,x=pe();for(let B=0,N=m.length;B<N;B++)x[m[B]]=1;m=x}this.filter=m,this.cache=(g=c.cache)&&new Kt(g)}G=Xt.prototype,G.append=function(c,g){return this.add(c,g,!0)},G.add=function(c,g,m,x){if(g&&(c||c===0)){if(!x&&!m&&this.register[c])return this.update(c,g);if(g=this.encode(g),x=g.length){let X=pe(),F=pe(),V=this.depth,L=this.D;for(let I=0;I<x;I++){let D=g[this.F?x-1-I:I];var w=D.length;if(D&&w>=this.B&&(V||!F[D])){var S=Zt(L,x,I),k="";switch(this.G){case"full":if(2<w){for(S=0;S<w;S++)for(var B=w;B>S;B--)if(B-S>=this.B){var N=Zt(L,x,I,w,S);k=D.substring(S,B),Yt(this,F,k,N,c,m)}break}case"reverse":if(1<w){for(B=w-1;0<B;B--)k=D[B]+k,k.length>=this.B&&Yt(this,F,k,Zt(L,x,I,w,B),c,m);k=""}case"forward":if(1<w){for(B=0;B<w;B++)k+=D[B],k.length>=this.B&&Yt(this,F,k,S,c,m);break}default:if(this.C&&(S=Math.min(S/this.C(g,D,I)|0,L-1)),Yt(this,F,D,S,c,m),V&&1<x&&I<x-1){for(w=pe(),k=this.A,S=D,B=Math.min(V+1,x-I),w[S]=1,N=1;N<B;N++)if((D=g[this.F?x-1-I-N:I+N])&&D.length>=this.B&&!w[D]){w[D]=1;let $=this.l&&D>S;Yt(this,X,$?S:D,Zt(k+(x/2>k?0:1),x,I,B-1,N-1),c,m,$?D:S)}}}}}this.m||(this.register[c]=1)}}return this};function Zt(c,g,m,x,w){return m&&1<c?g+(x||0)<=c?m+(w||0):(c-1)/(g+(x||0))*(m+(w||0))+1|0:0}function Yt(c,g,m,x,w,S,k){let B=k?c.h:c.map;(!g[m]||k&&!g[m][k])&&(c.s&&(B=B[x]),k?(g=g[m]||(g[m]=pe()),g[k]=1,B=B[k]||(B[k]=pe())):g[m]=1,B=B[m]||(B[m]=[]),c.s||(B=B[x]||(B[x]=[])),S&&B.includes(w)||(B[B.length]=w,c.m&&(c=c.register[w]||(c.register[w]=[]),c[c.length]=B)))}G.search=function(c,g,m){m||(!g&&Nt(c)?(m=c,c=m.query):Nt(g)&&(m=g));let x=[],w,S,k=0;if(m){c=m.query||c,g=m.limit,k=m.offset||0;var B=m.context;S=m.suggest}if(c&&(c=this.encode(""+c),w=c.length,1<w)){m=pe();var N=[];for(let F=0,V=0,L;F<w;F++)if((L=c[F])&&L.length>=this.B&&!m[L])if(this.s||S||this.map[L])N[V++]=L,m[L]=1;else return x;c=N,w=c.length}if(!w)return x;g||(g=100),B=this.depth&&1<w&&B!==!1,m=0;let X;B?(X=c[0],m=1):1<w&&c.sort(te);for(let F,V;m<w;m++){if(V=c[m],B?(F=ai(this,x,S,g,k,w===2,V,X),S&&F===!1&&x.length||(X=V)):F=ai(this,x,S,g,k,w===1,V),F)return F;if(S&&m===w-1){if(N=x.length,!N){if(B){B=0,m=-1;continue}return x}if(N===1)return W(x[0],g,k)}}return Ot(x,g,k,S)};function ai(c,g,m,x,w,S,k,B){let N=[],X=B?c.h:c.map;if(c.s||(X=re(X,k,B,c.l)),X){let F=0,V=Math.min(X.length,B?c.A:c.D);for(let L=0,I=0,D,$;L<V&&!((D=X[L])&&(c.s&&(D=re(D,k,B,c.l)),w&&D&&S&&($=D.length,$<=w?(w-=$,D=null):(D=D.slice(w),w=0)),D&&(N[F++]=D,S&&(I+=D.length,I>=x))));L++);if(F){if(S)return W(N,x,0);g[g.length]=N;return}}return!m&&N}function W(c,g,m){return c=c.length===1?c[0]:[].concat.apply([],c),m||c.length>g?c.slice(m,m+g):c}function re(c,g,m,x){return m?(x=x&&g>m,c=(c=c[x?g:m])&&c[x?m:g]):c=c[g],c}G.contain=function(c){return!!this.register[c]},G.update=function(c,g){return this.remove(c).add(c,g)},G.remove=function(c,g){let m=this.register[c];if(m){if(this.m)for(let x=0,w;x<m.length;x++)w=m[x],w.splice(w.indexOf(c),1);else fe(this.map,c,this.D,this.s),this.depth&&fe(this.h,c,this.A,this.s);if(g||delete this.register[c],this.cache){g=this.cache;for(let x=0,w,S;x<g.h.length;x++)S=g.h[x],w=g.cache[S],w.includes(c)&&(g.h.splice(x--,1),delete g.cache[S])}}return this};function fe(c,g,m,x,w){let S=0;if(c.constructor===Array)if(w)g=c.indexOf(g),g!==-1?1<c.length&&(c.splice(g,1),S++):S++;else{w=Math.min(c.length,m);for(let k=0,B;k<w;k++)(B=c[k])&&(S=fe(B,g,m,x,w),x||S||delete c[k])}else for(let k in c)(S=fe(c[k],g,m,x,w))||delete c[k];return S}G.searchCache=Li,G.export=function(c,g,m,x,w,S){let k=!0;typeof S>"u"&&(k=new Promise(X=>{S=X}));let B,N;switch(w||(w=0)){case 0:if(B="reg",this.m){N=pe();for(let X in this.register)N[X]=1}else N=this.register;break;case 1:B="cfg",N={doc:0,opt:this.s?1:0};break;case 2:B="map",N=this.map;break;case 3:B="ctx",N=this.h;break;default:typeof m>"u"&&S&&S();return}return Ai(c,g||this,m,B,x,w,N,S),k},G.import=function(c,g){if(g)switch(dt(g)&&(g=JSON.parse(g)),c){case"cfg":this.s=!!g.opt;break;case"reg":this.m=!1,this.register=g;break;case"map":this.map=g;break;case"ctx":this.h=g}},Fi(Xt.prototype);function _e(c){c=c.data;var g=self._index;let m=c.args;var x=c.task;switch(x){case"init":x=c.options||{},c=c.factory,g=x.encode,x.cache=!1,g&&g.indexOf("function")===0&&(x.encode=Function("return "+g)()),c?(Function("return "+c)()(self),self._index=new self.FlexSearch.Index(x),delete self.FlexSearch):self._index=new Xt(x);break;default:c=c.id,g=g[x].apply(g,m),postMessage(x==="search"?{id:c,msg:g}:{id:c})}}var we=0;function ye(c){if(!(this instanceof ye))return new ye(c);var g;c?Je(g=c.encode)&&(c.encode=g.toString()):c={},(g=(self||window)._factory)&&(g=g.toString());let m=typeof window>"u"&&self.exports,x=this;this.o=qe(g,m,c.worker),this.h=pe(),this.o&&(m?this.o.on("message",function(w){x.h[w.id](w.msg),delete x.h[w.id]}):this.o.onmessage=function(w){w=w.data,x.h[w.id](w.msg),delete x.h[w.id]},this.o.postMessage({task:"init",factory:g,options:c}))}Ce("add"),Ce("append"),Ce("search"),Ce("update"),Ce("remove");function Ce(c){ye.prototype[c]=ye.prototype[c+"Async"]=function(){let g=this,m=[].slice.call(arguments);var x=m[m.length-1];let w;return Je(x)&&(w=x,m.splice(m.length-1,1)),x=new Promise(function(S){setTimeout(function(){g.h[++we]=S,g.o.postMessage({task:c,id:we,args:m})})}),w?(x.then(w),this):x}}function qe(c,g,m){let x;try{x=g?new(Rt()).Worker(__dirname+"/node/node.js"):c?new Worker(URL.createObjectURL(new Blob(["onmessage="+_e.toString()],{type:"text/javascript"}))):new Worker(dt(m)?m:"worker/worker.js",{type:"module"})}catch{}return x}function Ke(c){if(!(this instanceof Ke))return new Ke(c);var g=c.document||c.doc||c,m;this.K=[],this.h=[],this.A=[],this.register=pe(),this.key=(m=g.key||g.id)&&ut(m,this.A)||"id",this.m=kt(c.fastupdate),this.C=(m=g.store)&&m!==!0&&[],this.store=m&&pe(),this.I=(m=g.tag)&&ut(m,this.A),this.l=m&&pe(),this.cache=(m=c.cache)&&new Kt(m),c.cache=!1,this.o=c.worker,this.async=!1,m=pe();let x=g.index||g.field||g;dt(x)&&(x=[x]);for(let w=0,S,k;w<x.length;w++)S=x[w],dt(S)||(k=S,S=S.field),k=Nt(k)?Object.assign({},c,k):c,this.o&&(m[S]=new ye(k),m[S].o||(this.o=!1)),this.o||(m[S]=new Xt(k,this.register)),this.K[w]=ut(S,this.A),this.h[w]=S;if(this.C)for(c=g.store,dt(c)&&(c=[c]),g=0;g<c.length;g++)this.C[g]=ut(c[g],this.A);this.index=m}function ut(c,g){let m=c.split(":"),x=0;for(let w=0;w<m.length;w++)c=m[w],0<=c.indexOf("[]")&&(c=c.substring(0,c.length-2))&&(g[x]=!0),c&&(m[x++]=c);return x<m.length&&(m.length=x),1<x?m:m[0]}function _t(c,g){if(dt(g))c=c[g];else for(let m=0;c&&m<g.length;m++)c=c[g[m]];return c}function ue(c,g,m,x,w){if(c=c[w],x===m.length-1)g[w]=c;else if(c)if(c.constructor===Array)for(g=g[w]=Array(c.length),w=0;w<c.length;w++)ue(c,g,m,x,w);else g=g[w]||(g[w]=pe()),w=m[++x],ue(c,g,m,x,w)}function Ie(c,g,m,x,w,S,k,B){if(c=c[k])if(x===g.length-1){if(c.constructor===Array){if(m[x]){for(g=0;g<c.length;g++)w.add(S,c[g],!0,!0);return}c=c.join(" ")}w.add(S,c,B,!0)}else if(c.constructor===Array)for(k=0;k<c.length;k++)Ie(c,g,m,x,w,S,k,B);else k=g[++x],Ie(c,g,m,x,w,S,k,B)}G=Ke.prototype,G.add=function(c,g,m){if(Nt(c)&&(g=c,c=_t(g,this.key)),g&&(c||c===0)){if(!m&&this.register[c])return this.update(c,g);for(let x=0,w,S;x<this.h.length;x++)S=this.h[x],w=this.K[x],dt(w)&&(w=[w]),Ie(g,w,this.A,0,this.index[S],c,w[0],m);if(this.I){let x=_t(g,this.I),w=pe();dt(x)&&(x=[x]);for(let S=0,k,B;S<x.length;S++)if(k=x[S],!w[k]&&(w[k]=1,B=this.l[k]||(this.l[k]=[]),!m||!B.includes(c))&&(B[B.length]=c,this.m)){let N=this.register[c]||(this.register[c]=[]);N[N.length]=B}}if(this.store&&(!m||!this.store[c])){let x;if(this.C){x=pe();for(let w=0,S;w<this.C.length;w++)S=this.C[w],dt(S)?x[S]=g[S]:ue(g,x,S,0,S[0])}this.store[c]=x||g}}return this},G.append=function(c,g){return this.add(c,g,!0)},G.update=function(c,g){return this.remove(c).add(c,g)},G.remove=function(c){if(Nt(c)&&(c=_t(c,this.key)),this.register[c]){for(var g=0;g<this.h.length&&(this.index[this.h[g]].remove(c,!this.o),!this.m);g++);if(this.I&&!this.m)for(let m in this.l){g=this.l[m];let x=g.indexOf(c);x!==-1&&(1<g.length?g.splice(x,1):delete this.l[m])}this.store&&delete this.store[c],delete this.register[c]}return this},G.search=function(c,g,m,x){m||(!g&&Nt(c)?(m=c,c=""):Nt(g)&&(m=g,g=0));let w=[],S=[],k,B,N,X,F,V,L=0;if(m)if(m.constructor===Array)N=m,m=null;else{if(c=m.query||c,N=(k=m.pluck)||m.index||m.field,X=m.tag,B=this.store&&m.enrich,F=m.bool==="and",g=m.limit||g||100,V=m.offset||0,X&&(dt(X)&&(X=[X]),!c)){for(let D=0,$;D<X.length;D++)($=ve.call(this,X[D],g,V,B))&&(w[w.length]=$,L++);return L?w:[]}dt(N)&&(N=[N])}N||(N=this.h),F=F&&(1<N.length||X&&1<X.length);let I=!x&&(this.o||this.async)&&[];for(let D=0,$,se,xe;D<N.length;D++){let Me;if(se=N[D],dt(se)||(Me=se,se=Me.field,c=Me.query||c,g=Me.limit||g,B=Me.enrich||B),I)I[D]=this.index[se].searchAsync(c,g,Me||m);else{if(x?$=x[D]:$=this.index[se].search(c,g,Me||m),xe=$&&$.length,X&&xe){let Ge=[],ct=0;F&&(Ge[0]=[$]);for(let Qt=0,ei,qt;Qt<X.length;Qt++)ei=X[Qt],(xe=(qt=this.l[ei])&&qt.length)&&(ct++,Ge[Ge.length]=F?[qt]:qt);ct&&($=F?Ot(Ge,g||100,V||0):Di($,Ge),xe=$.length)}if(xe)S[L]=se,w[L++]=$;else if(F)return[]}}if(I){let D=this;return new Promise(function($){Promise.all(I).then(function(se){$(D.search(c,g,m,se))})})}if(!L)return[];if(k&&(!B||!this.store))return w[0];for(let D=0,$;D<S.length;D++){if($=w[D],$.length&&B&&($=Se.call(this,$)),k)return $;w[D]={field:S[D],result:$}}return w};function ve(c,g,m,x){let w=this.l[c],S=w&&w.length-m;if(S&&0<S)return(S>g||m)&&(w=w.slice(m,m+g)),x&&(w=Se.call(this,w)),{tag:c,result:w}}function Se(c){let g=Array(c.length);for(let m=0,x;m<c.length;m++)x=c[m],g[m]={id:x,doc:this.store[x]};return g}G.contain=function(c){return!!this.register[c]},G.get=function(c){return this.store[c]},G.set=function(c,g){return this.store[c]=g,this},G.searchCache=Li,G.export=function(c,g,m,x,w,S){let k;if(typeof S>"u"&&(k=new Promise(B=>{S=B})),w||(w=0),x||(x=0),x<this.h.length){let B=this.h[x],N=this.index[B];g=this,setTimeout(function(){N.export(c,g,w?B:"",x,w++,S)||(x++,w=1,g.export(c,g,B,x,w,S))})}else{let B,N;switch(w){case 1:B="tag",N=this.l,m=null;break;case 2:B="store",N=this.store,m=null;break;default:S();return}Ai(c,this,m,B,x,w,N,S)}return k},G.import=function(c,g){if(g)switch(dt(g)&&(g=JSON.parse(g)),c){case"tag":this.l=g;break;case"reg":this.m=!1,this.register=g;for(let x=0,w;x<this.h.length;x++)w=this.index[this.h[x]],w.register=g,w.m=!1;break;case"store":this.store=g;break;default:c=c.split(".");let m=c[0];c=c[1],m&&c&&this.index[m].import(c,g)}},Fi(Ke.prototype);var $e={encode:st,F:!1,G:""},Fe=[nt("[\xE0\xE1\xE2\xE3\xE4\xE5]"),"a",nt("[\xE8\xE9\xEA\xEB]"),"e",nt("[\xEC\xED\xEE\xEF]"),"i",nt("[\xF2\xF3\xF4\xF5\xF6\u0151]"),"o",nt("[\xF9\xFA\xFB\xFC\u0171]"),"u",nt("[\xFD\u0177\xFF]"),"y",nt("\xF1"),"n",nt("[\xE7c]"),"k",nt("\xDF"),"s",nt(" & ")," and "];function st(c){var g=c=""+c;return g.normalize&&(g=g.normalize("NFD").replace(It,"")),xt.call(this,g.toLowerCase(),!c.normalize&&Fe)}var Jt={encode:At,F:!1,G:"strict"},De=/[^a-z0-9]+/,ci={b:"p",v:"f",w:"f",z:"s",x:"s",\u00DF:"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function At(c){c=st.call(this,c).join(" ");let g=[];if(c){let m=c.split(De),x=m.length;for(let w=0,S,k=0;w<x;w++)if((c=m[w])&&(!this.filter||!this.filter[c])){S=c[0];let B=ci[S]||S,N=B;for(let X=1;X<c.length;X++){S=c[X];let F=ci[S]||S;F&&F!==N&&(B+=F,N=F)}g[k++]=B}}return g}var ke={encode:Rr,F:!1,G:""},Pr=[nt("ae"),"a",nt("oe"),"o",nt("sh"),"s",nt("th"),"t",nt("ph"),"f",nt("pf"),"f",nt("(?![aeo])h(?![aeo])"),"",nt("(?!^[aeo])h(?!^[aeo])"),""];function Rr(c,g){return c&&(c=At.call(this,c).join(" "),2<c.length&&(c=mt(c,Pr)),g||(1<c.length&&(c=Qi(c)),c&&(c=c.split(" ")))),c||[]}var We={encode:kr,F:!1,G:""},$t=nt("(?!\\b)[aeo]");function kr(c){return c&&(c=Rr.call(this,c,!0),1<c.length&&(c=c.replace($t,"")),1<c.length&&(c=Qi(c)),c&&(c=c.split(" "))),c||[]}Gt["latin:default"]=yi,Gt["latin:simple"]=$e,Gt["latin:balance"]=Jt,Gt["latin:advanced"]=ke,Gt["latin:extra"]=We;var at={Index:Xt,Document:Ke,Worker:ye,registerCharset:function(c,g){Gt[c]=g},registerLanguage:function(c,g){ui[c]=g}};function dr(c,g){if(!c)return;function m(w){w.target===this&&(w.preventDefault(),w.stopPropagation(),g())}function x(w){w.key.startsWith("Esc")&&(w.preventDefault(),g())}c?.addEventListener("click",m),window.addCleanup(()=>c?.removeEventListener("click",m)),document.addEventListener("keydown",x),window.addCleanup(()=>document.removeEventListener("keydown",x))}function bt(c){for(;c.firstChild;)c.removeChild(c.firstChild)}var Xe=Object.hasOwnProperty,fr=ze(ht(),1),Ve=(0,fr.default)();function wt(c){let g=Qr(Jr(c,"index"),!0);return g.length===0?"/":g}var tr=(c,g,m)=>{let x=new URL(c.getAttribute(g),m);c.setAttribute(g,x.pathname+x.hash)};function Kr(c,g){c.querySelectorAll('[href^="./"], [href^="../"]').forEach(m=>tr(m,"href",g)),c.querySelectorAll('[src^="./"], [src^="../"]').forEach(m=>tr(m,"src",g))}function Zr(c){let g=c.split("/").filter(m=>m!=="").slice(0,-1).map(m=>"..").join("/");return g.length===0&&(g="."),g}function Le(c,g){return Ht(Zr(c),wt(g))}function Ht(...c){return c.filter(g=>g!=="").join("/").replace(/\/\/+/g,"/")}function Br(c,g){return c===g||c.endsWith("/"+g)}function Jr(c,g){return Br(c,g)&&(c=c.slice(0,-g.length)),c}function Qr(c,g){return c.startsWith("/")&&(c=c.substring(1)),!g&&c.endsWith("/")&&(c=c.slice(0,-1)),c}var xi="basic",Ct="",Ir=c=>c.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),Ni=new at.Document({charset:"latin:extra",encode:Ir,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),pr=new DOMParser,en=new Map,ir=30,Gr=8,Or=5,tn=c=>{let g=c.split(/\s+/).filter(x=>x.trim()!==""),m=g.length;if(m>1)for(let x=1;x<m;x++)g.push(g.slice(0,x+1).join(" "));return g.sort((x,w)=>w.length-x.length)};function Hi(c,g,m){let x=tn(c),w=g.split(/\s+/).filter(N=>N!==""),S=0,k=w.length-1;if(m){let N=L=>x.some(I=>L.toLowerCase().startsWith(I.toLowerCase())),X=w.map(N),F=0,V=0;for(let L=0;L<Math.max(w.length-ir,0);L++){let I=X.slice(L,L+ir).reduce((D,$)=>D+($?1:0),0);I>=F&&(F=I,V=L)}S=Math.max(V-ir,0),k=Math.min(S+2*ir,w.length-1),w=w.slice(S,k)}let B=w.map(N=>{for(let X of x)if(N.toLowerCase().includes(X.toLowerCase())){let F=new RegExp(X.toLowerCase(),"gi");return N.replace(F,'<span class="highlight">$&</span>')}return N}).join(" ");return`${S===0?"":"..."}${B}${k===w.length-1?"":"..."}`}function ot(c,g){let m=new DOMParser,x=tn(c),w=m.parseFromString(g.innerHTML,"text/html"),S=B=>{let N=document.createElement("span");return N.className="highlight",N.textContent=B,N},k=(B,N)=>{if(B.nodeType===Node.TEXT_NODE){let X=B.nodeValue??"",F=new RegExp(N.toLowerCase(),"gi"),V=X.match(F);if(!V||V.length===0)return;let L=document.createElement("span"),I=0;for(let D of V){let $=X.indexOf(D,I);L.appendChild(document.createTextNode(X.slice(I,$))),L.appendChild(S(D)),I=$+D.length}L.appendChild(document.createTextNode(X.slice(I))),B.parentNode?.replaceChild(L,B)}else if(B.nodeType===Node.ELEMENT_NODE){if(B.classList.contains("highlight"))return;Array.from(B.childNodes).forEach(X=>k(X,N))}};for(let B of x)k(w.body,B);return w.body}document.addEventListener("nav",async c=>{let g=c.detail.url,m=await fetchData,x=document.getElementById("search-container"),w=x?.closest(".sidebar"),S=document.getElementById("search-button"),k=document.getElementById("search-bar"),B=document.getElementById("search-layout"),N=Object.keys(m),X=Ae=>{B?.querySelector(`#${Ae.id}`)===null&&B?.appendChild(Ae)},F=B?.dataset?.preview==="true",V,L,I=document.createElement("div");I.id="results-container",X(I),F&&(V=document.createElement("div"),V.id="preview-container",X(V));function D(){x?.classList.remove("active"),k&&(k.value=""),w&&(w.style.zIndex="unset"),I&&bt(I),V&&bt(V),B&&B.classList.remove("display-results"),xi="basic",S?.focus()}function $(Ae){xi=Ae,w&&(w.style.zIndex="1"),x?.classList.add("active"),k?.focus()}let se=null;async function xe(Ae){if(Ae.key==="k"&&(Ae.ctrlKey||Ae.metaKey)&&!Ae.shiftKey){Ae.preventDefault(),x?.classList.contains("active")?D():$("basic");return}else if(Ae.shiftKey&&(Ae.ctrlKey||Ae.metaKey)&&Ae.key.toLowerCase()==="k"){Ae.preventDefault(),x?.classList.contains("active")?D():$("tags"),k&&(k.value="#");return}if(se&&se.classList.remove("focus"),!!x?.classList.contains("active")){if(Ae.key==="Enter")if(I?.contains(document.activeElement)){let Be=document.activeElement;if(Be.classList.contains("no-match"))return;await di(Be),Be.click()}else{let Be=document.getElementsByClassName("result-card")[0];if(!Be||Be?.classList.contains("no-match"))return;await di(Be),Be.click()}else if(Ae.key==="ArrowUp"||Ae.shiftKey&&Ae.key==="Tab"){if(Ae.preventDefault(),I?.contains(document.activeElement)){let Be=se||document.activeElement,He=Be?.previousElementSibling;Be?.classList.remove("focus"),He?.focus(),He&&(se=He),await di(He)}}else if((Ae.key==="ArrowDown"||Ae.key==="Tab")&&(Ae.preventDefault(),document.activeElement===k||se!==null)){let Be=se||document.getElementsByClassName("result-card")[0],He=Be?.nextElementSibling;Be?.classList.remove("focus"),He?.focus(),He&&(se=He),await di(He)}}}let Me=(Ae,Be)=>{let He=N[Be];return{id:Be,slug:He,title:xi==="tags"?m[He].title:Hi(Ae,m[He].title??""),content:Hi(Ae,m[He].content??"",!0),tags:Ge(Ae.substring(1),m[He].tags)}};function Ge(Ae,Be){return!Be||xi!=="tags"?[]:Be.map(He=>He.toLowerCase().includes(Ae.toLowerCase())?`<li><p class="match-tag">#${He}</p></li>`:`<li><p>#${He}</p></li>`).slice(0,Or)}function ct(Ae){return new URL(Le(g,Ae),location.toString())}let Qt=({slug:Ae,title:Be,content:He,tags:ft})=>{let et=ft.length>0?`<ul class="tags">${ft.join("")}</ul>`:"",lt=document.createElement("a");lt.classList.add("result-card"),lt.id=Ae,lt.href=ct(Ae).toString(),lt.innerHTML=`<h3>${Be}</h3>${et}${F&&window.innerWidth>600?"":`<p>${He}</p>`}`,lt.addEventListener("click",oi=>{oi.altKey||oi.ctrlKey||oi.metaKey||oi.shiftKey||D()});let zt=oi=>{oi.altKey||oi.ctrlKey||oi.metaKey||oi.shiftKey||D()};async function Ci(oi){if(!oi.target)return;let ko=oi.target;await di(ko)}return lt.addEventListener("mouseenter",Ci),window.addCleanup(()=>lt.removeEventListener("mouseenter",Ci)),lt.addEventListener("click",zt),window.addCleanup(()=>lt.removeEventListener("click",zt)),lt};async function ei(Ae){if(I)if(bt(I),Ae.length===0?I.innerHTML=`<a class="result-card no-match">
|
|
<h3>No results.</h3>
|
|
<p>Try another search term?</p>
|
|
</a>`:I.append(...Ae.map(Qt)),Ae.length===0&&V)bt(V);else{let Be=I.firstElementChild;Be.classList.add("focus"),se=Be,await di(Be)}}async function qt(Ae){if(en.has(Ae))return en.get(Ae);let Be=ct(Ae).toString(),He=await fetch(Be).then(ft=>ft.text()).then(ft=>{if(ft===void 0)throw new Error(`Could not fetch ${Be}`);let et=pr.parseFromString(ft??"","text/html");return Kr(et,Be),[...et.getElementsByClassName("popover-hint")]});return en.set(Ae,He),He}async function di(Ae){if(!B||!F||!Ae||!V)return;let Be=Ae.id,He=await qt(Be).then(ft=>ft.flatMap(et=>[...ot(Ct,et).children]));L=document.createElement("div"),L.classList.add("preview-inner"),L.append(...He),V.replaceChildren(L),[...V.querySelectorAll(".highlight")].sort((ft,et)=>et.innerHTML.length-ft.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function Ut(Ae){if(!B||!Ni)return;Ct=Ae.target.value,B.classList.toggle("display-results",Ct!==""),xi=Ct.startsWith("#")?"tags":"basic";let Be;if(xi==="tags"){Ct=Ct.substring(1).trim();let et=Ct.indexOf(" ");if(et!=-1){let lt=Ct.substring(0,et),zt=Ct.substring(et+1).trim();Be=await Ni.searchAsync({query:zt,limit:Math.max(Gr,1e4),index:["title","content"],tag:lt});for(let Ci of Be)Ci.result=Ci.result.slice(0,Gr);xi="basic",Ct=zt}else Be=await Ni.searchAsync({query:Ct,limit:Gr,index:["tags"]})}else xi==="basic"&&(Be=await Ni.searchAsync({query:Ct,limit:Gr,index:["title","content"]}));let He=et=>{let lt=Be.filter(zt=>zt.field===et);return lt.length===0?[]:[...lt[0].result]},ft=[...new Set([...He("title"),...He("content"),...He("tags")])].map(et=>Me(Ct,et));await ei(ft)}document.addEventListener("keydown",xe),window.addCleanup(()=>document.removeEventListener("keydown",xe)),S?.addEventListener("click",()=>$("basic")),window.addCleanup(()=>S?.removeEventListener("click",()=>$("basic"))),k?.addEventListener("input",Ut),window.addCleanup(()=>k?.removeEventListener("input",Ut)),dr(x,D),await E(m)});async function E(c){let g=0,m=[];for(let[x,w]of Object.entries(c))m.push(Ni.addAsync(g++,{id:g,slug:x,title:w.title,content:w.content,tags:w.tags}));return await Promise.all(m)}}(),function(){var gt,Pt=new IntersectionObserver(Ue=>{let ze=document.getElementById("explorer-ul");if(ze)for(let Rt of Ue)Rt.isIntersecting?ze.classList.add("no-background"):ze.classList.remove("no-background")});function jt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let Ue=this.nextElementSibling;Ue&&(Ue.classList.toggle("collapsed"),Ue.style.maxHeight=Ue.style.maxHeight==="0px"?Ue.scrollHeight+"px":"0px")}function it(Ue){Ue.stopPropagation();let ze=Ue.target;if(!ze)return;let Rt=ze.nodeName==="svg",ht=Rt?ze.parentElement?.nextSibling:ze.parentElement?.parentElement?.nextElementSibling,G=Rt?ze.nextElementSibling:ze.parentElement;if(!(ht&&G))return;ht.classList.toggle("open");let kt=ht.classList.contains("open");Bt(ht,!kt);let je=G.dataset.folderpath;v(gt,je);let pe=JSON.stringify(gt);localStorage.setItem("fileTree",pe)}function Et(){let Ue=document.getElementById("explorer");if(!Ue)return;if(Ue.dataset.behavior==="collapse")for(let je of document.getElementsByClassName("folder-button"))je.addEventListener("click",it),window.addCleanup(()=>je.removeEventListener("click",it));Ue.addEventListener("click",jt),window.addCleanup(()=>Ue.removeEventListener("click",jt));for(let je of document.getElementsByClassName("folder-icon"))je.addEventListener("click",it),window.addCleanup(()=>je.removeEventListener("click",it));let ze=localStorage.getItem("fileTree"),Rt=Ue?.dataset.savestate==="true",ht=ze&&Rt?JSON.parse(ze):[],G=new Map(ht.map(je=>[je.path,je.collapsed])),kt=Ue.dataset.tree?JSON.parse(Ue.dataset.tree):[];gt=[];for(let{path:je,collapsed:pe}of kt)gt.push({path:je,collapsed:G.get(je)??pe});gt.map(je=>{let pe=document.querySelector(`[data-folderpath='${je.path}']`)?.parentElement?.nextElementSibling;pe&&Bt(pe,je.collapsed)})}window.addEventListener("resize",Et),document.addEventListener("nav",()=>{Et(),Pt.disconnect();let Ue=document.getElementById("explorer-end");Ue&&Pt.observe(Ue)});function Bt(Ue,ze){return ze?Ue.classList.remove("open"):Ue.classList.add("open")}function v(Ue,ze){let Rt=Ue.find(ht=>ht.path===ze);Rt&&(Rt.collapsed=!Rt.collapsed)}}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(e,t)=>()=>(e&&(t=e(e=0)),t),Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ze=(e,t)=>{for(var i in t)Pt(e,i,{get:t[i],enumerable:!0})},Rt=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of it(t))!Bt.call(e,n)&&n!==i&&Pt(e,n,{get:()=>t[n],enumerable:!(r=jt(t,n))||r.enumerable});return e},ht=(e,t,i)=>(i=e!=null?gt(Et(e)):{},Rt(t||!e||!e.__esModule?Pt(i,"default",{value:e,enumerable:!0}):i,e)),G,kt,je,pe,te=v(()=>{"use strict";G=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e))(G||{}),kt=e=>{if(typeof e=="function"||typeof e=="object"&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={...typeof e.extension!="object"?{type:e.extension}:e.extension,ref:e}}if(typeof e=="object")e={...e};else throw new Error("Invalid extension type");return typeof e.type=="string"&&(e.type=[e.type]),e},je=(e,t)=>kt(e).priority??t,pe={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(kt).forEach(t=>{t.type.forEach(i=>this._removeHandlers[i]?.(t))}),this},add(...e){return e.map(kt).forEach(t=>{t.type.forEach(i=>{let r=this._addHandlers,n=this._queue;r[i]?r[i]?.(t):(n[i]=n[i]||[],n[i]?.push(t))})}),this},handle(e,t,i){let r=this._addHandlers,n=this._removeHandlers;if(r[e]||n[e])throw new Error(`Extension type ${e} already has a handler`);r[e]=t,n[e]=i;let s=this._queue;return s[e]&&(s[e]?.forEach(a=>t(a)),delete s[e]),this},handleByMap(e,t){return this.handle(e,i=>{i.name&&(t[i.name]=i.ref)},i=>{i.name&&delete t[i.name]})},handleByNamedList(e,t,i=-1){return this.handle(e,r=>{t.findIndex(n=>n.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((n,s)=>je(s.value,i)-je(n.value,i)))},r=>{let n=t.findIndex(s=>s.name===r.name);n!==-1&&t.splice(n,1)})},handleByList(e,t,i=-1){return this.handle(e,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((n,s)=>je(s,i)-je(n,i)))},r=>{let n=t.indexOf(r.ref);n!==-1&&t.splice(n,1)})}}}),dt=Ue((e,t)=>{"use strict";var i=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function a(h,u,d,p,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new s(d,p||h,f),b=r?r+u:u;return h._events[b]?h._events[b].fn?h._events[b]=[h._events[b],y]:h._events[b].push(y):(h._events[b]=y,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new n:delete h._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],u,d;if(this._eventsCount===0)return h;for(d in u=this._events)i.call(u,d)&&h.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},l.prototype.listeners=function(h){var u=r?r+h:h,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,f=d.length,y=new Array(f);p<f;p++)y[p]=d[p].fn;return y},l.prototype.listenerCount=function(h){var u=r?r+h:h,d=this._events[u];return d?d.fn?1:d.length:0},l.prototype.emit=function(h,u,d,p,f,y){var b=r?r+h:h;if(!this._events[b])return!1;var _=this._events[b],T=arguments.length,C,O;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),T){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,u),!0;case 3:return _.fn.call(_.context,u,d),!0;case 4:return _.fn.call(_.context,u,d,p),!0;case 5:return _.fn.call(_.context,u,d,p,f),!0;case 6:return _.fn.call(_.context,u,d,p,f,y),!0}for(O=1,C=new Array(T-1);O<T;O++)C[O-1]=arguments[O];_.fn.apply(_.context,C)}else{var R=_.length,z;for(O=0;O<R;O++)switch(_[O].once&&this.removeListener(h,_[O].fn,void 0,!0),T){case 1:_[O].fn.call(_[O].context);break;case 2:_[O].fn.call(_[O].context,u);break;case 3:_[O].fn.call(_[O].context,u,d);break;case 4:_[O].fn.call(_[O].context,u,d,p);break;default:if(!C)for(z=1,C=new Array(T-1);z<T;z++)C[z-1]=arguments[z];_[O].fn.apply(_[O].context,C)}}return!0},l.prototype.on=function(h,u,d){return a(this,h,u,d,!1)},l.prototype.once=function(h,u,d){return a(this,h,u,d,!0)},l.prototype.removeListener=function(h,u,d,p){var f=r?r+h:h;if(!this._events[f])return this;if(!u)return o(this,f),this;var y=this._events[f];if(y.fn)y.fn===u&&(!p||y.once)&&(!d||y.context===d)&&o(this,f);else{for(var b=0,_=[],T=y.length;b<T;b++)(y[b].fn!==u||p&&!y[b].once||d&&y[b].context!==d)&&_.push(y[b]);_.length?this._events[f]=_.length===1?_[0]:_:o(this,f)}return this},l.prototype.removeAllListeners=function(h){var u;return h?(u=r?r+h:h,this._events[u]&&o(this,u)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)}),Nt,Je,xt=v(()=>{Nt=ht(dt(),1),Je=Nt.default}),Ui,It,rt,mt,nt,Qi,yi,cr,ui,Gt,Fi,si,Ot,Di,Kt,Li,er,Ai,Xt,Zt,Yt,ai,W,re,fe,_e,we,ye,Ce,qe=v(()=>{Ui={grad:.9,turn:360,rad:360/(2*Math.PI)},It=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},rt=function(e,t,i){return t===void 0&&(t=0),i===void 0&&(i=Math.pow(10,t)),Math.round(i*e)/i+0},mt=function(e,t,i){return t===void 0&&(t=0),i===void 0&&(i=1),e>i?i:e>t?e:t},nt=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Qi=function(e){return{r:mt(e.r,0,255),g:mt(e.g,0,255),b:mt(e.b,0,255),a:mt(e.a)}},yi=function(e){return{r:rt(e.r),g:rt(e.g),b:rt(e.b),a:rt(e.a,3)}},cr=/^#([0-9a-f]{3,8})$/i,ui=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Gt=function(e){var t=e.r,i=e.g,r=e.b,n=e.a,s=Math.max(t,i,r),a=s-Math.min(t,i,r),o=a?s===t?(i-r)/a:s===i?2+(r-t)/a:4+(t-i)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},Fi=function(e){var t=e.h,i=e.s,r=e.v,n=e.a;t=t/360*6,i/=100,r/=100;var s=Math.floor(t),a=r*(1-i),o=r*(1-(t-s)*i),l=r*(1-(1-t+s)*i),h=s%6;return{r:255*[r,o,a,a,l,r][h],g:255*[l,r,r,o,a,a][h],b:255*[a,a,l,r,r,o][h],a:n}},si=function(e){return{h:nt(e.h),s:mt(e.s,0,100),l:mt(e.l,0,100),a:mt(e.a)}},Ot=function(e){return{h:rt(e.h),s:rt(e.s),l:rt(e.l),a:rt(e.a,3)}},Di=function(e){return Fi((i=(t=e).s,{h:t.h,s:(i*=((r=t.l)<50?r:100-r)/100)>0?2*i/(r+i)*100:0,v:r+i,a:t.a}));var t,i,r},Kt=function(e){return{h:(t=Gt(e)).h,s:(n=(200-(i=t.s))*(r=t.v)/100)>0&&n<200?i*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,i,r,n},Li=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,er=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ai=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zt={string:[[function(e){var t=cr.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?rt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?rt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Ai.exec(e)||Xt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Qi({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Li.exec(e)||er.exec(e);if(!t)return null;var i,r,n=si({h:(i=t[1],r=t[2],r===void 0&&(r="deg"),Number(i)*(Ui[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Di(n)},"hsl"]],object:[[function(e){var t=e.r,i=e.g,r=e.b,n=e.a,s=n===void 0?1:n;return It(t)&&It(i)&&It(r)?Qi({r:Number(t),g:Number(i),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,i=e.s,r=e.l,n=e.a,s=n===void 0?1:n;if(!It(t)||!It(i)||!It(r))return null;var a=si({h:Number(t),s:Number(i),l:Number(r),a:Number(s)});return Di(a)},"hsl"],[function(e){var t=e.h,i=e.s,r=e.v,n=e.a,s=n===void 0?1:n;if(!It(t)||!It(i)||!It(r))return null;var a=function(o){return{h:nt(o.h),s:mt(o.s,0,100),v:mt(o.v,0,100),a:mt(o.a)}}({h:Number(t),s:Number(i),v:Number(r),a:Number(s)});return Fi(a)},"hsv"]]},Yt=function(e,t){for(var i=0;i<t.length;i++){var r=t[i][0](e);if(r)return[r,t[i][1]]}return[null,void 0]},ai=function(e){return typeof e=="string"?Yt(e.trim(),Zt.string):typeof e=="object"&&e!==null?Yt(e,Zt.object):[null,void 0]},W=function(e,t){var i=Kt(e);return{h:i.h,s:mt(i.s+100*t,0,100),l:i.l,a:i.a}},re=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},fe=function(e,t){var i=Kt(e);return{h:i.h,s:i.s,l:mt(i.l+100*t,0,100),a:i.a}},_e=function(){function e(t){this.parsed=ai(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return rt(re(this.rgba),2)},e.prototype.isDark=function(){return re(this.rgba)<.5},e.prototype.isLight=function(){return re(this.rgba)>=.5},e.prototype.toHex=function(){return t=yi(this.rgba),i=t.r,r=t.g,n=t.b,a=(s=t.a)<1?ui(rt(255*s)):"","#"+ui(i)+ui(r)+ui(n)+a;var t,i,r,n,s,a},e.prototype.toRgb=function(){return yi(this.rgba)},e.prototype.toRgbString=function(){return t=yi(this.rgba),i=t.r,r=t.g,n=t.b,(s=t.a)<1?"rgba("+i+", "+r+", "+n+", "+s+")":"rgb("+i+", "+r+", "+n+")";var t,i,r,n,s},e.prototype.toHsl=function(){return Ot(Kt(this.rgba))},e.prototype.toHslString=function(){return t=Ot(Kt(this.rgba)),i=t.h,r=t.s,n=t.l,(s=t.a)<1?"hsla("+i+", "+r+"%, "+n+"%, "+s+")":"hsl("+i+", "+r+"%, "+n+"%)";var t,i,r,n,s},e.prototype.toHsv=function(){return t=Gt(this.rgba),{h:rt(t.h),s:rt(t.s),v:rt(t.v),a:rt(t.a,3)};var t},e.prototype.invert=function(){return we({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),we(W(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),we(W(this.rgba,-t))},e.prototype.grayscale=function(){return we(W(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),we(fe(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),we(fe(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?we({r:(i=this.rgba).r,g:i.g,b:i.b,a:t}):rt(this.rgba.a,3);var i},e.prototype.hue=function(t){var i=Kt(this.rgba);return typeof t=="number"?we({h:t,s:i.s,l:i.l,a:i.a}):rt(i.h)},e.prototype.isEqual=function(t){return this.toHex()===we(t).toHex()},e}(),we=function(e){return e instanceof _e?e:new _e(e)},ye=[],Ce=function(e){e.forEach(function(t){ye.indexOf(t)<0&&(t(_e,Zt),ye.push(t))})}});function Ke(e,t){var i={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var n in i)r[i[n]]=n;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,h=r[this.toHex()];if(h)return h;if(a?.closest){var u=this.toRgb(),d=1/0,p="black";if(!s.length)for(var f in i)s[f]=new e(i[f]).toRgb();for(var y in i){var b=(o=u,l=s[y],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));b<d&&(d=b,p=y)}return p}},t.string.push([function(a){var o=a.toLowerCase(),l=o==="transparent"?"#0000":i[o];return l?new e(l).toRgb():null},"name"])}var ut=v(()=>{}),_t,ue,Ie=v(()=>{qe(),ut(),Ce([Ke]),_t=class As{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof As)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._normalize(t),this._value=this._cloneSource(t))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,i){let r=typeof t;if(r!==typeof i)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===i;if(Array.isArray(t)&&Array.isArray(i)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(i))return t.length!==i.length?!1:t.every((n,s)=>n===i[s]);if(t!==null&&i!==null){let n=Object.keys(t),s=Object.keys(i);return n.length!==s.length?!1:n.every(a=>t[a]===i[a])}return t===i}toRgba(){let[t,i,r,n]=this._components;return{r:t,g:i,b:r,a:n}}toRgb(){let[t,i,r]=this._components;return{r:t,g:i,b:r}}toRgbaString(){let[t,i,r]=this.toUint8RgbArray();return`rgba(${t},${i},${r},${this.alpha})`}toUint8RgbArray(t){let[i,r,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(i*255),t[1]=Math.round(r*255),t[2]=Math.round(n*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;let[i,r,n,s]=this._components;return t[0]=i,t[1]=r,t[2]=n,t[3]=s,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;let[i,r,n]=this._components;return t[0]=i,t[1]=r,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){let[t,i,r]=this.toUint8RgbArray();return(r<<16)+(i<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[i,r,n,s]=As._temp.setValue(t)._components;return this._components[0]*=i,this._components[1]*=r,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,i=!0){return i&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,i=!0){if(t===1)return(255<<24)+this._int;if(t===0)return i?0:this._int;let r=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return i&&(r=r*t+.5|0,n=n*t+.5|0,s=s*t+.5|0),(t*255<<24)+(r<<16)+(n<<8)+s}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let i,r,n,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let a=t;i=(a>>16&255)/255,r=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[i,r,n,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[i,r,n,s=255]=t,i/=255,r/=255,n/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let o=As.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}let a=we(t);a.isValid()&&({r:i,g:r,b:n,a:s}=a.rgba,i/=255,r/=255,n/=255)}if(i!==void 0)this._components[0]=i,this._components[1]=r,this._components[2]=n,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,i,r]=this._components;this._int=(t*255<<16)+(i*255<<8)+(r*255|0)}_clamp(t,i=0,r=1){return typeof t=="number"?Math.min(Math.max(t,i),r):(t.forEach((n,s)=>{t[s]=Math.min(Math.max(n,i),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof As||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}},_t.shared=new _t,_t._temp=new _t,_t.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,ue=_t}),ve,Se=v(()=>{"use strict";ve={cullArea:null,cullable:!1,cullableChildren:!0}}),$e,Fe,st,Jt=v(()=>{"use strict";$e=Math.PI*2,Fe=180/Math.PI,st=Math.PI/180}),De,ci,At=v(()=>{"use strict";De=class $_{constructor(t=0,i=0){this.x=0,this.y=0,this.x=t,this.y=i}clone(){return new $_(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,i=t){return this.x=t,this.y=i,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ci.x=0,ci.y=0,ci}},ci=new De}),ke,Pr,Rr,We=v(()=>{Jt(),At(),ke=class X_{constructor(t=1,i=0,r=0,n=1,s=0,a=0){this.array=null,this.a=t,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a}fromArray(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]}set(t,i,r,n,s,a){return this.a=t,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a,this}toArray(t,i){this.array||(this.array=new Float32Array(9));let r=i||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}apply(t,i){i=i||new De;let r=t.x,n=t.y;return i.x=this.a*r+this.c*n+this.tx,i.y=this.b*r+this.d*n+this.ty,i}applyInverse(t,i){i=i||new De;let r=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,h=1/(r*a+s*-n),u=t.x,d=t.y;return i.x=a*h*u+-s*h*d+(l*s-o*a)*h,i.y=r*h*d+-n*h*u+(-l*r+o*n)*h,i}translate(t,i){return this.tx+=t,this.ty+=i,this}scale(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this}rotate(t){let i=Math.cos(t),r=Math.sin(t),n=this.a,s=this.c,a=this.tx;return this.a=n*i-this.b*r,this.b=n*r+this.b*i,this.c=s*i-this.d*r,this.d=s*r+this.d*i,this.tx=a*i-this.ty*r,this.ty=a*r+this.ty*i,this}append(t){let i=this.a,r=this.b,n=this.c,s=this.d;return this.a=t.a*i+t.b*n,this.b=t.a*r+t.b*s,this.c=t.c*i+t.d*n,this.d=t.c*r+t.d*s,this.tx=t.tx*i+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this}appendFrom(t,i){let r=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,l=t.ty,h=i.a,u=i.b,d=i.c,p=i.d;return this.a=r*h+n*d,this.b=r*u+n*p,this.c=s*h+a*d,this.d=s*u+a*p,this.tx=o*h+l*d+i.tx,this.ty=o*u+l*p+i.ty,this}setTransform(t,i,r,n,s,a,o,l,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=t-(r*this.a+n*this.c),this.ty=i-(r*this.b+n*this.d),this}prepend(t){let i=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let 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=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this}decompose(t){let i=this.a,r=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),l=Math.atan2(r,i),h=Math.abs(o+l);return h<1e-5||Math.abs($e-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=l),t.scale.x=Math.sqrt(i*i+r*r),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*i+a.y*n),t.position.y=this.ty+(a.x*r+a.y*s),t}invert(){let t=this.a,i=this.b,r=this.c,n=this.d,s=this.tx,a=t*n-i*r;return this.a=n/a,this.b=-i/a,this.c=-r/a,this.d=t/a,this.tx=(r*this.ty-n*s)/a,this.ty=-(t*this.ty-i*s)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new X_;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}copyTo(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}copyFrom(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}equals(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}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Rr.identity()}static get shared(){return Pr.identity()}},Pr=new ke,Rr=new ke}),$t,kr=v(()=>{"use strict";$t=class Y_{constructor(t,i,r){this._x=i||0,this._y=r||0,this._observer=t}clone(t){return new Y_(t??this._observer,this._x,this._y)}set(t=0,i=t){return(this._x!==t||this._y!==i)&&(this._x=t,this._y=i,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function at(e="default"){return dr[e]===void 0&&(dr[e]=-1),++dr[e]}var dr,bt=v(()=>{"use strict";dr={default:-1}});function Xe(e,t,i=3){if(fr[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
Deprecated since v${e}`):(r=r.split(`
|
|
`).splice(i).join(`
|
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
Deprecated since v${e}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
Deprecated since v${e}`),console.warn(r))),fr[t]=!0}var fr,Ve,wt=v(()=>{"use strict";fr={},Ve="8.0.0"}),tr,Kr=v(()=>{"use strict";tr=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}}),Zr,Le,Ht=v(()=>{Kr(),Zr=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new tr(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},Le=new Zr});function Br(e,t,i){let r=e.length,n;if(t>=r||i===0)return;i=t+i>r?r-t:i;let s=r-i;for(n=t;n<s;++n)e[n]=e[n+i];e.length=s}var Jr=v(()=>{"use strict"}),Qr,xi=v(()=>{Jr(),wt(),Qr={allowChildren:!0,removeChildren(e=0,t){let i=t??this.children.length,r=i-e,n=[];if(r>0&&r<=i){for(let a=i-1;a>=e;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}Br(this.children,e,i);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a<n.length;++a)this.emit("childRemoved",n[a],this,a),n[a].emit("removed",this);return n}else if(r===0&&this.children.length===0)return n;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(e){let t=this.getChildAt(e);return this.removeChild(t)},getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){let t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(e,t){this.allowChildren||Xe(Ve,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:i}=this;if(t<0||t>i.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${i.length}`);if(e.parent){let n=e.parent.children.indexOf(e);if(e.parent===this&&n===t)return e;n!==-1&&e.parent.children.splice(n,1)}t===i.length?i.push(e):i.splice(t,0,e),e.parent=this,e.didChange=!0,e.didViewUpdate=!1,e._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(e),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",e,this,t),e.emit("added",this),e},swapChildren(e,t){if(e===t)return;let i=this.getChildIndex(e),r=this.getChildIndex(t);this.children[i]=t,this.children[r]=e;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...e){return e.length===1?this.reparentChildAt(e[0],this.children.length):(e.forEach(t=>this.reparentChildAt(t,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;let i=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);let r=this.worldTransform.clone();return r.invert(),i.prepend(r),e.setFromMatrix(i),e}}}),Ct,Ir=v(()=>{"use strict";Ct=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}}),Ni,pr,en=v(()=>{te(),Ht(),Ni=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){let i=this._tests[t];if(i.test(e))return Le.get(i.maskClass,e)}return e}returnMaskEffect(e){Le.return(e)}},pr=new Ni,pe.handleByList(G.MaskEffect,pr._effectClasses)}),ir,Gr=v(()=>{Ir(),en(),ir={_maskEffect:null,_filterEffect:null,effects:[],addEffect(e){if(this.effects.indexOf(e)!==-1)return;this.effects.push(e),this.effects.sort((i,r)=>i.priority-r.priority);let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(e){let t=this.effects.indexOf(e);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(e){let t=this._maskEffect;t?.mask!==e&&(t&&(this.removeEffect(t),pr.returnMaskEffect(t),this._maskEffect=null),e!=null&&(this._maskEffect=pr.getMaskEffect(e),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},set filters(e){!Array.isArray(e)&&e&&(e=[e]);let t=this._filterEffect||(this._filterEffect=new Ct);e=e;let i=e?.length>0,r=t.filters?.length>0,n=i!==r;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),n&&(i?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){return this._filterEffect?.filters},set filterArea(e){this._filterEffect||(this._filterEffect=new Ct),this._filterEffect.filterArea=e},get filterArea(){return this._filterEffect?.filterArea}}}),Or,tn=v(()=>{wt(),Or={label:null,get name(){return Xe(Ve,"Container.name property has been removed, use Container.label instead"),this.label},set name(e){Xe(Ve,"Container.name property has been removed, use Container.label instead"),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){let i=this.children;for(let r=0;r<i.length;r++){let n=i[r];if(n.label===e||e instanceof RegExp&&e.test(n.label))return n}if(t)for(let r=0;r<i.length;r++){let n=i[r].getChildByLabel(e,!0);if(n)return n}return null},getChildrenByLabel(e,t=!1,i=[]){let r=this.children;for(let n=0;n<r.length;n++){let s=r[n];(s.label===e||e instanceof RegExp&&e.test(s.label))&&i.push(s)}if(t)for(let n=0;n<r.length;n++)r[n].getChildrenByLabel(e,!0,i);return i}}}),Hi,ot,E=v(()=>{At(),Hi=[new De,new De,new De,new De],ot=class Po{constructor(t=0,i=0,r=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(i),this.width=Number(r),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Po(0,0,0,0)}clone(){return new Po(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,i){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&i>=this.y&&i<this.y+this.height}strokeContains(t,i,r){let{width:n,height:s}=this;if(n<=0||s<=0)return!1;let a=this.x,o=this.y,l=a-r/2,h=a+n+r/2,u=o-r/2,d=o+s+r/2,p=a+r/2,f=a+n-r/2,y=o+r/2,b=o+s-r/2;return t>=l&&t<=h&&i>=u&&i<=d&&!(t>p&&t<f&&i>y&&i<b)}intersects(t,i){if(!i){let Q=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=Q)return!1;let Y=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>Y}let r=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=r||a<=s)return!1;let o=Hi[0].set(t.left,t.top),l=Hi[1].set(t.left,t.bottom),h=Hi[2].set(t.right,t.top),u=Hi[3].set(t.right,t.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let d=Math.sign(i.a*i.d-i.b*i.c);if(d===0||(i.apply(o,o),i.apply(l,l),i.apply(h,h),i.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=r||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let p=d*(l.y-o.y),f=d*(o.x-l.x),y=p*r+f*s,b=p*n+f*s,_=p*r+f*a,T=p*n+f*a;if(Math.max(y,b,_,T)<=p*o.x+f*o.y||Math.min(y,b,_,T)>=p*u.x+f*u.y)return!1;let C=d*(o.y-h.y),O=d*(h.x-o.x),R=C*r+O*s,z=C*n+O*s,ee=C*r+O*a,ne=C*n+O*a;return!(Math.max(R,z,ee,ne)<=C*o.x+O*o.y||Math.min(R,z,ee,ne)>=C*u.x+O*u.y)}pad(t=0,i=t){return this.x-=t,this.y-=i,this.width+=t*2,this.height+=i*2,this}fit(t){let i=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=i,this.width=Math.max(r-i,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,i=.001){let r=Math.ceil((this.x+this.width-i)*t)/t,n=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=r-this.x,this.height=n-this.y,this}enlarge(t){let i=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=i,this.width=r-i,this.y=n,this.height=s-n,this}getBounds(t){return t=t||new Po,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),c,g,m=v(()=>{We(),E(),c=new ke,g=class q_{constructor(t=1/0,i=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=c,this}set(t,i,r,n){this.minX=t,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,i,r,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,d=s.ty,p=this.minX,f=this.minY,y=this.maxX,b=this.maxY,_=a*t+l*i+u,T=o*t+h*i+d;_<p&&(p=_),T<f&&(f=T),_>y&&(y=_),T>b&&(b=T),_=a*r+l*i+u,T=o*r+h*i+d,_<p&&(p=_),T<f&&(f=T),_>y&&(y=_),T>b&&(b=T),_=a*t+l*n+u,T=o*t+h*n+d,_<p&&(p=_),T<f&&(f=T),_>y&&(y=_),T>b&&(b=T),_=a*r+l*n+u,T=o*r+h*n+d,_<p&&(p=_),T<f&&(f=T),_>y&&(y=_),T>b&&(b=T),this.minX=p,this.minY=f,this.maxX=y,this.maxY=b}addRect(t,i){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,i)}addBounds(t,i){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,i)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let i=this.minX,r=this.minY,n=this.maxX,s=this.maxY,{a,b:o,c:l,d:h,tx:u,ty:d}=t,p=a*i+l*r+u,f=o*i+h*r+d;this.minX=p,this.minY=f,this.maxX=p,this.maxY=f,p=a*n+l*r+u,f=o*n+h*r+d,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*i+l*s+u,f=o*i+h*s+d,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*n+l*s+u,f=o*n+h*s+d,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,i,r,n){return this.minX<t&&(this.minX=t),this.maxX>i&&(this.maxX=i),this.minY<r&&(this.minY=r),this.maxY>n&&(this.maxY=n),this}pad(t,i=t){return this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new q_(this.minX,this.minY,this.maxX,this.maxY)}scale(t,i=t){return this.minX*=t,this.minY*=i,this.maxX*=t,this.maxY*=i,this}get x(){return this.minX}set x(t){let i=this.maxX-this.minX;this.minX=t,this.maxX=t+i}get y(){return this.minY}set y(t){let i=this.maxY-this.minY;this.minY=t,this.maxY=t+i}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,i,r,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,d=n.c,p=n.d,f=n.tx,y=n.ty;for(let b=i;b<r;b+=2){let _=t[b],T=t[b+1],C=h*_+d*T+f,O=u*_+p*T+y;s=C<s?C:s,a=O<a?O:a,o=C>o?C:o,l=O>l?O:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,i){return this.minX<=t&&this.minY<=i&&this.maxX>=t&&this.maxY>=i}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}}),x,w,S=v(()=>{We(),Kr(),m(),x=new tr(ke),w=new tr(g)});function k(e,t,i){i.clear();let r,n;return e.parent?t?r=e.parent.worldTransform:(n=x.get().identity(),r=N(e,n)):r=ke.IDENTITY,B(e,i,r,t),n&&x.return(n),i.isValid||i.set(0,0,0,0),i}function B(e,t,i,r){if(!e.visible||!e.measurable)return;let n;r?n=e.worldTransform:(e.updateLocalTransform(),n=x.get(),n.appendFrom(e.localTransform,i));let s=t,a=!!e.effects.length;if(a&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,n);else{e.addBounds&&(t.matrix=n,e.addBounds(t));for(let o=0;o<e.children.length;o++)B(e.children[o],t,n,r)}if(a){for(let o=0;o<e.effects.length;o++)e.effects[o].addBounds?.(t);s.addBounds(t,ke.IDENTITY),w.return(t)}r||x.return(n)}function N(e,t){let i=e.parent;return i&&(N(i,t),i.updateLocalTransform(),t.append(i.localTransform)),t}var X=v(()=>{We(),S()});function F(...e){V!==L&&(V++,V===L?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}var V,L,I=v(()=>{"use strict";V=0,L=500});function D(e,t,i){return t.clear(),i||(i=ke.IDENTITY),$(e,t,i,e,!0),t.isValid||t.set(0,0,0,0),t}function $(e,t,i,r,n){let s;if(n)s=x.get(),s=i.copyTo(s);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();let l=e.localTransform;s=x.get(),s.appendFrom(l,i)}let a=t,o=!!e.effects.length;if(o&&(t=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{e.renderPipeId&&(t.matrix=s,e.addBounds(t));let l=e.children;for(let h=0;h<l.length;h++)$(l[h],t,s,r,!1)}if(o){for(let l=0;l<e.effects.length;l++)e.effects[l].addLocalBounds?.(t,r);a.addBounds(t,ke.IDENTITY),w.return(t)}x.return(s)}var se=v(()=>{We(),S()});function xe(e,t){let i=e.children;for(let r=0;r<i.length;r++){let n=i[r],s=n.uid,a=(n._didViewChangeTick&65535)<<16|n._didContainerChangeTick&65535,o=t.index;(t.data[o]!==s||t.data[o+1]!==a)&&(t.data[t.index]=s,t.data[t.index+1]=a,t.didChange=!0),t.index=o+2,n.children.length&&xe(n,t)}return t.didChange}var Me=v(()=>{"use strict"}),Ge,ct,Qt=v(()=>{We(),m(),X(),se(),Me(),Ge=new ke,ct={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){let i=Math.sign(this.scale.x)||1;t!==0?this.scale.x=e/t*i:this.scale.x=i},_setHeight(e,t){let i=Math.sign(this.scale.y)||1;t!==0?this.scale.y=e/t*i:this.scale.y=i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new g});let e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),xe(this,e),e.didChange&&D(this,e.localBounds,Ge),e.localBounds},getBounds(e,t){return k(this,e,t||new g)}}}),ei,qt=v(()=>{"use strict";ei={_onRender:null,set onRender(e){let t=this.renderGroup||this.parentRenderGroup;if(!e){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}}});function di(e,t){return e._zIndex-t._zIndex}var Ut,Ae=v(()=>{"use strict";Ut={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(di))}}}),Be,He=v(()=>{We(),At(),X(),Be={getGlobalPosition(e=new De,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,i=!1){if(!i){this.updateLocalTransform();let r=N(this,new ke);return r.append(this.localTransform),r.apply(e,t)}return this.worldTransform.apply(e,t)},toLocal(e,t,i,r){if(t&&(e=t.toGlobal(e,i,r)),!r){this.updateLocalTransform();let n=N(this,new ke);return n.append(this.localTransform),n.applyInverse(e,i)}return this.worldTransform.applyInverse(e,i)}}}),ft,et,lt=v(()=>{bt(),ft=0,et=class{constructor(){this.uid=at("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=ft++}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}}),zt,Ci=v(()=>{We(),lt(),zt=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ke,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new et,this._onRenderContainers=[]}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i<t.length;i++)this.addChild(t[i])}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i<t.length;i++)this.addChild(t[i])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let t=e.children;for(let i=0;i<t.length;i++)this.removeChild(t[i])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(e.didViewUpdate=!1,this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e))}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){let t=this.root.children;for(let i=0;i<t.length;i++)this._getChildren(t[i],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let i=e.children;for(let r=0;r<i.length;r++)this._getChildren(i[r],t);return t}}});function oi(e,t,i={}){for(let r in t)!i[r]&&t[r]!==void 0&&(e[r]=t[r])}var ko=v(()=>{"use strict"}),Ms,Ps,Rs,Mn,ks,rn,Tt,zi=v(()=>{xt(),Ie(),Se(),We(),Jt(),kr(),bt(),wt(),Ht(),xi(),Gr(),tn(),Qt(),qt(),Ae(),He(),Ci(),ko(),Ms=new $t(null),Ps=new $t(null),Rs=new $t(null,1,1),Mn=1,ks=2,rn=4,Tt=class K_ extends Je{constructor(t={}){super(),this.uid=at("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new ke,this.relativeGroupTransform=new ke,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new $t(this,0,0),this._scale=Rs,this._pivot=Ps,this._skew=Ms,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],oi(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(i=>this.addChild(i)),t.parent?.addChild(this)}static mixin(t){Object.defineProperties(K_.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||Xe(Ve,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let n=0;n<t.length;n++)this.addChild(t[n]);return t[0]}let i=t[0];if(i.parent===this)return this.children.splice(this.children.indexOf(i),1),this.children.push(i),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),i;i.parent&&i.parent.removeChild(i),this.children.push(i),this.sortableChildren&&(this.sortDirty=!0),i.parent=this,i.didChange=!0,i.didViewUpdate=!1,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.emit("childAdded",i,this,this.children.length-1),i.emit("added",this),this._didViewChangeTick++,i._zIndex!==0&&i.depthOfChildModified(),i}removeChild(...t){if(t.length>1){for(let n=0;n<t.length;n++)this.removeChild(t[n]);return t[0]}let i=t[0],r=this.children.indexOf(i);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(i):this.parentRenderGroup&&this.parentRenderGroup.removeChild(i),i.parent=null,this.emit("childRemoved",i,this,r),i.emit("removed",this)),i}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=Le.get(zt,this),this.groupTransform=ke.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),Le.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new ke),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Fe}set angle(t){this.rotation=t*st}get pivot(){return this._pivot===Ps&&(this._pivot=new $t(this,0,0)),this._pivot}set pivot(t){this._pivot===Ps&&(this._pivot=new $t(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew}set skew(t){this._skew===Ms&&(this._skew=new $t(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Rs&&(this._scale=new $t(this,1,1)),this._scale}set scale(t){this._scale===Rs&&(this._scale=new $t(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let i=this.getLocalBounds().width;this._setWidth(t,i)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let i=this.getLocalBounds().height;this._setHeight(t,i)}getSize(t){t||(t={});let i=this.getLocalBounds();return t.width=Math.abs(this.scale.x*i.width),t.height=Math.abs(this.scale.y*i.height),t}setSize(t,i){let r=this.getLocalBounds(),n,s;typeof t!="object"?(n=t,s=i??t):(n=t.width,s=t.height??t.width),n!==void 0&&this._setWidth(n,r.width),s!==void 0&&this._setHeight(s,r.height)}_updateSkew(){let t=this._rotation,i=this._skew;this._cx=Math.cos(t+i._y),this._sx=Math.sin(t+i._y),this._cy=-Math.sin(t-i._x),this._sy=Math.cos(t-i._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let i=this.localTransform,r=this._scale,n=this._pivot,s=this._position,a=r._x,o=r._y,l=n._x,h=n._y;i.a=this._cx*a,i.b=this._sx*a,i.c=this._cy*o,i.d=this._sy*o,i.tx=s._x-(l*i.a+h*i.c),i.ty=s._y-(l*i.b+h*i.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Mn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=ue.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Mn,this._onUpdate())}get tint(){let t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let i=t?2:0;(this.localDisplayStatus&2)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let i=t?0:4;(this.localDisplayStatus&4)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=rn,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let i=t?1:0;(this.localDisplayStatus&1)!==i&&(this._updateFlags|=rn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let i=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.children)for(let r=0;r<i.length;++r)i[r].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}},Tt.mixin(Qr),Tt.mixin(Be),Tt.mixin(ei),Tt.mixin(ct),Tt.mixin(ir),Tt.mixin(Or),Tt.mixin(Ut),Tt.mixin(ve)}),Bs,Bo=v(()=>{At(),Bs=class Z_{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Z_.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new De,this.page=new De,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,i,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,i,r,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Ev(e){return function(t){return t.test(e)}}function Rc(e){var t={userAgent:"",platform:"",maxTouchPoints:0};!e&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e=="string"?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var i=t.userAgent,r=i.split("[FBAN");typeof r[1]<"u"&&(i=r[0]),r=i.split("Twitter"),typeof r[1]<"u"&&(i=r[0]);var n=Ev(i),s={apple:{phone:n(Is)&&!n(Wi),ipod:n(Io),tablet:!n(Is)&&(n(Go)||Wo(t))&&!n(Wi),universal:n(Oo),device:(n(Is)||n(Io)||n(Go)||n(Oo)||Wo(t))&&!n(Wi)},amazon:{phone:n(Ur),tablet:!n(Ur)&&n(Pn),device:n(Ur)||n(Pn)},android:{phone:!n(Wi)&&n(Ur)||!n(Wi)&&n(Gs),tablet:!n(Wi)&&!n(Ur)&&!n(Gs)&&(n(Pn)||n(Uo)),device:!n(Wi)&&(n(Ur)||n(Pn)||n(Gs)||n(Uo))||n(/\bokhttp\b/i)},windows:{phone:n(Wi),tablet:n(Fo),device:n(Wi)||n(Fo)},other:{blackberry:n(Do),blackberry10:n(Lo),opera:n(No),firefox:n(zo),chrome:n(Ho),device:n(Do)||n(Lo)||n(No)||n(zo)||n(Ho)},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 Is,Io,Go,Oo,Gs,Uo,Ur,Pn,Wi,Fo,Do,Lo,No,Ho,zo,Wo,kc=v(()=>{Is=/iPhone/i,Io=/iPod/i,Go=/iPad/i,Oo=/\biOS-universal(?:.+)Mac\b/i,Gs=/\bAndroid(?:.+)Mobile\b/i,Uo=/Android/i,Ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Pn=/Silk/i,Wi=/Windows Phone/i,Fo=/\bWindows(?:.+)ARM\b/i,Do=/BlackBerry/i,Lo=/BB10/i,No=/Opera Mini/i,Ho=/\b(CriOS|Chrome)(?:.+)Mobile/i,zo=/Mobile(?:.+)Firefox\b/i,Wo=function(e){return typeof e<"u"&&e.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1&&typeof MSStream>"u"}}),Av=v(()=>{kc(),kc()}),Bc,Ic,Cv=v(()=>{Av(),Bc=Rc.default??Rc,Ic=Bc(globalThis.navigator)}),Gc,Rn,Oc,Uc,Vo,jo,Fc,Dc,Lc,$o,Mv=v(()=>{Bo(),te(),Cv(),Jr(),Gc=9,Rn=100,Oc=0,Uc=0,Vo=2,jo=1,Fc=-1e3,Dc=-1e3,Lc=2,$o=class{constructor(e,t=Ic){this._mobileInfo=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,(t.tablet||t.phone)&&this._createTouchHook();let i=document.createElement("div");i.style.width=`${Rn}px`,i.style.height=`${Rn}px`,i.style.position="absolute",i.style.top=`${Oc}px`,i.style.left=`${Uc}px`,i.style.zIndex=Vo.toString(),this._div=i,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${jo}px`,e.style.height=`${jo}px`,e.style.position="absolute",e.style.top=`${Fc}px`,e.style.left=`${Dc}px`,e.style.zIndex=Lc.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),this._renderer.view.canvas.parentNode?.appendChild(this._div))}_deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),this._div.parentNode?.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){this.debug=e?.debug??this.debug,this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);let{x:t,y:i,width:r,height:n}=this._renderer.view.canvas.getBoundingClientRect(),{width:s,height:a,resolution:o}=this._renderer,l=r/s*o,h=n/a*o,u=this._div;u.style.left=`${t}px`,u.style.top=`${i}px`,u.style.width=`${s}px`,u.style.height=`${a}px`;for(let d=0;d<this._children.length;d++){let p=this._children[d];if(p._renderId!==this._renderId)p._accessibleActive=!1,Br(this._children,d,1),this._div.removeChild(p._accessibleDiv),this._pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{u=p._accessibleDiv;let f=p.hitArea,y=p.worldTransform;p.hitArea?(u.style.left=`${(y.tx+f.x*y.a)*l}px`,u.style.top=`${(y.ty+f.y*y.d)*h}px`,u.style.width=`${f.width*y.a*l}px`,u.style.height=`${f.height*y.d*h}px`):(f=p.getBounds().rectangle,this._capHitArea(f),u.style.left=`${f.x*l}px`,u.style.top=`${f.y*h}px`,u.style.width=`${f.width*l}px`,u.style.height=`${f.height*h}px`,u.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(u.title=p.accessibleTitle||""),u.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&u.setAttribute("aria-label",p.accessibleHint||"")),(p.accessibleTitle!==u.title||p.tabIndex!==u.tabIndex)&&(u.title=p.accessibleTitle||"",u.tabIndex=p.tabIndex,this.debug&&this._updateDebugHTML(u))}}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${Rn}px`,t.style.height=`${Rn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Vo.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){let{container:i}=e.target,r=this._renderer.events.rootBoundary,n=Object.assign(new Bs(r),{target:i});r.rootTarget=this._renderer.lastObjectRendered,t.forEach(s=>r.dispatchEvent(n,s))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===Gc&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){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}},$o.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"accessibility"}}),Nc,Pv=v(()=>{"use strict";Nc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Rv=v(()=>{te(),zi(),Mv(),Pv(),pe.add($o),Tt.mixin(Nc)}),Xo,kv=v(()=>{te(),Xo=class{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:n}=this._resizeTo;t=r,i=n}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},Xo.extension=G.Application}),nn,Yo=v(()=>{"use strict";nn=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(nn||{})}),Os,Bv=v(()=>{"use strict";Os=class{constructor(e,t=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=i,this._once=r}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}}}),qo,Mi,Us=v(()=>{Yo(),Bv(),qo=class vi{constructor(){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 Os(null,null,1/0),this.deltaMS=1/vi.targetFPMS,this.elapsedMS=1/vi.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r))}addOnce(t,i,r=nn.NORMAL){return this._addListener(new Os(t,i,r,!0))}_addListener(t){let i=this._head.next,r=this._head;if(!i)t.connect(r);else{for(;i;){if(t.priority>i.priority){t.connect(r);break}r=i,i=i.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,i){let r=this._head.next;for(;r;)r.match(t,i)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,i=this._head;for(;i=i.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let i;if(t>this.lastTime){if(i=this.elapsedMS=t-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let s=t-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=t-s%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*vi.targetFPMS;let r=this._head,n=r.next;for(;n;)n=n.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let i=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,i)/1e3,vi.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let i=Math.max(this.minFPS,t);this._minElapsedMS=1/(i/1e3)}}static get shared(){if(!vi._shared){let t=vi._shared=new vi;t.autoStart=!0,t._protected=!0}return vi._shared}static get system(){if(!vi._system){let t=vi._system=new vi;t.autoStart=!0,t._protected=!0}return vi._system}},qo.targetFPMS=.06,Mi=qo}),Ko,Iv=v(()=>{te(),Yo(),Us(),Ko=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,nn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Mi.shared:new Mi,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}},Ko.extension=G.Application}),Hc=v(()=>{te(),kv(),Iv(),pe.add(Xo),pe.add(Ko)}),zc,rr,Wc=v(()=>{Yo(),Us(),zc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Mi.system.add(this._tickerUpdate,this,nn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Mi.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},rr=new zc}),kn,Zo=v(()=>{At(),Bo(),kn=class extends Bs{constructor(){super(...arguments),this.client=new De,this.movement=new De,this.offset=new De,this.global=new De,this.screen=new De}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,r,n,s,a,o,l,h,u,d,p,f,y){throw new Error("Method not implemented.")}}}),bi,Vc=v(()=>{Zo(),bi=class extends kn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}}),Fr,jc=v(()=>{Zo(),Fr=class extends kn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Fr.DOM_DELTA_PIXEL=0,Fr.DOM_DELTA_LINE=1,Fr.DOM_DELTA_PAGE=2}),$c,Xc,sn,Yc,Gv=v(()=>{xt(),At(),I(),Wc(),Zo(),Vc(),jc(),$c=2048,Xc=new De,sn=new De,Yc=class{constructor(e){this.dispatch=new Je,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,r)=>i.priority-r.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let i=0,r=t.length;i<r;i++)t[i].fn(e);else F(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){rr.pauseUpdate=!0;let i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,Xc.set(e,t),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(e,t){if(!e.target)return;let i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(e.currentTarget=i[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(e.currentTarget=i[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)r.forEach(s=>{e.currentTarget=i[n],this.notifyTarget(e,s)})}propagationPath(e){let t=[e];for(let i=0;i<$c&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,r,n,s=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let h=e.children;for(let u=h.length-1;u>=0;u--){let d=h[u],p=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,r,n,s||n(e,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;let f=e.isInteractive();(p.length>0||f)&&(f&&this._allInteractiveElements.push(e),p.push(e)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}let o=this._isInteractive(t),l=e.isInteractive();return l&&l&&this._allInteractiveElements.push(e),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(e,i)&&r(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,r,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(rr.pauseUpdate=!1),e.interactiveChildren&&e.children){let o=e.children,l=i;for(let h=o.length-1;h>=0;h--){let u=o[h],d=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,l,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let p=e.isInteractive();return(d.length>0||p)&&d.push(e),d}}}let s=this._isInteractive(t),a=e.isInteractive();return s&&r(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.includeInBuild||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,sn),!e.hitArea.contains(sn.x,sn.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i<e.effects.length;i++){let r=e.effects[i];if(r.containsPoint&&!r.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e?.containsPoint?(e.worldTransform.applyInverse(t,sn),e.containsPoint(sn)):!1}notifyTarget(e,t){if(!e.currentTarget.isInteractive())return;t=t??e.type;let i=`on${t}`;e.currentTarget[i]?.(e);let r=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,r),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){let r=t.button===2;this.dispatchEvent(t,r?"rightdown":"mousedown")}let i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.trackingData(e.pointerId),n=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&n!==t.target){let o=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,o,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){let h=this.createPointerEvent(e,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!t.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),i&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==t.target){let o=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,o);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==t.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(t,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&s.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&s.push("globaltouchmove")),i&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&s.push("globalmousemove"),this.cursor=t.target?.cursor),s.length>0&&this.all(t,s),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId);if(t.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(e,"pointerleave",r);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let r=this.trackingData(e.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[e.button]),s=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let o=i.button===2;this.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[e.button],s=a}if(s){let a=this.clonePointerEvent(i,"click");a.target=s,a.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===a.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=t,a.detail=o.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof bi)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof Fr)){F("EventBoundary cannot map a non-wheel event as a wheel event");return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){let r=this.allocateEvent(bi);return this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof t=="string"&&(r.type=t),r}createWheelEvent(e){let t=this.allocateEvent(Fr);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){let i=this.allocateEvent(bi);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof bi&&t instanceof bi&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof kn&&t instanceof kn&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){let i=e.currentTarget._events[t];if(i)if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let r=0,n=i.length;r<n&&!e.propagationImmediatelyStopped;r++)i[r].once&&e.currentTarget.removeListener(t,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,e)}}}),qc,Kc,Fs,Jo,Zc=v(()=>{te(),Gv(),Wc(),Vc(),jc(),qc=1,Kc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Fs=class bc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Yc(null),rr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new bi(null),this._rootWheelEvent=new Fr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...bc.defaultEventFeatures},{set:(i,r,n)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),i[r]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,bc._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t=t||"default";let i=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(i=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":i&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":i&&Object.assign(this.domElement.style,r);break}else i&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(t);this.autoPreventDefault&&i[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,n=i.length;r<n;r++){let s=i[r],a=this._bootstrapEvent(this._rootPointerEvent,s);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,rr.pointerMoved();let i=this._normalizeToPointerData(t);for(let r=0,n=i.length;r<n;r++){let s=this._bootstrapEvent(this._rootPointerEvent,i[r]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=t.target;t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0]);let r=i!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);for(let s=0,a=n.length;s<a;s++){let o=this._bootstrapEvent(this._rootPointerEvent,n[s]);o.type+=r,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(t);for(let r=0,n=i.length;r<n;r++){let s=this._bootstrapEvent(this._rootPointerEvent,i[r]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let i=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(i)}setTargetElement(t){this._removeEvents(),this.domElement=t,rr.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;rr.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;rr.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,i,r){let n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(i-n.left)*(this.domElement.width/n.width)*s,t.y=(r-n.top)*(this.domElement.height/n.height)*s}_normalizeToPointerData(t){let i=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,n=t.changedTouches.length;r<n;r++){let s=t.changedTouches[r];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,i.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=qc),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,i.push(r)}else i.push(t);return i}normalizeWheelEvent(t){let i=this._rootWheelEvent;return this._transferMouseData(i,t),i.deltaX=t.deltaX,i.deltaY=t.deltaY,i.deltaZ=t.deltaZ,i.deltaMode=t.deltaMode,this.mapPositionToPoint(i.screen,t.clientX,t.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.nativeEvent=t,i.type=t.type,i}_bootstrapEvent(t,i){return t.originalEvent=null,t.nativeEvent=i,t.pointerId=i.pointerId,t.width=i.width,t.height=i.height,t.isPrimary=i.isPrimary,t.pointerType=i.pointerType,t.pressure=i.pressure,t.tangentialPressure=i.tangentialPressure,t.tiltX=i.tiltX,t.tiltY=i.tiltY,t.twist=i.twist,this._transferMouseData(t,i),this.mapPositionToPoint(t.screen,i.clientX,i.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Kc[t.type]||t.type),t}_transferMouseData(t,i){t.isTrusted=i.isTrusted,t.srcElement=i.srcElement,t.timeStamp=performance.now(),t.type=i.type,t.altKey=i.altKey,t.button=i.button,t.buttons=i.buttons,t.client.x=i.clientX,t.client.y=i.clientY,t.ctrlKey=i.ctrlKey,t.metaKey=i.metaKey,t.movement.x=i.movementX,t.movement.y=i.movementY,t.page.x=i.pageX,t.page.y=i.pageY,t.relatedTarget=null,t.shiftKey=i.shiftKey}},Fs.extension={name:"events",type:[G.WebGLSystem,G.CanvasSystem,G.WebGPUSystem],priority:-1},Fs.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},Jo=Fs}),Jc,Ov=v(()=>{Zc(),Bo(),Jc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(e){this.eventMode=e?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jo.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof i=="object"?i.signal:void 0,s=typeof i=="object"?i.once===!0:!1,a=typeof t=="function"?void 0:t;e=r?`${e}capture`:e;let o=typeof t=="function"?t:t.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(e,o,a)}),s?l.once(e,o,a):l.on(e,o,a)},removeEventListener(e,t,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof t=="function"?void 0:t;e=r?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,n)},dispatchEvent(e){if(!(e instanceof Bs))throw new Error("Container cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}}}),Uv=v(()=>{te(),zi(),Zc(),Ov(),pe.add(Jo),Tt.mixin(Jc)}),Qo,Fv=v(()=>{"use strict";Qo=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(Qo||{})}),Qc,Dv=v(()=>{"use strict";Qc={createCanvas:(e,t)=>{let i=document.createElement("canvas");return i.width=e,i.height=t,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,"text/xml")}}),el,vt,Ft=v(()=>{Dv(),el=Qc,vt={get(){return el},set(e){el=e}}});function Pi(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Bn(e){return e.split("?")[0].split("#")[0]}function Lv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nv(e,t,i){return e.replace(new RegExp(Lv(t),"g"),i)}function Hv(e,t){let i="",r=0,n=-1,s=0,a=-1;for(let o=0;o<=e.length;++o){if(o<e.length)a=e.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(i.length<2||r!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let l=i.lastIndexOf("/");if(l!==i.length-1){l===-1?(i="",r=0):(i=i.slice(0,l),r=i.length-1-i.lastIndexOf("/")),n=o,s=0;continue}}else if(i.length===2||i.length===1){i="",r=0,n=o,s=0;continue}}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${e.slice(n+1,o)}`:i=e.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return i}var an,ed=v(()=>{Ft(),an={toPosix(e){return Nv(e,"\\","/")},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith("blob:")},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Pi(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let i=/^[^/:]+:\/{0,2}/.exec(e);return i?i[0]:""},toAbsolute(e,t,i){if(Pi(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=Bn(this.toPosix(t??vt.get().getBaseUrl())),n=Bn(this.toPosix(i??this.rootname(r)));return e=this.toPosix(e),e.startsWith("/")?an.join(n,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(Pi(e),e.length===0)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t="",i=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith("/");return e=Hv(e,!1),e.length>0&&r&&(e+="/"),i?`/${e}`:t+e},isAbsolute(e){return Pi(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith("/")},join(...e){if(e.length===0)return".";let t;for(let i=0;i<e.length;++i){let r=e[i];if(Pi(r),r.length>0)if(t===void 0)t=r;else{let n=e[i-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(e){if(Pi(e),e.length===0)return".";e=this.toPosix(e);let t=e.charCodeAt(0),i=t===47,r=-1,n=!0,s=this.getProtocol(e),a=e;e=e.slice(s.length);for(let o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":this.isUrl(a)?s+e:s:i&&r===1?"//":s+e.slice(0,r)},rootname(e){Pi(e),e=this.toPosix(e);let t="";if(e.startsWith("/")?t="/":t=this.getProtocol(e),this.isUrl(e)){let i=e.indexOf("/",t.length);i!==-1?t=e.slice(0,i):t=e,t.endsWith("/")||(t+="/")}return t},basename(e,t){Pi(e),t&&Pi(t),e=Bn(this.toPosix(e));let i=0,r=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,o=-1;for(s=e.length-1;s>=0;--s){let l=e.charCodeAt(s);if(l===47){if(!n){i=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return i===r?r=o:r===-1&&(r=e.length),e.slice(i,r)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":e.slice(i,r)},extname(e){Pi(e),e=Bn(this.toPosix(e));let t=-1,i=0,r=-1,n=!0,s=0;for(let a=e.length-1;a>=0;--a){let o=e.charCodeAt(a);if(o===47){if(!n){i=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===i+1?"":e.slice(t,r)},parse(e){Pi(e);let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;e=Bn(this.toPosix(e));let i=e.charCodeAt(0),r=this.isAbsolute(e),n,s="";t.root=this.rootname(e),r||this.hasProtocol(e)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=e.length-1,d=0;for(;u>=n;--u){if(i=e.charCodeAt(u),i===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),i===46?a===-1?a=u:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||l===-1||d===0||d===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&r?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),t.dir=this.dirname(e),s&&(t.dir=s+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Dr,td=v(()=>{"use strict";Dr=(e,t,i=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(r=>typeof r=="string"||i?t(r):r):e)});function id(e,t,i,r,n){let s=t[i];for(let a=0;a<s.length;a++){let o=s[a];i<t.length-1?id(e.replace(r[i],o),t,i+1,r,n):n.push(e.replace(r[i],o))}}function zv(e){let t=/\{(.*?)\}/g,i=e.match(t),r=[];if(i){let n=[];i.forEach(s=>{let a=s.substring(1,s.length-1).split(",");n.push(a)}),id(e,n,0,i,r)}else r.push(e);return r}var Wv=v(()=>{"use strict"}),tl,Vv=v(()=>{"use strict";tl=e=>!Array.isArray(e)});function jv(e){return e.split(".").pop().split("?").shift().split("#").shift()}var il,$v=v(()=>{I(),ed(),td(),Wv(),Vv(),il=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){let{alias:t,src:i}=e;return Dr(t||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(n=>n?.src??n):r?.src?r.src:r,!0)}addManifest(e){this._manifest&&F("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){let i=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),r.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(e,a);i.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(e,h));i.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[e]=i}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let i;i=r=>{this.hasKey(r)&&F(`[Resolver] already has key: ${r} overwriting`)},Dr(t).forEach(r=>{let{src:n}=r,{data:s,format:a,loadParser:o}=r,l=Dr(n).map(d=>typeof d=="string"?zv(d):Array.isArray(d)?d:[d]),h=this.getAlias(r);Array.isArray(h)?h.forEach(i):i(h);let u=[];l.forEach(d=>{d.forEach(p=>{let f={};if(typeof p!="object"){f.src=p;for(let y=0;y<this._parsers.length;y++){let b=this._parsers[y];if(b.test(p)){f=b.parse(p);break}}}else s=p.data??s,a=p.format??a,o=p.loadParser??o,f={...f,...p};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${f.src}`);f=this._buildResolvedAsset(f,{aliases:h,data:s,format:a,loadParser:o}),u.push(f)})}),h.forEach(d=>{this._assetMap[d]=u})})}resolveBundle(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{let n=this._bundles[r];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(r,o)]=l}i[r]=a}}),t?i[e[0]]:i}resolveUrl(e){let t=this.resolve(e);if(typeof e!="string"){let i={};for(let r in t)i[r]=t[r].src;return i}return t.src}resolve(e){let t=tl(e);e=Dr(e);let i={};return e.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){let i=e[0],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){let{aliases:i,data:r,loadParser:n,format:s}=t;return(this._basePath||this._rootPath)&&(e.src=an.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=n??e.loadParser,e.format=s??e.format??jv(e.src),e}},il.RETINA_PREFIX=/@([0-9\.]+)x/}),rl,Xv=v(()=>{"use strict";rl=(e,t)=>{let i=t.split("?")[1];return i&&(e+=`?${i}`),e}});function Yv(){for(let e=0;e<16;e++){let t=[];Ds.push(t);for(let i=0;i<16;i++){let r=In(gr[e]*gr[i]+_r[e]*mr[i]),n=In(mr[e]*gr[i]+vr[e]*mr[i]),s=In(gr[e]*_r[i]+_r[e]*vr[i]),a=In(mr[e]*_r[i]+vr[e]*vr[i]);for(let o=0;o<16;o++)if(gr[o]===r&&mr[o]===n&&_r[o]===s&&vr[o]===a){t.push(o);break}}}for(let e=0;e<16;e++){let t=new ke;t.set(gr[e],mr[e],_r[e],vr[e],0,0),nl.push(t)}}var gr,mr,_r,vr,Ds,nl,In,yt,qv=v(()=>{We(),gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],mr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_r=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ds=[],nl=[],In=Math.sign,Yv(),yt={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:e=>gr[e],uY:e=>mr[e],vX:e=>_r[e],vY:e=>vr[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Ds[e][t],sub:(e,t)=>Ds[e][yt.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?yt.S:yt.N:Math.abs(t)*2<=Math.abs(e)?e>0?yt.E:yt.W:t>0?e>0?yt.SE:yt.SW:e>0?yt.NE:yt.NW,matrixAppendRotationInv:(e,t,i=0,r=0)=>{let n=nl[yt.inv(t)];n.tx=i,n.ty=r,e.append(n)}}}),sl,Kv=v(()=>{"use strict";sl=()=>{}});function on(e){return e+=e===0?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function rd(e){return!(e&e-1)&&!!e}var Ls=v(()=>{"use strict"});function Zv(e){let t={};for(let i in e)e[i]!==void 0&&(t[i]=e[i]);return t}var Jv=v(()=>{"use strict"});function Qv(e){let t=al[e];return t===void 0&&(al[e]=at("resource")),t}var al,ol,nd,ey=v(()=>{xt(),bt(),wt(),al=Object.create(null),ol=class J_ extends Je{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...J_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){Xe(Ve,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Qv(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},ol.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},nd=ol}),ll,Dt,fi=v(()=>{xt(),Ls(),Jv(),bt(),ey(),ll=class Q_ extends Je{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Q_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new nd(Zv(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=at("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,i,r){r=r||this._resolution,t=t||this.width,i=i||this.height;let n=Math.round(t*r),s=Math.round(i*r);return this.width=n/r,this.height=s/r,this._resolution=r,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=at("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rd(this.pixelWidth)&&rd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}},ll.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Dt=ll}),Ns,sd=v(()=>{te(),fi(),Ns=class extends Dt{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}},Ns.extension=G.TextureSource}),hl,ul,ad=v(()=>{We(),hl=new ke,ul=class{constructor(e,t){this.mapCoord=new ke,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let r=0;r<e.length;r+=2){let n=e[r],s=e[r+1];t[r]=n*i.a+s*i.c+i.tx,t[r+1]=n*i.b+s*i.d+i.ty}return t}update(){let e=this._texture;this._updateID++;let t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);let i=e.orig,r=e.trim;r&&(hl.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(hl));let n=e.source,s=this.uClampFrame,a=this.clampMargin/n._resolution,o=this.clampOffset/n._resolution;return s[0]=(e.frame.x+a+o)/n.width,s[1]=(e.frame.y+a+o)/n.height,s[2]=(e.frame.x+e.frame.width-a+o)/n.width,s[3]=(e.frame.y+e.frame.height-a+o)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=e.frame.width===n.width&&e.frame.height===n.height&&e.rotate===0,!0}}}),Re,pt=v(()=>{xt(),qv(),E(),bt(),wt(),Kv(),sd(),fi(),ad(),Re=class extends Je{constructor({source:e,label:t,frame:i,orig:r,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Dt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ul(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:r}=this._source,n=t.x/i,s=t.y/r,a=t.width/i,o=t.height/r,l=this.rotate;if(l){let h=a/2,u=o/2,d=n+h,p=s+u;l=yt.add(l,yt.NW),e.x0=d+h*yt.uX(l),e.y0=p+u*yt.uY(l),l=yt.add(l,2),e.x1=d+h*yt.uX(l),e.y1=p+u*yt.uY(l),l=yt.add(l,2),e.x2=d+h*yt.uX(l),e.y2=p+u*yt.uY(l),l=yt.add(l,2),e.x3=d+h*yt.uX(l),e.y3=p+u*yt.uY(l)}else e.x0=n,e.y0=s,e.x1=n+a,e.y1=s,e.x2=n+a,e.y2=s+o,e.x3=n,e.y3=s+o}destroy(e=!1){this._source&&e&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return Xe(Ve,"Texture.baseTexture is now Texture.source"),this._source}},Re.EMPTY=new Re({label:"EMPTY",source:new Dt({label:"EMPTY"})}),Re.EMPTY.destroy=sl,Re.WHITE=new Re({source:new Ns({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Re.WHITE.destroy=sl}),cl,dl,ty=v(()=>{E(),pt(),cl=class Cs{constructor(t,i){this.linkedSheets=[],this._texture=t instanceof Re?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=i;let r=parseFloat(i.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Cs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let i=t,r=Cs.BATCH_SIZE;for(;i-t<r&&i<this._frameKeys.length;){let n=this._frameKeys[i],s=this._frames[n],a=s.frame;if(a){let o=null,l=null,h=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,u=new ot(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);s.rotated?o=new ot(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 ot(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&&(l=new ot(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 Re({source:this.textureSource,frame:o,orig:u,trim:l,rotate:s.rotated?2:0,defaultAnchor:s.anchor,defaultBorders:s.borders,label:n.toString()})}i++}}_processAnimations(){let t=this.data.animations||{};for(let i in t){this.animations[i]=[];for(let r=0;r<t[i].length;r++){let n=t[i][r];this.animations[i].push(this.textures[n])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Cs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Cs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}},cl.BATCH_SIZE=1e3,dl=cl});function od(e,t,i){let r={};if(e.forEach(n=>{r[n]=t}),Object.keys(t.textures).forEach(n=>{r[n]=t.textures[n]}),!i){let n=an.dirname(e[0]);t.linkedSheets.forEach((s,a)=>{let o=od([`${n}/${t.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(r,o)})}return r}var ld,hd,iy=v(()=>{Fv(),$v(),Xv(),te(),pt(),ed(),ty(),ld=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],hd={extension:G.Asset,cache:{test:e=>e instanceof dl,getCacheableAssets:(e,t)=>od(e,t,!1)},resolver:{extension:{type:G.ResolveParser,name:"resolveSpritesheet"},test:e=>{let t=e.split("?")[0].split("."),i=t.pop(),r=t.pop();return i==="json"&&ld.includes(r)},parse:e=>{let t=e.split(".");return{resolution:parseFloat(il.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Qo.Normal,name:"spritesheetLoader"},async testParse(e,t){return an.extname(t.src).toLowerCase()===".json"&&!!e.frames},async parse(e,t,i){let{texture:r,imageFilename:n}=t?.data??{},s=an.dirname(t.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(r instanceof Re)a=r;else{let h=rl(s+(n??e.meta.image),t.src);a=(await i.load([h]))[h]}let o=new dl(a.source,e);await o.parse();let l=e?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let p=s+d;t.data?.ignoreMultiPack||(p=rl(p,t.src),h.push(i.load({src:p,data:{ignoreMultiPack:!0}})))}let u=await Promise.all(h);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},async unload(e,t,i){await i.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}}}),fl=v(()=>{te(),iy(),pe.add(hd)});function Hs(e,t,i,r){let{width:n,height:s}=i.orig,a=i.trim;if(a){let o=a.width,l=a.height;e.minX=a.x-t._x*n-r,e.maxX=e.minX+o,e.minY=a.y-t._y*s-r,e.maxY=e.minY+l}else e.minX=-t._x*n-r,e.maxX=e.minX+n,e.minY=-t._y*s-r,e.maxY=e.minY+s}var pl=v(()=>{"use strict"}),zs,gl=v(()=>{m(),zi(),zs=class extends Tt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new g(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:i,y:r}=e;return i>=t.minX&&i<=t.maxX&&r>=t.minY&&r<=t.maxY}destroy(e){super.destroy(e),this._bounds=null}}}),Ws,ud=v(()=>{kr(),pt(),pl(),gl(),Ws=class wc extends zs{constructor(t=Re.EMPTY){t instanceof Re&&(t={texture:t});let{texture:i=Re.EMPTY,anchor:r,roundPixels:n,width:s,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new $t({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(t,i=!1){return t instanceof Re?new wc(t):new wc(Re.from(t,i))}set texture(t){t||(t=Re.EMPTY);let i=this._texture;i!==t&&(i&&i.dynamic&&i.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){let i=this.sourceBounds;return t.x>=i.maxX&&t.x<=i.minX&&t.y>=i.maxY&&t.y<=i.minY}addBounds(t){let i=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(i.minX,i.minY,i.maxX,i.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){Hs(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){let t=this._anchor,i=this._texture,r=this._sourceBounds,{width:n,height:s}=i.orig;r.maxX=-t._x*n,r.minX=r.maxX+n,r.maxY=-t._y*s,r.minY=r.maxY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,i){let r,n;typeof t!="object"?(r=t,n=i??t):(r=t.width,n=t.height??t.width),r!==void 0&&this._setWidth(r,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}});function cd(e,t,i){let r=dd;e.measurable=!0,k(e,i,r),t.addBoundsMask(r),e.measurable=!1}var dd,fd=v(()=>{m(),X(),dd=new g});function pd(e,t,i){let r=w.get();e.measurable=!0;let n=x.get().identity(),s=gd(e,i,n);D(e,r,s),e.measurable=!1,t.addBoundsMask(r),x.return(n),w.return(r)}function gd(e,t,i){return e?(e!==t&&(gd(e.parent,t,i),e.updateLocalTransform(),i.append(e.localTransform)),i):(F("Mask bounds, renderable is not inside the root container"),i)}var md=v(()=>{se(),S(),I()}),ml,ry=v(()=>{te(),ud(),fd(),md(),ml=class{constructor(e){this.priority=0,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Ws),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Ws}},ml.extension=G.MaskEffect}),_l,ny=v(()=>{te(),_l=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}},_l.extension=G.MaskEffect}),vl,sy=v(()=>{te(),zi(),fd(),md(),vl=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,t){cd(this.mask,e,t)}addLocalBounds(e,t){pd(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Tt}},vl.extension=G.MaskEffect}),Lr,Vs=v(()=>{Ft(),te(),fi(),Lr=class extends Dt{constructor(e){e.resource||(e.resource=vt.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity;let t=e.resource;(this.pixelWidth!==t.width||this.pixelWidth!==t.height)&&this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,i=this._resolution){let r=super.resize(e,t,i);return r&&this.resizeCanvas(),r}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}},Lr.extension=G.TextureSource}),Gn,yl=v(()=>{Ft(),te(),I(),fi(),Gn=class extends Dt{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let t=vt.get().createCanvas(e.resource.width,e.resource.height);t.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=t,F("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}},Gn.extension=G.TextureSource});async function ay(){return xl??(xl=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let t=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let n=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),e.deleteFramebuffer(r),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),xl}var xl,oy=v(()=>{"use strict"}),On,_d,ly=v(()=>{te(),Us(),oy(),fi(),On=class ev extends Dt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ev.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Mi.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,i=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(i.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await ay(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,i.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${i.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Mi.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Mi.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}},On.extension=G.TextureSource,On.defaultOptions={...Dt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},On.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},_d=On}),vd,Wt,js=v(()=>{I(),td(),vd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||F(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let i=Dr(e),r;for(let o=0;o<this.parsers.length;o++){let l=this.parsers[o];if(l.test(t)){r=l.getCacheableAssets(i,t);break}}let n=new Map(Object.entries(r||{}));r||i.forEach(o=>{n.set(o,t)});let s=[...n.keys()],a={cacheKeys:s,keys:i};i.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=r?r[o]:t;this._cache.has(o)&&this._cache.get(o)!==l&&F("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(e){if(!this._cacheMap.has(e)){F(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}},Wt=new vd});function yd(e={}){let t=e&&e.resource,i=t?e.resource:e,r=t?e:{resource:e};for(let n=0;n<$s.length;n++){let s=$s[n];if(s.test(i))return new s(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function hy(e={},t=!1){let i=e&&e.resource,r=i?e.resource:e,n=i?e:{resource:e};if(!t&&Wt.has(r))return Wt.get(r);let s=new Re({source:yd(n)});return s.on("destroy",()=>{Wt.has(r)&&Wt.remove(r)}),t||Wt.set(r,s),s}function uy(e,t=!1){return typeof e=="string"?Wt.get(e):e instanceof Dt?new Re({source:e}):hy(e,t)}var $s,xd=v(()=>{js(),te(),fi(),pt(),$s=[],pe.handleByList(G.TextureSource,$s),Re.from=uy,Dt.from=yd}),bl=v(()=>{te(),ry(),ny(),sy(),sd(),Vs(),yl(),ly(),xd(),pe.add(ml,_l,vl,_d,Gn,Lr,Ns)}),Vi,Nr=v(()=>{"use strict";Vi=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(let i in e){let r=e[i];this.setResource(r,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],t=0;for(let i in this.resources)e[t++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,t){let i=this.resources[t];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let t=this.resources;for(let i in t)t[i]._touched=e}destroy(){let e=this.resources;for(let t in e)e[t].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let t=this.resources;for(let i in t)t[i]===e&&(t[i]=null)}else this._updateKey()}}});function bd(){return(!Xs||Xs?.isContextLost())&&(Xs=vt.get().createCanvas().getContext("webgl",{})),Xs}var Xs,wd=v(()=>{Ft()});function cy(e){let t="";for(let i=0;i<e;++i)i>0&&(t+=`
|
|
else `),i<e-1&&(t+=`if(test == ${i}.0){}`);return t}function dy(e,t){if(e===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let i=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=Td.replace(/%forloop%/gi,cy(e));if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))e=e/2|0;else break}}finally{t.deleteShader(i)}return e}var Td,fy=v(()=>{"use strict";Td=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
`)});function yr(){if(Hr)return Hr;let e=bd();return Hr=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Hr=dy(Hr,e),e.getExtension("WEBGL_lose_context")?.loseContext(),Hr}var Hr,xr=v(()=>{wd(),fy(),Hr=null});function wl(e,t){let i=2166136261;for(let r=0;r<t;r++)i^=e[r].uid,i=Math.imul(i,16777619),i>>>=0;return Tl[i]||py(e,t,i)}function py(e,t,i){let r={},n=0;Ys||(Ys=yr());for(let a=0;a<Ys;a++){let o=a<t?e[a]:Re.EMPTY.source;r[n++]=o.source,r[n++]=o.style}let s=new Vi(r);return Tl[i]=s,s}var Tl,Ys,Sl=v(()=>{Nr(),pt(),xr(),Tl={},Ys=0}),El,gy=v(()=>{"use strict";El=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Al(e,t){let i=e.byteLength/8|0,r=new Float64Array(e,0,i);new Float64Array(t,0,i).set(r);let n=e.byteLength-i*8;if(n>0){let s=new Uint8Array(e,i*8,n);new Uint8Array(t,i*8,n).set(s)}}var Sd=v(()=>{"use strict"}),Ed,Lt,ln=v(()=>{"use strict";Ed={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Lt=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",e[e.NONE=4]="NONE",e))(Lt||{})});function qs(e,t){return t.alphaMode==="no-premultiply-alpha"&&Ed[e]||e}var Cl=v(()=>{ln()}),Ad,my=v(()=>{"use strict";Ad=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){let t=this.textures[e];this.textures[e]=null,this.ids[t.uid]=null}this.count=0}}});function Cd(){return Ks>0?Ml[--Ks]:new Pd}function Md(e){Ml[Ks++]=e}var Pd,Ml,Ks,hn,Pl,Rl,Rd=v(()=>{bt(),gy(),Sd(),Cl(),xr(),my(),Pd=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ad,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Ml=[],Ks=0,hn=0,Pl=class Ro{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._vertexSize=6,this._elements=[],Ro.defaultOptions.maxTextures=Ro.defaultOptions.maxTextures??yr(),t={...Ro.defaultOptions,...t};let{vertexSize:i,indexSize:r,maxTextures:n}=t;this.attributeBuffer=new El(i*this._vertexSize*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Md(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t.indexStart=this.indexSize,t.location=this.attributeSize,t.batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.vertexSize*this._vertexSize}checkAndUpdateTexture(t,i){let r=t.batch.textures.ids[i._source.uid];return!r&&r!==0?!1:(t.textureId=r,t.texture=i,!0)}updateElement(t){this.dirty=!0,t.packAttributes(this.attributeBuffer.float32View,this.attributeBuffer.uint32View,t.location,t.textureId)}break(t){let i=this._elements;if(!i[this.elementStart])return;let r=Cd(),n=r.textures;n.clear();let s=i[this.elementStart],a=qs(s.blendMode,s.texture._source);this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let o=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",f=this.maxTextures;for(let y=this.elementStart;y<this.elementSize;++y){let b=i[y];i[y]=null;let _=b.texture._source,T=qs(b.blendMode,_),C=a!==T;if(_._batchTick===hn&&!C){b.textureId=_._textureBindLocation,u+=b.indexSize,b.packAttributes(o,l,b.location,b.textureId),b.packIndex(h,b.indexStart,b.location/this._vertexSize),b.batch=r;continue}_._batchTick=hn,(n.count>=f||C)&&(this._finishBatch(r,d,u-d,n,a,t,p),p="renderBatch",d=u,a=T,r=Cd(),n=r.textures,n.clear(),++hn),b.textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,b.batch=r,u+=b.indexSize,b.packAttributes(o,l,b.location,b.textureId),b.packIndex(h,b.indexStart,b.location/this._vertexSize)}n.count>0&&(this._finishBatch(r,d,u-d,n,a,t,p),d=u,++hn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,i,r,n,s,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=n,t.blendMode=s,t.start=i,t.size=r,++hn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let i=Math.max(t,this.attributeBuffer.size*2),r=new El(i);Al(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let i=this.indexBuffer,r=Math.max(t,i.length*1.5);r+=r%2;let n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==i.BYTES_PER_ELEMENT)for(let s=0;s<i.length;s++)n[s]=i[s];else Al(i.buffer,n.buffer);this.indexBuffer=n}destroy(){for(let t=0;t<this.batches.length;t++)Md(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t].batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}},Pl.defaultOptions={vertexSize:4,indexSize:6,maxTextures:null},Rl=Pl}),tt,zr=v(()=>{"use strict";tt=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(tt||{})}),wi,un=v(()=>{xt(),bt(),zr(),wi=class extends Je{constructor(e){let{data:t,size:i}=e,{usage:r,label:n,shrinkToFit:s}=e;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,i=i??t?.byteLength;let a=!!t;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get static(){return!!(this.descriptor.usage&tt.STATIC)}set static(e){e?this.descriptor.usage|=tt.STATIC:this.descriptor.usage&=~tt.STATIC}setDataWithSize(e,t,i){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let r=this._data;if(this._data=e,r.length!==e.length){!this.shrinkToFit&&e.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=at("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function kd(e,t){if(!(e instanceof wi)){let i=t?tt.INDEX:tt.VERTEX;e instanceof Array&&(t?(e=new Uint32Array(e),i=tt.INDEX|tt.COPY_DST):(e=new Float32Array(e),i=tt.VERTEX|tt.COPY_DST)),e=new wi({data:e,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:i})}return e}var _y=v(()=>{un(),zr()});function vy(e,t,i){let r=e.getAttribute(t);if(!r)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;let n=r.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(r.offset||0)/h,d=(r.stride||2*4)/h;for(let p=u;p<n.length;p+=d){let f=n[p],y=n[p+1];f>o&&(o=f),y>l&&(l=y),f<s&&(s=f),y<a&&(a=y)}return i.minX=s,i.minY=a,i.maxX=o,i.maxY=l,i}var yy=v(()=>{"use strict"});function xy(e){return(e instanceof wi||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=kd(e.buffer,!1),e}var Un,Zs=v(()=>{xt(),m(),bt(),un(),_y(),yy(),Un=class extends Je{constructor(e){let{attributes:t,indexBuffer:i,topology:r}=e;super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new g,this._boundsDirty=!0,this.attributes=t,this.buffers=[],this.instanceCount=e.instanceCount||1;for(let n in t){let s=t[n]=xy(t[n]);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this))}i&&(this.indexBuffer=kd(i,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,vy(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Bd,Id,kl,Gd=v(()=>{un(),zr(),Zs(),Bd=new Float32Array(1),Id=new Uint32Array(1),kl=class extends Un{constructor(){let e=new wi({data:Bd,label:"attribute-batch-buffer",usage:tt.VERTEX|tt.COPY_DST,shrinkToFit:!1}),t=new wi({data:Id,label:"index-batch-buffer",usage:tt.INDEX|tt.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:t})}}});function by(e,t,i,r,n,s,a,o=null){let l=0;i*=t,n*=s;let h=o.a,u=o.b,d=o.c,p=o.d,f=o.tx,y=o.ty;for(;l<a;){let b=e[i],_=e[i+1];r[n]=h*b+d*_+f,r[n+1]=u*b+p*_+y,n+=s,i+=t,l++}}function wy(e,t,i,r){let n=0;for(t*=i;n<r;)e[t]=0,e[t+1]=0,t+=i,n++}var Ty=v(()=>{"use strict"});function Od(e,t,i,r,n){let s=t.a,a=t.b,o=t.c,l=t.d,h=t.tx,u=t.ty;i=i||0,r=r||2,n=n||e.length/r-i;let d=i*r;for(let p=0;p<n;p++){let f=e[d],y=e[d+1];e[d]=s*f+o*y+h,e[d+1]=a*f+l*y+u,d+=r}}var Sy=v(()=>{"use strict"});function Ey(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;let i=e>>16&255,r=e>>8&255,n=e&255,s=t>>16&255,a=t>>8&255,o=t&255,l=i*s/255,h=r*a/255,u=n*o/255;return(l<<16)+(h<<8)+u}var Ay=v(()=>{"use strict"}),Js,Ud=v(()=>{Ay(),Js=class{constructor(){this.batcher=null,this.batch=null,this.applyTransform=!0,this.roundPixels=0}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}packIndex(e,t,i){let r=this.geometryData.indices;for(let n=0;n<this.indexSize;n++)e[t++]=r[n+this.indexOffset]+i-this.vertexOffset}packAttributes(e,t,i,r){let n=this.geometryData,s=this.renderable,a=n.vertices,o=n.uvs,l=this.vertexOffset*2,h=(this.vertexOffset+this.vertexSize)*2,u=this.color,d=u>>16|u&65280|(u&255)<<16;if(this.applyTransform){let p=Ey(d,s.groupColor)+(this.alpha*s.groupAlpha*255<<24),f=s.groupTransform,y=r<<16|this.roundPixels&65535,b=f.a,_=f.b,T=f.c,C=f.d,O=f.tx,R=f.ty;for(let z=l;z<h;z+=2){let ee=a[z],ne=a[z+1];e[i]=b*ee+T*ne+O,e[i+1]=_*ee+C*ne+R,e[i+2]=o[z],e[i+3]=o[z+1],t[i+4]=p,t[i+5]=y,i+=6}}else{let p=d+(this.alpha*255<<24);for(let f=l;f<h;f+=2)e[i]=a[f],e[i+1]=a[f+1],e[i+2]=o[f],e[i+3]=o[f+1],t[i+4]=p,t[i+5]=r<<16,i+=6}}get vertSize(){return this.vertexSize}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.vertexOffset=this.vertexOffset,e.vertexSize=this.vertexSize,e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData}reset(){this.applyTransform=!0}}}),cn,Fd,Dd,Cy=v(()=>{te(),cn={extension:{type:G.ShapeBuilder,name:"circle"},build(e,t){let i,r,n,s,a,o;if(e.type==="circle"){let R=e;i=R.x,r=R.y,a=o=R.radius,n=s=0}else if(e.type==="ellipse"){let R=e;i=R.x,r=R.y,a=R.halfWidth,o=R.halfHeight,n=s=0}else{let R=e,z=R.width/2,ee=R.height/2;i=R.x+z,r=R.y+ee,a=o=Math.max(0,Math.min(R.radius,Math.min(z,ee))),n=z-a,s=ee-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return t;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=i+n,t[1]=t[3]=r+s,t[2]=t[4]=i-n,t[5]=t[7]=r-s,t;let u=0,d=l*4+(n?2:0)+2,p=d,f=h,y=n+a,b=s,_=i+y,T=i-y,C=r+b;if(t[u++]=_,t[u++]=C,t[--d]=C,t[--d]=T,s){let R=r-b;t[p++]=T,t[p++]=R,t[--f]=R,t[--f]=_}for(let R=1;R<l;R++){let z=Math.PI/2*(R/l),ee=n+Math.cos(z)*a,ne=s+Math.sin(z)*o,Q=i+ee,Y=i-ee,ie=r+ne,Te=r-ne;t[u++]=Q,t[u++]=ie,t[--d]=ie,t[--d]=Y,t[p++]=Y,t[p++]=Te,t[--f]=Te,t[--f]=Q}y=n,b=s+o,_=i+y,T=i-y,C=r+b;let O=r-b;return t[u++]=_,t[u++]=C,t[--f]=O,t[--f]=_,n&&(t[u++]=T,t[u++]=C,t[--f]=O,t[--f]=T),t},triangulate(e,t,i,r,n,s){if(e.length===0)return;let a=0,o=0;for(let u=0;u<e.length;u+=2)a+=e[u],o+=e[u+1];a/=e.length/2,o/=e.length/2;let l=r;t[l*i]=a,t[l*i+1]=o;let h=l++;for(let u=0;u<e.length;u+=2)t[l*i]=e[u],t[l*i+1]=e[u+1],u>0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},Fd={...cn,extension:{...cn.extension,name:"ellipse"}},Dd={...cn,extension:{...cn.extension,name:"roundedRectangle"}}});function My(e){let t=e.length;if(t<6)return 1;let i=0;for(let r=0,n=e[t-2],s=e[t-1];r<t;r+=2){let a=e[r],o=e[r+1];i+=(a-n)*(o+s),n=a,s=o}return i<0?-1:1}var Py=v(()=>{"use strict"});function Ld(e,t,i,r,n,s,a,o){let l=e-i*n,h=t-r*n,u=e+i*s,d=t+r*s,p,f;a?(p=r,f=-i):(p=-r,f=i);let y=l+p,b=h+f,_=u+p,T=d+f;return o.push(y,b),o.push(_,T),2}function Wr(e,t,i,r,n,s,a,o){let l=i-e,h=r-t,u=Math.atan2(l,h),d=Math.atan2(n-e,s-t);o&&u<d?u+=Math.PI*2:!o&&u>d&&(d+=Math.PI*2);let p=u,f=d-u,y=Math.abs(f),b=Math.sqrt(l*l+h*h),_=(15*y*Math.sqrt(b)/Math.PI>>0)+1,T=f/_;if(p+=T,o){a.push(e,t),a.push(i,r);for(let C=1,O=p;C<_;C++,O+=T)a.push(e,t),a.push(e+Math.sin(O)*b,t+Math.cos(O)*b);a.push(e,t),a.push(n,s)}else{a.push(i,r),a.push(e,t);for(let C=1,O=p;C<_;C++,O+=T)a.push(e+Math.sin(O)*b,t+Math.cos(O)*b),a.push(e,t);a.push(n,s),a.push(e,t)}return _*2}function Ry(e,t,i,r,n,s,a,o,l){let h=1e-4;if(e.length===0)return;let u=t,d=u.alignment;if(t.alignment!==.5){let H=My(e);i&&(H*=-1),d=(d-.5)*H+.5}let p=new De(e[0],e[1]),f=new De(e[e.length-2],e[e.length-1]),y=r,b=Math.abs(p.x-f.x)<h&&Math.abs(p.y-f.y)<h;if(y){e=e.slice(),b&&(e.pop(),e.pop(),f.set(e[e.length-2],e[e.length-1]));let H=(p.x+f.x)*.5,J=(f.y+p.y)*.5;e.unshift(H,J),e.push(H,J)}let _=n,T=e.length/2,C=e.length,O=_.length/2,R=u.width/2,z=R*R,ee=u.miterLimit*u.miterLimit,ne=e[0],Q=e[1],Y=e[2],ie=e[3],Te=0,Pe=0,ce=-(Q-ie),U=ne-Y,ae=0,K=0,de=Math.sqrt(ce*ce+U*U);ce/=de,U/=de,ce*=R,U*=R;let M=d,P=(1-M)*2,A=M*2;y||(u.cap==="round"?C+=Wr(ne-ce*(P-A)*.5,Q-U*(P-A)*.5,ne-ce*P,Q-U*P,ne+ce*A,Q+U*A,_,!0)+2:u.cap==="square"&&(C+=Ld(ne,Q,ce,U,P,A,!0,_))),_.push(ne-ce*P,Q-U*P),_.push(ne+ce*A,Q+U*A);for(let H=1;H<T-1;++H){ne=e[(H-1)*2],Q=e[(H-1)*2+1],Y=e[H*2],ie=e[H*2+1],Te=e[(H+1)*2],Pe=e[(H+1)*2+1],ce=-(Q-ie),U=ne-Y,de=Math.sqrt(ce*ce+U*U),ce/=de,U/=de,ce*=R,U*=R,ae=-(ie-Pe),K=Y-Te,de=Math.sqrt(ae*ae+K*K),ae/=de,K/=de,ae*=R,K*=R;let J=Y-ne,Z=Q-ie,oe=Y-Te,be=Pe-ie,me=J*oe+Z*be,Oe=Z*oe-be*J,Ne=Oe<0;if(Math.abs(Oe)<.001*Math.abs(me)){_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),me>=0&&(u.join==="round"?C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4:C+=2,_.push(Y-ae*A,ie-K*A),_.push(Y+ae*P,ie+K*P));continue}let Ye=(-ce+ne)*(-U+ie)-(-ce+Y)*(-U+Q),St=(-ae+Te)*(-K+ie)-(-ae+Y)*(-K+Pe),Ze=(J*St-oe*Ye)/Oe,_i=(be*Ye-Z*St)/Oe,Oi=(Ze-Y)*(Ze-Y)+(_i-ie)*(_i-ie),q=Y+(Ze-Y)*P,le=ie+(_i-ie)*P,he=Y-(Ze-Y)*A,ge=ie-(_i-ie)*A,Mt=Math.min(J*J+Z*Z,oe*oe+be*be),Es=Ne?P:A,xc=Mt+Es*Es*z;Oi<=xc?u.join==="bevel"||Oi/z>ee?(Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),_.push(Y-ae*P,ie-K*P),_.push(he,ge)),C+=2):u.join==="round"?Ne?(_.push(q,le),_.push(Y+ce*A,ie+U*A),C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+4,_.push(q,le),_.push(Y+ae*A,ie+K*A)):(_.push(Y-ce*P,ie-U*P),_.push(he,ge),C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+4,_.push(Y-ae*P,ie-K*P),_.push(he,ge)):(_.push(q,le),_.push(he,ge)):(_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),u.join==="round"?Ne?C+=Wr(Y,ie,Y+ce*A,ie+U*A,Y+ae*A,ie+K*A,_,!0)+2:C+=Wr(Y,ie,Y-ce*P,ie-U*P,Y-ae*P,ie-K*P,_,!1)+2:u.join==="miter"&&Oi/z<=ee&&(Ne?(_.push(he,ge),_.push(he,ge)):(_.push(q,le),_.push(q,le)),C+=2),_.push(Y-ae*P,ie-K*P),_.push(Y+ae*A,ie+K*A),C+=2)}ne=e[(T-2)*2],Q=e[(T-2)*2+1],Y=e[(T-1)*2],ie=e[(T-1)*2+1],ce=-(Q-ie),U=ne-Y,de=Math.sqrt(ce*ce+U*U),ce/=de,U/=de,ce*=R,U*=R,_.push(Y-ce*P,ie-U*P),_.push(Y+ce*A,ie+U*A),y||(u.cap==="round"?C+=Wr(Y-ce*(P-A)*.5,ie-U*(P-A)*.5,Y-ce*P,ie-U*P,Y+ce*A,ie+U*A,_,!1)+2:u.cap==="square"&&(C+=Ld(Y,ie,ce,U,P,A,!1,_)));let j=1e-4*1e-4;for(let H=O;H<C+O-2;++H)ne=_[H*2],Q=_[H*2+1],Y=_[(H+1)*2],ie=_[(H+1)*2+1],Te=_[(H+2)*2],Pe=_[(H+2)*2+1],!(Math.abs(ne*(ie-Pe)+Y*(Pe-Q)+Te*(Q-ie))<j)&&o.push(H,H+1,H+2)}var ky=v(()=>{At(),Py()}),Nd=Ue((e,t)=>{"use strict";t.exports=i,t.exports.default=i;function i(M,P,A){A=A||2;var j=P&&P.length,H=j?P[0]*A:M.length,J=r(M,0,H,A,!0),Z=[];if(!J||J.next===J.prev)return Z;var oe,be,me,Oe,Ne,Ye,St;if(j&&(J=u(M,P,J,A)),M.length>80*A){oe=me=M[0],be=Oe=M[1];for(var Ze=A;Ze<H;Ze+=A)Ne=M[Ze],Ye=M[Ze+1],Ne<oe&&(oe=Ne),Ye<be&&(be=Ye),Ne>me&&(me=Ne),Ye>Oe&&(Oe=Ye);St=Math.max(me-oe,Oe-be),St=St!==0?32767/St:0}return s(J,Z,A,oe,be,St,0),Z}function r(M,P,A,j,H){var J,Z;if(H===de(M,P,A,j)>0)for(J=P;J<A;J+=j)Z=U(J,M[J],M[J+1],Z);else for(J=A-j;J>=P;J-=j)Z=U(J,M[J],M[J+1],Z);return Z&&ee(Z,Z.next)&&(ae(Z),Z=Z.next),Z}function n(M,P){if(!M)return M;P||(P=M);var A=M,j;do if(j=!1,!A.steiner&&(ee(A,A.next)||z(A.prev,A,A.next)===0)){if(ae(A),A=P=A.prev,A===A.next)break;j=!0}else A=A.next;while(j||A!==P);return P}function s(M,P,A,j,H,J,Z){if(M){!Z&&J&&b(M,j,H,J);for(var oe=M,be,me;M.prev!==M.next;){if(be=M.prev,me=M.next,J?o(M,j,H,J):a(M)){P.push(be.i/A|0),P.push(M.i/A|0),P.push(me.i/A|0),ae(M),M=me.next,oe=me.next;continue}if(M=me,M===oe){Z?Z===1?(M=l(n(M),P,A),s(M,P,A,j,H,J,2)):Z===2&&h(M,P,A,j,H,J):s(n(M),P,A,j,H,J,1);break}}}}function a(M){var P=M.prev,A=M,j=M.next;if(z(P,A,j)>=0)return!1;for(var H=P.x,J=A.x,Z=j.x,oe=P.y,be=A.y,me=j.y,Oe=H<J?H<Z?H:Z:J<Z?J:Z,Ne=oe<be?oe<me?oe:me:be<me?be:me,Ye=H>J?H>Z?H:Z:J>Z?J:Z,St=oe>be?oe>me?oe:me:be>me?be:me,Ze=j.next;Ze!==P;){if(Ze.x>=Oe&&Ze.x<=Ye&&Ze.y>=Ne&&Ze.y<=St&&O(H,oe,J,be,Z,me,Ze.x,Ze.y)&&z(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.next}return!0}function o(M,P,A,j){var H=M.prev,J=M,Z=M.next;if(z(H,J,Z)>=0)return!1;for(var oe=H.x,be=J.x,me=Z.x,Oe=H.y,Ne=J.y,Ye=Z.y,St=oe<be?oe<me?oe:me:be<me?be:me,Ze=Oe<Ne?Oe<Ye?Oe:Ye:Ne<Ye?Ne:Ye,_i=oe>be?oe>me?oe:me:be>me?be:me,Oi=Oe>Ne?Oe>Ye?Oe:Ye:Ne>Ye?Ne:Ye,q=T(St,Ze,P,A,j),le=T(_i,Oi,P,A,j),he=M.prevZ,ge=M.nextZ;he&&he.z>=q&&ge&&ge.z<=le;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0||(he=he.prevZ,ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0))return!1;ge=ge.nextZ}for(;he&&he.z>=q;){if(he.x>=St&&he.x<=_i&&he.y>=Ze&&he.y<=Oi&&he!==H&&he!==Z&&O(oe,Oe,be,Ne,me,Ye,he.x,he.y)&&z(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;ge&&ge.z<=le;){if(ge.x>=St&&ge.x<=_i&&ge.y>=Ze&&ge.y<=Oi&&ge!==H&&ge!==Z&&O(oe,Oe,be,Ne,me,Ye,ge.x,ge.y)&&z(ge.prev,ge,ge.next)>=0)return!1;ge=ge.nextZ}return!0}function l(M,P,A){var j=M;do{var H=j.prev,J=j.next.next;!ee(H,J)&&ne(H,j,j.next,J)&&Te(H,J)&&Te(J,H)&&(P.push(H.i/A|0),P.push(j.i/A|0),P.push(J.i/A|0),ae(j),ae(j.next),j=M=J),j=j.next}while(j!==M);return n(j)}function h(M,P,A,j,H,J){var Z=M;do{for(var oe=Z.next.next;oe!==Z.prev;){if(Z.i!==oe.i&&R(Z,oe)){var be=ce(Z,oe);Z=n(Z,Z.next),be=n(be,be.next),s(Z,P,A,j,H,J,0),s(be,P,A,j,H,J,0);return}oe=oe.next}Z=Z.next}while(Z!==M)}function u(M,P,A,j){var H=[],J,Z,oe,be,me;for(J=0,Z=P.length;J<Z;J++)oe=P[J]*j,be=J<Z-1?P[J+1]*j:M.length,me=r(M,oe,be,j,!1),me===me.next&&(me.steiner=!0),H.push(C(me));for(H.sort(d),J=0;J<H.length;J++)A=p(H[J],A);return A}function d(M,P){return M.x-P.x}function p(M,P){var A=f(M,P);if(!A)return P;var j=ce(A,M);return n(j,j.next),n(A,A.next)}function f(M,P){var A=P,j=M.x,H=M.y,J=-1/0,Z;do{if(H<=A.y&&H>=A.next.y&&A.next.y!==A.y){var oe=A.x+(H-A.y)*(A.next.x-A.x)/(A.next.y-A.y);if(oe<=j&&oe>J&&(J=oe,Z=A.x<A.next.x?A:A.next,oe===j))return Z}A=A.next}while(A!==P);if(!Z)return null;var be=Z,me=Z.x,Oe=Z.y,Ne=1/0,Ye;A=Z;do j>=A.x&&A.x>=me&&j!==A.x&&O(H<Oe?j:J,H,me,Oe,H<Oe?J:j,H,A.x,A.y)&&(Ye=Math.abs(H-A.y)/(j-A.x),Te(A,M)&&(Ye<Ne||Ye===Ne&&(A.x>Z.x||A.x===Z.x&&y(Z,A)))&&(Z=A,Ne=Ye)),A=A.next;while(A!==be);return Z}function y(M,P){return z(M.prev,M,P.prev)<0&&z(P.next,M,M.next)<0}function b(M,P,A,j){var H=M;do H.z===0&&(H.z=T(H.x,H.y,P,A,j)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==M);H.prevZ.nextZ=null,H.prevZ=null,_(H)}function _(M){var P,A,j,H,J,Z,oe,be,me=1;do{for(A=M,M=null,J=null,Z=0;A;){for(Z++,j=A,oe=0,P=0;P<me&&(oe++,j=j.nextZ,!!j);P++);for(be=me;oe>0||be>0&&j;)oe!==0&&(be===0||!j||A.z<=j.z)?(H=A,A=A.nextZ,oe--):(H=j,j=j.nextZ,be--),J?J.nextZ=H:M=H,H.prevZ=J,J=H;A=j}J.nextZ=null,me*=2}while(Z>1);return M}function T(M,P,A,j,H){return M=(M-A)*H|0,P=(P-j)*H|0,M=(M|M<<8)&16711935,M=(M|M<<4)&252645135,M=(M|M<<2)&858993459,M=(M|M<<1)&1431655765,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,M|P<<1}function C(M){var P=M,A=M;do(P.x<A.x||P.x===A.x&&P.y<A.y)&&(A=P),P=P.next;while(P!==M);return A}function O(M,P,A,j,H,J,Z,oe){return(H-Z)*(P-oe)>=(M-Z)*(J-oe)&&(M-Z)*(j-oe)>=(A-Z)*(P-oe)&&(A-Z)*(J-oe)>=(H-Z)*(j-oe)}function R(M,P){return M.next.i!==P.i&&M.prev.i!==P.i&&!ie(M,P)&&(Te(M,P)&&Te(P,M)&&Pe(M,P)&&(z(M.prev,M,P.prev)||z(M,P.prev,P))||ee(M,P)&&z(M.prev,M,M.next)>0&&z(P.prev,P,P.next)>0)}function z(M,P,A){return(P.y-M.y)*(A.x-P.x)-(P.x-M.x)*(A.y-P.y)}function ee(M,P){return M.x===P.x&&M.y===P.y}function ne(M,P,A,j){var H=Y(z(M,P,A)),J=Y(z(M,P,j)),Z=Y(z(A,j,M)),oe=Y(z(A,j,P));return!!(H!==J&&Z!==oe||H===0&&Q(M,A,P)||J===0&&Q(M,j,P)||Z===0&&Q(A,M,j)||oe===0&&Q(A,P,j))}function Q(M,P,A){return P.x<=Math.max(M.x,A.x)&&P.x>=Math.min(M.x,A.x)&&P.y<=Math.max(M.y,A.y)&&P.y>=Math.min(M.y,A.y)}function Y(M){return M>0?1:M<0?-1:0}function ie(M,P){var A=M;do{if(A.i!==M.i&&A.next.i!==M.i&&A.i!==P.i&&A.next.i!==P.i&&ne(A,A.next,M,P))return!0;A=A.next}while(A!==M);return!1}function Te(M,P){return z(M.prev,M,M.next)<0?z(M,P,M.next)>=0&&z(M,M.prev,P)>=0:z(M,P,M.prev)<0||z(M,M.next,P)<0}function Pe(M,P){var A=M,j=!1,H=(M.x+P.x)/2,J=(M.y+P.y)/2;do A.y>J!=A.next.y>J&&A.next.y!==A.y&&H<(A.next.x-A.x)*(J-A.y)/(A.next.y-A.y)+A.x&&(j=!j),A=A.next;while(A!==M);return j}function ce(M,P){var A=new K(M.i,M.x,M.y),j=new K(P.i,P.x,P.y),H=M.next,J=P.prev;return M.next=P,P.prev=M,A.next=H,H.prev=A,j.next=A,A.prev=j,J.next=j,j.prev=J,j}function U(M,P,A,j){var H=new K(M,P,A);return j?(H.next=j.next,H.prev=j,j.next.prev=H,j.next=H):(H.prev=H,H.next=H),H}function ae(M){M.next.prev=M.prev,M.prev.next=M.next,M.prevZ&&(M.prevZ.nextZ=M.nextZ),M.nextZ&&(M.nextZ.prevZ=M.prevZ)}function K(M,P,A){this.i=M,this.x=P,this.y=A,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(M,P,A,j){var H=P&&P.length,J=H?P[0]*A:M.length,Z=Math.abs(de(M,0,J,A));if(H)for(var oe=0,be=P.length;oe<be;oe++){var me=P[oe]*A,Oe=oe<be-1?P[oe+1]*A:M.length;Z-=Math.abs(de(M,me,Oe,A))}var Ne=0;for(oe=0;oe<j.length;oe+=3){var Ye=j[oe]*A,St=j[oe+1]*A,Ze=j[oe+2]*A;Ne+=Math.abs((M[Ye]-M[Ze])*(M[St+1]-M[Ye+1])-(M[Ye]-M[St])*(M[Ze+1]-M[Ye+1]))}return Z===0&&Ne===0?0:Math.abs((Ne-Z)/Z)};function de(M,P,A,j){for(var H=0,J=P,Z=A-j;J<A;J+=j)H+=(M[Z]-M[J])*(M[J+1]+M[Z+1]),Z=J;return H}i.flatten=function(M){for(var P=M[0][0].length,A={vertices:[],holes:[],dimensions:P},j=0,H=0;H<M.length;H++){for(var J=0;J<M[H].length;J++)for(var Z=0;Z<P;Z++)A.vertices.push(M[H][J][Z]);H>0&&(j+=M[H-1].length,A.holes.push(j))}return A}});function Hd(e,t,i,r,n,s,a){let o=(0,zd.default)(e,t,2);if(!o)return;for(let h=0;h<o.length;h+=3)s[a++]=o[h]+n,s[a++]=o[h+1]+n,s[a++]=o[h+2]+n;let l=n*r;for(let h=0;h<e.length;h+=2)i[l]=e[h],i[l+1]=e[h+1],l+=r}var zd,Wd=v(()=>{zd=ht(Nd(),1)}),Vd,jd,By=v(()=>{te(),Wd(),Vd=[],jd={extension:{type:G.ShapeBuilder,name:"polygon"},build(e,t){for(let i=0;i<e.points.length;i++)t[i]=e.points[i];return t},triangulate(e,t,i,r,n,s){Hd(e,Vd,t,i,r,n,s)}}}),$d,Iy=v(()=>{te(),$d={extension:{type:G.ShapeBuilder,name:"rectangle"},build(e,t){let i=e,r=i.x,n=i.y,s=i.width,a=i.height;return s>=0&&a>=0&&(t[0]=r,t[1]=n,t[2]=r+s,t[3]=n,t[4]=r+s,t[5]=n+a,t[6]=r,t[7]=n+a),t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[6],t[r+a+1]=e[7],a+=i,t[r+a]=e[4],t[r+a+1]=e[5],a+=i;let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),Xd,Gy=v(()=>{te(),Xd={extension:{type:G.ShapeBuilder,name:"triangle"},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,t},triangulate(e,t,i,r,n,s){let a=0;r*=i,t[r+a]=e[0],t[r+a+1]=e[1],a+=i,t[r+a]=e[2],t[r+a+1]=e[3],a+=i,t[r+a]=e[4],t[r+a+1]=e[5];let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Oy(e,t){let{geometryData:i,batches:r}=t;r.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let n=0;n<e.instructions.length;n++){let s=e.instructions[n];if(s.action==="texture")Uy(s.data,r,i);else if(s.action==="fill"||s.action==="stroke"){let a=s.action==="stroke",o=s.data.path.shapePath,l=s.data.style,h=s.data.hole;a&&h&&Yd(h.shapePath,l,null,!0,r,i),Yd(o,l,h,a,r,i)}}}function Uy(e,t,i){let{vertices:r,uvs:n,indices:s}=i,a=s.length,o=r.length/2,l=[],h=Fn.rectangle,u=qd,d=e.image;u.x=e.dx,u.y=e.dy,u.width=e.dw,u.height=e.dh;let p=e.transform;h.build(u,l),p&&Od(l,p),h.triangulate(l,r,2,o,s,a);let f=d.uvs;n.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let y=Le.get(Js);y.indexOffset=a,y.indexSize=s.length-a,y.vertexOffset=o,y.vertexSize=r.length/2-o,y.color=e.style,y.alpha=e.alpha,y.texture=d,y.geometryData=i,t.push(y)}function Yd(e,t,i,r,n,s){let{vertices:a,uvs:o,indices:l}=s,h=e.shapePrimitives.length-1;e.shapePrimitives.forEach(({shape:u,transform:d},p)=>{let f=l.length,y=a.length/2,b=[],_=Fn[u.type];if(_.build(u,b),d&&Od(b,d),r){let R=u.closePath??!0;Ry(b,t,!1,R,a,2,y,l,f)}else if(i&&h===p){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let R=[],z=b.slice();Fy(i.shapePath).forEach(ee=>{R.push(z.length/2),z.push(...ee)}),Hd(z,R,a,2,y,l,f)}else _.triangulate(b,a,2,y,l,f);let T=o.length/2,C=t.texture;if(C!==Re.WHITE){let R=t.matrix;R&&(d&&R.append(d.clone().invert()),by(a,2,y,o,T,2,a.length/2-y,R))}else wy(o,T,2,a.length/2-y);let O=Le.get(Js);O.indexOffset=f,O.indexSize=l.length-f,O.vertexOffset=y,O.vertexSize=a.length/2-y,O.color=t.color,O.alpha=t.alpha,O.texture=C,O.geometryData=s,n.push(O)})}function Fy(e){if(!e)return[];let t=e.shapePrimitives,i=[];for(let r=0;r<t.length;r++){let n=t[r].shape,s=[];Fn[n.type].build(n,s),i.push(s)}return i}var Fn,qd,Dy=v(()=>{te(),E(),Ty(),Sy(),pt(),Ht(),Ud(),Cy(),ky(),By(),Iy(),Gy(),Wd(),Fn={},pe.handleByMap(G.ShapeBuilder,Fn),pe.add($d,jd,Xd,cn,Fd,Dd),qd=new ot}),Kd,Zd,Qs,ea,Bl=v(()=>{te(),Sl(),Rd(),Gd(),lt(),Ht(),Dy(),Kd=class{constructor(){this.batcher=new Rl,this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Zd=class{constructor(){this.geometry=new kl,this.instructions=new et}init(){this.instructions.reset()}},Qs=class Tc{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){Tc.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Tc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let i=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){i?this._cleanGraphicsContextData(t):i=this._initContext(t),Oy(t,i);let r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"&&(i.isBatchable=i.geometryData.vertices.length<400),t.dirty=!1}return i}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let i=Le.get(Zd),{batches:r,geometryData:n,batcher:s}=this._gpuContextHash[t.uid],a=n.vertices.length,o=n.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;s.ensureAttributeBuffer(a),s.ensureIndexBuffer(o),s.begin();for(let u=0;u<r.length;u++){let d=r[u];s.add(d)}s.finish(i.instructions);let l=i.geometry;l.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),l.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!0);let h=s.batches;for(let u=0;u<h.length;u++){let d=h[u];d.bindGroup=wl(d.textures.textures,d.textures.count)}return this._graphicsDataContextHash[t.uid]=i,i}_initContext(t){let i=new Kd;return i.context=t,this._gpuContextHash[t.uid]=i,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let i=this._gpuContextHash[t.uid];i.isBatchable||this._graphicsDataContextHash[t.uid]&&(Le.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),i.batches&&i.batches.forEach(r=>{Le.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}},Qs.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"graphicsContext"},Qs.defaultOptions={bezierSmoothness:.5},ea=Qs}),Jd,ta,ia,ra,na,sa,aa,oa,ji,nr=v(()=>{"use strict";Jd={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},ta=0,ia=1,ra=2,na=3,sa=4,aa=5,oa=class tv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ta)}set blend(t){!!(this.data&1<<ta)!==t&&(this.data^=1<<ta)}get offsets(){return!!(this.data&1<<ia)}set offsets(t){!!(this.data&1<<ia)!==t&&(this.data^=1<<ia)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<ra)}set culling(t){!!(this.data&1<<ra)!==t&&(this.data^=1<<ra)}get depthTest(){return!!(this.data&1<<na)}set depthTest(t){!!(this.data&1<<na)!==t&&(this.data^=1<<na)}get depthMask(){return!!(this.data&1<<aa)}set depthMask(t){!!(this.data&1<<aa)!==t&&(this.data^=1<<aa)}get clockwiseFrontFace(){return!!(this.data&1<<sa)}set clockwiseFrontFace(t){!!(this.data&1<<sa)!==t&&(this.data^=1<<sa)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Jd[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new tv;return t.depthTest=!1,t.blend=!0,t}},oa.default2d=oa.for2d(),ji=oa});function la(e,t,i){let r=(e>>24&255)/255;t[i++]=(e&255)/255*r,t[i++]=(e>>8&255)/255*r,t[i++]=(e>>16&255)/255*r,t[i++]=r}var ha=v(()=>{"use strict"}),Il,Ly=v(()=>{te(),nr(),Ht(),ha(),Ud(),Il=class{constructor(e,t){this.state=ji.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],r=this.renderer.graphicsContext.updateGpuContext(t);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e._didGraphicsUpdate&&(e._didGraphicsUpdate=!1,this._rebuild(e)),i.isBatchable?this._addToBatcher(e):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i<t.length;i++){let r=t[i];r.batcher.updateElement(r)}}destroyRenderable(e){this._graphicsBatchesHash[e.uid]&&this._removeBatchForRenderable(e.uid),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;let t=this.renderer,i=e.context;if(!t.graphicsContext.getGpuContext(i).batches.length)return;let r=i.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;let n=r.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=t._roundPixels|e._roundPixels,la(e.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){let t=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(e.context);t&&this._removeBatchForRenderable(e.uid),i.isBatchable&&this._initBatchesForRenderable(e),e.batched=i.isBatchable}_addToBatcher(e){let t=this.renderer.renderPipes.batch,i=this._getBatchesForRenderable(e);for(let r=0;r<i.length;r++){let n=i[r];t.addToBatch(n)}}_getBatchesForRenderable(e){return this._graphicsBatchesHash[e.uid]||this._initBatchesForRenderable(e)}_initBatchesForRenderable(e){let t=e.context,i=this.renderer.graphicsContext.getGpuContext(t),r=this.renderer._roundPixels|e._roundPixels,n=i.batches.map(s=>{let a=Le.get(Js);return s.copyTo(a),a.renderable=e,a.roundPixels=r,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{Le.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}},Il.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"graphics"}}),Qd=v(()=>{te(),Bl(),Ly(),pe.add(Il),pe.add(ea)});function Dn(e,t){let i=Gl[e];return i===void 0&&(ua[t]===void 0&&(ua[t]=1),Gl[e]=i=ua[t]++),i}var ua,Gl,ca=v(()=>{"use strict";ua=Object.create(null),Gl=Object.create(null)}),Ol,ef,Ny=v(()=>{"use strict";Ol=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>"],ef=Ol.reduce((e,t)=>(e[t]=!0,e),{})});function Hy(e,t){switch(e){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var zy=v(()=>{"use strict"}),Ul,ti,pi=v(()=>{bt(),ca(),Ny(),zy(),Ul=class iv{constructor(t,i){this._touched=0,this.uid=at("uniform"),this._resourceType="uniformGroup",this._resourceId=at("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...iv.defaultOptions,...i},this.uniformStructures=t;let r={};for(let n in t){let s=t[n];if(s.name=n,s.size=s.size??1,!ef[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ol.join(", ")}`);s.value??(s.value=Hy(s.type,s.size)),r[n]=s.value}this.uniforms=r,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=Dn(Object.keys(r).map(n=>`${n}-${t[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Ul.defaultOptions={ubo:!1,isStatic:!1},ti=Ul}),da,Fl=v(()=>{"use strict";da=class{constructor(){this.batcher=null,this.batch=null,this.roundPixels=0,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.mesh.groupBlendMode}reset(){this.mesh=null,this.texture=null,this.batcher=null,this.batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}packIndex(e,t,i){let r=this.geometry.indices;for(let n=0;n<r.length;n++)e[t++]=r[n]+i}packAttributes(e,t,i,r){let n=this.mesh,s=this.geometry,a=n.groupTransform,o=r<<16|this.roundPixels&65535,l=a.a,h=a.b,u=a.c,d=a.d,p=a.tx,f=a.ty,y=s.positions,b=s.getBuffer("aUV"),_=b.data,T=_,C=this.texture.textureMatrix;C.isSimple||(T=this._transformedUvs,(this._textureMatrixUpdateId!==C._updateID||this._uvUpdateId!==b._updateID)&&((!T||T.length<_.length)&&(T=this._transformedUvs=new Float32Array(_.length)),this._textureMatrixUpdateId=C._updateID,this._uvUpdateId=b._updateID,C.multiplyUvs(_,T)));let O=n.groupColorAlpha;for(let R=0;R<y.length;R+=2){let z=y[R],ee=y[R+1];e[i]=l*z+u*ee+p,e[i+1]=h*z+d*ee+f,e[i+2]=T[R],e[i+3]=T[R+1],t[i+4]=O,t[i+5]=o,i+=6}}get vertexSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}}),Dl,Wy=v(()=>{te(),We(),Nr(),pi(),Cl(),Ht(),ha(),Fl(),Dl=class{constructor(e,t){this.localUniforms=new ti({uTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Vi({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,r=e.batched;if(t.batched=r,i!==r)return!0;if(r){let n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(e),a=e.texture;if(s.texture._source!==a._source&&s.texture._source!==a._source)return!s.batcher.checkAndUpdateTexture(s,a)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:r}=this._getMeshData(e);if(r){let n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,i.addToBatch(n)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.texture=e._texture,t.geometry=e._geometry,t.batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(Le.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=qs(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),la(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=Le.get(da);return t.mesh=e,t.texture=e._texture,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t.mesh=e,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&Le.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},Dl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"mesh"}}),tf=v(()=>{te(),Wy(),pe.add(Dl)}),fa,Ll=v(()=>{"use strict";fa=class{constructor(){this.vertexSize=4,this.indexSize=6,this.location=0,this.batcher=null,this.batch=null,this.roundPixels=0}get blendMode(){return this.renderable.groupBlendMode}packAttributes(e,t,i,r){let n=this.renderable,s=this.texture,a=n.groupTransform,o=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,p=a.ty,f=this.bounds,y=f.maxX,b=f.minX,_=f.maxY,T=f.minY,C=s.uvs,O=n.groupColorAlpha,R=r<<16|this.roundPixels&65535;e[i+0]=o*b+h*T+d,e[i+1]=u*T+l*b+p,e[i+2]=C.x0,e[i+3]=C.y0,t[i+4]=O,t[i+5]=R,e[i+6]=o*y+h*T+d,e[i+7]=u*T+l*y+p,e[i+8]=C.x1,e[i+9]=C.y1,t[i+10]=O,t[i+11]=R,e[i+12]=o*y+h*_+d,e[i+13]=u*_+l*y+p,e[i+14]=C.x2,e[i+15]=C.y2,t[i+16]=O,t[i+17]=R,e[i+18]=o*b+h*_+d,e[i+19]=u*_+l*b+p,e[i+20]=C.x3,e[i+21]=C.y3,t[i+22]=O,t[i+23]=R}packIndex(e,t,i){e[t]=i+0,e[t+1]=i+1,e[t+2]=i+2,e[t+3]=i+0,e[t+4]=i+2,e[t+5]=i+3}reset(){this.renderable=null,this.texture=null,this.batcher=null,this.batch=null,this.bounds=null}}}),Nl,Vy=v(()=>{te(),pl(),Ht(),Ll(),Nl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();if(t.currentKey!==i){let{width:r,height:n}=this._renderer.canvasText.getTextureSize(e.text,e.resolution,e._style);return!(this._renderer.canvasText.getReferenceCount(t.currentKey)===1&&r===t.texture._source.width&&n===t.texture._source.height)}return!1}addRenderable(e,t){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),Le.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:Le.get(fa)};return t.batchableSprite.renderable=e,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},Nl.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"text"}}),rf,$i,pa=v(()=>{Ft(),Ls(),rf=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=vt.get().createCanvas();i.width=e,i.height=t;let r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=on(e),t=on(t);let r=(e<<17)+(t<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:r}=t,n=(i<<17)+(r<<1);this._canvasPool[n].push(e)}clear(){this._canvasPool={}}},$i=new rf}),nf,sf,gi,Ln=v(()=>{Ls(),fi(),pt(),nf=0,sf=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let r=new Dt({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!0});return new Re({source:r,label:`texturePool_${nf++}`})}getOptimalTexture(e,t,i=1,r){let n=Math.ceil(e*i-1e-6),s=Math.ceil(t*i-1e-6);n=on(n),s=on(s);let a=(n<<17)+(s<<1)+(r?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,r)),o.source._resolution=i,o.source.width=n/i,o.source.height=s/i,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=e,o.frame.height=t,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}},gi=new sf});function af(e,t,i){for(let r=0,n=4*i*t;r<t;++r,n+=4)if(e[n+3]!==0)return!1;return!0}function of(e,t,i,r,n){let s=4*t;for(let a=r,o=r*s+4*i;a<=n;++a,o+=s)if(e[o+3]!==0)return!1;return!0}function jy(e,t=1){let{width:i,height:r}=e,n=e.getContext("2d",{willReadFrequently:!0});if(n===null)throw new TypeError("Failed to get canvas 2D context");let s=n.getImageData(0,0,i,r).data,a=0,o=0,l=i-1,h=r-1;for(;o<r&&af(s,i,o);)++o;if(o===r)return ot.EMPTY;for(;af(s,i,h);)--h;for(;of(s,i,a,o,h);)++a;for(;of(s,i,l,o,h);)--l;return++l,++h,new ot(a/t,o/t,(l-a)/t,(h-o)/t)}var $y=v(()=>{E()}),Hl,dn,zl=v(()=>{Ie(),Ft(),We(),yl(),pt(),bt(),Hl=class Sc{constructor(t,i,r,n){this.uid=at("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=i,this.x1=r,this.y1=n}addColorStop(t,i){return this.gradientStops.push({offset:t,color:ue.shared.setValue(i).toHexa()}),this._styleKey=null,this}buildLinearGradient(){let t=Sc.defaultTextureSize,{gradientStops:i}=this,r=vt.get().createCanvas();r.width=t,r.height=t;let n=r.getContext("2d"),s=n.createLinearGradient(0,0,Sc.defaultTextureSize,1);for(let b=0;b<i.length;b++){let _=i[b];s.addColorStop(_.offset,_.color)}n.fillStyle=s,n.fillRect(0,0,t,t),this.texture=new Re({source:new Gn({resource:r,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});let{x0:a,y0:o,x1:l,y1:h}=this,u=new ke,d=l-a,p=h-o,f=Math.sqrt(d*d+p*p),y=Math.atan2(p,d);u.translate(-a,-o),u.scale(1/t,1/t),u.rotate(-y),u.scale(256/f,1),this.transform=u,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;let t=this.gradientStops.map(n=>`${n.offset}-${n.color}`).join("-"),i=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${i}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},Hl.defaultTextureSize=256,dn=Hl}),Wl,Nn,Vl=v(()=>{We(),bt(),Wl={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Nn=class{constructor(e,t){this.uid=at("fillPattern"),this.transform=new ke,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=Wl[t].addressModeU,e.source.style.addressModeV=Wl[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}}),Xy=Ue((e,t)=>{t.exports=n;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(r,function(h,u,d){var p=u.toLowerCase();for(d=a(d),p=="m"&&d.length>2&&(l.push([u].concat(d.splice(0,2))),p="l",u=u=="m"?"l":"L");;){if(d.length==i[p])return d.unshift(u),l.push(d);if(d.length<i[p])throw new Error("malformed path data");l.push([u].concat(d.splice(0,i[p])))}}),l}var s=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function a(o){var l=o.match(s);return l?l.map(Number):[]}});function Yy(e,t){let i=(0,lf.default)(e),r=[],n=null,s=0,a=0;for(let o=0;o<i.length;o++){let l=i[o],h=l[0],u=l;switch(h){case"M":s=u[1],a=u[2],t.moveTo(s,a);break;case"m":s+=u[1],a+=u[2],t.moveTo(s,a);break;case"H":s=u[1],t.lineTo(s,a);break;case"h":s+=u[1],t.lineTo(s,a);break;case"V":a=u[1],t.lineTo(s,a);break;case"v":a+=u[1],t.lineTo(s,a);break;case"L":s=u[1],a=u[2],t.lineTo(s,a);break;case"l":s+=u[1],a+=u[2],t.lineTo(s,a);break;case"C":s=u[5],a=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],s,a);break;case"c":t.bezierCurveTo(s+u[1],a+u[2],s+u[3],a+u[4],s+u[5],a+u[6]),s+=u[5],a+=u[6];break;case"S":s=u[3],a=u[4],t.bezierCurveToShort(u[1],u[2],s,a);break;case"s":t.bezierCurveToShort(s+u[1],a+u[2],s+u[3],a+u[4]),s+=u[3],a+=u[4];break;case"Q":s=u[3],a=u[4],t.quadraticCurveTo(u[1],u[2],s,a);break;case"q":t.quadraticCurveTo(s+u[1],a+u[2],s+u[3],a+u[4]),s+=u[3],a+=u[4];break;case"T":s=u[1],a=u[2],t.quadraticCurveToShort(s,a);break;case"t":s+=u[1],a+=u[2],t.quadraticCurveToShort(s,a);break;case"A":s=u[6],a=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"a":s+=u[6],a+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"Z":case"z":t.closePath(),r.length>0&&(n=r.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:F(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},r.push(n))}return t}var lf,qy=v(()=>{lf=ht(Xy(),1),I()}),jl,hf=v(()=>{E(),jl=class rv{constructor(t=0,i=0,r=0){this.type="circle",this.x=t,this.y=i,this.radius=r}clone(){return new rv(this.x,this.y,this.radius)}contains(t,i){if(this.radius<=0)return!1;let r=this.radius*this.radius,n=this.x-t,s=this.y-i;return n*=n,s*=s,n+s<=r}strokeContains(t,i,r){if(this.radius===0)return!1;let n=this.x-t,s=this.y-i,a=this.radius,o=r/2,l=Math.sqrt(n*n+s*s);return l<a+o&&l>a-o}getBounds(t){return t=t||new ot,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),uf,Ky=v(()=>{E(),uf=class nv{constructor(t=0,i=0,r=0,n=0){this.type="ellipse",this.x=t,this.y=i,this.halfWidth=r,this.halfHeight=n}clone(){return new nv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,i){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,n=(i-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(t,i,r){let{halfWidth:n,halfHeight:s}=this;if(n<=0||s<=0)return!1;let a=r/2,o=n-a,l=s-a,h=n+a,u=s+a,d=t-this.x,p=i-this.y,f=d*d/(o*o)+p*p/(l*l),y=d*d/(h*h)+p*p/(u*u);return f>1&&y<=1}getBounds(t){return t=t||new ot,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Zy(e,t,i,r,n,s){let a=e-i,o=t-r,l=n-i,h=s-r,u=a*l+o*h,d=l*l+h*h,p=-1;d!==0&&(p=u/d);let f,y;p<0?(f=i,y=r):p>1?(f=n,y=s):(f=i+p*l,y=r+p*h);let b=e-f,_=t-y;return b*b+_*_}var Jy=v(()=>{"use strict"}),ga,Qy=v(()=>{Jy(),E(),ga=class sv{constructor(...t){this.type="polygon";let i=Array.isArray(t[0])?t[0]:t;if(typeof i[0]!="number"){let r=[];for(let n=0,s=i.length;n<s;n++)r.push(i[n].x,i[n].y);i=r}this.points=i,this.closePath=!0}clone(){let t=this.points.slice(),i=new sv(t);return i.closePath=this.closePath,i}contains(t,i){let r=!1,n=this.points.length/2;for(let s=0,a=n-1;s<n;a=s++){let o=this.points[s*2],l=this.points[s*2+1],h=this.points[a*2],u=this.points[a*2+1];l>i!=u>i&&t<(h-o)*((i-l)/(u-l))+o&&(r=!r)}return r}strokeContains(t,i,r){let n=r/2,s=n*n,{points:a}=this,o=a.length-(this.closePath?0:2);for(let l=0;l<o;l+=2){let h=a[l],u=a[l+1],d=a[(l+2)%a.length],p=a[(l+3)%a.length];if(Zy(t,i,h,u,d,p)<=s)return!0}return!1}getBounds(t){t=t||new ot;let i=this.points,r=1/0,n=-1/0,s=1/0,a=-1/0;for(let o=0,l=i.length;o<l;o+=2){let h=i[o],u=i[o+1];r=h<r?h:r,n=h>n?h:n,s=u<s?u:s,a=u>a?u:a}return t.x=r,t.width=n-r,t.y=s,t.height=a-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,i)=>`${t}, ${i}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}}),Hn,cf,ex=v(()=>{E(),Hn=(e,t,i,r,n,s)=>{let a=e-i,o=t-r,l=Math.sqrt(a*a+o*o);return l>=n-s&&l<=n+s},cf=class av{constructor(t=0,i=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=t,this.y=i,this.width=r,this.height=n,this.radius=s}getBounds(t){return t=t||new ot,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new av(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+r&&i<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let n=t-(this.x+r),s=i-(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=i-(this.y+this.height-r),n*n+s*s<=a)||(n=t-(this.x+r),n*n+s*s<=a))return!0}return!1}strokeContains(t,i,r){let{x:n,y:s,width:a,height:o,radius:l}=this,h=r/2,u=n+l,d=s+l,p=a-l*2,f=o-l*2,y=n+a,b=s+o;return(t>=n-h&&t<=n+h||t>=y-h&&t<=y+h)&&i>=d&&i<=d+f||(i>=s-h&&i<=s+h||i>=b-h&&i<=b+h)&&t>=u&&t<=u+p?!0:t<u&&i<d&&Hn(t,i,u,d,l,h)||t>y-l&&i<d&&Hn(t,i,y-l,d,l,h)||t>y-l&&i>b-l&&Hn(t,i,y-l,b-l,l,h)||t<u&&i>b-l&&Hn(t,i,u,b-l,l,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function df(e,t,i,r,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ea.defaultOptions.bezierSmoothness)),d=(pf-u)/1;return d*=d,tx(t,i,r,n,s,a,o,l,e,d),e}function tx(e,t,i,r,n,s,a,o,l,h){$l(e,t,i,r,n,s,a,o,l,h,0),l.push(a,o)}function $l(e,t,i,r,n,s,a,o,l,h,u){if(u>ff)return;let d=Math.PI,p=(e+i)/2,f=(t+r)/2,y=(i+n)/2,b=(r+s)/2,_=(n+a)/2,T=(s+o)/2,C=(p+y)/2,O=(f+b)/2,R=(y+_)/2,z=(b+T)/2,ee=(C+R)/2,ne=(O+z)/2;if(u>0){let Q=a-e,Y=o-t,ie=Math.abs((i-a)*Y-(r-o)*Q),Te=Math.abs((n-a)*Y-(s-o)*Q),Pe,ce;if(ie>zn&&Te>zn){if((ie+Te)*(ie+Te)<=h*(Q*Q+Y*Y)){if(Vr<ma){l.push(ee,ne);return}let U=Math.atan2(s-r,n-i);if(Pe=Math.abs(U-Math.atan2(r-t,i-e)),ce=Math.abs(Math.atan2(o-s,a-n)-U),Pe>=d&&(Pe=2*d-Pe),ce>=d&&(ce=2*d-ce),Pe+ce<Vr){l.push(ee,ne);return}if(br!==0){if(Pe>br){l.push(i,r);return}if(ce>br){l.push(n,s);return}}}}else if(ie>zn){if(ie*ie<=h*(Q*Q+Y*Y)){if(Vr<ma){l.push(ee,ne);return}if(Pe=Math.abs(Math.atan2(s-r,n-i)-Math.atan2(r-t,i-e)),Pe>=d&&(Pe=2*d-Pe),Pe<Vr){l.push(i,r),l.push(n,s);return}if(br!==0&&Pe>br){l.push(i,r);return}}}else if(Te>zn){if(Te*Te<=h*(Q*Q+Y*Y)){if(Vr<ma){l.push(ee,ne);return}if(Pe=Math.abs(Math.atan2(o-s,a-n)-Math.atan2(s-r,n-i)),Pe>=d&&(Pe=2*d-Pe),Pe<Vr){l.push(i,r),l.push(n,s);return}if(br!==0&&Pe>br){l.push(n,s);return}}}else if(Q=ee-(e+a)/2,Y=ne-(t+o)/2,Q*Q+Y*Y<=h){l.push(ee,ne);return}}$l(e,t,p,f,C,O,ee,ne,l,h,u+1),$l(ee,ne,R,z,_,T,a,o,l,h,u+1)}var ff,zn,pf,ma,Vr,br,gf=v(()=>{Bl(),ff=8,zn=11920929e-14,pf=1,ma=.01,Vr=0,br=0});function ix(e,t,i,r,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ea.defaultOptions.bezierSmoothness)),h=(vf-l)/1;return h*=h,rx(t,i,r,n,s,a,e,h),e}function rx(e,t,i,r,n,s,a,o){Xl(a,e,t,i,r,n,s,o,0),a.push(n,s)}function Xl(e,t,i,r,n,s,a,o,l){if(l>mf)return;let h=Math.PI,u=(t+r)/2,d=(i+n)/2,p=(r+s)/2,f=(n+a)/2,y=(u+p)/2,b=(d+f)/2,_=s-t,T=a-i,C=Math.abs((r-s)*T-(n-a)*_);if(C>_f){if(C*C<=o*(_*_+T*T)){if(Yl<yf){e.push(y,b);return}let O=Math.abs(Math.atan2(a-n,s-r)-Math.atan2(n-i,r-t));if(O>=h&&(O=2*h-O),O<Yl){e.push(y,b);return}}}else if(_=y-(t+s)/2,T=b-(i+a)/2,_*_+T*T<=o){e.push(y,b);return}Xl(e,t,i,u,d,y,b,o,l+1),Xl(e,y,b,p,f,s,a,o,l+1)}var mf,_f,vf,yf,Yl,nx=v(()=>{Bl(),mf=8,_f=11920929e-14,vf=1,yf=.01,Yl=0});function xf(e,t,i,r,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o=o||Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let d=0;d<o+1;d++){let p=Math.cos(u),f=Math.sin(u),y=t+p*r,b=i+f*r;e.push(y,b),u+=h}}var bf=v(()=>{"use strict"});function sx(e,t,i,r,n,s){let a=e[e.length-2],o=e[e.length-1]-i,l=a-t,h=n-i,u=r-t,d=Math.abs(o*u-l*h);if(d<1e-8||s===0){(e[e.length-2]!==t||e[e.length-1]!==i)&&e.push(t,i);return}let p=o*o+l*l,f=h*h+u*u,y=o*h+l*u,b=s*Math.sqrt(p)/d,_=s*Math.sqrt(f)/d,T=b*y/p,C=_*y/f,O=b*u+_*l,R=b*h+_*o,z=l*(_+T),ee=o*(_+T),ne=u*(b+C),Q=h*(b+C),Y=Math.atan2(ee-R,z-O),ie=Math.atan2(Q-R,ne-O);xf(e,O+t,R+i,s,Y,ie,l*h>u*o)}var ax=v(()=>{bf()});function ox(e,t){let i=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:i,n=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*r,y:s+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}function lx(e,t,i,r,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*fn/360),d=Math.cos(o*fn/360),p=d*(t-r)/2+u*(i-n)/2,f=-u*(t-r)/2+d*(i-n)/2;if(p===0&&f===0)return;s=Math.abs(s),a=Math.abs(a);let y=Math.pow(p,2)/Math.pow(s,2)+Math.pow(f,2)/Math.pow(a,2);y>1&&(s*=Math.sqrt(y),a*=Math.sqrt(y)),wf(t,i,r,n,s,a,l,h,u,d,p,f,_a);let{ang1:b,ang2:_}=_a,{centerX:T,centerY:C}=_a,O=Math.abs(_)/(fn/4);Math.abs(1-O)<1e-7&&(O=1);let R=Math.max(Math.ceil(O),1);_/=R;let z=e[e.length-2],ee=e[e.length-1],ne={x:0,y:0};for(let Q=0;Q<R;Q++){let Y=ox(b,_),{x:ie,y:Te}=va(Y[0],s,a,d,u,T,C,ne),{x:Pe,y:ce}=va(Y[1],s,a,d,u,T,C,ne),{x:U,y:ae}=va(Y[2],s,a,d,u,T,C,ne);df(e,z,ee,ie,Te,Pe,ce,U,ae),z=U,ee=ae,b+=_}}var fn,_a,va,ql,wf,hx=v(()=>{gf(),fn=Math.PI*2,_a={centerX:0,centerY:0,ang1:0,ang2:0},va=({x:e,y:t},i,r,n,s,a,o,l)=>{e*=i,t*=r;let h=n*e-s*t,u=s*e+n*t;return l.x=h+a,l.y=u+o,l},ql=(e,t,i,r)=>{let n=e*r-t*i<0?-1:1,s=e*i+t*r;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},wf=(e,t,i,r,n,s,a,o,l,h,u,d,p)=>{let f=Math.pow(n,2),y=Math.pow(s,2),b=Math.pow(u,2),_=Math.pow(d,2),T=f*y-f*_-y*b;T<0&&(T=0),T/=f*_+y*b,T=Math.sqrt(T)*(a===o?-1:1);let C=T*n/s*d,O=T*-s/n*u,R=h*C-l*O+(e+i)/2,z=l*C+h*O+(t+r)/2,ee=(u-C)/n,ne=(d-O)/s,Q=(-u-C)/n,Y=(-d-O)/s,ie=ql(1,0,ee,ne),Te=ql(ee,ne,Q,Y);o===0&&Te>0&&(Te-=fn),o===1&&Te<0&&(Te+=fn),p.centerX=R,p.centerY=z,p.ang1=ie,p.ang2=Te}});function ux(e,t,i){let r=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),d=l/u,p=h/u;return{len:u,nx:d,ny:p}},n=(a,o)=>{a===0?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)},s=t[t.length-1];for(let a=0;a<t.length;a++){let o=t[a%t.length],l=o.radius??i;if(l<=0){n(a,o),s=o;continue}let h=t[(a+1)%t.length],u=r(o,s),d=r(o,h);if(u.len<1e-4||d.len<1e-4){n(a,o),s=o;continue}let p=Math.asin(u.nx*d.ny-u.ny*d.nx),f=1,y=!1;u.nx*d.nx-u.ny*-d.ny<0?p<0?p=Math.PI+p:(p=Math.PI-p,f=-1,y=!0):p>0&&(f=-1,y=!0);let b=p/2,_,T=Math.abs(Math.cos(b)*l/Math.sin(b));T>Math.min(u.len/2,d.len/2)?(T=Math.min(u.len/2,d.len/2),_=Math.abs(T*Math.sin(b)/Math.cos(b))):_=l;let C=o.x+d.nx*T+-d.ny*_*f,O=o.y+d.ny*T+d.nx*_*f,R=Math.atan2(u.ny,u.nx)+Math.PI/2*f,z=Math.atan2(d.ny,d.nx)-Math.PI/2*f;a===0&&e.moveTo(C+Math.cos(R)*_,O+Math.sin(R)*_),e.arc(C,O,_,R,z,y),s=o}}function cx(e,t,i,r){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=t.length;for(let o=0;o<a;o++){let l=t[(o+1)%a],h=l.radius??i;if(h<=0){o===0?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y);continue}let u=t[o],d=t[(o+2)%a],p=n(u,l),f;if(p<1e-4)f=l;else{let _=Math.min(p/2,h);f=s(l,u,_/p)}let y=n(d,l),b;if(y<1e-4)b=l;else{let _=Math.min(y/2,h);b=s(l,d,_/y)}o===0?e.moveTo(f.x,f.y):e.lineTo(f.x,f.y),e.quadraticCurveTo(l.x,l.y,b.x,b.y,r)}}var dx=v(()=>{"use strict"}),Tf,Sf,fx=v(()=>{hf(),Ky(),Qy(),E(),ex(),m(),gf(),nx(),bf(),ax(),hx(),dx(),Tf=new ot,Sf=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new g,this._graphicsPath2D=e}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==e||n!==t)&&i.push(e,t),this}arc(e,t,i,r,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return xf(a,e,t,i,r,n,s),this}arcTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly.points;return sx(s,e,t,i,r,n),this}arcToSvg(e,t,i,r,n,s,a){let o=this._currentPoly.points;return lx(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,e,t,i,r,n),this}bezierCurveTo(e,t,i,r,n,s,a){this._ensurePoly();let o=this._currentPoly;return df(this._currentPoly.points,o.lastX,o.lastY,e,t,i,r,n,s,a),this}quadraticCurveTo(e,t,i,r,n){this._ensurePoly();let s=this._currentPoly;return ix(this._currentPoly.points,s.lastX,s.lastY,e,t,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));for(let i=0;i<e.instructions.length;i++){let r=e.instructions[i];this[r.action](...r.data)}return this}finish(e=!1){this.endPoly(e)}rect(e,t,i,r,n){return this.drawShape(new ot(e,t,i,r),n),this}circle(e,t,i,r){return this.drawShape(new jl(e,t,i),r),this}poly(e,t,i){let r=new ga(e);return r.closePath=t,this.drawShape(r,i),this}regularPoly(e,t,i,r,n=0,s){r=Math.max(r|0,3);let a=-1*Math.PI/2+n,o=Math.PI*2/r,l=[];for(let h=0;h<r;h++){let u=h*o+a;l.push(e+i*Math.cos(u),t+i*Math.sin(u))}return this.poly(l,!0,s),this}roundPoly(e,t,i,r,n,s=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(e,t,i,r,s);let o=i*Math.sin(Math.PI/r)-.001;n=Math.min(n,o);let l=-1*Math.PI/2+s,h=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let d=0;d<r;d++){let p=d*h+l,f=e+i*Math.cos(p),y=t+i*Math.sin(p),b=p+Math.PI+u,_=p-Math.PI-u,T=f+n*Math.cos(b),C=y+n*Math.sin(b),O=f+n*Math.cos(_),R=y+n*Math.sin(_);d===0?this.moveTo(T,C):this.lineTo(T,C),this.quadraticCurveTo(f,y,O,R,a)}return this.closePath()}roundShape(e,t,i=!1,r){return e.length<3?this:(i?cx(this,e,t,r):ux(this,e,t),this.closePath())}filletRect(e,t,i,r,n){if(n===0)return this.rect(e,t,i,r);let s=Math.min(i,r)/2,a=Math.min(s,Math.max(-s,n)),o=e+i,l=t+r,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(e,t+u).arcTo(e+h,t+h,e+u,t,u).lineTo(o-u,t).arcTo(o-h,t+h,o,t+u,u).lineTo(o,l-u).arcTo(o-h,l-h,e+i-u,l,u).lineTo(e+u,l).arcTo(e+h,l-h,e,l-u,u).closePath()}chamferRect(e,t,i,r,n,s){if(n<=0)return this.rect(e,t,i,r);let a=Math.min(n,Math.min(i,r)/2),o=e+i,l=t+r,h=[e+a,t,o-a,t,o,t+a,o,l-a,o-a,l,e+a,l,e,l-a,e,t+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(e,t,i,r,n){return this.drawShape(new uf(e,t,i,r),n),this}roundRect(e,t,i,r,n,s){return this.drawShape(new cf(e,t,i,r,n),s),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new ga,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new ga,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,r=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let n=t.transform,s=i;i=n.a*i+n.c*r+n.tx,r=n.b*s+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t<e.instructions.length;t++){let i=e.instructions[t];this[i.action](...i.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let i=0;i<t.length;i++){let r=t[i],n=r.shape.getBounds(Tf);r.transform?e.addRect(n,r.transform):e.addRect(n)}return e}}});function Wn(e,t){return e?e.prepend(t):t.clone()}var Vn,Ef=v(()=>{At(),bt(),I(),qy(),fx(),Vn=class ov{constructor(t){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,typeof t=="string"?Yy(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Sf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,i){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,i]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,i,r,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(De.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,d=o.y;l=u+(u-l),h=d+(d-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,i,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,i,r){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(De.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,i,r]}),this._dirty=!0,this}rect(t,i,r,n,s){return this.instructions.push({action:"rect",data:[t,i,r,n,s]}),this._dirty=!0,this}circle(t,i,r,n){return this.instructions.push({action:"circle",data:[t,i,r,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,i,r,n,s,a,o){s=s||n/2;let l=-1*Math.PI/2+a,h=r*2,u=Math.PI*2/h,d=[];for(let p=0;p<h;p++){let f=p%2?s:n,y=p*u+l;d.push(t+f*Math.cos(y),i+f*Math.sin(y))}return this.poly(d,!0,o),this}clone(t=!1){let i=new ov;if(!t)i.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let n=this.instructions[r];i.instructions.push({action:n.action,data:n.data.slice()})}return i}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let i=t.a,r=t.b,n=t.c,s=t.d,a=t.tx,o=t.ty,l=0,h=0,u=0,d=0,p=0,f=0,y=0,b=0;for(let _=0;_<this.instructions.length;_++){let T=this.instructions[_],C=T.data;switch(T.action){case"moveTo":case"lineTo":l=C[0],h=C[1],C[0]=i*l+n*h+a,C[1]=r*l+s*h+o;break;case"bezierCurveTo":u=C[0],d=C[1],p=C[2],f=C[3],l=C[4],h=C[5],C[0]=i*u+n*d+a,C[1]=r*u+s*d+o,C[2]=i*p+n*f+a,C[3]=r*p+s*f+o,C[4]=i*l+n*h+a,C[5]=r*l+s*h+o;break;case"quadraticCurveTo":u=C[0],d=C[1],l=C[2],h=C[3],C[0]=i*u+n*d+a,C[1]=r*u+s*d+o,C[2]=i*l+n*h+a,C[3]=r*l+s*h+o;break;case"arcToSvg":l=C[5],h=C[6],y=C[0],b=C[1],C[0]=i*y+n*b,C[1]=r*y+s*b,C[5]=i*l+n*h+a,C[6]=r*l+s*h+o;break;case"circle":C[4]=Wn(C[3],t);break;case"rect":C[4]=Wn(C[4],t);break;case"ellipse":C[8]=Wn(C[8],t);break;case"roundRect":C[5]=Wn(C[5],t);break;case"addPath":C[0].transform(t);break;case"poly":C[2]=Wn(C[2],t);break;default:F("unknown transform action",T.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let i=this.instructions.length-1,r=this.instructions[i];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(i--,i<0)return t.x=0,t.y=0,t;r=this.instructions[i]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function px(e,t){if(typeof e=="string"){let r=document.createElement("div");r.innerHTML=e.trim(),e=r.querySelector("svg")}let i={context:t,path:new Vn};return Af(e,i,null,null),t}function Af(e,t,i,r){let n=e.children,{fillStyle:s,strokeStyle:a}=gx(e);s&&i?i={...i,...s}:s&&(i=s),a&&r?r={...r,...a}:a&&(r=a),t.context.fillStyle=i,t.context.strokeStyle=r;let o,l,h,u,d,p,f,y,b,_,T,C,O,R,z,ee,ne;switch(e.nodeName.toLowerCase()){case"path":R=e.getAttribute("d"),z=new Vn(R),t.context.path(z),i&&t.context.fill(),r&&t.context.stroke();break;case"circle":f=Vt(e,"cx",0),y=Vt(e,"cy",0),b=Vt(e,"r",0),t.context.ellipse(f,y,b,b),i&&t.context.fill(),r&&t.context.stroke();break;case"rect":o=Vt(e,"x",0),l=Vt(e,"y",0),ee=Vt(e,"width",0),ne=Vt(e,"height",0),_=Vt(e,"rx",0),T=Vt(e,"ry",0),_||T?t.context.roundRect(o,l,ee,ne,_||T):t.context.rect(o,l,ee,ne),i&&t.context.fill(),r&&t.context.stroke();break;case"ellipse":f=Vt(e,"cx",0),y=Vt(e,"cy",0),_=Vt(e,"rx",0),T=Vt(e,"ry",0),t.context.beginPath(),t.context.ellipse(f,y,_,T),i&&t.context.fill(),r&&t.context.stroke();break;case"line":h=Vt(e,"x1",0),u=Vt(e,"y1",0),d=Vt(e,"x2",0),p=Vt(e,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,p),r&&t.context.stroke();break;case"polygon":O=e.getAttribute("points"),C=O.match(/\d+/g).map(Q=>parseInt(Q,10)),t.context.poly(C,!0),i&&t.context.fill(),r&&t.context.stroke();break;case"polyline":O=e.getAttribute("points"),C=O.match(/\d+/g).map(Q=>parseInt(Q,10)),t.context.poly(C,!1),r&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${e.nodeName}> elements unsupported`);break}}for(let Q=0;Q<n.length;Q++)Af(n[Q],t,i,r)}function Vt(e,t,i){let r=e.getAttribute(t);return r?Number(r):i}function gx(e){let t=e.getAttribute("style"),i={},r={},n=!1,s=!1;if(t){let a=t.split(";");for(let o=0;o<a.length;o++){let l=a[o],[h,u]=l.split(":");switch(h){case"stroke":u!=="none"&&(i.color=ue.shared.setValue(u).toNumber(),s=!0);break;case"stroke-width":i.width=Number(u);break;case"fill":u!=="none"&&(n=!0,r.color=ue.shared.setValue(u).toNumber());break;case"fill-opacity":r.alpha=Number(u);break;case"stroke-opacity":i.alpha=Number(u);break;case"opacity":r.alpha=Number(u),i.alpha=Number(u);break}}}else{let a=e.getAttribute("stroke");a&&a!=="none"&&(s=!0,i.color=ue.shared.setValue(a).toNumber(),i.width=Vt(e,"stroke-width",1));let o=e.getAttribute("fill");o&&o!=="none"&&(n=!0,r.color=ue.shared.setValue(o).toNumber())}return{strokeStyle:s?i:null,fillStyle:n?r:null}}var mx=v(()=>{Ie(),Ef()});function _x(e){return ue.isColorLike(e)}function Cf(e){return e instanceof Nn}function Mf(e){return e instanceof dn}function vx(e,t,i){let r=ue.shared.setValue(t??0);return e.color=r.toNumber(),e.alpha=r.alpha===1?i.alpha:r.alpha,e.texture=Re.WHITE,{...i,...e}}function Pf(e,t,i){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function Rf(e,t,i){return t.buildLinearGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...i,...e}}function yx(e,t){let i={...t,...e};if(i.texture){if(i.texture!==Re.WHITE){let s=i.matrix?.invert()||new ke;s.translate(i.texture.frame.x,i.texture.frame.y),s.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=s}let n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}let r=ue.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function jr(e,t){if(e==null)return null;let i={},r=e;return _x(e)?vx(i,e,t):Cf(e)?Pf(i,e,t):Mf(e)?Rf(i,e,t):r.fill&&Cf(r.fill)?Pf(r,r.fill,t):r.fill&&Mf(r.fill)?Rf(r,r.fill,t):yx(r,t)}function ya(e,t){let{width:i,alignment:r,miterLimit:n,cap:s,join:a,...o}=t,l=jr(e,o);return l?{width:i,alignment:r,miterLimit:n,cap:s,join:a,...l}:null}var kf=v(()=>{Ie(),We(),pt(),zl(),Vl()}),Bf,Kl,xa,Ti,If=v(()=>{xt(),Ie(),We(),At(),pt(),bt(),wt(),m(),Ef(),mx(),kf(),Bf=new De,Kl=new ke,xa=class Ji extends Je{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Vn,this._transform=new ke,this._fillStyle={...Ji.defaultFillStyle},this._strokeStyle={...Ji.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new g,this._boundsDirty=!0}clone(){let t=new Ji;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=jr(t,Ji.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ya(t,Ji.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=jr(t,Ji.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=jr(t,Ji.defaultStrokeStyle),this}texture(t,i,r,n,s,a){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:n||0,dw:s||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:i?ue.shared.setValue(i).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Vn,this}fill(t,i){let r,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?r=n.data.path:r=this._activePath.clone(),r?(t!=null&&(i!==void 0&&typeof t=="number"&&(Xe(Ve,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:i}),this._fillStyle=jr(t,Ji.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:i}=this._activePath.getLastPoint(De.shared);this._activePath.clear(),this._activePath.moveTo(t,i)}stroke(t){let i,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(this._strokeStyle=ya(t,Ji.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let i=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(i&&(i.action==="stroke"||i.action==="fill"))if(i.data.hole)i.data.hole.addPath(r);else{i.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,i,r,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*t+o.c*i+o.tx,o.b*t+o.d*i+o.ty,r,n,s,a),this}arcTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}arcToSvg(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,i,r,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*i+l.tx,l.b*t+l.d*i+l.ty,l.a*r+l.c*n+l.tx,l.b*r+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,i,r,n){return this._tick++,this._activePath.ellipse(t,i,r,n,this._transform.clone()),this}circle(t,i,r){return this._tick++,this._activePath.circle(t,i,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,i){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*i+r.tx,r.b*t+r.d*i+r.ty),this}moveTo(t,i){this._tick++;let r=this._transform,n=this._activePath.instructions,s=r.a*t+r.c*i+r.tx,a=r.b*t+r.d*i+r.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(t,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*i+a.tx,a.b*t+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}rect(t,i,r,n){return this._tick++,this._activePath.rect(t,i,r,n,this._transform.clone()),this}roundRect(t,i,r,n,s){return this._tick++,this._activePath.roundRect(t,i,r,n,s,this._transform.clone()),this}poly(t,i){return this._tick++,this._activePath.poly(t,i,this._transform.clone()),this}regularPoly(t,i,r,n,s=0,a){return this._tick++,this._activePath.regularPoly(t,i,r,n,s,a),this}roundPoly(t,i,r,n,s,a){return this._tick++,this._activePath.roundPoly(t,i,r,n,s,a),this}roundShape(t,i,r,n){return this._tick++,this._activePath.roundShape(t,i,r,n),this}filletRect(t,i,r,n,s){return this._tick++,this._activePath.filletRect(t,i,r,n,s),this}chamferRect(t,i,r,n,s,a){return this._tick++,this._activePath.chamferRect(t,i,r,n,s,a),this}star(t,i,r,n,s=0,a=0){return this._tick++,this._activePath.star(t,i,r,n,s,a,this._transform.clone()),this}svg(t){return this._tick++,px(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,i=t){return this._transform.scale(t,i),this}setTransform(t,i,r,n,s,a){return t instanceof ke?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,i,r,n,s,a),this)}transform(t,i,r,n,s,a){return t instanceof ke?(this._transform.append(t),this):(Kl.set(t,i,r,n,s,a),this._transform.append(Kl),this)}translate(t,i=t){return this._transform.translate(t,i),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let i=0;i<this.instructions.length;i++){let r=this.instructions[i],n=r.action;if(n==="fill"){let s=r.data;t.addBounds(s.path.bounds)}else if(n==="texture"){let s=r.data;t.addFrame(s.dx,s.dy,s.dx+s.dw,s.dy+s.dh,s.transform)}if(n==="stroke"){let s=r.data,a=s.style.width/2,o=s.path.bounds;t.addFrame(o.minX-a,o.minY-a,o.maxX+a,o.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let i=this.instructions,r=!1;for(let n=0;n<i.length;n++){let s=i[n],a=s.data,o=a.path;if(!s.action||!o)continue;let l=a.style,h=o.shapePath.shapePrimitives;for(let u=0;u<h.length;u++){let d=h[u].shape;if(!l||!d)continue;let p=h[u].transform,f=p?p.applyInverse(t,Bf):t;s.action==="fill"?r=d.contains(f.x,f.y):r=d.strokeContains(f.x,f.y,l.width);let y=a.hole;if(y){let b=y.shapePath?.shapePrimitives;if(b)for(let _=0;_<b.length;_++)b[_].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(i),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(i)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}},xa.defaultFillStyle={color:16777215,alpha:1,texture:Re.WHITE,matrix:null,fill:null},xa.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Re.WHITE,matrix:null,fill:null},Ti=xa});function Gf(e){let t=[],i=0;for(let r=0;r<Zl.length;r++){let n=`_${Zl[r]}`;t[i++]=e[n]}return i=Of(e._fill,t,i),i=xx(e._stroke,t,i),i=bx(e.dropShadow,t,i),t.join("-")}function Of(e,t,i){return e&&(t[i++]=e.color,t[i++]=e.alpha,t[i++]=e.fill?.styleKey),i}function xx(e,t,i){return e&&(i=Of(e,t,i),t[i++]=e.width,t[i++]=e.alignment,t[i++]=e.cap,t[i++]=e.join,t[i++]=e.miterLimit),i}function bx(e,t,i){return e&&(t[i++]=e.alpha,t[i++]=e.angle,t[i++]=e.blur,t[i++]=e.distance,t[i++]=ue.shared.setValue(e.color).toNumber()),i}var Zl,Uf=v(()=>{Ie(),Zl=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function wx(e){let t=e;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let i=Xi.defaultDropShadow;e.dropShadow={alpha:t.dropShadowAlpha??i.alpha,angle:t.dropShadowAngle??i.angle,blur:t.dropShadowBlur??i.blur,color:t.dropShadowColor??i.color,distance:t.dropShadowDistance??i.distance}}if(t.strokeThickness!==void 0){Xe(Ve,"strokeThickness is now a part of stroke");let i=t.stroke,r={};if(ue.isColorLike(i))r.color=i;else if(i instanceof dn||i instanceof Nn)r.fill=i;else if(Object.hasOwnProperty.call(i,"color")||Object.hasOwnProperty.call(i,"fill"))r=i;else throw new Error("Invalid stroke value.");e.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){Xe(Ve,"gradient fill is now a fill pattern: `new FillGradient(...)`");let i;e.fontSize==null?e.fontSize=Xi.defaultTextStyle.fontSize:typeof e.fontSize=="string"?i=parseInt(e.fontSize,10):i=e.fontSize;let r=new dn(0,0,0,i*1.7),n=t.fillGradientStops.map(s=>ue.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);r.addColorStop(o,s)}),e.fill={fill:r}}}var ba,Xi,jn=v(()=>{xt(),Ie(),wt(),zl(),Vl(),If(),kf(),Uf(),ba=class Cn extends Je{constructor(t={}){super(),wx(t);let i={...Cn.defaultTextStyle,...t};for(let r in i){let n=r;this[n]=i[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Cn.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Cn.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ti.defaultFillStyle,...t},()=>{this._fill=jr({...this._originalFill},Ti.defaultFillStyle)})),this._fill=jr(t===0?"black":t,Ti.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ti.defaultStrokeStyle,...t},()=>{this._stroke=ya({...this._originalStroke},Ti.defaultStrokeStyle)})),this._stroke=ya(t,Ti.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Gf(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Cn.defaultTextStyle;for(let i in t)this[i]=t[i]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Cn({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,i){return new Proxy(t,{set:(r,n,s)=>(r[n]=s,i?.(n,s),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(ue.isColorLike(t)||t instanceof dn||t instanceof Nn)}},ba.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},ba.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100},Xi=ba});function Ff(e,t,i,r){let n=Df;n.minX=0,n.minY=0,n.maxX=e.width/r|0,n.maxY=e.height/r|0;let s=gi.getOptimalTexture(n.width,n.height,r,!1);return s.source.uploadMethodId="image",s.source.resource=e,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=t/r,s.frame.height=i/r,s.source.emit("update",s.source),s.updateUvs(),s}var Df,Lf=v(()=>{Ln(),m(),Df=new g});function wa(e){let t=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize,i=e.fontFamily;Array.isArray(e.fontFamily)||(i=e.fontFamily.split(","));for(let r=i.length-1;r>=0;r--){let n=i[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Nf.includes(n)&&(n=`"${n}"`),i[r]=n}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${i.join(",")}`}var Nf,Jl=v(()=>{"use strict";Nf=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Ta,Si,Ri,Sa=v(()=>{Ft(),Jl(),Ta={willReadFrequently:!0},Si=class Ee{static get experimentalLetterSpacingSupported(){let t=Ee._experimentalLetterSpacingSupported;if(t!==void 0){let i=vt.get().getCanvasRenderingContext2D().prototype;t=Ee._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return t}constructor(t,i,r,n,s,a,o,l,h){this.text=t,this.style=i,this.width=r,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",i,r=Ee._canvas,n=i.wordWrap){let s=`${t}:${i.styleKey}`;if(Ee._measurementCache[s])return Ee._measurementCache[s];let a=wa(i),o=Ee.measureFont(a);o.fontSize===0&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);let l=Ee.__context;l.font=a;let h=(n?Ee._wordWrap(t,i,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let _=0;_<h.length;_++){let T=Ee._measureText(h[_],i.letterSpacing,l);u[_]=T,d=Math.max(d,T)}let p=i._stroke?.width||0,f=d+p;i.dropShadow&&(f+=i.dropShadow.distance);let y=i.lineHeight||o.fontSize,b=Math.max(y,o.fontSize+p)+(h.length-1)*(y+i.leading);return i.dropShadow&&(b+=i.dropShadow.distance),new Ee(t,i,f,b,h,u,y+i.leading,d,o)}static _measureText(t,i,r){let n=!1;Ee.experimentalLetterSpacingSupported&&(Ee.experimentalLetterSpacing?(r.letterSpacing=`${i}px`,r.textLetterSpacing=`${i}px`,n=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let s=r.measureText(t).width;return s>0&&(n?s-=i:s+=(Ee.graphemeSegmenter(t).length-1)*i),s}static _wordWrap(t,i,r=Ee._canvas){let n=r.getContext("2d",Ta),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=Ee._collapseSpaces(u),p=Ee._collapseNewlines(u),f=!d,y=i.wordWrapWidth+h,b=Ee._tokenize(t);for(let _=0;_<b.length;_++){let T=b[_];if(Ee._isNewline(T)){if(!p){o+=Ee._addLine(a),f=!d,a="",s=0;continue}T=" "}if(d){let O=Ee.isBreakingSpace(T),R=Ee.isBreakingSpace(a[a.length-1]);if(O&&R)continue}let C=Ee._getFromCache(T,h,l,n);if(C>y)if(a!==""&&(o+=Ee._addLine(a),a="",s=0),Ee.canBreakWords(T,i.breakWords)){let O=Ee.wordWrapSplit(T);for(let R=0;R<O.length;R++){let z=O[R],ee=z,ne=1;for(;O[R+ne];){let Y=O[R+ne];if(!Ee.canBreakChars(ee,Y,T,R,i.breakWords))z+=Y;else break;ee=Y,ne++}R+=ne-1;let Q=Ee._getFromCache(z,h,l,n);Q+s>y&&(o+=Ee._addLine(a),f=!1,a="",s=0),a+=z,s+=Q}}else{a.length>0&&(o+=Ee._addLine(a),a="",s=0);let O=_===b.length-1;o+=Ee._addLine(T,!O),f=!1,a="",s=0}else C+s>y&&(f=!1,o+=Ee._addLine(a),a="",s=0),(a.length>0||!Ee.isBreakingSpace(T)||f)&&(a+=T,s+=C)}return o+=Ee._addLine(a,!1),o}static _addLine(t,i=!0){return t=Ee._trimRight(t),t=i?`${t}
|
|
`:t,t}static _getFromCache(t,i,r,n){let s=r[t];return typeof s!="number"&&(s=Ee._measureText(t,i,n)+i,r[t]=s),s}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let i=t.length-1;i>=0;i--){let r=t[i];if(!Ee.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Ee._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,i){return typeof t!="string"?!1:Ee._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let i=[],r="";if(typeof t!="string")return i;for(let n=0;n<t.length;n++){let s=t[n],a=t[n+1];if(Ee.isBreakingSpace(s,a)||Ee._isNewline(s)){r!==""&&(i.push(r),r=""),i.push(s);continue}r+=s}return r!==""&&i.push(r),i}static canBreakWords(t,i){return i}static canBreakChars(t,i,r,n,s){return!0}static wordWrapSplit(t){return Ee.graphemeSegmenter(t)}static measureFont(t){if(Ee._fonts[t])return Ee._fonts[t];let i=Ee._context;i.font=t;let r=i.measureText(Ee.METRICS_STRING+Ee.BASELINE_SYMBOL),n={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return Ee._fonts[t]=n,n}static clearMetrics(t=""){t?delete Ee._fonts[t]:Ee._fonts={}}static get _canvas(){if(!Ee.__canvas){let t;try{let i=new OffscreenCanvas(0,0);if(i.getContext("2d",Ta)?.measureText)return Ee.__canvas=i,i;t=vt.get().createCanvas()}catch{t=vt.get().createCanvas()}t.width=t.height=10,Ee.__canvas=t}return Ee.__canvas}static get _context(){return Ee.__context||(Ee.__context=Ee._canvas.getContext("2d",Ta)),Ee.__context}},Si.METRICS_STRING="|\xC9q\xC5",Si.BASELINE_SYMBOL="M",Si.BASELINE_MULTIPLIER=1.4,Si.HEIGHT_MULTIPLIER=2,Si.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let e=new Intl.Segmenter;return t=>[...e.segment(t)].map(i=>i.segment)}return e=>[...e]})(),Si.experimentalLetterSpacing=!1,Si._fonts={},Si._newlines=[10,13],Si._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Si._measurementCache={},Ri=Si});function Ea(e,t){if(e.texture===Re.WHITE&&!e.fill)return ue.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof Nn){let i=e.fill,r=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(ke.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),r.setTransform(n),r}else if(e.fill instanceof dn){let i=e.fill;if(i.type==="linear"){let r=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{r.addColorStop(n.offset,ue.shared.setValue(n.color).toHex())}),r}}}else{let i=t.createPattern(e.texture.source.resource,"repeat"),r=e.matrix.copyTo(ke.shared);return r.scale(e.texture.frame.width,e.texture.frame.height),i.setTransform(r),i}return F("FillStyle not recognised",e),"red"}var Hf=v(()=>{Ie(),We(),pt(),I(),zl(),Vl()}),Ql,Tx=v(()=>{Ie(),te(),Ls(),pa(),Ln(),$y(),wt(),jn(),Lf(),Sa(),Jl(),Hf(),Ql=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let r=Ri.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,r.width)+i.padding*2)*t),s=Math.ceil(Math.ceil(Math.max(1,r.height)+i.padding*2)*t);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=on(n),s=on(s),{width:n,height:s}}getTexture(e,t,i,r){typeof e=="string"&&(Xe("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Xi||(e.style=new Xi(e.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(n._source),$i.returnCanvasAndContext(s),n}createTextureAndCanvas(e){let{text:t,style:i}=e,r=e.resolution??this._renderer.resolution,n=Ri.measureText(t||" ",i),s=Math.ceil(Math.ceil(Math.max(1,n.width)+i.padding*2)*r),a=Math.ceil(Math.ceil(Math.max(1,n.height)+i.padding*2)*r),o=$i.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(t,i,r,o);let h=Ff(l,s,a,r);if(i.trim){let u=jy(l,r);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:r}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:r,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];if(t.usageCount--,t.usageCount===0){$i.returnCanvasAndContext(t.canvasAndContext),gi.returnTexture(t.texture);let i=t.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[e]=null}}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,r){let{canvas:n,context:s}=r,a=wa(t),o=Ri.measureText(e||" ",t),l=o.lines,h=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,p=o.fontProperties,f=n.height;s.resetTransform(),s.scale(i,i);let y=t.padding*2;if(s.clearRect(0,0,o.width+4+y,o.height+4+y),t._stroke?.width){let C=t._stroke;s.lineWidth=C.width,s.miterLimit=C.miterLimit,s.lineJoin=C.join,s.lineCap=C.cap}s.font=a;let b,_,T=t.dropShadow?2:1;for(let C=0;C<T;++C){let O=t.dropShadow&&C===0,R=O?Math.ceil(Math.max(1,f)+t.padding*2):0,z=R*i;if(O){s.fillStyle="black",s.strokeStyle="black";let Q=t.dropShadow,Y=Q.color,ie=Q.alpha;s.shadowColor=ue.shared.setValue(Y).setAlpha(ie).toRgbaString();let Te=Q.blur*i,Pe=Q.distance*i;s.shadowBlur=Te,s.shadowOffsetX=Math.cos(Q.angle)*Pe,s.shadowOffsetY=Math.sin(Q.angle)*Pe+z}else s.globalAlpha=t._fill?.alpha??1,s.fillStyle=t._fill?Ea(t._fill,s):null,t._stroke?.width&&(s.strokeStyle=Ea(t._stroke,s)),s.shadowColor="black";let ee=(h-p.fontSize)/2;h-p.fontSize<0&&(ee=0);let ne=t._stroke?.width??0;for(let Q=0;Q<l.length;Q++)b=ne/2,_=ne/2+Q*h+p.ascent+ee,t.align==="right"?b+=d-u[Q]:t.align==="center"&&(b+=(d-u[Q])/2),t._stroke?.width&&this._drawLetterSpacing(l[Q],t,r,b+t.padding,_+t.padding-R,!0),t._fill!==void 0&&this._drawLetterSpacing(l[Q],t,r,b+t.padding,_+t.padding-R)}}_drawLetterSpacing(e,t,i,r,n,s=!1){let{context:a}=i,o=t.letterSpacing,l=!1;if(Ri.experimentalLetterSpacingSupported&&(Ri.experimentalLetterSpacing?(a.letterSpacing=`${o}px`,a.textLetterSpacing=`${o}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),o===0||l){s?a.strokeText(e,r,n):a.fillText(e,r,n);return}let h=r,u=Ri.graphemeSegmenter(e),d=a.measureText(e).width,p=0;for(let f=0;f<u.length;++f){let y=u[f];s?a.strokeText(y,h,n):a.fillText(y,h,n);let b="";for(let _=f+1;_<u.length;++_)b+=u[_];p=a.measureText(b).width,h+=d-p+o,d=p}}destroy(){this._activeTextures=null}},Ql.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"canvasText"}}),zf=v(()=>{te(),Vy(),Tx(),pe.add(Ql),pe.add(Nl)}),Aa,Wf=v(()=>{wt(),gl(),If(),Aa=class Ec extends zs{constructor(t){t instanceof Ti&&(t={context:t});let{context:i,roundPixels:r,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new Ti,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,i){return this.context[t](...i),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Ec(this._context.clone()):(this._ownedContext=null,new Ec(this._context))}lineStyle(t,i,r){Xe(Ve,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return t&&(n.width=t),i&&(n.color=i),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(t,i){Xe(Ve,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t&&(r.color=t),i&&(r.alpha=i),this.context.fillStyle=r,this}endFill(){Xe(Ve,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ti.defaultStrokeStyle.width||t.color!==Ti.defaultStrokeStyle.color||t.alpha!==Ti.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return Xe(Ve,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return Xe(Ve,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return Xe(Ve,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return Xe(Ve,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return Xe(Ve,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return Xe(Ve,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});function Sx(){if(!Ca){Ca="mediump";let e=bd();e&&e.getShaderPrecisionFormat&&(Ca=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision?"highp":"mediump")}return Ca}var Ca,Ex=v(()=>{wd()});function Ax(e,t,i){return t?e:i?(e=e.replace("out vec4 finalColor;",""),`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in varying
|
|
#define finalColor gl_FragColor
|
|
#define texture texture2D
|
|
#endif
|
|
${e}
|
|
`):`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in attribute
|
|
#define out varying
|
|
#endif
|
|
${e}
|
|
`}var Cx=v(()=>{"use strict"});function Mx(e,t,i){let r=i?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(e.substring(0,9)!=="precision"){let n=i?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&r!=="highp"&&(n="mediump"),`precision ${n} float;
|
|
${e}`}else if(r!=="highp"&&e.substring(0,15)==="precision highp")return e.replace("precision highp","precision mediump");return e}var Px=v(()=>{"use strict"});function Rx(e,t){return t?`#version 300 es
|
|
${e}`:e}var kx=v(()=>{"use strict"});function Bx(e,{name:t="pixi-program"},i=!0){t=t.replace(/\s+/g,"-"),t+=i?"-fragment":"-vertex";let r=i?Vf:jf;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,e.indexOf("#define SHADER_NAME")!==-1?e:`${`#define SHADER_NAME ${t}`}
|
|
${e}`}var Vf,jf,Ix=v(()=>{"use strict";Vf={},jf={}});function Gx(e,t){return t?e.replace("#version 300 es",""):e}var Ox=v(()=>{"use strict"}),Ma,Pa,eh,pn,$n=v(()=>{ca(),Ex(),Cx(),Px(),kx(),Ix(),Ox(),Ma={stripVersion:Gx,ensurePrecision:Mx,addProgramDefines:Ax,setProgramName:Bx,insertVersion:Rx},Pa=Object.create(null),eh=class Ac{constructor(t){t={...Ac.defaultOptions,...t};let i=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Sx()},setProgramName:{name:t.name},addProgramDefines:i,insertVersion:i},n=t.fragment,s=t.vertex;Object.keys(Ma).forEach(a=>{let o=r[a];n=Ma[a](n,o,!0),s=Ma[a](s,o,!1)}),this.fragment=n,this.vertex=s,this._key=Dn(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){let i=`${t.vertex}:${t.fragment}`;return Pa[i]||(Pa[i]=new Ac(t)),Pa[i]}},eh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},pn=eh});function Xn(e){return th[e]??th.float32}var th,Ra=v(()=>{"use strict";th={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Ux({source:e,entryPoint:t}){let i={},r=e.indexOf(`fn ${t}`);if(r!==-1){let n=e.indexOf("->",r);if(n!==-1){let s=e.substring(r,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=$f[o[3]]??"float32";i[o[2]]={location:parseInt(o[1],10),format:l,stride:Xn(l).stride,offset:0,instance:!1,start:0}}}}return i}var $f,Fx=v(()=>{Ra(),$f={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function ih(e){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,i=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=e.match(t)?.map(d=>({group:parseInt(d.match(i)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(n)[2],isUniform:d.match(n)[1]==="<uniform>",type:d.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=e.match(a)?.map(d=>{let p=d.match(l)[1],f=d.match(o).reduce((y,b)=>{let[_,T]=b.split(":");return y[_.trim()]=T.trim(),y},{});return f?{name:p,members:f}:null}).filter(({name:d})=>h.some(p=>p.type===d))??[];return{groups:h,structs:u}}var Dx=v(()=>{"use strict"}),gn,Lx=v(()=>{"use strict";gn=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(gn||{})});function Nx({groups:e}){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:gn.VERTEX|gn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:gn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:gn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Hx=v(()=>{Lx()});function zx({groups:e}){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var Wx=v(()=>{"use strict"});function Vx(e,t){let i=new Set,r=new Set,n=[...e.structs,...t.structs].filter(a=>i.has(a.name)?!1:(i.add(a.name),!0)),s=[...e.groups,...t.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:s}}var jx=v(()=>{"use strict"}),ka,Yn,Ba=v(()=>{ca(),Fx(),Dx(),Hx(),Wx(),jx(),ka=Object.create(null),Yn=class lv{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:i,vertex:r,layout:n,gpuLayout:s,name:a}=t;if(this.name=a,this.fragment=i,this.vertex=r,i.source===r.source){let o=ih(i.source);this.structsAndGroups=o}else{let o=ih(r.source),l=ih(i.source);this.structsAndGroups=Vx(o,l)}this.layout=n??zx(this.structsAndGroups),this.gpuLayout=s??Nx(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:i}=this,r=t.source+i.source+t.entryPoint+i.entryPoint;this._layoutKey=Dn(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ux(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let i=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return ka[i]||(ka[i]=new lv(t)),ka[i]}}});function Xf(e,t,i){if(e)for(let r in e){let n=r.toLocaleLowerCase(),s=t[n];if(s){let a=e[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&s.push(`//----${i}----//`),s.push(a)}else F(`${r} placement hook does not exist in shader`)}}var $x=v(()=>{I()});function Yf(e){let t={};return(e.match(qf)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var qf,Xx=v(()=>{"use strict";qf=/\{\{(.*?)\}\}/g});function Kf(e,t){let i,r=/@in\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function Zf(e,t,i=!1){let r=[];Kf(t,r),e.forEach(o=>{o.header&&Kf(o.header,r)});let n=r;i&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
|
|
`),a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
|
|
${s}
|
|
`),a}var Yx=v(()=>{"use strict"});function Jf(e,t){let i,r=/@out\s+([^;]+);/g;for(;(i=r.exec(e))!==null;)t.push(i[1])}function qx(e){let t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:""}function Kx(e){let t=/@.*?\s+/g;return e.replace(t,"")}function Zx(e,t){let i=[];Jf(t,i),e.forEach(l=>{l.header&&Jf(l.header,i)});let r=0,n=i.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
`),s=i.sort().map(l=>` var ${Kx(l)};`).join(`
|
|
`),a=`return VSOutput(
|
|
${i.sort().map(l=>` ${qx(l)}`).join(`,
|
|
`)});`,o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
${n}
|
|
`),o=o.replace("{{start}}",`
|
|
${s}
|
|
`),o=o.replace("{{return}}",`
|
|
${a}
|
|
`),o}var Jx=v(()=>{"use strict"});function Qf(e,t){let i=e;for(let r in t){let n=t[r];n.join(`
|
|
`).length?i=i.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
${n.join(`
|
|
`)}
|
|
//----${r} FINISH----//`):i=i.replace(`{{${r}}}`,"")}return i}var Qx=v(()=>{"use strict"});function e0({template:e,bits:t}){let i=ep(e,t);if(wr[i])return wr[i];let{vertex:r,fragment:n}=i0(e,t);return wr[i]=tp(r,n,t),wr[i]}function t0({template:e,bits:t}){let i=ep(e,t);return wr[i]||(wr[i]=tp(e.vertex,e.fragment,t)),wr[i]}function i0(e,t){let i=t.map(a=>a.vertex).filter(a=>!!a),r=t.map(a=>a.fragment).filter(a=>!!a),n=Zf(i,e.vertex,!0);n=Zx(i,n);let s=Zf(r,e.fragment,!0);return{vertex:n,fragment:s}}function ep(e,t){return t.map(i=>(Ia.has(i)||Ia.set(i,ip++),Ia.get(i))).sort((i,r)=>i-r).join("-")+e.vertex+e.fragment}function tp(e,t,i){let r=Yf(e),n=Yf(t);return i.forEach(s=>{Xf(s.vertex,r,s.name),Xf(s.fragment,n,s.name)}),{vertex:Qf(e,r),fragment:Qf(t,n)}}var wr,Ia,ip,r0=v(()=>{$x(),Xx(),Yx(),Jx(),Qx(),wr=Object.create(null),Ia=new Map,ip=0}),rp,np,sp,ap,n0=v(()=>{"use strict";rp=`
|
|
@in aPosition: vec2<f32>;
|
|
@in aUV: vec2<f32>;
|
|
|
|
@out @builtin(position) vPosition: vec4<f32>;
|
|
@out vUV : vec2<f32>;
|
|
@out vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
struct VSOutput {
|
|
{{struct}}
|
|
};
|
|
|
|
@vertex
|
|
fn main( {{in}} ) -> VSOutput {
|
|
|
|
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
var modelMatrix = mat3x3<f32>(
|
|
1.0, 0.0, 0.0,
|
|
0.0, 1.0, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
var position = aPosition;
|
|
var uv = aUV;
|
|
|
|
{{start}}
|
|
|
|
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
|
|
{{main}}
|
|
|
|
vUV = uv;
|
|
|
|
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
|
|
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vColor *= globalUniforms.uWorldColorAlpha;
|
|
|
|
{{end}}
|
|
|
|
{{return}}
|
|
};
|
|
`,np=`
|
|
@in vUV : vec2<f32>;
|
|
@in vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
@fragment
|
|
fn main(
|
|
{{in}}
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
{{start}}
|
|
|
|
var outColor:vec4<f32>;
|
|
|
|
{{main}}
|
|
|
|
return outColor * vColor;
|
|
};
|
|
`,sp=`
|
|
in vec2 aPosition;
|
|
in vec2 aUV;
|
|
|
|
out vec4 vColor;
|
|
out vec2 vUV;
|
|
|
|
{{header}}
|
|
|
|
void main(void){
|
|
|
|
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
mat3 modelMatrix = mat3(
|
|
1.0, 0.0, 0.0,
|
|
0.0, 1.0, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
vec2 position = aPosition;
|
|
vec2 uv = aUV;
|
|
|
|
{{start}}
|
|
|
|
vColor = vec4(1.);
|
|
|
|
{{main}}
|
|
|
|
vUV = uv;
|
|
|
|
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
|
|
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vColor *= uWorldColorAlpha;
|
|
|
|
{{end}}
|
|
}
|
|
`,ap=`
|
|
|
|
in vec4 vColor;
|
|
in vec2 vUV;
|
|
|
|
out vec4 finalColor;
|
|
|
|
{{header}}
|
|
|
|
void main(void) {
|
|
|
|
{{start}}
|
|
|
|
vec4 outColor;
|
|
|
|
{{main}}
|
|
|
|
finalColor = outColor * vColor;
|
|
}
|
|
`}),op,lp,s0=v(()=>{"use strict";op={name:"global-uniforms-bit",vertex:{header:`
|
|
struct GlobalUniforms {
|
|
uProjectionMatrix:mat3x3<f32>,
|
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
uWorldColorAlpha: vec4<f32>,
|
|
uResolution: vec2<f32>,
|
|
}
|
|
|
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
`}},lp={name:"global-uniforms-bit",vertex:{header:`
|
|
uniform mat3 uProjectionMatrix;
|
|
uniform mat3 uWorldTransformMatrix;
|
|
uniform vec4 uWorldColorAlpha;
|
|
uniform vec2 uResolution;
|
|
`}}});function qn({bits:e,name:t}){let i=e0({template:{fragment:np,vertex:rp},bits:[op,...e]});return Yn.from({name:t,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function Kn({bits:e,name:t}){return new pn({name:t,...t0({template:{vertex:sp,fragment:ap},bits:[lp,...e]})})}var Tr=v(()=>{$n(),Ba(),r0(),n0(),s0()}),Ga,Oa,Zn=v(()=>{"use strict";Ga={name:"color-bit",vertex:{header:`
|
|
@in aColor: vec4<f32>;
|
|
`,main:`
|
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
`}},Oa={name:"color-bit",vertex:{header:`
|
|
in vec4 aColor;
|
|
`,main:`
|
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
`}}});function a0(e){let t=[];if(e===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let r=0;r<e;r++)t.push(`@group(1) @binding(${i++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${i++}) var textureSampler${r+1}: sampler;`)}return t.join(`
|
|
`)}function o0(e){let t=[];if(e===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let i=0;i<e;i++)i===e-1?t.push(" default:{"):t.push(` case ${i}:{`),t.push(` outColor = textureSampleGrad(textureSource${i+1}, textureSampler${i+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
`)}function rh(e){return Ua[e]||(Ua[e]={name:"texture-batch-bit",vertex:{header:`
|
|
@in aTextureIdAndRound: vec2<u32>;
|
|
@out @interpolate(flat) vTextureId : u32;
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1)
|
|
{
|
|
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`},fragment:{header:`
|
|
@in @interpolate(flat) vTextureId: u32;
|
|
|
|
${a0(e)}
|
|
`,main:`
|
|
var uvDx = dpdx(vUV);
|
|
var uvDy = dpdy(vUV);
|
|
|
|
${o0(e)}
|
|
`}}),Ua[e]}function l0(e){let t=[];for(let i=0;i<e;i++)i>0&&t.push("else"),i<e-1&&t.push(`if(vTextureId < ${i}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${i}], vUV);`),t.push("}");return t.join(`
|
|
`)}function nh(e){return Fa[e]||(Fa[e]={name:"texture-batch-bit",vertex:{header:`
|
|
in vec2 aTextureIdAndRound;
|
|
out float vTextureId;
|
|
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`},fragment:{header:`
|
|
in float vTextureId;
|
|
|
|
uniform sampler2D uTextures[${e}];
|
|
|
|
`,main:`
|
|
|
|
${l0(e)}
|
|
`}}),Fa[e]}var Ua,Fa,Jn=v(()=>{"use strict";Ua={},Fa={}}),mn,_n,Sr=v(()=>{"use strict";mn={name:"round-pixels-bit",vertex:{header:`
|
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
`}},_n={name:"round-pixels-bit",vertex:{header:`
|
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
`}}});function sh(e){let t=ah[e];if(t)return t;let i=new Int32Array(e);for(let r=0;r<e;r++)i[r]=r;return t=ah[e]=new ti({uTextures:{value:i,type:"i32",size:e}},{isStatic:!0}),t}var ah,oh=v(()=>{pi(),ah={}}),Ei,sr=v(()=>{"use strict";Ei=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.BOTH=3]="BOTH",e))(Ei||{})}),ki,Yi=v(()=>{xt(),$n(),Nr(),Ba(),sr(),pi(),ki=class hv extends Je{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:i,glProgram:r,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=i,this.glProgram=r,a===void 0&&(a=0,i&&(a|=Ei.WEBGPU),r&&(a|=Ei.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!i&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!i&&n&&o)for(let h in o)for(let u in o[h]){let d=o[h][u];l[d]={group:h,binding:u,name:d}}else if(i&&n&&!o){let h=i.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},i&&i.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new Vi,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let d=u,p=s[u];!p.source&&!p._resourceType&&(p=new ti(p));let f=l[d];f&&(n[f.group]||(n[f.group]=new Vi,this._ownedBindGroups.push(n[f.group])),n[f.group].setResource(p,f.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(t,i,r){var n,s;(n=this._uniformBindMap)[i]||(n[i]={}),(s=this._uniformBindMap[i])[r]||(s[r]=t),this.groups[i]||(this.groups[i]=new Vi,this._ownedBindGroups.push(this.groups[i]))}_buildResourceAccessor(t,i){let r={};for(let n in i){let s=i[n];Object.defineProperty(r,s.name,{get(){return t[s.group].getResource(s.binding)},set(a){t[s.group].setResource(a,s.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:i,gl:r,...n}=t,s,a;return i&&(s=Yn.from(i)),r&&(a=pn.from(r)),new hv({gpuProgram:s,glProgram:a,...n})}}}),hp,up,h0=v(()=>{"use strict";hp={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
struct LocalUniforms {
|
|
uColor:vec4<f32>,
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uDistance: f32,
|
|
uRound:f32,
|
|
}
|
|
|
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
vColor *= localUniforms.uColor;
|
|
modelMatrix *= localUniforms.uTransformMatrix;
|
|
`,end:`
|
|
if(localUniforms.uRound == 1)
|
|
{
|
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`},fragment:{header:`
|
|
struct LocalUniforms {
|
|
uColor:vec4<f32>,
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uDistance: f32
|
|
}
|
|
|
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
`}},up={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
uniform mat3 uTransformMatrix;
|
|
uniform vec4 uColor;
|
|
uniform float uRound;
|
|
`,main:`
|
|
vColor *= uColor;
|
|
modelMatrix *= uTransformMatrix;
|
|
`,end:`
|
|
if(uRound == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`},fragment:{header:`
|
|
uniform float uDistance;
|
|
`,main:`
|
|
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
`}}}),cp,dp,u0=v(()=>{"use strict";cp={name:"msdf-bit",fragment:{header:`
|
|
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
|
|
// MSDF
|
|
var median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
|
|
// SDF
|
|
median = min(median, msdfColor.a);
|
|
|
|
var screenPxDistance = distance * (median - 0.5);
|
|
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
if (median < 0.01) {
|
|
alpha = 0.0;
|
|
} else if (median > 0.99) {
|
|
alpha = 1.0;
|
|
}
|
|
|
|
// Gamma correction for coverage-like alpha
|
|
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
|
|
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
|
|
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
|
|
|
|
return coverage;
|
|
|
|
}
|
|
`}},dp={name:"msdf-bit",fragment:{header:`
|
|
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
|
|
// MSDF
|
|
float median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
|
|
// SDF
|
|
median = min(median, msdfColor.a);
|
|
|
|
float screenPxDistance = distance * (median - 0.5);
|
|
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
|
|
if (median < 0.01) {
|
|
alpha = 0.0;
|
|
} else if (median > 0.99) {
|
|
alpha = 1.0;
|
|
}
|
|
|
|
// Gamma correction for coverage-like alpha
|
|
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
float gamma = mix(1.0, 1.0 / 2.2, luma);
|
|
float coverage = pow(shapeColor.a * alpha, gamma);
|
|
|
|
return coverage;
|
|
}
|
|
`}}}),lh,hh,fp,c0=v(()=>{We(),xr(),Tr(),Zn(),Jn(),Sr(),oh(),Yi(),pi(),h0(),u0(),fp=class extends ki{constructor(){let e=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=yr();lh??(lh=qn({name:"sdf-shader",bits:[Ga,rh(t),hp,cp,mn]})),hh??(hh=Kn({name:"sdf-shader",bits:[Oa,nh(t),up,dp,_n]})),super({glProgram:hh,gpuProgram:lh,resources:{localUniforms:e,batchSamplers:sh(t)}})}}}),pp,d0=v(()=>{xt(),wt(),pp=class extends Je{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return Xe(Ve,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Xe(Ve,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Xe(Ve,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Xe(Ve,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function gp(e){if(e==="")return[];typeof e=="string"&&(e=[e]);let t=[];for(let i=0,r=e.length;i<r;i++){let n=e[i];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);if(n[0].length===0||n[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(let o=s,l=a;o<=l;o++)t.push(String.fromCharCode(o))}else t.push(...Array.from(n))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var mp=v(()=>{"use strict"}),uh,ch,f0=v(()=>{Ie(),E(),pa(),yl(),pt(),wt(),Sa(),Jl(),Hf(),jn(),d0(),mp(),uh=class uv extends pp{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let i={...uv.defaultOptions,...t};this._textureSize=i.textureSize,this._mipmap=i.mipmap;let r=i.style.clone();i.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=Re.WHITE,r._fill.fill=null),this.applyFillAsTint=i.overrideFill;let n=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let s=wa(r);i.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/n):r.fontSize=this.baseRenderedFontSize=n,this._style=r,this._skipKerning=i.skipKerning??!1,this.resolution=i.resolution??1,this._padding=i.padding??4,this.fontMetrics=Ri.measureFont(s),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let i=gp(t).filter(b=>!this._currentChars.includes(b)).filter((b,_,T)=>T.indexOf(b)===_);if(!i.length)return;this._currentChars=[...this._currentChars,...i];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:n,context:s}=r.canvasAndContext,a=r.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,d=this._padding*u,p=o.fontStyle==="italic"?2:1,f=0,y=!1;for(let b=0;b<i.length;b++){let _=i[b],T=Ri.measureText(_,o,n,!1);T.lineHeight=T.height;let C=p*T.width*u,O=T.height*u,R=C+d*2,z=O+d*2;if(y=!1,_!==`
|
|
`&&_!=="\r"&&_!==" "&&_!==" "&&(y=!0,f=Math.ceil(Math.max(z,f))),l+R>this._textureSize&&(h+=f,f=z,l=0,h+f>this._textureSize)){a.update();let ne=this._nextPage();n=ne.canvasAndContext.canvas,s=ne.canvasAndContext.context,a=ne.texture.source,h=0}let ee=C/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:ee,kerning:{}},y){this._drawGlyph(s,T,l+d,h+d,u,o);let ne=a.width*u,Q=a.height*u,Y=new ot(l/ne*a.width,h/Q*a.height,R/ne*a.width,z/Q*a.height);this.chars[_].texture=new Re({source:a,frame:Y}),l+=Math.ceil(R)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(i,s)}get pageTextures(){return Xe(Ve,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,i){let r=this._measureCache;for(let n=0;n<t.length;n++){let s=t[n];for(let a=0;a<this._currentChars.length;a++){let o=this._currentChars[a],l=r[s];l||(l=r[s]=i.measureText(s).width);let h=r[o];h||(h=r[o]=i.measureText(o).width);let u=i.measureText(s+o).width,d=u-(l+h);d&&(this.chars[s].kerning[o]=d),u=i.measureText(s+o).width,d=u-(l+h),d&&(this.chars[o].kerning[s]=d)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,i=$i.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(i.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n=new Re({source:new Gn({resource:i.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),s={canvasAndContext:i,texture:n};return this.pages[this._currentPageIndex]=s,s}_setupContext(t,i,r){i.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=wa(i),i.fontSize=this.baseMeasurementFontSize,t.textBaseline=i.textBaseline;let n=i._stroke,s=n?.width??0;if(n&&(t.lineWidth=s,t.lineJoin=n.join,t.miterLimit=n.miterLimit,t.strokeStyle=Ea(n,t)),i._fill&&(t.fillStyle=Ea(i._fill,t)),i.dropShadow){let a=i.dropShadow,o=ue.shared.setValue(a.color).toArray(),l=a.blur*r,h=a.distance*r;t.shadowColor=`rgba(${o[0]*255},${o[1]*255},${o[2]*255},${a.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(a.angle)*h,t.shadowOffsetY=Math.sin(a.angle)*h}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,i,r,n,s,a){let o=i.text,l=i.fontProperties,h=(a._stroke?.width??0)*s,u=r+h/2,d=n-h/2,p=l.descent*s,f=i.lineHeight*s;a.stroke&&h&&t.strokeText(o,u,d+f-p),a._fill&&t.fillText(o,u,d+f-p)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:i,texture:r}=this.pages[t];i.canvas.width=i.canvas.width,$i.returnCanvasAndContext(i),r.destroy(!0)}this.pages=null}},uh.defaultOptions={textureSize:512,style:new Xi,mipmap:!0},ch=uh});function _p(e,t,i){let r={width:0,height:0,offsetY:0,scale:t.fontSize/i.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};r.offsetY=i.baseLineOffset;let n=r.lines[0],s=null,a=!0,o={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=f=>{let y=n.width;for(let b=0;b<o.index;b++){let _=f.positions[b];n.chars.push(f.chars[b]),n.charPositions.push(_+y)}n.width+=f.width,a=!1,o.width=0,o.index=0,o.chars.length=0},h=()=>{let f=n.chars.length-1,y=n.chars[f];for(;y===" ";)n.width-=i.chars[y].xAdvance,y=n.chars[--f];r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,r.lines.push(n),r.height+=i.lineHeight},u=i.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,p=t.wordWrapWidth*u;for(let f=0;f<e.length+1;f++){let y,b=f===e.length;b||(y=e[f]);let _=i.chars[y]||i.chars[" "];if(/(?:\s)/.test(y)||y==="\r"||y===`
|
|
`||b){if(!a&&t.wordWrap&&n.width+o.width-d>p?(h(),l(o),b||n.charPositions.push(0)):(o.start=n.width,l(o),b||n.charPositions.push(0)),y==="\r"||y===`
|
|
`)n.width!==0&&h();else if(!b){let T=_.xAdvance+(_.kerning[s]||0)+d;n.width+=T,n.spaceWidth=T,n.spacesIndex.push(n.charPositions.length),n.chars.push(y)}}else{let T=_.kerning[s]||0,C=_.xAdvance+T+d;o.positions[o.index++]=o.width+T,o.chars.push(y),o.width+=C}s=y}return h(),t.align==="center"?p0(r):t.align==="right"?g0(r):t.align==="justify"&&m0(r),r}function p0(e){for(let t=0;t<e.lines.length;t++){let i=e.lines[t],r=e.width/2-i.width/2;for(let n=0;n<i.charPositions.length;n++)i.charPositions[n]+=r}}function g0(e){for(let t=0;t<e.lines.length;t++){let i=e.lines[t],r=e.width-i.width;for(let n=0;n<i.charPositions.length;n++)i.charPositions[n]+=r}}function m0(e){let t=e.width;for(let i=0;i<e.lines.length;i++){let r=e.lines[i],n=0,s=r.spacesIndex[n++],a=0,o=r.spacesIndex.length,l=(t-r.width)/o;for(let h=0;h<r.charPositions.length;h++)h===s&&(s=r.spacesIndex[n++],a+=l),r.charPositions[h]+=a}}var vp=v(()=>{"use strict"}),Qn,yp,xp,_0=v(()=>{js(),wt(),I(),jn(),f0(),vp(),mp(),Qn=0,yp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(e,t){let i=`${t.fontFamily}-bitmap`,r=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,r=!1;else if(t._stroke||t.dropShadow){let s=t.styleKey;s=s.substring(0,s.lastIndexOf("-")),i=`${s}-bitmap`,r=!1}if(!Wt.has(i)){let s=new ch({style:t,overrideFill:r,overrideSize:!0,...this.defaultOptions});Qn++,Qn>50&&F("BitmapText",`You have dynamically created ${Qn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Qn--,Wt.remove(i)}),Wt.set(i,s)}let n=Wt.get(i);return n.ensureCharacters?.(e),n}getLayout(e,t){let i=this.getFont(e,t);return _p([...e],t,i)}measureText(e,t){return this.getLayout(e,t)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},Xe(Ve,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=t?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let r=t.style,n=r instanceof Xi?r:new Xi(r),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new ch({style:n,overrideFill:s,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),o=gp(t.chars);return a.ensureCharacters(o.join("")),Wt.set(`${i}-bitmap`,a),a.once("destroy",()=>Wt.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Wt.get(t);i&&(Wt.remove(t),i.destroy())}},xp=new yp});function bp(e,t){t.groupTransform=e.groupTransform,t.groupColorAlpha=e.groupColorAlpha,t.groupColor=e.groupColor,t.groupBlendMode=e.groupBlendMode,t.globalDisplayStatus=e.globalDisplayStatus,t.groupTransform=e.groupTransform,t.localDisplayStatus=e.localDisplayStatus,t.groupAlpha=e.groupAlpha,t._roundPixels=e._roundPixels}var dh,v0=v(()=>{js(),te(),Ht(),Wf(),c0(),_0(),vp(),dh=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let i=this._getGpuBitmapText(e);bp(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,t),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(Le.return(t.customShader),t.customShader=null),Le.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);bp(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,r=xp.getFont(e.text,e._style);i.clear(),r.distanceField.type!=="none"&&(i.customShader||(i.customShader=Le.get(fp)));let n=Array.from(e.text),s=e._style,a=r.baseLineOffset,o=_p(n,s,r),l=0,h=s.padding,u=o.scale,d=o.width,p=o.height+o.offsetY;s._stroke&&(d+=s._stroke.width/u,p+=s._stroke.width/u),i.translate(-e._anchor._x*d-h,-e._anchor._y*p-h).scale(u,u);let f=r.applyFillAsTint?s._fill.color:16777215;for(let y=0;y<o.lines.length;y++){let b=o.lines[y];for(let _=0;_<b.charPositions.length;_++){let T=n[l++],C=r.chars[T];C?.texture&&i.texture(C.texture,f||"black",Math.round(b.charPositions[_]+C.xOffset),Math.round(a+C.yOffset))}a+=r.lineHeight}}_getGpuBitmapText(e){return this._gpuBitmapText[e.uid]||this.initGpuText(e)}initGpuText(e){let t=Le.get(Aa);return this._gpuBitmapText[e.uid]=t,this._updateContext(e,t),e.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[e.uid]}_updateDistanceField(e){let t=this._getGpuBitmapText(e).context,i=e._style.fontFamily,r=Wt.get(`${i}-bitmap`),{a:n,b:s,c:a,d:o}=e.groupTransform,l=Math.sqrt(n*n+s*s),h=Math.sqrt(a*a+o*o),u=(Math.abs(l)+Math.abs(h))/2,d=r.baseRenderedFontSize/e._style.fontSize,p=u*r.distanceField.range*(1/d);t.customShader.resources.localUniforms.uniforms.uDistance=p}destroy(){for(let e in this._gpuBitmapText)this._destroyRenderableByUid(e);this._gpuBitmapText=null,this._renderer=null}},dh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"bitmapText"}}),wp=v(()=>{te(),v0(),pe.add(dh)}),fh,y0=v(()=>{te(),pt(),pl(),Ht(),Ll(),fh=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e].batchableSprite.renderable;t._autoResolution&&(t._resolution=this._renderer.resolution,t.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==i}addRenderable(e,t){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t.batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),Le.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),r=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(s=>{console.error(s)}),e._didTextUpdate=!1;let n=e._style.padding;Hs(r.bounds,e._anchor,r.texture,n)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=i;let r=e.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(e.text,r,e._style,e._getKey()),s=t.batchableSprite;s.texture=t.texture=n,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate();let a=e._style.padding;Hs(s.bounds,e._anchor,s.texture,a)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:Re.EMPTY,currentKey:"--",batchableSprite:Le.get(fa),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.texture=Re.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},fh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"htmlText"}});function x0(){let{userAgent:e}=vt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}var b0=v(()=>{Ft()}),ph,gh,mh,Tp=v(()=>{"use strict";ph="http://www.w3.org/2000/svg",gh="http://www.w3.org/1999/xhtml",mh=class{constructor(){this.svgRoot=document.createElementNS(ph,"svg"),this.foreignObject=document.createElementNS(ph,"foreignObject"),this.domElement=document.createElementNS(gh,"div"),this.styleElement=document.createElementNS(gh,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:r}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(r)}}});function w0(e){let t=e._stroke,i=e._fill,r=[`div { ${[`color: ${ue.shared.setValue(i.color).toHex()}`,`font-size: ${e.fontSize}px`,`font-family: ${e.fontFamily}`,`font-weight: ${e.fontWeight}`,`font-style: ${e.fontStyle}`,`font-variant: ${e.fontVariant}`,`letter-spacing: ${e.letterSpacing}px`,`text-align: ${e.align}`,`padding: ${e.padding}px`,`white-space: ${e.whiteSpace==="pre"&&e.wordWrap?"pre-wrap":e.whiteSpace}`,...e.lineHeight?[`line-height: ${e.lineHeight}px`]:[],...e.wordWrap?[`word-wrap: ${e.breakWords?"break-all":"break-word"}`,`max-width: ${e.wordWrapWidth}px`]:[],...t?[Ep(t)]:[],...e.dropShadow?[Sp(e.dropShadow)]:[],...e.cssOverrides].join(";")} }`];return T0(e.tagStyles,r),r.join(" ")}function Sp(e){let t=ue.shared.setValue(e.color).setAlpha(e.alpha).toHexa(),i=Math.round(Math.cos(e.angle)*e.distance),r=Math.round(Math.sin(e.angle)*e.distance),n=`${i}px ${r}px`;return e.blur>0?`text-shadow: ${n} ${e.blur}px ${t}`:`text-shadow: ${n} ${t}`}function Ep(e){return[`-webkit-text-stroke-width: ${e.width}px`,`-webkit-text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,`text-stroke-width: ${e.width}px`,`text-stroke-color: ${ue.shared.setValue(e.color).toHex()}`,"paint-order: stroke"].join(";")}function T0(e,t){for(let i in e){let r=e[i],n=[];for(let s in r)vh[s]?n.push(vh[s](r[s])):_h[s]&&n.push(_h[s].replace("{{VALUE}}",r[s]));t.push(`${i} { ${n.join(";")} }`)}}var _h,vh,S0=v(()=>{Ie(),_h={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},vh={fill:e=>`color: ${ue.shared.setValue(e).toHex()}`,breakWords:e=>`word-wrap: ${e?"break-all":"break-word"}`,stroke:Ep,dropShadow:Sp}}),Ap,E0=v(()=>{I(),jn(),Uf(),S0(),Ap=class cv extends Xi{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Gf(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new cv({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=w0(this)),this._cssStyle}addOverride(...t){let i=t.filter(r=>!this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides.push(...i),this.update())}removeOverride(...t){let i=t.filter(r=>this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!i.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function A0(e,t){let i=t.fontFamily,r=[],n={},s=/font-family:([^;"\s]+)/g,a=e.match(s);function o(l){n[l]||(r.push(l),n[l]=!0)}if(Array.isArray(i))for(let l=0;l<i.length;l++)o(i[l]);else o(i);a&&a.forEach(l=>{let h=l.split(":")[1].trim();o(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;o(h)}return r}var C0=v(()=>{"use strict"});async function M0(e){let t=await(await vt.get().fetch(e)).blob(),i=new FileReader;return await new Promise((r,n)=>{i.onloadend=()=>r(i.result),i.onerror=n,i.readAsDataURL(t)})}var P0=v(()=>{Ft()});async function Cp(e,t){let i=await M0(t);return`@font-face {
|
|
font-family: "${e.fontFamily}";
|
|
src: url('${i}');
|
|
font-weight: ${e.fontWeight};
|
|
font-style: ${e.fontStyle};
|
|
}`}var R0=v(()=>{P0()});async function k0(e,t,i){let r=e.filter(n=>Wt.has(`${n}-and-url`)).map((n,s)=>{if(!es.has(n)){let{url:a}=Wt.get(`${n}-and-url`);s===0?es.set(n,Cp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:n},a)):es.set(n,Cp({fontWeight:i.fontWeight,fontStyle:i.fontStyle,fontFamily:n},a))}return es.get(n)});return(await Promise.all(r)).join(`
|
|
`)}var es,B0=v(()=>{js(),R0(),es=new Map});function I0(e,t,i,r,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${e}</div>`,s.setAttribute("style",`transform: scale(${i});transform-origin: top left; display: inline-block`),a.textContent=r;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var G0=v(()=>{"use strict"});function O0(e,t){let i=$i.getOptimalCanvasAndContext(e.width,e.height,t),{context:r}=i;return r.clearRect(0,0,e.width,e.height),r.drawImage(e,0,0),$i.returnCanvasAndContext(i),i.canvas}var U0=v(()=>{pa()});function F0(e,t,i){return new Promise(async r=>{i&&await new Promise(n=>setTimeout(n,100)),e.onload=()=>{r()},e.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,e.crossOrigin="anonymous"})}var D0=v(()=>{"use strict"});function L0(e,t,i,r){r=r||Mp||(Mp=new mh);let{domElement:n,styleElement:s,svgRoot:a}=r;n.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${e}</div>`,n.setAttribute("style","transform-origin: top left; display: inline-block"),i&&(s.textContent=i),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=Ri.measureFont(t.fontStyle).descent,h=t.padding*2;return{width:o.width-h,height:o.height+l-h}}var Mp,N0=v(()=>{Sa(),Tp()}),Da,H0=v(()=>{te(),Ln(),sr(),b0(),I(),Ht(),Lf(),Tp(),E0(),C0(),B0(),G0(),U0(),D0(),N0(),Da=class{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===Ei.WEBGPU}getTexture(e){return this._buildTexturePromise(e.text,e.resolution,e.style)}getManagedTexture(e,t,i,r){if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].promise;let n=this._buildTexturePromise(e,t,i).then(s=>(this._activeTextures[r].texture=s,s));return this._activeTextures[r]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(e,t,i){let r=Le.get(mh),n=A0(e,i),s=await k0(n,i,Ap.defaultTextStyle),a=L0(e,i,s,r),o=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*t),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*t),h=r.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let d=I0(e,i,t,s,r);await F0(h,d,x0()&&n.length>0);let p=h;this._createCanvas&&(p=O0(h,t));let f=Ff(p,h.width-u,h.height-u,t);return this._createCanvas&&this._renderer.texture.initSource(f.source),Le.return(r),f}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t):t.promise.then(i=>{t.texture=i,this._cleanUp(t)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}_cleanUp(e){gi.returnTexture(e.texture),e.texture.source.resource=null,e.texture.source.uploadMethodId="unknown"}getReferenceCount(e){return this._activeTextures[e].usageCount}destroy(){this._activeTextures=null}},Da.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"htmlText"},Da.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Pp=v(()=>{te(),y0(),H0(),pe.add(Da),pe.add(fh)}),yh,La,xh=v(()=>{un(),zr(),Zs(),wt(),yh=class dv extends Un{constructor(...t){let i=t[0]??{};i instanceof Float32Array&&(Xe(Ve,"use new MeshGeometry({ positions, uvs, indices }) instead"),i={positions:i,uvs:t[1],indices:t[2]}),i={...dv.defaultOptions,...i};let r=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),s=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,o=new wi({data:r,label:"attribute-mesh-positions",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),l=new wi({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:tt.VERTEX|tt.COPY_DST}),h=new wi({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:tt.INDEX|tt.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}},yh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},La=yh}),vn,Rp,Na,ts=v(()=>{"use strict";vn={name:"local-uniform-bit",vertex:{header:`
|
|
|
|
struct LocalUniforms {
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uColor:vec4<f32>,
|
|
uRound:f32,
|
|
}
|
|
|
|
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
vColor *= localUniforms.uColor;
|
|
modelMatrix *= localUniforms.uTransformMatrix;
|
|
`,end:`
|
|
if(localUniforms.uRound == 1)
|
|
{
|
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`}},Rp={...vn,vertex:{...vn.vertex,header:vn.vertex.header.replace("group(1)","group(2)")}},Na={name:"local-uniform-bit",vertex:{header:`
|
|
|
|
uniform mat3 uTransformMatrix;
|
|
uniform vec4 uColor;
|
|
uniform float uRound;
|
|
`,main:`
|
|
vColor *= uColor;
|
|
modelMatrix = uTransformMatrix;
|
|
`,end:`
|
|
if(uRound == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`}}}),kp,Bp,z0=v(()=>{"use strict";kp={name:"tiling-bit",vertex:{header:`
|
|
struct TilingUniforms {
|
|
uMapCoord:mat3x3<f32>,
|
|
uClampFrame:vec4<f32>,
|
|
uClampOffset:vec2<f32>,
|
|
uTextureTransform:mat3x3<f32>,
|
|
uSizeAnchor:vec4<f32>
|
|
};
|
|
|
|
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(2) var uSampler: sampler;
|
|
`,main:`
|
|
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
|
|
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
`},fragment:{header:`
|
|
struct TilingUniforms {
|
|
uMapCoord:mat3x3<f32>,
|
|
uClampFrame:vec4<f32>,
|
|
uClampOffset:vec2<f32>,
|
|
uTextureTransform:mat3x3<f32>,
|
|
uSizeAnchor:vec4<f32>
|
|
};
|
|
|
|
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(2) var uSampler: sampler;
|
|
`,main:`
|
|
|
|
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
var unclamped = coord;
|
|
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
|
|
var bias = 0.;
|
|
|
|
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
{
|
|
bias = -32.;
|
|
}
|
|
|
|
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
`}},Bp={name:"tiling-bit",vertex:{header:`
|
|
uniform mat3 uTextureTransform;
|
|
uniform vec4 uSizeAnchor;
|
|
|
|
`,main:`
|
|
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
|
|
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
`},fragment:{header:`
|
|
uniform sampler2D uTexture;
|
|
uniform mat3 uMapCoord;
|
|
uniform vec4 uClampFrame;
|
|
uniform vec2 uClampOffset;
|
|
`,main:`
|
|
|
|
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
vec2 unclamped = coord;
|
|
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
|
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
|
|
`}}}),bh,wh,Ip,W0=v(()=>{We(),Tr(),ts(),Sr(),Yi(),pi(),pt(),z0(),Ip=class extends ki{constructor(){bh??(bh=qn({name:"tiling-sprite-shader",bits:[vn,kp,mn]})),wh??(wh=Kn({name:"tiling-sprite-shader",bits:[Na,Bp,_n]}));let e=new ti({uMapCoord:{value:new ke,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new ke,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:wh,gpuProgram:bh,resources:{localUniforms:new ti({uTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:Re.EMPTY.source,uSampler:Re.EMPTY.source.style}})}updateUniforms(e,t,i,r,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*o/e,i.b*o/t,i.c*l/e,i.d*l/t,i.tx/e,i.ty/t),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=r,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),Gp,V0=v(()=>{xh(),Gp=class extends La{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function j0(e,t){let i=e.anchor.x,r=e.anchor.y;t[0]=-i*e.width,t[1]=-r*e.height,t[2]=(1-i)*e.width,t[3]=-r*e.height,t[4]=(1-i)*e.width,t[5]=(1-r)*e.height,t[6]=-i*e.width,t[7]=(1-r)*e.height}var $0=v(()=>{"use strict"});function X0(e,t,i,r){let n=0,s=e.length/(t||2),a=r.a,o=r.b,l=r.c,h=r.d,u=r.tx,d=r.ty;for(i*=t;n<s;){let p=e[i],f=e[i+1];e[i]=a*p+l*f+u,e[i+1]=o*p+h*f+d,i+=t,n++}}var Y0=v(()=>{"use strict"});function q0(e,t){let i=e.texture,r=i.frame.width,n=i.frame.height,s=0,a=0;e._applyAnchorToTexture&&(s=e.anchor.x,a=e.anchor.y),t[0]=t[6]=-s,t[2]=t[4]=1-s,t[1]=t[3]=-a,t[5]=t[7]=1-a;let o=ke.shared;o.copyFrom(e._tileTransform.matrix),o.tx/=e.width,o.ty/=e.height,o.invert(),o.scale(e.width/r,e.height/n),X0(t,2,0,o)}var K0=v(()=>{We(),Y0()}),is,Th,Z0=v(()=>{te(),Cl(),nr(),sr(),ha(),Fl(),xh(),W0(),V0(),$0(),K0(),is=new Gp,Th=class{constructor(e){this._state=ji.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let r=t.canBatch;if(r&&r===i){let{batchableMesh:n}=t;if(n&&n.texture._source!==e.texture._source)return!n.batcher.checkAndUpdateTexture(n,e.texture)}return i!==r}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let r=this._getTilingSpriteData(e),{geometry:n,canBatch:s}=r;if(s){r.batchableMesh||(r.batchableMesh=new da);let a=r.batchableMesh;e._didTilingSpriteUpdate&&(e._didTilingSpriteUpdate=!1,this._updateBatchableMesh(e),a.geometry=n,a.mesh=e,a.texture=e._texture),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a)}else i.break(t),r.shader||(r.shader=new Ip),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,la(e.groupColorAlpha,i.uColor,0),this._state.blendMode=qs(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:is,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:r}=t;e._didTilingSpriteUpdate&&this._updateBatchableMesh(e),r.batcher.updateElement(r)}else if(e._didTilingSpriteUpdate){let{shader:r}=t;r.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}e._didTilingSpriteUpdate=!1}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new La({indices:is.indices,positions:is.positions.slice(),uvs:is.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,r=e.texture.source.style;r.addressMode!=="repeat"&&(r.addressMode="repeat",r.update()),q0(e,i.uvs),j0(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,r=!0;return this._renderer.type===Ei.WEBGL&&(r=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(r||i.source.isPowerOfTwo),t.canBatch}},Th.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"tilingSprite"}}),Op=v(()=>{te(),Z0(),pe.add(Th)}),Sh,Up,J0=v(()=>{wt(),xh(),Sh=class fv extends La{constructor(...t){super({});let i=t[0]??{};typeof i=="number"&&(Xe(Ve,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){t={...fv.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let i=this.verticesX*this.verticesY,r=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let d=0;d<i;d++){let p=d%this.verticesX,f=d/this.verticesX|0;r.push(p*l,f*h),n.push(p/a,f/o)}let u=a*o;for(let d=0;d<u;d++){let p=d%a,f=d/a|0,y=f*this.verticesX+p,b=f*this.verticesX+p+1,_=(f+1)*this.verticesX+p,T=(f+1)*this.verticesX+p+1;s.push(y,b,_,b,T,_)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint32Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}},Sh.defaultOptions={width:100,height:100,verticesX:10,verticesY:10},Up=Sh}),Eh,Fp,Q0=v(()=>{J0(),Eh=class pv extends Up{constructor(t={}){t={...pv.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,i=this._leftWidth+this._rightWidth,r=this.width>i?1:this.width/i,n=this._topHeight+this._bottomHeight,s=this.height>n?1:this.height/n,a=Math.min(r,s);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let i=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=i*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-i*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}},Eh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},Fp=Eh}),Ah,eb=v(()=>{te(),Ht(),Fl(),Q0(),Ah=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){let i=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,i=this._getGpuSprite(e);return i.texture._source!==t._source?!i.batcher.checkAndUpdateTexture(i,t):!1}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];Le.return(t.geometry),Le.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=Le.get(da);return t.geometry=Le.get(Fp),t.mesh=e,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._didSpriteUpdate=!0,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Ah.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"nineSliceSprite"}}),Dp=v(()=>{te(),eb(),pe.add(Ah)}),Ch,tb=v(()=>{te(),Ch=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Ch.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"filter"}});function ib(e,t){return t.clear(),Lp(e,t),t.isValid||t.set(0,0,0,0),e.renderGroup?t.applyMatrix(e.renderGroup.localTransform):t.applyMatrix(e.parentRenderGroup.worldTransform),t}function Lp(e,t){if(e.localDisplayStatus!==7||!e.measurable)return;let i=!!e.effects.length,r=t;if((e.renderGroup||i)&&(r=w.get().clear()),e.boundsArea)t.addRect(e.boundsArea,e.worldTransform);else{if(e.renderPipeId){let s=e.bounds;r.addFrame(s.minX,s.minY,s.maxX,s.maxY,e.groupTransform)}let n=e.children;for(let s=0;s<n.length;s++)Lp(n[s],r)}if(i){let n=!1;for(let s=0;s<e.effects.length;s++)e.effects[s].addBounds&&(n||(n=!0,r.applyMatrix(e.parentRenderGroup.worldTransform)),e.effects[s].addBounds(r,!0));n&&(r.applyMatrix(e.parentRenderGroup.worldTransform.copyTo(Np).invert()),t.addBounds(r,e.relativeGroupTransform)),t.addBounds(r),w.return(r)}else e.renderGroup&&(t.addBounds(r,e.relativeGroupTransform),w.return(r))}var Np,rb=v(()=>{We(),S(),Np=new ke});function nb(e,t){t.clear();let i=t.matrix;for(let r=0;r<e.length;r++){let n=e[r];n.globalDisplayStatus<7||(t.matrix=n.worldTransform,n.addBounds(t))}return t.matrix=i,t}var sb=v(()=>{"use strict"}),Hp,Mh,ab=v(()=>{te(),We(),At(),Nr(),Zs(),pi(),pt(),Ln(),sr(),m(),rb(),sb(),I(),Hp=new Un({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Mh=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ti({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Vi({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let r=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){r.skip=!0;return}let n=r.bounds;e.renderables?nb(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):ib(e.container,n);let s=t.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1;for(let p=0;p<i.length;p++){let f=i[p];if(a=Math.min(a,f.resolution==="inherit"?s._resolution:f.resolution),o+=f.padding,f.antialias==="off"?l=!1:f.antialias==="inherit"&&l&&(l=s.antialias),!(f.compatibleRenderers&t.type)){u=!1;break}if(f.blendRequired&&!(t.backBuffer?.useBackBuffer??!0)){F("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=f.enabled||u,h=h||f.blendRequired}if(!u){r.skip=!0;return}let d=t.renderTarget.rootViewPort;if(n.scale(a).fitBounds(0,d.width,0,d.height).scale(1/a).pad(o).ceil(),!n.isPositive){r.skip=!0;return}r.skip=!1,r.bounds=n,r.blendRequired=h,r.container=e.container,r.filterEffect=e.filterEffect,r.previousRenderSurface=t.renderTarget.renderSurface,r.inputTexture=gi.getOptimalTexture(n.width,n.height,a,l),t.renderTarget.bind(r.inputTexture,!0),t.globalUniforms.push({offset:n})}pop(){let e=this.renderer;this._filterStackIndex--;let t=this._filterStack[this._filterStackIndex];if(t.skip)return;this._activeFilterData=t;let i=t.inputTexture,r=t.bounds,n=Re.EMPTY;if(e.renderTarget.finishRenderPass(),t.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,o=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(o,r,a)}t.backTexture=n;let s=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),s.length===1)s[0].apply(this,i,t.previousRenderSurface,!1),gi.returnTexture(i);else{let a=t.inputTexture,o=gi.getOptimalTexture(r.width,r.height,a.source._resolution,!1),l=0;for(l=0;l<s.length-1;++l){s[l].apply(this,a,o,!0);let h=a;a=o,o=h}s[l].apply(this,a,t.previousRenderSurface,!1),gi.returnTexture(a),gi.returnTexture(o)}t.blendRequired&&gi.returnTexture(n)}getBackTexture(e,t,i){let r=e.colorTexture.source._resolution,n=gi.getOptimalTexture(t.width,t.height,r,!1),s=t.minX,a=t.minY;i&&(s-=i.minX,a-=i.minY),s=Math.floor(s*r),a=Math.floor(a*r);let o=Math.ceil(t.width*r),l=Math.ceil(t.height*r);return this.renderer.renderTarget.copyToTexture(e,n,{x:s,y:a},{width:o,height:l},{x:0,y:0}),n}applyFilter(e,t,i,r){let n=this.renderer,s=this._filterStack[this._filterStackIndex],a=s.bounds,o=De.shared,l=s.previousRenderSurface===i,h=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._filterStackIndex-1;for(;u>0&&this._filterStack[u].skip;)--u;u>0&&(h=this._filterStack[u].inputTexture.source._resolution);let d=this._filterGlobalUniforms,p=d.uniforms,f=p.uOutputFrame,y=p.uInputSize,b=p.uInputPixel,_=p.uInputClamp,T=p.uGlobalFrame,C=p.uOutputTexture;if(l){let z=this._filterStackIndex;for(;z>0;){z--;let ee=this._filterStack[this._filterStackIndex-1];if(!ee.skip){o.x=ee.bounds.minX,o.y=ee.bounds.minY;break}}f[0]=a.minX-o.x,f[1]=a.minY-o.y}else f[0]=0,f[1]=0;f[2]=t.frame.width,f[3]=t.frame.height,y[0]=t.source.width,y[1]=t.source.height,y[2]=1/y[0],y[3]=1/y[1],b[0]=t.source.pixelWidth,b[1]=t.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],_[0]=.5*b[2],_[1]=.5*b[3],_[2]=t.frame.width*y[2]-.5*b[2],_[3]=t.frame.height*y[3]-.5*b[3];let O=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=o.x*h,T[1]=o.y*h,T[2]=O.source.width*h,T[3]=O.source.height*h;let R=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!r),i instanceof Re?(C[0]=i.frame.width,C[1]=i.frame.height):(C[0]=R.width,C[1]=R.height),C[2]=R.isRoot?-1:1,d.update(),n.renderPipes.uniformBatch){let z=n.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(z,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:Hp,shader:e,state:e._state,topology:"triangle-list"}),n.type===Ei.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new g,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,r=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=t.worldTransform.copyTo(ke.shared);return n.invert(),r.prepend(n),r.scale(1/t.texture.frame.width,1/t.texture.frame.height),r.translate(t.anchor.x,t.anchor.y),r}},Mh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"filter"}}),zp=v(()=>{te(),tb(),ab(),pe.add(Mh),pe.add(Ch)}),ob={},lb=v(()=>{Rv(),Hc(),Uv(),fl(),bl(),Qd(),tf(),zf(),wp(),Pp(),Op(),Dp(),zp()}),hb={},ub=v(()=>{Hc(),fl(),bl(),Qd(),tf(),zf(),wp(),Pp(),Op(),Dp(),zp()}),Ph,Wp,cb=v(()=>{$n(),Ba(),Yi(),nr(),Ph=class Cc extends ki{constructor(t){t={...Cc.defaultOptions,...t},super(t),this.enabled=!0,this._state=ji.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.addResource("uTexture",0,1)}apply(t,i,r,n){t.applyFilter(this,i,r,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:i,gl:r,...n}=t,s,a;return i&&(s=Yn.from(i)),r&&(a=pn.from(r)),new Cc({gpuProgram:s,glProgram:a,...n})}},Ph.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1},Wp=Ph});async function db(e){if(!e)for(let t=0;t<Ha.length;t++){let i=Ha[t];if(i.value.test()){await i.value.load();return}}}var Ha,fb=v(()=>{te(),Ha=[],pe.handleByNamedList(G.Environment,Ha)});function Vp(){if(typeof rs=="boolean")return rs;try{rs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{rs=!1}return rs}var rs,jp=v(()=>{"use strict"}),li,ns=v(()=>{"use strict";li=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(li||{})}),Rh,$p=v(()=>{"use strict";Rh=class{constructor(e){this.items=[],this._name=e}emit(e,t,i,r,n,s,a,o){let{name:l,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][l](e,t,i,r,n,s,a,o);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){let t=this.items.indexOf(e);return t!==-1&&this.items.splice(t,1),this}contains(e){return this.items.indexOf(e)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}}),Xp,kh,ss,za=v(()=>{Ie(),fb(),zi(),jp(),wt(),ns(),$p(),xt(),Xp=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],kh=class gv extends Je{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let i=[...Xp,...this.config.runners??[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(t={}){let i=t.skipExtensionImports===!0?!0:t.manageImports===!1;await db(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...gv.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,i){let r=t;if(r instanceof Tt&&(r={container:r},i&&(Xe(Ve,"passing a second argument is deprecated, please use render options instead"),r.target=i.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor=this.background.colorRgba),r.clearColor){let n=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=n?r.clearColor:ue.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,i,r){this.view.resize(t,i,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution)}clear(t={}){let i=this;t.target||(t.target=i.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=li.ALL);let{clear:r,clearColor:n,target:s}=t;ue.shared.setValue(n??this.background.colorRgba),i.renderTarget.clear(s,r,ue.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(i=>{this.runners[i]=new Rh(i)})}_addSystems(t){let i;for(i in t){let r=t[i];this._addSystem(r.value,r.name)}}_addSystem(t,i){let r=new t(this);if(this[i])throw new Error(`Whoops! The name "${i}" is already in use`);this[i]=r,this._systemsHash[i]=r;for(let n in this.runners)this.runners[n].add(r);return this}_addPipes(t,i){let r=i.reduce((n,s)=>(n[s.name]=s.value,n),{});t.forEach(n=>{let s=n.value,a=n.name,o=r[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(i=>{i.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Vp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}},kh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},ss=kh}),Bh,pb=v(()=>{te(),We(),xr(),Sl(),Tr(),Zn(),Jn(),ts(),Sr(),Yi(),pi(),Bh=class{init(){let e=new ti({uTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),t=qn({name:"graphics",bits:[Ga,rh(yr()),Rp,mn]});this.shader=new ki({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.context,r=i.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{geometry:a,instructions:o}=s.getContextRenderData(i),l=n.encoder;l.setPipelineFromGeometryProgramAndState(a,r.gpuProgram,e.state),l.setGeometry(a,r.gpuProgram);let h=n.globalUniforms.bindGroup;l.setBindGroup(0,h,r.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(r.resources.localUniforms,!0);l.setBindGroup(2,u,r.gpuProgram);let d=o.instructions;for(let p=0;p<o.instructionSize;p++){let f=d[p];if(r.groups[1]=f.bindGroup,!f.gpuBindGroup){let y=f.textures;f.bindGroup=wl(y.textures,y.count),f.gpuBindGroup=n.bindGroup.getBindGroup(f.bindGroup,r.gpuProgram,1)}l.setBindGroup(1,f.bindGroup,r.gpuProgram),l.renderPassEncoder.drawIndexed(f.size,1,f.start)}}destroy(){this.shader.destroy(!0),this.shader=null}},Bh.extension={type:[G.WebGPUPipesAdaptor],name:"graphics"}}),Yp,qp,Kp=v(()=>{"use strict";Yp={name:"texture-bit",vertex:{header:`
|
|
|
|
struct TextureUniforms {
|
|
uTextureMatrix:mat3x3<f32>,
|
|
}
|
|
|
|
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
`,main:`
|
|
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
`},fragment:{header:`
|
|
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(1) var uSampler: sampler;
|
|
|
|
|
|
`,main:`
|
|
outColor = textureSample(uTexture, uSampler, vUV);
|
|
`}},qp={name:"texture-bit",vertex:{header:`
|
|
uniform mat3 uTextureMatrix;
|
|
`,main:`
|
|
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
`},fragment:{header:`
|
|
uniform sampler2D uTexture;
|
|
|
|
|
|
`,main:`
|
|
outColor = texture(uTexture, vUV);
|
|
`}}}),Ih,gb=v(()=>{te(),We(),Tr(),ts(),Sr(),Kp(),Yi(),pt(),I(),Ih=class{init(){let e=qn({name:"mesh",bits:[vn,Yp,mn]});this._shader=new ki({gpuProgram:e,resources:{uTexture:Re.EMPTY._source,uSampler:Re.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new ke}}}})}execute(e,t){let i=e.renderer,r=t._shader;if(!r)r=this._shader,r.groups[2]=i.texture.getTextureBindGroup(t.texture);else if(!r.gpuProgram){F("Mesh shader has no gpuProgram",t.shader);return}let n=r.gpuProgram;if(n.autoAssignGlobalUniforms&&(r.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=e.localUniforms;r.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}i.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Ih.extension={type:[G.WebGPUPipesAdaptor],name:"mesh"}}),as,Gh,mb=v(()=>{te(),Tr(),Zn(),Jn(),Sr(),Yi(),nr(),xr(),Sl(),as=ji.for2d(),Gh=class{init(){let e=qn({name:"batch",bits:[Ga,rh(yr()),mn]});this._shader=new ki({gpuProgram:e,groups:{}})}start(e,t){let i=e.renderer,r=i.encoder,n=this._shader.gpuProgram;this._geometry=t,r.setGeometry(t,n),as.blendMode="normal",i.pipeline.getPipeline(t,n,as);let s=i.globalUniforms.bindGroup;r.resetBindGroup(1),r.setBindGroup(0,s,n)}execute(e,t){let i=this._shader.gpuProgram,r=e.renderer,n=r.encoder;if(!t.bindGroup){let o=t.textures;t.bindGroup=wl(o.textures,o.count)}as.blendMode=t.blendMode;let s=r.bindGroup.getBindGroup(t.bindGroup,i,1),a=r.pipeline.getPipeline(this._geometry,i,as);t.bindGroup._touch(r.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(t.size,1,t.start)}destroy(){this._shader.destroy(!0),this._shader=null}},Gh.extension={type:[G.WebGPUPipesAdaptor],name:"batch"}}),Oh,_b=v(()=>{te(),Oh=class{constructor(e){this._renderer=e}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}},Oh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"customRender"}});function Zp(e,t){let i=e.instructionSet,r=i.instructions;for(let n=0;n<i.instructionSize;n++){let s=r[n];t[s.renderPipeId].execute(s)}}var Jp=v(()=>{"use strict"}),Uh,vb=v(()=>{te(),Jp(),Uh=class{constructor(e){this._renderer=e}addRenderGroup(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:e.worldTransform,worldColor:e.worldColorAlpha}),Zp(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}},Uh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"renderGroup"}});function yb(e,t){let i=e.root,r=e.instructionSet;r.reset();let n=t.renderPipes?t:t.batch.renderer,s=n.renderPipes;s.batch.buildStart(r),s.blendMode.buildStart(),s.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),Qp(i,r,n,!0),s.batch.buildEnd(r),s.blendMode.buildEnd(r)}function Wa(e,t,i){let r=i.renderPipes?i:i.batch.renderer;e.globalDisplayStatus<7||!e.includeInBuild||(e.sortableChildren&&e.sortChildren(),e.isSimple?xb(e,t,r):Qp(e,t,r,!1))}function xb(e,t,i){if(e.renderPipeId){let{renderPipes:r,renderableGC:n}=i;r.blendMode.setBlendMode(e,e.groupBlendMode,t),e.didViewUpdate=!1,r[e.renderPipeId].addRenderable(e,t),n.addRenderable(e,t)}if(!e.renderGroup){let r=e.children,n=r.length;for(let s=0;s<n;s++)Wa(r[s],t,i)}}function Qp(e,t,i,r){let{renderPipes:n,renderableGC:s}=i;if(!r&&e.renderGroup)n.renderGroup.addRenderGroup(e.renderGroup,t);else{for(let l=0;l<e.effects.length;l++){let h=e.effects[l];n[h.pipe].push(h,e,t)}let a=e.renderPipeId;a&&(n.blendMode.setBlendMode(e,e.groupBlendMode,t),e.didViewUpdate=!1,n[a].addRenderable(e,t),s.addRenderable(e,t));let o=e.children;if(o.length)for(let l=0;l<o.length;l++)Wa(o[l],t,i);for(let l=e.effects.length-1;l>=0;l--){let h=e.effects[l];n[h.pipe].pop(h,e,t)}}}var Fh=v(()=>{"use strict"});function Dh(e,t){t||(t=0);for(let i=t;i<e.length&&e[i];i++)e[i]=null}var eg=v(()=>{"use strict"});function tg(e,t=[]){t.push(e);for(let i=0;i<e.renderGroupChildren.length;i++)tg(e.renderGroupChildren[i],t);return t}var bb=v(()=>{"use strict"});function wb(e,t,i){let r=e>>16&255,n=e>>8&255,s=e&255,a=t>>16&255,o=t>>8&255,l=t&255,h=r+(a-r)*i,u=n+(o-n)*i,d=s+(l-s)*i;return(h<<16)+(u<<8)+d}var Tb=v(()=>{"use strict"});function ig(e,t){return e===Va||t===Va?e+t-Va:wb(e,t,.5)}var Va,Sb=v(()=>{Tb(),Va=16777215});function rg(e,t=!1){Eb(e);let i=e.childrenToUpdate,r=e.updateTick++;for(let n in i){let s=Number(n),a=i[n],o=a.list,l=a.index;for(let h=0;h<l;h++){let u=o[h];u.parentRenderGroup===e&&u.relativeRenderGroupDepth===s&&ng(u,r,0)}Dh(o,l),a.index=0}if(t)for(let n=0;n<e.renderGroupChildren.length;n++)rg(e.renderGroupChildren[n],t)}function Eb(e){let t=e.root,i;if(e.renderGroupParent){let r=e.renderGroupParent;e.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),e.worldColor=ig(t.groupColor,r.worldColor),i=t.groupAlpha*r.worldAlpha}else e.worldTransform.copyFrom(t.localTransform),e.worldColor=t.localColor,i=t.localAlpha;i=i<0?0:i>1?1:i,e.worldAlpha=i,e.worldColorAlpha=e.worldColor+((i*255|0)<<24)}function ng(e,t,i){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;let r=e.localTransform;e.updateLocalTransform();let n=e.parent;if(n&&!n.renderGroup?(i=i|e._updateFlags,e.relativeGroupTransform.appendFrom(r,n.relativeGroupTransform),i&Lh&&sg(e,n,i)):(i=e._updateFlags,e.relativeGroupTransform.copyFrom(r),i&Lh&&sg(e,ag,i)),!e.renderGroup){let s=e.children,a=s.length;for(let l=0;l<a;l++)ng(s[l],t,i);let o=e.parentRenderGroup;e.renderPipeId&&!o.structureDidChange&&o.updateRenderable(e)}}function sg(e,t,i){if(i&Mn){e.groupColor=ig(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,e.groupAlpha=r,e.groupColorAlpha=e.groupColor+((r*255|0)<<24)}i&ks&&(e.groupBlendMode=e.localBlendMode==="inherit"?t.groupBlendMode:e.localBlendMode),i&rn&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}var ag,Lh,Ab=v(()=>{zi(),eg(),Sb(),ag=new Tt,Lh=rn|Mn|ks});function Cb(e,t){let{list:i,index:r}=e.childrenRenderablesToUpdate,n=!1;for(let s=0;s<r;s++){let a=i[s];if(n=t[a.renderPipeId].validateRenderable(a),n)break}return e.structureDidChange=n,n}var Mb=v(()=>{"use strict"});function Pb(e){let{list:t,index:i}=e.childrenRenderablesToUpdate;for(let r=0;r<i;r++){let n=t[r];n.didViewUpdate&&e.updateRenderable(n)}Dh(t,i)}var og,Nh,Rb=v(()=>{te(),We(),Fh(),eg(),bb(),Jp(),Ab(),Mb(),og=new ke,Nh=class{constructor(e){this._renderer=e}render({container:e,transform:t}){e.isRenderGroup=!0;let i=e.parent,r=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let n=this._renderer,s=tg(e.renderGroup,[]),a=og;t&&(a=a.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let o=n.renderPipes;for(let l=0;l<s.length;l++){let h=s[l];h.runOnRender(),h.instructionSet.renderPipes=o,h.structureDidChange?Dh(h.childrenRenderablesToUpdate.list,0):Cb(h,o),rg(h),h.structureDidChange?(h.structureDidChange=!1,yb(h,n)):Pb(h),h.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(h.instructionSet)}n.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),Zp(e.renderGroup,o),o.uniformBatch&&o.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(a),e.parent=i,e.renderGroup.renderGroupParent=r}destroy(){this._renderer=null}},Nh.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"renderGroup"}}),Hh,kb=v(()=>{te(),Ht(),Ll(),Hh=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){let i=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t.batcher.updateElement(t)}validateRenderable(e){let t=e._texture,i=this._getGpuSprite(e);return i.texture._source!==t._source?!i.batcher.checkAndUpdateTexture(i,t):!1}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];Le.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.bounds=e.bounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=Le.get(fa);return t.renderable=e,t.texture=e._texture,t.bounds=e.bounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e._didSpriteUpdate=!1,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)Le.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}},Hh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"sprite"}}),zh,Wh,lg=v(()=>{te(),zh=class{static init(){globalThis.__PIXI_APP_INIT__?.(this)}static destroy(){}},zh.extension=G.Application,Wh=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer)}destroy(){this._renderer=null}},Wh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"initHook",priority:-10}}),Vh,Bb=v(()=>{te(),nr(),Rd(),Gd(),Vh=class{constructor(e,t){this.state=ji.for2d(),this._batches=Object.create(null),this._geometries=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init(this)}buildStart(e){if(!this._batches[e.uid]){let t=new Rl;this._batches[e.uid]=t,this._geometries[t.uid]=new kl}this._activeBatch=this._batches[e.uid],this._activeGeometry=this._geometries[this._activeBatch.uid],this._activeBatch.begin()}addToBatch(e){this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){let t=this._activeBatch,i=this._activeGeometry;t.finish(e),i.indexBuffer.setDataWithSize(t.indexBuffer,t.indexSize,!0),i.buffers[0].setDataWithSize(t.attributeBuffer.float32View,t.attributeSize,!1)}upload(e){let t=this._batches[e.uid],i=this._geometries[t.uid];t.dirty&&(t.dirty=!1,i.buffers[0].update(t.attributeSize*4))}execute(e){if(e.action==="startBatch"){let t=e.batcher,i=this._geometries[t.uid];this._adaptor.start(this,i)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor.destroy(),this._adaptor=null;for(let e in this._batches)this._batches[e].destroy();this._batches=null;for(let e in this._geometries)this._geometries[e].destroy();this._geometries=null}},Vh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"batch"}}),hg,Ib=v(()=>{hg=`in vec2 vMaskCoord;
|
|
in vec2 vTextureCoord;
|
|
|
|
uniform sampler2D uTexture;
|
|
uniform sampler2D uMaskTexture;
|
|
|
|
uniform float uAlpha;
|
|
uniform vec4 uMaskClamp;
|
|
|
|
out vec4 finalColor;
|
|
|
|
void main(void)
|
|
{
|
|
float clip = step(3.5,
|
|
step(uMaskClamp.x, vMaskCoord.x) +
|
|
step(uMaskClamp.y, vMaskCoord.y) +
|
|
step(vMaskCoord.x, uMaskClamp.z) +
|
|
step(vMaskCoord.y, uMaskClamp.w));
|
|
|
|
// TODO look into why this is needed
|
|
float npmAlpha = uAlpha;
|
|
vec4 original = texture(uTexture, vTextureCoord);
|
|
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
|
|
original *= (alphaMul * masky.r * uAlpha * clip);
|
|
|
|
finalColor = original;
|
|
}
|
|
`}),ug,Gb=v(()=>{ug=`in vec2 aPosition;
|
|
|
|
out vec2 vTextureCoord;
|
|
out vec2 vMaskCoord;
|
|
|
|
|
|
uniform vec4 uInputSize;
|
|
uniform vec4 uOutputFrame;
|
|
uniform vec4 uOutputTexture;
|
|
uniform mat3 uFilterMatrix;
|
|
|
|
vec4 filterVertexPosition( vec2 aPosition )
|
|
{
|
|
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
|
|
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
|
|
return vec4(position, 0.0, 1.0);
|
|
}
|
|
|
|
vec2 filterTextureCoord( vec2 aPosition )
|
|
{
|
|
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
}
|
|
|
|
vec2 getFilterCoord( vec2 aPosition )
|
|
{
|
|
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = filterVertexPosition(aPosition);
|
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
vMaskCoord = getFilterCoord(aPosition);
|
|
}
|
|
`}),jh,Ob=v(()=>{jh=`struct GlobalFilterUniforms {
|
|
uInputSize:vec4<f32>,
|
|
uInputPixel:vec4<f32>,
|
|
uInputClamp:vec4<f32>,
|
|
uOutputFrame:vec4<f32>,
|
|
uGlobalFrame:vec4<f32>,
|
|
uOutputTexture:vec4<f32>,
|
|
};
|
|
|
|
struct MaskUniforms {
|
|
uFilterMatrix:mat3x3<f32>,
|
|
uMaskClamp:vec4<f32>,
|
|
uAlpha:f32,
|
|
};
|
|
|
|
|
|
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(0) @binding(2) var uSampler : sampler;
|
|
|
|
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
|
|
struct VSOutput {
|
|
@builtin(position) position: vec4<f32>,
|
|
@location(0) uv : vec2<f32>,
|
|
@location(1) filterUv : vec2<f32>,
|
|
};
|
|
|
|
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
{
|
|
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
|
|
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
|
|
return vec4(position, 0.0, 1.0);
|
|
}
|
|
|
|
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
}
|
|
|
|
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
}
|
|
|
|
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
}
|
|
|
|
fn getSize() -> vec2<f32>
|
|
{
|
|
|
|
|
|
return gfu.uGlobalFrame.zw;
|
|
}
|
|
|
|
@vertex
|
|
fn mainVertex(
|
|
@location(0) aPosition : vec2<f32>,
|
|
) -> VSOutput {
|
|
return VSOutput(
|
|
filterVertexPosition(aPosition),
|
|
filterTextureCoord(aPosition),
|
|
getFilterCoord(aPosition)
|
|
);
|
|
}
|
|
|
|
@fragment
|
|
fn mainFragment(
|
|
@location(0) uv: vec2<f32>,
|
|
@location(1) filterUv: vec2<f32>,
|
|
@builtin(position) position: vec4<f32>
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
var maskClamp = filterUniforms.uMaskClamp;
|
|
|
|
var clip = step(3.5,
|
|
step(maskClamp.x, filterUv.x) +
|
|
step(maskClamp.y, filterUv.y) +
|
|
step(filterUv.x, maskClamp.z) +
|
|
step(filterUv.y, maskClamp.w));
|
|
|
|
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
var source = textureSample(uTexture, uSampler, uv);
|
|
|
|
var npmAlpha = 0.0;
|
|
|
|
var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a);
|
|
|
|
var a = (alphaMul * mask.r) * clip;
|
|
|
|
return vec4(source.rgb, source.a) * a;
|
|
}`}),cg,Ub=v(()=>{We(),$n(),Ba(),pi(),ad(),cb(),Ib(),Gb(),Ob(),cg=class extends Wp{constructor(e){let{sprite:t,...i}=e,r=new ul(t.texture),n=new ti({uFilterMatrix:{value:new ke,type:"mat3x3<f32>"},uMaskClamp:{value:r.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"}}),s=Yn.from({vertex:{source:jh,entryPoint:"mainVertex"},fragment:{source:jh,entryPoint:"mainFragment"}}),a=pn.from({vertex:ug,fragment:hg,name:"mask-filter"});super({...i,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=r}apply(e,t,i,r){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,i,r)}}}),dg,fg,$h,Fb=v(()=>{te(),Ir(),Ub(),m(),X(),Fh(),ud(),Ht(),pt(),Ln(),sr(),dg=new g,fg=class extends Ct{constructor(){super(),this.filters=[new cg({sprite:new Ws(Re.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}},$h=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,i){let r=this._renderer;if(r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,canBundle:!1,maskedContainer:t}),e.renderMaskToTexture){let n=e.mask;n.includeInBuild=!0,Wa(n,i,r),n.includeInBuild=!1}r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,canBundle:!1})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,canBundle:!1})}execute(e){let t=this._renderer,i=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let r=Le.get(fg);if(i){e.mask.mask.measurable=!0;let n=k(e.mask.mask,!0,dg);e.mask.mask.measurable=!1,n.ceil();let s=t.renderTarget.renderTarget.colorTexture.source,a=gi.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:n,worldColor:4294967295});let o=r.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:r,maskedContainer:e.maskedContainer,filterTexture:a})}else r.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:r,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let r=this._activeMaskStage[this._activeMaskStage.length-1];i&&(t.type===Ei.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:r.maskedContainer,filterEffect:r.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let r=this._activeMaskStage.pop();i&&gi.returnTexture(r.filterTexture),Le.return(r.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},$h.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"alphaMask"}}),Xh,Db=v(()=>{te(),Xh=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,i){this._renderer.renderPipes.batch.break(i);let r=this._colorStack;r[this._colorStackIndex]=r[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,i){this._renderer.renderPipes.batch.break(i);let r=this._colorStack;this._colorStackIndex--;let n=r[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}},Xh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"colorMask"}}),Yh,Lb=v(()=>{te(),Fh(),ns(),ln(),Yh=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,i){var r;let n=e,s=this._renderer;s.renderPipes.batch.break(i),s.renderPipes.blendMode.setBlendMode(n.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(n);o.instructionsStart=i.instructionSize,Wa(a,i,s),a.includeInBuild=!1,s.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,canBundle:!1});let l=i.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let h=s.renderTarget.renderTarget.uid;(r=this._maskStackHash)[h]??(r[h]=0)}pop(e,t,i){let r=e,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(r.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});let s=this._maskHash.get(e);for(let a=0;a<s.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[s.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;let i=this._renderer,r=i.renderTarget.renderTarget.uid,n=(t=this._maskStackHash)[r]??(t[r]=0);e.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Lt.RENDERING_MASK_ADD,n),n++,i.colorMask.setMask(0)):e.action==="pushMaskEnd"?(i.stencil.setStencilMode(Lt.MASK_ACTIVE,n),i.colorMask.setMask(15)):e.action==="popMaskBegin"?(i.colorMask.setMask(0),n!==0?i.stencil.setStencilMode(Lt.RENDERING_MASK_REMOVE,n):(i.renderTarget.clear(null,li.STENCIL),i.stencil.setStencilMode(Lt.DISABLED,n)),n--):e.action==="popMaskEnd"&&(i.stencil.setStencilMode(Lt.MASK_ACTIVE,n),i.colorMask.setMask(15)),this._maskStackHash[r]=n}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}},Yh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"stencilMask"}}),ja,pg,Nb=v(()=>{Ie(),te(),ja=class mv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ue(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...mv.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},ja.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"background",priority:0},ja.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},pg=ja}),yn,qh,Hb=v(()=>{te(),Ir(),I(),yn={},pe.handle(G.BlendMode,e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");yn[e.name]=e.ref},e=>{delete yn[e.name]}),qh=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e}setBlendMode(e,t,i){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!yn[t],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!yn[t]){F(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[t];i||(i=this._filterHash[t]=new Ct,i.filters=[new yn[t]]);let r={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=r.renderables,e.add(r)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}},qh.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"blendMode"}}),$a,Xa,gg,zb=v(()=>{te(),zi(),pt(),$a={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Xa=class _v{constructor(t){this._renderer=t}_normalizeOptions(t,i={}){return t instanceof Tt||t instanceof Re?{target:t,...i}:{...i,...t}}async image(t){let i=new Image;return i.src=await this.base64(t),i}async base64(t){t=this._normalizeOptions(t,_v.defaultImageOptions);let{format:i,quality:r}=t,n=this.canvas(t);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},$a[i],r)});if(n.toDataURL!==void 0)return n.toDataURL($a[i],r);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:$a[i],quality:r});return new Promise((a,o)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let i=t.target,r=this._renderer;if(i instanceof Re)return r.texture.generateCanvas(i);let n=r.textureGenerator.generateTexture(t),s=r.texture.generateCanvas(n);return n.destroy(),s}pixels(t){t=this._normalizeOptions(t);let i=t.target,r=this._renderer,n=i instanceof Re?i:r.textureGenerator.generateTexture(t),s=r.texture.getPixels(n);return i instanceof Tt&&n.destroy(),s}texture(t){return t=this._normalizeOptions(t),t.target instanceof Re?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let i=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=i.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let i=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let s=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},Xa.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"extract"},Xa.defaultImageOptions={format:"png",quality:1},gg=Xa}),mg,Wb=v(()=>{fi(),pt(),mg=class vv extends Re{static create(t){return new vv({source:new Dt(t)})}resize(t,i,r){return this.source.resize(t,i,r),this}}}),_g,vg,yg,Kh,Vb=v(()=>{Ie(),te(),We(),E(),m(),se(),zi(),Wb(),_g=new ot,vg=new g,yg=[0,0,0,0],Kh=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof Tt&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,i=e.antialias||this._renderer.view.antialias,r=e.target,n=e.clearColor;n?n=Array.isArray(n)&&n.length===4?n:ue.shared.setValue(n).toArray():n=yg;let s=e.frame?.copyTo(_g)||D(r,vg).rectangle;s.width=Math.max(s.width,1/t)|0,s.height=Math.max(s.height,1/t)|0;let a=mg.create({...e.textureSourceOptions,width:s.width,height:s.height,resolution:t,antialias:i}),o=ke.shared.translate(-s.x,-s.y);return this._renderer.render({container:r,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},Kh.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"textureGenerator"}}),Zh,jb=v(()=>{te(),We(),At(),ha(),Nr(),sr(),pi(),Zh=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:i,worldColor:r,offset:n}){let s=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:s,worldTransformMatrix:new ke,worldColor:4294967295,offset:new De},o={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||s.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:r||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=o.projectionMatrix,h.uResolution=o.resolution,h.uWorldTransformMatrix.copyFrom(o.worldTransformMatrix),h.uWorldTransformMatrix.tx-=o.offset.x,h.uWorldTransformMatrix.ty-=o.offset.y,la(o.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Vi,this._activeBindGroups.push(u),u.setResource(l,0)),o.bindGroup=u,this._currentGlobalUniformData=o}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Ei.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ti({uProjectionMatrix:{value:new ke,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}},Zh.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"globalUniforms"}}),xg,Jh,$b=v(()=>{te(),Us(),xg=1,Jh=class{constructor(){this._tasks=[]}init(){Mi.system.add(this._update,this)}repeat(e,t){let i=xg++;return this._tasks.push({func:e,duration:t,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e){this._tasks.splice(t,1);return}}_update(){let e=performance.now();for(let t=0;t<this._tasks.length;t++){let i=this._tasks[t];if(e-i.last>=i.duration){let r=e-i.start;i.func(r),i.last=e}}}destroy(){Mi.system.remove(this._update,this),this._tasks.length=0}},Jh.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"scheduler",priority:0}});function Xb(e){if(!Qh){if(vt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${eu} (${e}) http://www.pixijs.com/
|
|
|
|
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${eu} - ${e} - http://www.pixijs.com/`);Qh=!0}}var Qh,eu,Yb=v(()=>{Ft(),Qh=!1,eu="8.3.3"}),Ya,qb=v(()=>{te(),Yb(),sr(),Ya=class{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===Ei.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),Xb(t)}}},Ya.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"hello",priority:-2},Ya.defaultOptions={hello:!1}}),qa,bg,Kb=v(()=>{te(),qa=class yv{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t={...yv.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,i){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=i.tick}run(){let t=performance.now(),i=this._managedRenderables,r=this._renderer.renderPipes,n=0;for(let s=0;s<i.length;s++){let a=i[s],o=(a.renderGroup??a.parentRenderGroup)?.instructionSet?.tick??-1;a._lastInstructionTick!==o&&t-a._lastUsed>this.maxUnusedTime?(a.destroyed||r[a.renderPipeId].destroyRenderable(a),a._lastInstructionTick=-1,n++):i[s-n]=a}i.length=i.length-n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}},qa.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"renderableGC"},qa.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},bg=qa}),Ka,wg,Zb=v(()=>{te(),Ka=class xv{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...xv.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let i=0;i<t.length;i++){let r=t[i];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}},Ka.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"textureGC"},Ka.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600},wg=Ka}),tu,Za,Tg=v(()=>{bt(),fi(),pt(),tu=class bv{constructor(t={}){if(this.uid=at("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...bv.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let i=0;i<t.colorTextures;i++)this.colorTextures.push(new Dt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let i=this.colorTexture.source;this.resize(i.width,i.height,i._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof Re||t.depthStencilTexture instanceof Dt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Dt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,i,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(t,i,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,i,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},tu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},Za=tu});function Sg(e,t){if(!xn.has(e)){let i=new Re({source:new Lr({resource:e,...t})}),r=()=>{xn.get(e)===i&&xn.delete(e)};i.once("destroy",r),i.source.once("destroy",r),xn.set(e,i)}return xn.get(e)}var xn,Eg=v(()=>{Vs(),pt(),xn=new Map}),Ja,Ag,Jb=v(()=>{Ft(),te(),E(),wt(),Tg(),Eg(),Ja=class wv{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...wv.defaultOptions,...t},t.view&&(Xe(Ve,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new ot(0,0,t.width,t.height),this.canvas=t.canvas||vt.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Sg(this.canvas,t),this.renderTarget=new Za({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,i,r){this.texture.source.resize(t,i,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${i}px`)}destroy(t=!1){(typeof t=="boolean"?t:t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},Ja.extension={type:[G.WebGLSystem,G.WebGPUSystem,G.CanvasSystem],name:"view",priority:0},Ja.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},Ag=Ja}),iu,ru,Cg=v(()=>{_b(),vb(),Rb(),kb(),lg(),Bb(),Fb(),Db(),Lb(),Nb(),Hb(),zb(),Vb(),jb(),$b(),qb(),Kb(),Zb(),Jb(),iu=[pg,Zh,Ya,Ag,Nh,wg,Kh,gg,Wh,bg,Jh],ru=[qh,Vh,Hh,Uh,$h,Yh,Xh,Oh]}),nu,Qb=v(()=>{te(),nu=class{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,i){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,i)}_createBindGroup(e,t,i){let r=this._gpu.device,n=t.layout[i],s=[],a=this._renderer;for(let h in n){let u=e.resources[h]??e.resources[n[h]],d;if(u._resourceType==="uniformGroup"){let p=u;a.ubo.updateUniformGroup(p);let f=p.buffer;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="buffer"){let p=u;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="bufferResource"){let p=u;d={buffer:a.buffer.getGPUBuffer(p.buffer),offset:p.offset,size:p.size}}else if(u._resourceType==="textureSampler"){let p=u;d=a.texture.getGpuSampler(p)}else if(u._resourceType==="textureSource"){let p=u;d=a.texture.getGpuSource(p).createView({})}s.push({binding:n[h],resource:d})}let o=a.shader.getProgramData(t).bindGroups[i],l=r.createBindGroup({layout:o,entries:s});return this._hash[e._key]=l,l}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}},nu.extension={type:[G.WebGPUSystem],name:"bindGroup"}}),su,e1=v(()=>{te(),Sd(),su=class{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),i=e.data;return e._updateID&&i&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,i.buffer,0,(e._updateSize||i.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(Al(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}},su.extension={type:[G.WebGPUSystem],name:"buffer"}}),au,t1=v(()=>{te(),au=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}},au.extension={type:[G.WebGPUSystem],name:"colorMask"}}),Qa,i1=v(()=>{Ft(),te(),Qa=class{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(e).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await vt.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>t.features.has(n)),r=await t.requestDevice({requiredFeatures:i});return{adapter:t,device:r}}destroy(){this.gpu=null,this._renderer=null}},Qa.extension={type:[G.WebGPUSystem],name:"device"},Qa.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),ou,r1=v(()=>{te(),ou=class{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,i,r){let n=this._renderer.pipeline.getPipeline(e,t,i,r);this.setPipeline(n)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,i){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let r=this._renderer.bindGroup.getBindGroup(t,i,e);this.renderPassEncoder.setBindGroup(e,r)}setGeometry(e,t){for(let i in t.attributeData)this._setVertexBuffer(t.attributeData[i].location,e.attributes[i].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let i in e.groups){let r=e.groups[i];t||this._syncBindGroup(r),this.setBindGroup(i,r,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let i=e.resources[t];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(e){let{geometry:t,shader:i,state:r,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=e;this.setPipelineFromGeometryProgramAndState(t,i.gpuProgram,r,n),this.setGeometry(t,i.gpuProgram),this._setShaderBindGroups(i,l),t.indexBuffer?this.renderPassEncoder.drawIndexed(s||t.indexBuffer.data.length,o||t.instanceCount,a||0):this.renderPassEncoder.draw(s||t.getSize(),o||t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,i={...this._boundVertexBuffer},r=this._boundIndexBuffer,n={...this._boundBindGroup};this._clearCache();let s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(t);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(r)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}},ou.extension={type:[G.WebGPUSystem],name:"encoder",priority:1}}),lu,n1=v(()=>{te(),ln(),lu=class{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Lt.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=e,i.stencilReference=t;let r=this._renderer;r.pipeline.setStencilMode(e),r.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},lu.extension={type:[G.WebGPUSystem],name:"stencil"}}),hu,Mg=v(()=>{jp(),un(),zr(),hu=class{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!Vp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new wi({data:new Float32Array(t.layout.size/4),usage:tt.UNIFORM|tt.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,i=this._syncFunctionHash[t];if(!i){let r=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),n=this._adaptor.createUboElements(r),s=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[t]={layout:n,syncFunction:s}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,i){let r=this.getUniformGroupData(e);return e.buffer||(e.buffer=new wi({data:new Float32Array(r.layout.size/4),usage:tt.UNIFORM|tt.COPY_DST})),t||(t=e.buffer.data),i||(i=0),r.syncFunction(e.uniforms,t,i),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}});function s1(e){let t=e.map(r=>({data:r,offset:0,size:0})),i=0;for(let r=0;r<t.length;r++){let n=t[r],s=os[n.data.type].size,a=os[n.data.type].align;if(!os[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(s=Math.max(s,a)*n.data.size),i=Math.ceil(i/a)*a,n.size=s,n.offset=i,i+=s}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}var os,Pg=v(()=>{"use strict";os={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}}),Er,Rg=v(()=>{"use strict";Er=[{type:"mat3x3<f32>",test:e=>e.value.a!==void 0,ubo:`
|
|
var matrix = uv[name].toArray(true);
|
|
data[offset] = matrix[0];
|
|
data[offset + 1] = matrix[1];
|
|
data[offset + 2] = matrix[2];
|
|
data[offset + 4] = matrix[3];
|
|
data[offset + 5] = matrix[4];
|
|
data[offset + 6] = matrix[5];
|
|
data[offset + 8] = matrix[6];
|
|
data[offset + 9] = matrix[7];
|
|
data[offset + 10] = matrix[8];
|
|
`,uniform:`
|
|
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
`},{type:"vec4<f32>",test:e=>e.type==="vec4<f32>"&&e.size===1&&e.value.width!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.x;
|
|
data[offset + 1] = v.y;
|
|
data[offset + 2] = v.width;
|
|
data[offset + 3] = v.height;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
cv[0] = v.x;
|
|
cv[1] = v.y;
|
|
cv[2] = v.width;
|
|
cv[3] = v.height;
|
|
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
}
|
|
`},{type:"vec2<f32>",test:e=>e.type==="vec2<f32>"&&e.size===1&&e.value.x!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.x;
|
|
data[offset + 1] = v.y;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
cv[0] = v.x;
|
|
cv[1] = v.y;
|
|
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
}
|
|
`},{type:"vec4<f32>",test:e=>e.type==="vec4<f32>"&&e.size===1&&e.value.red!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.red;
|
|
data[offset + 1] = v.green;
|
|
data[offset + 2] = v.blue;
|
|
data[offset + 3] = v.alpha;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
cv[0] = v.red;
|
|
cv[1] = v.green;
|
|
cv[2] = v.blue;
|
|
cv[3] = v.alpha;
|
|
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
}
|
|
`},{type:"vec3<f32>",test:e=>e.type==="vec3<f32>"&&e.size===1&&e.value.red!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.red;
|
|
data[offset + 1] = v.green;
|
|
data[offset + 2] = v.blue;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
cv[0] = v.red;
|
|
cv[1] = v.green;
|
|
cv[2] = v.blue;
|
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
}
|
|
`}]});function kg(e,t,i,r){let n=[`
|
|
var v = null;
|
|
var v2 = null;
|
|
var t = 0;
|
|
var index = 0;
|
|
var name = null;
|
|
var arrayOffset = null;
|
|
`],s=0;for(let o=0;o<e.length;o++){let l=e[o],h=l.data.name,u=!1,d=0;for(let p=0;p<Er.length;p++)if(Er[p].test(l.data)){d=l.offset/4,n.push(`name = "${h}";`,`offset += ${d-s};`,Er[p][t]||Er[p].ubo),u=!0;break}if(!u)if(l.data.size>1)d=l.offset/4,n.push(i(l,d-s));else{let p=r[l.data.type];d=l.offset/4,n.push(`
|
|
v = uv.${h};
|
|
offset += ${d-s};
|
|
${p};
|
|
`)}s=d}let a=n.join(`
|
|
`);return new Function("uv","data","offset",a)}var Bg=v(()=>{Rg()});function bn(e,t){return`
|
|
for (let i = 0; i < ${e*t}; i++) {
|
|
data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i];
|
|
}
|
|
`}var uu,Ig,Gg=v(()=>{"use strict";uu={f32:`
|
|
data[offset] = v;`,i32:`
|
|
data[offset] = v;`,"vec2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 4] = v[2];
|
|
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 4] = v[3];
|
|
data[offset + 5] = v[4];
|
|
data[offset + 6] = v[5];
|
|
data[offset + 8] = v[6];
|
|
data[offset + 9] = v[7];
|
|
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
for (let i = 0; i < 16; i++) {
|
|
data[offset + i] = v[i];
|
|
}`,"mat3x2<f32>":bn(3,2),"mat4x2<f32>":bn(4,2),"mat2x3<f32>":bn(2,3),"mat4x3<f32>":bn(4,3),"mat2x4<f32>":bn(2,4),"mat3x4<f32>":bn(3,4)},Ig={...uu,"mat2x2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 3] = v[3];
|
|
`}});function a1(e,t){let{size:i,align:r}=os[e.data.type],n=(r-i)/4;return`
|
|
v = uv.${e.data.name};
|
|
${t!==0?`offset += ${t};`:""}
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${e.data.size*(i/4)}; i++)
|
|
{
|
|
for(var j = 0; j < ${i/4}; j++)
|
|
{
|
|
data[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var o1=v(()=>{Pg()});function l1(e){return kg(e,"uboWgsl",a1,Ig)}var h1=v(()=>{Bg(),Gg(),o1()}),cu,u1=v(()=>{te(),Mg(),Pg(),h1(),cu=class extends hu{constructor(){super({createUboElements:s1,generateUboSync:l1})}},cu.extension={type:[G.WebGPUSystem],name:"ubo"}}),eo,du=v(()=>{xt(),bt(),eo=class extends Je{constructor({buffer:e,offset:t,size:i}){super(),this.uid=at("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=at("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=at("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),Og,c1=v(()=>{"use strict";Og=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let t=this.byteIndex,i=t+e*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let i=0;i<e.length;i++)this.data[t/4+i]=e[i];return t}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}}),ar,fu,d1=v(()=>{te(),un(),du(),zr(),c1(),Nr(),ar=128,fu=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new Og({minUniformOffsetAlignment:ar});let t=256/ar;for(let i=0;i<t;i++){let r=tt.UNIFORM|tt.COPY_DST;i===0&&(r|=tt.COPY_SRC),this._buffers.push(new wi({data:this._batchBuffer.data,usage:r}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let e in this._bindGroupHash)this._bindGroupHash[e]=null;this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);let i=e.buffer.data,r=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,r/4),this._bindGroupHash[e.uid]=this._getBindGroup(r/ar),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);let t=e.buffer.data,i=this._batchBuffer.addGroup(t);return this._getBufferResource(i/ar)}getArrayBindGroup(e){let t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/ar)}getArrayBufferResource(e){let t=this._batchBuffer.addGroup(e)/ar;return this._getBufferResource(t)}_getBufferResource(e){if(!this._bufferResources[e]){let t=this._buffers[e%2];this._bufferResources[e]=new eo({buffer:t,offset:(e/2|0)*256,size:ar})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){let t=new Vi({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){let e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);let i=this._renderer.gpu.device.createCommandEncoder();for(let r=1;r<this._buffers.length;r++){let n=this._buffers[r];i.copyBufferToBuffer(e.getGPUBuffer(t),ar,e.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}},fu.extension={type:[G.WebGPUPipes],name:"uniformBatch"}});function Ug(e,t){for(let i in e.attributes){let r=e.attributes[i],n=t[i];n?(r.format??(r.format=n.format),r.offset??(r.offset=n.offset),r.instance??(r.instance=n.instance)):F(`Attribute ${i} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}f1(e)}function f1(e){let{buffers:t,attributes:i}=e,r={},n={};for(let s in t){let a=t[s];r[a.uid]=0,n[a.uid]=0}for(let s in i){let a=i[s];r[a.buffer.uid]+=Xn(a.format).stride}for(let s in i){let a=i[s];a.stride??(a.stride=r[a.buffer.uid]),a.start??(a.start=n[a.buffer.uid]),n[a.buffer.uid]+=Xn(a.format).stride}}var Fg=v(()=>{I(),Ra()}),Ar,Dg=v(()=>{ln(),Ar=[],Ar[Lt.NONE]=void 0,Ar[Lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Ar[Lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Ar[Lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Ar[Lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}}});function p1(e,t,i,r,n){return e<<24|t<<16|i<<10|r<<5|n}function g1(e,t,i,r){return i<<6|e<<3|r<<1|t}var Lg,pu,m1=v(()=>{te(),I(),Fg(),ln(),ca(),Dg(),Lg={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},pu=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Lt.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Ar[e],this._updatePipeHash())}setPipeline(e,t,i,r){let n=this.getPipeline(e,t,i);r.setPipeline(n)}getPipeline(e,t,i,r){e._layoutKey||(Ug(e,t.attributeData),this._generateBufferKey(e)),r=r||e.topology;let n=p1(e._layoutKey,t._layoutKey,i.data,i._blendModeId,Lg[r]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(e,t,i,r),this._pipeCache[n])}_createPipeline(e,t,i,r){let n=this._gpu.device,s=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Lt.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(t).pipeline,l={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:r,cullMode:i.cullMode},layout:o,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),n.createRenderPipeline(l)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],i=0,r=Object.keys(e.attributes).sort();for(let s=0;s<r.length;s++){let a=e.attributes[r[s]];t[i++]=a.offset,t[i++]=a.format,t[i++]=a.stride,t[i++]=a.instance}let n=t.join("|");return e._layoutKey=Dn(n,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){let t=[],i=0,r=Object.keys(e.attributeData).sort();for(let s=0;s<r.length;s++){let a=e.attributeData[r[s]];t[i++]=a.location}let n=t.join("|");return e._attributeLocationsKey=Dn(n,"programAttributes"),e._attributeLocationsKey}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);let i=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let r=[];return e.buffers.forEach(n=>{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in t.attributeData){let l=e.attributes[o];(l.divisor??1)!==1&&F(`Attribute ${o} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===n&&(s.arrayStride=l.stride,s.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&r.push(s)}),this._bufferLayoutsCache[i]=r,r}_updatePipeHash(){let e=g1(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},pu.extension={type:[G.WebGPUSystem],name:"pipeline"}});function _1(e,t,i,r,n,s){let a=s?1:-1;return e.identity(),e.a=1/r*2,e.d=a*(1/n*2),e.tx=-1-t*e.a,e.ty=-a-i*e.d,e}var v1=v(()=>{"use strict"});function y1(e){let t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var x1=v(()=>{"use strict"}),gu,Ng=v(()=>{We(),E(),ns(),v1(),$p(),Vs(),fi(),pt(),Eg(),x1(),Tg(),gu=class{constructor(e){this.rootViewPort=new ot,this.viewport=new ot,this.onRenderTargetChange=new Rh("onRenderTargetChange"),this.projectionMatrix=new ke,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:i,frame:r}){this._renderTargetStack.length=0,this.push(e,t,i,r),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=y1(this.rootRenderTarget)}bind(e,t=!0,i,r){let n=this.getRenderTarget(e),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=e;let a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);let o=n.colorTexture,l=this.viewport,h=o.pixelWidth,u=o.pixelHeight;if(!r&&e instanceof Re&&(r=e.frame),r){let d=o._resolution;l.x=r.x*d+.5|0,l.y=r.y*d+.5|0,l.width=r.width*d+.5|0,l.height=r.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return _1(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,t,i,l),s&&this.onRenderTargetChange.emit(n),n}clear(e,t=li.ALL,i){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=li.ALL,i,r){let n=this.bind(e,t,i,r);return this._renderTargetStack.push({renderTarget:n,frame:r}),n}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,i,r,n){i.x<0&&(r.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(r.height+=i.y,n.y-=i.y,i.y=0);let{pixelWidth:s,pixelHeight:a}=e;return r.width=Math.min(r.width,s-i.x),r.height=Math.min(r.height,a-i.y),this.adaptor.copyToTexture(e,t,i,r,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return Lr.test(e)&&(e=Sg(e).source),e instanceof Za?t=e:e instanceof Dt&&(t=new Za({colorTextures:[e]}),Lr.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[t.uid];i&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}}}),Hg,b1=v(()=>{"use strict";Hg=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),zg,w1=v(()=>{ns(),Vs(),fi(),b1(),zg=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,i,r,n){let s=this._renderer,a=this._getGpuColorTexture(e),o=s.texture.getGpuSource(t.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:o,origin:n},r),t}startRenderPass(e,t=!0,i,r){let n=this._renderTargetSystem.getGpuRenderTarget(e),s=this.getDescriptor(e,t,i);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(r)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,i){typeof t=="boolean"&&(t=t?li.ALL:li.NONE);let r=this._renderTargetSystem,n=r.getGpuRenderTarget(e),s=e.colorTextures.map((o,l)=>{let h=n.contexts[l],u,d;h?u=h.getCurrentTexture().createView():u=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(d=u,u=this._renderer.texture.getTextureView(n.msaaTextures[l]));let p=t&li.COLOR?"clear":"load";return i??(i=r.defaultClearColor),{view:u,resolveTarget:d,clearValue:i,storeOp:"store",loadOp:p}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=n.msaa?4:1),e.depthStencilTexture){let o=t&li.STENCIL?"clear":"load",l=t&li.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(e,t=!0,i,r){if(!t)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(e,t,i),h=o.beginRenderPass(l);h.setViewport(r.x,r.y,r.width,r.height,0,1),h.end();let u=o.finish();a.queue.submit([u])}else this.startRenderPass(e,t,i,r)}initGpuRenderTarget(e){e.isRoot=!0;let t=new Hg;return e.colorTextures.forEach((i,r)=>{if(Lr.test(i.resource)){let n=i.resource.getContext("webgpu"),s=i.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(a){console.error(a)}t.contexts[r]=n}if(t.msaa=i.source.antialias,i.source.antialias){let n=new Dt({width:0,height:0,sampleCount:4});t.msaaTextures[r]=n}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((i,r)=>{t.msaaTextures[r]?.resize(i.source.width,i.source.height,i.source._resolution)})}}}),mu,T1=v(()=>{te(),Ng(),w1(),mu=class extends gu{constructor(e){super(e),this.adaptor=new zg,this.adaptor.init(e,this)}},mu.extension={type:[G.WebGPUSystem],name:"renderTarget"}}),_u,S1=v(()=>{te(),_u=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let t=this._gpu.device,i=e.gpuLayout.map(n=>t.createBindGroupLayout({entries:n})),r={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:t.createPipelineLayout(r)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},_u.extension={type:[G.WebGPUSystem],name:"shader"}}),ii,E1=v(()=>{"use strict";ii={},ii.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},ii.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},ii.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},ii.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ii.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ii.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},ii["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},ii["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},ii["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},ii.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},ii.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},ii.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),vu,A1=v(()=>{te(),nr(),E1(),vu=class{constructor(){this.defaultState=new ji,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:ii[e.blendMode]||ii.normal}]}destroy(){this.gpu=null}},vu.extension={type:[G.WebGPUSystem],name:"state"}}),Wg,C1=v(()=>{"use strict";Wg={type:"image",upload(e,t,i){let r=e.resource,n=(e.pixelWidth|0)*(e.pixelHeight|0),s=r.byteLength/n;i.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelHeight*s},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}}}),yu,Vg,jg,M1=v(()=>{"use strict";yu={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Vg={blockBytes:4,blockWidth:1,blockHeight:1},jg={type:"compressed",upload(e,t,i){let r=e.pixelWidth,n=e.pixelHeight,s=yu[e.format]||Vg;for(let a=0;a<e.resource.length;a++){let o=e.resource[a],l=Math.ceil(r/s.blockWidth)*s.blockBytes;i.device.queue.writeTexture({texture:t,mipLevel:a},o,{offset:0,bytesPerRow:l},{width:Math.ceil(r/s.blockWidth)*s.blockWidth,height:Math.ceil(n/s.blockHeight)*s.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),n=Math.max(n>>1,1)}}}}),xu,$g=v(()=>{"use strict";xu={type:"image",upload(e,t,i){let r=e.resource;if(!r)return;let n=Math.min(t.width,e.resourceWidth||e.pixelWidth),s=Math.min(t.height,e.resourceHeight||e.pixelHeight),a=e.alphaMode==="premultiply-alpha-on-upload";i.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:a},{width:n,height:s})}}}),Xg,P1=v(()=>{$g(),Xg={type:"video",upload(e,t,i){xu.upload(e,t,i)}}}),Yg,R1=v(()=>{"use strict";Yg=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position : vec4<f32>,
|
|
@location(0) texCoord : vec2<f32>,
|
|
};
|
|
|
|
@vertex
|
|
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
var output : VertexOutput;
|
|
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
return output;
|
|
}
|
|
|
|
@group(0) @binding(0) var imgSampler : sampler;
|
|
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
|
|
@fragment
|
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
return textureSample(img, imgSampler, texCoord);
|
|
}
|
|
`})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=e,r=e.depthOrArrayLayers||1,n=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};i=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let o=0;o<r;++o){let l=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),h=n?1:0;for(let u=1;u<e.mipLevelCount;++u){let d=i.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),p=s.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),f=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});p.setPipeline(t),p.setBindGroup(0,f),p.draw(3,1,0,0),p.end(),l=d}}if(!n){let o={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:r};for(let l=1;l<e.mipLevelCount;++l)s.copyTextureToTexture({texture:i,mipLevel:l-1},{texture:e,mipLevel:l},o),o.width=Math.ceil(o.width/2),o.height=Math.ceil(o.height/2)}return this.device.queue.submit([s.finish()]),n||i.destroy(),e}}}),bu,k1=v(()=>{Ft(),te(),pi(),pa(),Nr(),C1(),M1(),$g(),P1(),R1(),bu=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:xu,buffer:Wg,video:Xg,compressed:jg},this._renderer=e}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let o=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(o))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let i=yu[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},r=Math.ceil(e.pixelWidth/i.blockWidth)*i.blockWidth,n=Math.ceil(e.pixelHeight/i.blockHeight)*i.blockHeight,s={label:e.label,size:{width:r,height:n},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(s);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Yg(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new Vi({0:t,1:t.style,2:new ti({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,i=t.gpu.device.createCommandEncoder(),r=vt.get().createCanvas();r.width=e.source.pixelWidth,r.height=e.source.pixelHeight;let n=r.getContext("webgpu");return n.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:vt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:r.width,height:r.height}),t.gpu.device.queue.submit([i.finish()]),r}getPixels(e){let t=this.generateCanvas(e),i=$i.getOptimalCanvasAndContext(t.width,t.height),r=i.context;r.drawImage(t,0,0);let{width:n,height:s}=t,a=r.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return $i.returnCanvasAndContext(i),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},bu.extension={type:[G.WebGPUSystem],name:"texture"}}),qg={};ze(qg,{WebGPURenderer:()=>Qg});var Kg,Zg,Jg,wu,Tu,Su,Qg,B1=v(()=>{te(),pb(),gb(),mb(),za(),Cg(),sr(),Qb(),e1(),t1(),i1(),r1(),n1(),u1(),d1(),m1(),T1(),S1(),A1(),k1(),Kg=[...iu,cu,ou,Qa,su,bu,mu,_u,vu,pu,au,lu,nu],Zg=[...ru,fu],Jg=[Gh,Ih,Bh],wu=[],Tu=[],Su=[],pe.handleByNamedList(G.WebGPUSystem,wu),pe.handleByNamedList(G.WebGPUPipes,Tu),pe.handleByNamedList(G.WebGPUPipesAdaptor,Su),pe.add(...Kg,...Zg,...Jg),Qg=class extends ss{constructor(){let e={name:"webgpu",type:Ei.WEBGPU,systems:wu,renderPipes:Tu,renderPipeAdaptors:Su};super(e)}}}),Eu,I1=v(()=>{te(),We(),xr(),Tr(),Zn(),Jn(),ts(),Sr(),oh(),Yi(),pi(),Eu=class{init(){let e=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new ke,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),t=yr(),i=Kn({name:"graphics",bits:[Oa,nh(t),Na,_n]});this.shader=new ki({glProgram:i,resources:{localUniforms:e,batchSamplers:sh(t)}})}execute(e,t){let i=t.context,r=i.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{geometry:a,instructions:o}=s.getContextRenderData(i);r.groups[0]=n.globalUniforms.bindGroup,n.state.set(e.state),n.shader.bind(r),n.geometry.bind(a,r.glProgram);let l=o.instructions;for(let h=0;h<o.instructionSize;h++){let u=l[h];if(u.size){for(let d=0;d<u.textures.count;d++)n.texture.bind(u.textures.textures[d],d);n.geometry.draw("triangle-list",u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}},Eu.extension={type:[G.WebGLPipesAdaptor],name:"graphics"}}),Au,G1=v(()=>{te(),We(),Tr(),ts(),Sr(),Kp(),Yi(),pt(),I(),Au=class{init(){let e=Kn({name:"mesh",bits:[Na,qp,_n]});this._shader=new ki({glProgram:e,resources:{uTexture:Re.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new ke}}}})}execute(e,t){let i=e.renderer,r=t._shader;if(r){if(!r.glProgram){F("Mesh shader has no glProgram",t.shader);return}}else{r=this._shader;let n=t.texture,s=n.source;r.resources.uTexture=s,r.resources.uSampler=s.style,r.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}r.groups[100]=i.globalUniforms.bindGroup,r.groups[101]=e.localUniformsBindGroup,i.encoder.draw({geometry:t._geometry,shader:r,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Au.extension={type:[G.WebGLPipesAdaptor],name:"mesh"}}),Cu,O1=v(()=>{te(),Tr(),Zn(),Jn(),Sr(),oh(),Yi(),nr(),xr(),Cu=class{constructor(){this._didUpload=!1,this._tempState=ji.for2d()}init(e){let t=yr(),i=Kn({name:"batch",bits:[Oa,nh(t),_n]});this._shader=new ki({glProgram:i,resources:{batchSamplers:sh(t)}}),e.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(e,t){let i=e.renderer;i.shader.bind(this._shader,this._didUpload),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(t,this._shader.glProgram)}execute(e,t){let i=e.renderer;this._didUpload=!0,this._tempState.blendMode=t.blendMode,i.state.set(this._tempState);let r=t.textures.textures;for(let n=0;n<t.textures.count;n++)i.texture.bind(r[n],n);i.geometry.draw("triangle-list",t.size,t.start)}destroy(){this._shader.destroy(!0),this._shader=null}},Cu.extension={type:[G.WebGLPipesAdaptor],name:"batch"}}),ls,U1=v(()=>{"use strict";ls=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e))(ls||{})}),em,F1=v(()=>{"use strict";em=class{constructor(e,t){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}}),Mu,D1=v(()=>{te(),zr(),U1(),F1(),Mu=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=e}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,i=this.getGlBuffer(e);t.bindBuffer(i.type,i.buffer)}bindBufferBase(e,t){let{_gl:i}=this;if(this._boundBufferBases[t]!==e){let r=this.getGlBuffer(e);this._boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,i){let{_gl:r}=this;i=i||0;let n=this.getGlBuffer(e);r.bindBufferRange(r.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}updateBuffer(e){let{_gl:t}=this,i=this.getGlBuffer(e);if(e._updateID===i.updateID)return i;i.updateID=e._updateID,t.bindBuffer(i.type,i.buffer);let r=e.data;if(i.byteLength>=e.data.byteLength)t.bufferSubData(i.type,0,r,0,e._updateSize/r.BYTES_PER_ELEMENT);else{let n=e.descriptor.usage&tt.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;i.byteLength=r.byteLength,t.bufferData(i.type,r,n)}return i}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let i=this._gpuBuffers[e.uid],r=this._gl;t||r.deleteBuffer(i.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,i=ls.ARRAY_BUFFER;e.descriptor.usage&tt.INDEX?i=ls.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&tt.UNIFORM&&(i=ls.UNIFORM_BUFFER);let r=new em(t.createBuffer(),i);return this._gpuBuffers[e.uid]=r,e.on("destroy",this.onBufferDestroy,this),r}},Mu.extension={type:[G.WebGLSystem],name:"buffer"}}),to,tm,L1=v(()=>{Ft(),te(),I(),to=class Tv{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){if(t={...Tv.defaultOptions,...t},t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,r=t.premultipliedAlpha??!0,n=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:r,antialias:n,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof vt.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let i=this._renderer.view.canvas;i.addEventListener("webglcontextlost",this.handleContextLost,!1),i.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,i){let r,n=this._renderer.view.canvas;if(t===2&&(r=n.getContext("webgl2",i)),!r&&(r=n.getContext("webgl",i),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,i={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"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...i,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"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...i,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let i=t.getContextAttributes();i&&!i.stencil&&F("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,n=this.webGLVersion===2,s=this.extensions;r.uint32Indices=n||!!s.uint32ElementIndex,r.uniformBufferObject=n,r.vertexArrayObject=n||!!s.vertexArrayObject,r.srgbTextures=n||!!s.srgb,r.nonPowOf2wrapping=n,r.nonPowOf2mipmaps=n,r.msaa=n,r.uint32Indices||F("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},to.extension={type:[G.WebGLSystem],name:"context"},to.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2},tm=to}),io,Pu,Qe,im=v(()=>{"use strict";io=(e=>(e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.RG=33319]="RG",e[e.RED=6403]="RED",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e))(io||{}),Pu=(e=>(e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e))(Pu||{}),Qe=(e=>(e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.BYTE=5120]="BYTE",e[e.SHORT=5122]="SHORT",e[e.INT=5124]="INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.HALF_FLOAT=36193]="HALF_FLOAT",e))(Qe||{})});function N1(e){return Ru[e]??Ru.float32}var Ru,H1=v(()=>{im(),Ru={uint8x2:Qe.UNSIGNED_BYTE,uint8x4:Qe.UNSIGNED_BYTE,sint8x2:Qe.BYTE,sint8x4:Qe.BYTE,unorm8x2:Qe.UNSIGNED_BYTE,unorm8x4:Qe.UNSIGNED_BYTE,snorm8x2:Qe.BYTE,snorm8x4:Qe.BYTE,uint16x2:Qe.UNSIGNED_SHORT,uint16x4:Qe.UNSIGNED_SHORT,sint16x2:Qe.SHORT,sint16x4:Qe.SHORT,unorm16x2:Qe.UNSIGNED_SHORT,unorm16x4:Qe.UNSIGNED_SHORT,snorm16x2:Qe.SHORT,snorm16x4:Qe.SHORT,float16x2:Qe.HALF_FLOAT,float16x4:Qe.HALF_FLOAT,float32:Qe.FLOAT,float32x2:Qe.FLOAT,float32x3:Qe.FLOAT,float32x4:Qe.FLOAT,uint32:Qe.UNSIGNED_INT,uint32x2:Qe.UNSIGNED_INT,uint32x3:Qe.UNSIGNED_INT,uint32x4:Qe.UNSIGNED_INT,sint32:Qe.INT,sint32x2:Qe.INT,sint32x3:Qe.INT,sint32x4:Qe.INT}}),rm,ku,z1=v(()=>{te(),Ra(),Fg(),H1(),rm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},ku=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=r=>t.bindVertexArrayOES(r),e.deleteVertexArray=r=>t.deleteVertexArrayOES(r));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(e.drawArraysInstanced=(r,n,s,a)=>{i.drawArraysInstancedANGLE(r,n,s,a)},e.drawElementsInstanced=(r,n,s,a,o)=>{i.drawElementsInstancedANGLE(r,n,s,a,o)},e.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let i=this.gl;this._activeGeometry=e;let r=this.getVao(e,t);this._activeVao!==r&&(this._activeVao=r,i.bindVertexArray(r)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let i=0;i<e.buffers.length;i++){let r=e.buffers[i];t.updateBuffer(r)}}checkCompatibility(e,t){let i=e.attributes,r=t._attributeData;for(let n in r)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(e,t){let i=e.attributes,r=t._attributeData,n=["g",e.uid];for(let s in i)r[s]&&n.push(s,r[s].location);return n.join("-")}getVao(e,t){return this._geometryVaoHash[e.uid]?.[t._key]||this.initGeometryVao(e,t)}initGeometryVao(e,t,i=!0){let r=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);let s=this.getSignature(e,t);this._geometryVaoHash[e.uid]||(this._geometryVaoHash[e.uid]=Object.create(null),e.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[e.uid],o=a[s];if(o)return a[t._key]=o,o;Ug(e,t._attributeData);let l=e.buffers;o=r.createVertexArray(),r.bindVertexArray(o);for(let h=0;h<l.length;h++){let u=l[h];n.bind(u)}return this.activateVao(e,t),a[t._key]=o,a[s]=o,r.bindVertexArray(null),o}onGeometryDestroy(e,t){let i=this._geometryVaoHash[e.uid],r=this.gl;if(i){if(t)for(let n in i)this._activeVao!==i[n]&&this.unbind(),r.deleteVertexArray(i[n]);this._geometryVaoHash[e.uid]=null}}destroyAll(e=!1){let t=this.gl;for(let i in this._geometryVaoHash){if(e)for(let r in this._geometryVaoHash[i]){let n=this._geometryVaoHash[i];this._activeVao!==n&&this.unbind(),t.deleteVertexArray(n[r])}this._geometryVaoHash[i]=null}}activateVao(e,t){let i=this._renderer.gl,r=this._renderer.buffer,n=e.attributes;e.indexBuffer&&r.bind(e.indexBuffer);let s=null;for(let a in n){let o=n[a],l=o.buffer,h=r.getGlBuffer(l),u=t._attributeData[a];if(u){s!==h&&(r.bind(l),s=h);let d=u.location;i.enableVertexAttribArray(d);let p=Xn(o.format),f=N1(o.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,p.size,f,o.stride,o.offset):i.vertexAttribPointer(d,p.size,f,p.normalised,o.stride,o.offset),o.instance)if(this.hasInstance){let y=o.divisor??1;i.vertexAttribDivisor(d,y)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,r){let{gl:n}=this._renderer,s=this._activeGeometry,a=rm[s.topology||e];if(r||(r=s.instanceCount),s.indexBuffer){let o=s.indexBuffer.data.BYTES_PER_ELEMENT,l=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;r>1?n.drawElementsInstanced(a,t||s.indexBuffer.data.length,l,(i||0)*o,r):n.drawElements(a,t||s.indexBuffer.data.length,l,(i||0)*o)}else r>1?n.drawArraysInstanced(a,i||0,t||s.getSize(),r):n.drawArrays(a,i||0,t||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}},ku.extension={type:[G.WebGLSystem],name:"geometry"}}),nm,ro,sm,W1=v(()=>{te(),I(),Zs(),Yi(),nr(),fi(),pt(),$n(),nm=new Un({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ro=class Sv{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:i,antialias:r}={...Sv.defaultOptions,...t};this.useBackBuffer=i,this._antialias=r,this._renderer.context.supports.msaa||(F("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=ji.for2d();let n=new pn({vertex:`
|
|
attribute vec2 aPosition;
|
|
out vec2 vUv;
|
|
|
|
void main() {
|
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
|
|
vUv = (aPosition + 1.0) / 2.0;
|
|
|
|
// flip dem UVs
|
|
vUv.y = 1.0 - vUv.y;
|
|
}`,fragment:`
|
|
in vec2 vUv;
|
|
out vec4 finalColor;
|
|
|
|
uniform sampler2D uTexture;
|
|
|
|
void main() {
|
|
finalColor = texture(uTexture, vUv);
|
|
}`,name:"big-triangle"});this._bigTriangleShader=new ki({glProgram:n,resources:{uTexture:Re.WHITE.source}})}renderStart(t){let i=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!i.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:nm,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new Re({source:new Dt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},ro.extension={type:[G.WebGLSystem],name:"backBuffer",priority:1},ro.defaultOptions={useBackBuffer:!1},sm=ro}),Bu,V1=v(()=>{te(),Bu=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}},Bu.extension={type:[G.WebGLSystem],name:"colorMask"}}),Iu,j1=v(()=>{te(),Iu=class{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){let t=this._renderer,{geometry:i,shader:r,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=e;t.shader.bind(r,s),t.geometry.bind(i,t.shader._activeProgram),n&&t.state.set(n),t.geometry.draw(a,o,l,h??i.instanceCount)}destroy(){this._renderer=null}},Iu.extension={type:[G.WebGLSystem],name:"encoder"}}),Gu,$1=v(()=>{te(),Dg(),ln(),Gu=class{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Lt.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Lt.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Lt.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],r=this._gl,n=Ar[e],s=this._stencilCache;if(i.stencilMode=e,i.stencilReference=t,e===Lt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,r.disable(r.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,r.enable(r.STENCIL_TEST)),(e!==s.stencilMode||s.stencilReference!==t)&&(s.stencilMode=e,s.stencilReference=t,r.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],t,255),r.stencilOp(r.KEEP,r.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Gu.extension={type:[G.WebGLSystem],name:"stencil"}});function X1(e){let t=e.map(s=>({data:s,offset:0,size:0})),i=0,r=0,n=0;for(let s=0;s<t.length;s++){let a=t[s];if(i=Ou[a.data.type],!i)throw new Error(`Unknown type ${a.data.type}`);if(a.data.size>1&&(i=Math.max(i,16)*a.data.size),a.size=i,r%i!==0&&r<16){let o=r%i%16;r+=o,n+=o}r+i>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=i,r=i):(a.offset=n,r+=i,n+=i)}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}var Ou,am=v(()=>{"use strict";Ou={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function Y1(e,t){let i=Math.max(Ou[e.data.type]/16,1),r=e.data.value.length/e.data.size,n=(4-r%4)%4;return`
|
|
v = uv.${e.data.name};
|
|
offset += ${t};
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${e.data.size*i}; i++)
|
|
{
|
|
for(var j = 0; j < ${r}; j++)
|
|
{
|
|
data[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var q1=v(()=>{am()});function K1(e){return kg(e,"uboStd40",Y1,uu)}var Z1=v(()=>{Bg(),Gg(),q1()}),Uu,J1=v(()=>{te(),Mg(),am(),Z1(),Uu=class extends hu{constructor(){super({createUboElements:X1,generateUboSync:K1})}},Uu.extension={type:[G.WebGLSystem],name:"ubo"}}),om,Q1=v(()=>{"use strict";om=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),lm,ew=v(()=>{E(),I(),ns(),Q1(),lm=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}copyToTexture(e,t,i,r,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(e),l=a.gl;return this.finishRenderPass(e),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(t,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,i.x,i.y,r.width,r.height),t}startRenderPass(e,t=!0,i,r){let n=this._renderTargetSystem,s=e.colorTexture,a=n.getGpuRenderTarget(e),o=r.y;e.isRoot&&(o=s.pixelHeight-r.height),e.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==r.x||h.y!==o||h.width!==r.width||h.height!==r.height)&&(h.x=r.x,h.y=o,h.width=r.width,h.height=r.height,l.viewport(r.x,o,r.width,r.height)),!a.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(a),this.clear(e,t,i)}finishRenderPass(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);if(!t.msaa)return;let i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,t.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,t.framebuffer),i.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer)}initGpuRenderTarget(e){let t=this._renderer,i=t.gl,r=new om;return e.colorTexture.resource===t.gl.canvas?(r.framebuffer=null,r):(this._initColor(e,r),i.bindFramebuffer(i.FRAMEBUFFER,null),r)}destroyGpuRenderTarget(e){let t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(i=>{t.deleteRenderbuffer(i)}),e.msaaRenderBuffer=null}clear(e,t,i){if(!t)return;let r=this._renderTargetSystem;typeof t=="boolean"&&(t=t?li.ALL:li.NONE);let n=this._renderer.gl;if(t&li.COLOR){i??(i=r.defaultClearColor);let s=this._clearColorCache,a=i;(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2]||s[3]!==a[3])&&(s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(t)}resizeGpuRenderTarget(e){if(e.isRoot)return;let t=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,t),(e.stencil||e.depth)&&this._resizeStencil(t)}_initColor(e,t){let i=this._renderer,r=i.gl,n=r.createFramebuffer();if(t.resolveTargetFramebuffer=n,r.bindFramebuffer(r.FRAMEBUFFER,n),t.width=e.colorTexture.source.pixelWidth,t.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(i.context.supports.msaa?t.msaa=!0:F("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(o,0);let l=i.texture.getGlSource(o).texture;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+a,3553,l,0)}),t.msaa){let s=r.createFramebuffer();t.framebuffer=s,r.bindFramebuffer(r.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=r.createRenderbuffer();t.msaaRenderBuffer[o]=l})}else t.framebuffer=n;this._resizeColor(e,t)}_resizeColor(e,t){let i=e.colorTexture.source;if(t.width=i.pixelWidth,t.height=i.pixelHeight,e.colorTextures.forEach((r,n)=>{n!==0&&r.source.resize(i.width,i.height,i._resolution)}),t.msaa){let r=this._renderer,n=r.gl,s=t.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=a.source;r.texture.bindSource(l,0);let h=r.texture.getGlSource(l).internalFormat,u=t.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,h,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,u)})}}_initStencil(e){if(e.framebuffer===null)return;let t=this._renderer.gl,i=t.createRenderbuffer();e.depthStencilRenderBuffer=i,t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,i),this._resizeStencil(e)}_resizeStencil(e){let t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,this._renderer.context.webGLVersion===2?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}}}),Fu,tw=v(()=>{te(),Ng(),ew(),Fu=class extends gu{constructor(e){super(e),this.adaptor=new lm,this.adaptor.init(e,this)}},Fu.extension={type:[G.WebGLSystem],name:"renderTarget"}});function iw(e,t){let i=[],r=[`
|
|
var g = s.groups;
|
|
var sS = r.shader;
|
|
var p = s.glProgram;
|
|
var ugS = r.uniformGroup;
|
|
var resources;
|
|
`],n=!1,s=0,a=0,o=t._getProgramData(e.glProgram);for(let h in e.groups){let u=e.groups[h];i.push(`
|
|
resources = g[${h}].resources;
|
|
`);for(let d in u.resources){let p=u.resources[d];if(p instanceof ti)p.ubo?i.push(`
|
|
sS.bindUniformBlock(
|
|
resources[${d}],
|
|
sS._uniformBindMap[${h}[${d}],
|
|
${s++}
|
|
);
|
|
`):i.push(`
|
|
ugS.updateUniformGroup(resources[${d}], p, sD);
|
|
`);else if(p instanceof eo)i.push(`
|
|
sS.bindUniformBlock(
|
|
resources[${d}],
|
|
sS._uniformBindMap[${h}[${d}],
|
|
${s++}
|
|
);
|
|
`);else if(p instanceof Dt){let f=e._uniformBindMap[h][d],y=o.uniformData[f];y&&(n||(n=!0,r.push(`
|
|
var tS = r.texture;
|
|
`)),t._gl.uniform1i(y.location,a),i.push(`
|
|
tS.bind(resources[${d}], ${a});
|
|
`),a++)}}}let l=[...r,...i].join(`
|
|
`);return new Function("r","s","sD",l)}var rw=v(()=>{du(),pi(),fi()}),hm,nw=v(()=>{"use strict";hm=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function um(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var sw=v(()=>{"use strict"});function Du(e){let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=!1;return t}function cm(e,t){switch(e){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 Du(2*t);case"bvec3":return Du(3*t);case"bvec4":return Du(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 dm=v(()=>{"use strict"});function fm(e,t){if(!hs){let i=Object.keys(Lu);hs={};for(let r=0;r<i.length;++r){let n=i[r];hs[e[n]]=Lu[n]}}return hs[t]}function aw(e,t){let i=fm(e,t);return pm[i]||"float32"}var hs,Lu,pm,gm=v(()=>{"use strict";hs=null,Lu={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"},pm={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function ow(e,t,i=!1){let r={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let a=0;a<n;a++){let o=t.getActiveAttrib(e,a);if(o.name.startsWith("gl_"))continue;let l=aw(t,o.type);r[o.name]={location:0,format:l,stride:Xn(l).stride,offset:0,instance:!1,start:0}}let s=Object.keys(r);if(i){s.sort((a,o)=>a>o?1:-1);for(let a=0;a<s.length;a++)r[s[a]].location=a,t.bindAttribLocation(e,a,s[a]);t.linkProgram(e)}else for(let a=0;a<s.length;a++)r[s[a]].location=t.getAttribLocation(e,s[a]);return r}var lw=v(()=>{Ra(),gm()});function hw(e,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let i={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n<r;n++){let s=t.getActiveUniformBlockName(e,n),a=t.getUniformBlockIndex(e,s),o=t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE);i[s]={name:s,index:a,size:o}}return i}var uw=v(()=>{"use strict"});function cw(e,t){let i={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<r;n++){let s=t.getActiveUniform(e,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),l=fm(t,s.type);i[a]={name:a,index:n,type:l,size:s.size,isArray:o,value:cm(l,s.size)}}return i}var dw=v(()=>{dm(),gm()});function mm(e,t){let i=e.getShaderSource(t).split(`
|
|
`).map((h,u)=>`${u}: ${h}`),r=e.getShaderInfoLog(t),n=r.split(`
|
|
`),s={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),o=[""];a.forEach(h=>{i[h-1]=`%c${i[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=i.join(`
|
|
`);o[0]=l,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function fw(e,t,i,r){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(i,e.COMPILE_STATUS)||mm(e,i),e.getShaderParameter(r,e.COMPILE_STATUS)||mm(e,r),console.error("PixiJS Error: Could not initialize shader."),e.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}var pw=v(()=>{"use strict"});function gw(e,t){let i=um(e,e.VERTEX_SHADER,t.vertex),r=um(e,e.FRAGMENT_SHADER,t.fragment),n=e.createProgram();e.attachShader(n,i),e.attachShader(n,r);let s=t.transformFeedbackVaryings;s&&(typeof e.transformFeedbackVaryings!="function"?F("TransformFeedback is not supported but TransformFeedbackVaryings are given."):e.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS)),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||fw(e,n,i,r),t._attributeData=ow(n,e,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=cw(n,e),t._uniformBlockData=hw(n,e),e.deleteShader(i),e.deleteShader(r);let a={};for(let o in t._uniformData){let l=t._uniformData[o];a[o]={location:e.getUniformLocation(n,o),value:cm(l.type,l.size)}}return new hm(n,a)}var mw=v(()=>{I(),nw(),sw(),dm(),lw(),uw(),dw(),pw()}),us,Nu,_w=v(()=>{te(),xr(),rw(),mw(),us={textureCount:0,blockIndex:0},Nu=class{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=yr()}bind(e,t){if(this._setProgram(e.glProgram),t)return;us.textureCount=0,us.blockIndex=0;let i=this._shaderSyncFunctions[e.glProgram._key];i||(i=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),i(this._renderer,e,us)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,us)}bindUniformBlock(e,t,i=0){let r=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=e._bufferResource;s&&this._renderer.ubo.updateUniformGroup(e),r.updateBuffer(e.buffer);let a=this._boundUniformsIdsToIndexHash[e.uid];if(a===void 0){let h=this._nextIndex++%this._maxBindings,u=this._boundIndexToUniformsHash[h];u&&(this._boundUniformsIdsToIndexHash[u.uid]=void 0),a=this._boundUniformsIdsToIndexHash[e.uid]=h,this._boundIndexToUniformsHash[h]=e,s?r.bindBufferRange(e.buffer,h,e.offset):r.bindBufferBase(e.buffer,h)}let o=this._gl,l=this._activeProgram._uniformBlockData[t].index;n.uniformBlockBindings[i]!==a&&(n.uniformBlockBindings[i]=a,o.uniformBlockBinding(n.program,l,a))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;let t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){let t=e._key;return this._programDataHash[t]=gw(this._gl,e),this._programDataHash[t]}destroy(){for(let e of Object.keys(this._programDataHash))this._programDataHash[e].destroy(),this._programDataHash[e]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(e,t){return iw(e,t)}},Nu.extension={type:[G.WebGLSystem],name:"shader"}}),_m,vm,vw=v(()=>{"use strict";_m={f32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1f(location, v);
|
|
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2f(location, v[0], v[1]);
|
|
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
}`,i32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1i(location, v);
|
|
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2i(location, v[0], v[1]);
|
|
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
}`,u32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1ui(location, v);
|
|
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2ui(location, v[0], v[1]);
|
|
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
}`,bool:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1i(location, v);
|
|
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2i(location, v[0], v[1]);
|
|
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},vm={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function yw(e,t){let i=[`
|
|
var v = null;
|
|
var cv = null;
|
|
var cu = null;
|
|
var t = 0;
|
|
var gl = renderer.gl;
|
|
var name = null;
|
|
`];for(let r in e.uniforms){if(!t[r]){e.uniforms[r]instanceof ti?e.uniforms[r].ubo?i.push(`
|
|
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
`):i.push(`
|
|
renderer.shader.updateUniformGroup(uv.${r});
|
|
`):e.uniforms[r]instanceof eo&&i.push(`
|
|
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
`);continue}let n=e.uniformStructures[r],s=!1;for(let a=0;a<Er.length;a++){let o=Er[a];if(n.type===o.type&&o.test(n)){i.push(`name = "${r}";`,Er[a].uniform),s=!0;break}}if(!s){let a=(n.size===1?_m:vm)[n.type].replace("location",`ud["${r}"].location`);i.push(`
|
|
cu = ud["${r}"];
|
|
cv = cu.value;
|
|
v = uv["${r}"];
|
|
${a};`)}}return new Function("ud","uv","renderer","syncData",i.join(`
|
|
`))}var xw=v(()=>{du(),pi(),Rg(),vw()}),Hu,bw=v(()=>{te(),xw(),Hu=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let r=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==r.uniformDirtyGroups[e.uid])&&(r.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(r.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),r=this._getSignature(e,t._uniformData,"u");return this._cache[r]||(this._cache[r]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[r],i[t._key]}_generateUniformsSync(e,t){return yw(e,t)}_getSignature(e,t,i){let r=e.uniforms,n=[`${i}-`];for(let s in r)n.push(s),t[s]&&n.push(t[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Hu.extension={type:[G.WebGLSystem],name:"uniformGroup"}});function ww(e){let t={};if(t.normal=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t.add=[e.ONE,e.ONE],t.multiply=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.screen=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t["screen-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.erase=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],!(e instanceof vt.get().getWebGLRenderingContext()))t.min=[e.ONE,e.ONE,e.ONE,e.ONE,e.MIN,e.MIN],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,e.MAX,e.MAX];else{let i=e.getExtension("EXT_blend_minmax");i&&(t.min=[e.ONE,e.ONE,e.ONE,e.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var Tw=v(()=>{Ft()}),ym,xm,bm,wm,Tm,Sm,zu,Em,Sw=v(()=>{te(),nr(),Tw(),ym=0,xm=1,bm=2,wm=3,Tm=4,Sm=5,zu=class Mc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[ym]=this.setBlend,this.map[xm]=this.setOffset,this.map[bm]=this.setCullFace,this.map[wm]=this.setDepthTest,this.map[Tm]=this.setFrontFace,this.map[Sm]=this.setDepthMask,this.checks=[],this.defaultState=ji.for2d()}contextChange(t){this.gl=t,this.blendModesMap=ww(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let i=this.stateId^t.data,r=0;for(;i;)i&1&&this.map[r].call(this,!!(t.data&1<<r)),i=i>>1,r++;this.stateId=t.data}for(let i=0;i<this.checks.length;i++)this.checks[i](this,t)}forceState(t){t=t||this.defaultState;for(let i=0;i<this.map.length;i++)this.map[i].call(this,!!(t.data&1<<i));for(let i=0;i<this.checks.length;i++)this.checks[i](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Mc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Mc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let i=this.blendModesMap[t],r=this.gl;i.length===2?r.blendFunc(i[0],i[1]):r.blendFuncSeparate(i[0],i[1],i[2],i[3]),i.length===6?(this._blendEq=!0,r.blendEquationSeparate(i[4],i[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,i){this.gl.polygonOffset(t,i)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,i){let r=this.checks.indexOf(t);i&&r===-1?this.checks.push(t):!i&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,i){t.setBlendMode(i.blendMode)}static _checkPolygonOffset(t,i){t.setPolygonOffset(1,i.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}},zu.extension={type:[G.WebGLSystem],name:"state"},Em=zu}),Am,Ew=v(()=>{im(),Am=class{constructor(e){this.target=Pu.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=Qe.UNSIGNED_BYTE,this.internalFormat=io.RGBA,this.format=io.RGBA,this.samplerType=0}}}),Cm,Aw=v(()=>{"use strict";Cm={id:"buffer",upload(e,t,i){t.width===e.width||t.height===e.height?i.texSubImage2D(i.TEXTURE_2D,0,0,0,e.width,e.height,t.format,t.type,e.resource):i.texImage2D(t.target,0,t.internalFormat,e.width,e.height,0,t.format,t.type,e.resource),t.width=e.width,t.height=e.height}}}),Mm,Pm,Cw=v(()=>{"use strict";Mm={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Pm={id:"compressed",upload(e,t,i){i.pixelStorei(i.UNPACK_ALIGNMENT,4);let r=e.pixelWidth,n=e.pixelHeight,s=!!Mm[e.format];for(let a=0;a<e.resource.length;a++){let o=e.resource[a];s?i.compressedTexImage2D(i.TEXTURE_2D,a,t.internalFormat,r,n,0,o):i.texImage2D(i.TEXTURE_2D,a,t.internalFormat,r,n,0,t.format,t.type,o),r=Math.max(r>>1,1),n=Math.max(n>>1,1)}}}}),Wu,Rm=v(()=>{"use strict";Wu={id:"image",upload(e,t,i,r){let n=e.alphaMode==="premultiply-alpha-on-upload";i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n);let s=t.width,a=t.height,o=e.pixelWidth,l=e.pixelHeight,h=e.resourceWidth,u=e.resourceHeight;h<o||u<l?((s!==o||a!==l)&&i.texImage2D(t.target,0,t.internalFormat,o,l,0,t.format,t.type,null),r===2?i.texSubImage2D(i.TEXTURE_2D,0,0,0,h,u,t.format,t.type,e.resource):i.texSubImage2D(i.TEXTURE_2D,0,0,0,t.format,t.type,e.resource)):s===o||a===l?i.texSubImage2D(i.TEXTURE_2D,0,0,0,t.format,t.type,e.resource):r===2?i.texImage2D(t.target,0,t.internalFormat,o,l,0,t.format,t.type,e.resource):i.texImage2D(t.target,0,t.internalFormat,t.format,t.type,e.resource),t.width=o,t.height=l}}}),km,Mw=v(()=>{Rm(),km={id:"video",upload(e,t,i,r){if(!e.isValid){i.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Wu.upload(e,t,i,r)}}}),Vu,Bm,no,Im,Pw=v(()=>{"use strict";Vu={linear:9729,nearest:9728},Bm={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},no={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Im={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Gm(e,t,i,r,n,s,a,o){let l=s;if(!o||e.addressModeU!=="repeat"||e.addressModeV!=="repeat"||e.addressModeW!=="repeat"){let h=no[a?"clamp-to-edge":e.addressModeU],u=no[a?"clamp-to-edge":e.addressModeV],d=no[a?"clamp-to-edge":e.addressModeW];t[n](l,t.TEXTURE_WRAP_S,h),t[n](l,t.TEXTURE_WRAP_T,u),t.TEXTURE_WRAP_R&&t[n](l,t.TEXTURE_WRAP_R,d)}if((!o||e.magFilter!=="linear")&&t[n](l,t.TEXTURE_MAG_FILTER,Vu[e.magFilter]),i){if(!o||e.mipmapFilter!=="linear"){let h=Bm[e.minFilter][e.mipmapFilter];t[n](l,t.TEXTURE_MIN_FILTER,h)}}else t[n](l,t.TEXTURE_MIN_FILTER,Vu[e.minFilter]);if(r&&e.maxAnisotropy>1){let h=Math.min(e.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[n](l,r.TEXTURE_MAX_ANISOTROPY_EXT,h)}e.compare&&t[n](l,t.TEXTURE_COMPARE_FUNC,Im[e.compare])}var Rw=v(()=>{Pw()});function kw(e){return{r8unorm:e.RED,r8snorm:e.RED,r8uint:e.RED,r8sint:e.RED,r16uint:e.RED,r16sint:e.RED,r16float:e.RED,rg8unorm:e.RG,rg8snorm:e.RG,rg8uint:e.RG,rg8sint:e.RG,r32uint:e.RED,r32sint:e.RED,r32float:e.RED,rg16uint:e.RG,rg16sint:e.RG,rg16float:e.RG,rgba8unorm:e.RGBA,"rgba8unorm-srgb":e.RGBA,rgba8snorm:e.RGBA,rgba8uint:e.RGBA,rgba8sint:e.RGBA,bgra8unorm:e.RGBA,"bgra8unorm-srgb":e.RGBA,rgb9e5ufloat:e.RGB,rgb10a2unorm:e.RGBA,rg11b10ufloat:e.RGB,rg32uint:e.RG,rg32sint:e.RG,rg32float:e.RG,rgba16uint:e.RGBA,rgba16sint:e.RGBA,rgba16float:e.RGBA,rgba32uint:e.RGBA,rgba32sint:e.RGBA,rgba32float:e.RGBA,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT,depth24plus:e.DEPTH_COMPONENT,"depth24plus-stencil8":e.DEPTH_STENCIL,depth32float:e.DEPTH_COMPONENT,"depth32float-stencil8":e.DEPTH_STENCIL}}var Bw=v(()=>{"use strict"});function Iw(e,t){let i={},r=e.RGBA;return e instanceof vt.get().getWebGLRenderingContext()?t.srgb&&(i={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(i={"rgba8unorm-srgb":e.SRGB8_ALPHA8,"bgra8unorm-srgb":e.SRGB8_ALPHA8},r=e.RGBA8),{r8unorm:e.R8,r8snorm:e.R8_SNORM,r8uint:e.R8UI,r8sint:e.R8I,r16uint:e.R16UI,r16sint:e.R16I,r16float:e.R16F,rg8unorm:e.RG8,rg8snorm:e.RG8_SNORM,rg8uint:e.RG8UI,rg8sint:e.RG8I,r32uint:e.R32UI,r32sint:e.R32I,r32float:e.R32F,rg16uint:e.RG16UI,rg16sint:e.RG16I,rg16float:e.RG16F,rgba8unorm:e.RGBA,...i,rgba8snorm:e.RGBA8_SNORM,rgba8uint:e.RGBA8UI,rgba8sint:e.RGBA8I,bgra8unorm:r,rgb9e5ufloat:e.RGB9_E5,rgb10a2unorm:e.RGB10_A2,rg11b10ufloat:e.R11F_G11F_B10F,rg32uint:e.RG32UI,rg32sint:e.RG32I,rg32float:e.RG32F,rgba16uint:e.RGBA16UI,rgba16sint:e.RGBA16I,rgba16float:e.RGBA16F,rgba32uint:e.RGBA32UI,rgba32sint:e.RGBA32I,rgba32float:e.RGBA32F,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT16,depth24plus:e.DEPTH_COMPONENT24,"depth24plus-stencil8":e.DEPTH24_STENCIL8,depth32float:e.DEPTH_COMPONENT32F,"depth32float-stencil8":e.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var Gw=v(()=>{Ft()});function Ow(e){return{r8unorm:e.UNSIGNED_BYTE,r8snorm:e.BYTE,r8uint:e.UNSIGNED_BYTE,r8sint:e.BYTE,r16uint:e.UNSIGNED_SHORT,r16sint:e.SHORT,r16float:e.HALF_FLOAT,rg8unorm:e.UNSIGNED_BYTE,rg8snorm:e.BYTE,rg8uint:e.UNSIGNED_BYTE,rg8sint:e.BYTE,r32uint:e.UNSIGNED_INT,r32sint:e.INT,r32float:e.FLOAT,rg16uint:e.UNSIGNED_SHORT,rg16sint:e.SHORT,rg16float:e.HALF_FLOAT,rgba8unorm:e.UNSIGNED_BYTE,"rgba8unorm-srgb":e.UNSIGNED_BYTE,rgba8snorm:e.BYTE,rgba8uint:e.UNSIGNED_BYTE,rgba8sint:e.BYTE,bgra8unorm:e.UNSIGNED_BYTE,"bgra8unorm-srgb":e.UNSIGNED_BYTE,rgb9e5ufloat:e.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:e.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:e.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:e.UNSIGNED_INT,rg32sint:e.INT,rg32float:e.FLOAT,rgba16uint:e.UNSIGNED_SHORT,rgba16sint:e.SHORT,rgba16float:e.HALF_FLOAT,rgba32uint:e.UNSIGNED_INT,rgba32sint:e.INT,rgba32float:e.FLOAT,stencil8:e.UNSIGNED_BYTE,depth16unorm:e.UNSIGNED_SHORT,depth24plus:e.UNSIGNED_INT,"depth24plus-stencil8":e.UNSIGNED_INT_24_8,depth32float:e.FLOAT,"depth32float-stencil8":e.FLOAT_32_UNSIGNED_INT_24_8_REV}}var Uw=v(()=>{"use strict"}),Om,ju,Fw=v(()=>{Ft(),te(),pt(),Ew(),Aw(),Cw(),Rm(),Mw(),Rw(),Bw(),Gw(),Uw(),Om=4,ju=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Wu,buffer:Cm,video:km,compressed:Pm},this._useSeparateSamplers=!1,this._renderer=e}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Iw(e,this._renderer.context.extensions),this._mapFormatToType=Ow(e),this._mapFormatToFormat=kw(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let t=0;t<16;t++)this.bind(Re.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e=e||Re.EMPTY.source;let r=this.getGlSource(e);i.bindTexture(r.target,r.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let r=this._getGlSampler(e);this._boundSamplers[t]!==r&&(this._boundSamplers[t]=r,i.bindSampler(t,r))}unbind(e){let t=e.source,i=this._boundTextures,r=this._gl;for(let n=0;n<i.length;n++)if(i[n]===t){this._activateLocation(n);let s=this.getGlSource(t);r.bindTexture(s.target,null),i[n]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){let t=this._gl,i=new Am(t.createTexture());if(i.type=this._mapFormatToType[e.format],i.internalFormat=this._mapFormatToInternalFormat[e.format],i.format=this._mapFormatToFormat[e.format],e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){let r=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(r))+1}return this._glTextures[e.uid]=i,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),this.updateStyle(e,!1),i}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){let i=this._gl,r=this.getGlSource(e);i.bindTexture(i.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=e,Gm(e.style,i,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e,this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,Gm(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:i,height:r}=this.getPixels(e),n=vt.get().createCanvas();n.width=i,n.height=r;let s=n.getContext("2d");if(s){let a=s.createImageData(i,r);a.data.set(t),s.putImageData(a,0,0)}return n}getPixels(e){let t=e.source.resolution,i=e.frame,r=Math.max(Math.round(i.width*t),1),n=Math.max(Math.round(i.height*t),1),s=new Uint8Array(Om*r*n),a=this._renderer,o=a.renderTarget.getRenderTarget(e),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(i.x*t),Math.round(i.y*t),r,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:r,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}},ju.extension={type:[G.WebGLSystem],name:"texture"}}),Um={};ze(Um,{WebGLRenderer:()=>Nm});var Fm,Dm,Lm,$u,Xu,Yu,Nm,Dw=v(()=>{te(),I1(),G1(),O1(),za(),Cg(),sr(),D1(),L1(),z1(),W1(),V1(),j1(),$1(),J1(),tw(),_w(),bw(),Sw(),Fw(),Fm=[...iu,Uu,sm,tm,Mu,ju,Fu,ku,Hu,Nu,Iu,Em,Gu,Bu],Dm=[...ru],Lm=[Cu,Au,Eu],$u=[],Xu=[],Yu=[],pe.handleByNamedList(G.WebGLSystem,$u),pe.handleByNamedList(G.WebGLPipes,Xu),pe.handleByNamedList(G.WebGLPipesAdaptor,Yu),pe.add(...Fm,...Dm,...Lm),Nm=class extends ss{constructor(){let e={name:"webgl",type:Ei.WEBGL,systems:$u,renderPipes:Xu,renderPipeAdaptors:Yu};super(e)}}}),Lw=Ue((e,t)=>{"use strict";t.exports=r;function i(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function r(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,d=>new Date(d)),a.set(Map,(d,p)=>new Map(l(Array.from(d),p))),a.set(Set,(d,p)=>new Set(l(Array.from(d),p))),s.constructorHandlers)for(let d of s.constructorHandlers)a.set(d[0],d[1]);let o=null;return s.proto?u:h;function l(d,p){let f=Object.keys(d),y=new Array(f.length);for(let b=0;b<f.length;b++){let _=f[b],T=d[_];typeof T!="object"||T===null?y[_]=T:T.constructor!==Object&&(o=a.get(T.constructor))?y[_]=o(T,p):ArrayBuffer.isView(T)?y[_]=i(T):y[_]=p(T)}return y}function h(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return l(d,h);if(d.constructor!==Object&&(o=a.get(d.constructor)))return o(d,h);let p={};for(let f in d){if(Object.hasOwnProperty.call(d,f)===!1)continue;let y=d[f];typeof y!="object"||y===null?p[f]=y:y.constructor!==Object&&(o=a.get(y.constructor))?p[f]=o(y,h):ArrayBuffer.isView(y)?p[f]=i(y):p[f]=h(y)}return p}function u(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return l(d,u);if(d.constructor!==Object&&(o=a.get(d.constructor)))return o(d,u);let p={};for(let f in d){let y=d[f];typeof y!="object"||y===null?p[f]=y:y.constructor!==Object&&(o=a.get(y.constructor))?p[f]=o(y,u):ArrayBuffer.isView(y)?p[f]=i(y):p[f]=u(y)}return p}}function n(s){let a=[],o=[],l=new Map;if(l.set(Date,f=>new Date(f)),l.set(Map,(f,y)=>new Map(u(Array.from(f),y))),l.set(Set,(f,y)=>new Set(u(Array.from(f),y))),s.constructorHandlers)for(let f of s.constructorHandlers)l.set(f[0],f[1]);let h=null;return s.proto?p:d;function u(f,y){let b=Object.keys(f),_=new Array(b.length);for(let T=0;T<b.length;T++){let C=b[T],O=f[C];if(typeof O!="object"||O===null)_[C]=O;else if(O.constructor!==Object&&(h=l.get(O.constructor)))_[C]=h(O,y);else if(ArrayBuffer.isView(O))_[C]=i(O);else{let R=a.indexOf(O);R!==-1?_[C]=o[R]:_[C]=y(O)}}return _}function d(f){if(typeof f!="object"||f===null)return f;if(Array.isArray(f))return u(f,d);if(f.constructor!==Object&&(h=l.get(f.constructor)))return h(f,d);let y={};a.push(f),o.push(y);for(let b in f){if(Object.hasOwnProperty.call(f,b)===!1)continue;let _=f[b];if(typeof _!="object"||_===null)y[b]=_;else if(_.constructor!==Object&&(h=l.get(_.constructor)))y[b]=h(_,d);else if(ArrayBuffer.isView(_))y[b]=i(_);else{let T=a.indexOf(_);T!==-1?y[b]=o[T]:y[b]=d(_)}}return a.pop(),o.pop(),y}function p(f){if(typeof f!="object"||f===null)return f;if(Array.isArray(f))return u(f,p);if(f.constructor!==Object&&(h=l.get(f.constructor)))return h(f,p);let y={};a.push(f),o.push(y);for(let b in f){let _=f[b];if(typeof _!="object"||_===null)y[b]=_;else if(_.constructor!==Object&&(h=l.get(_.constructor)))y[b]=h(_,p);else if(ArrayBuffer.isView(_))y[b]=i(_);else{let T=a.indexOf(_);T!==-1?y[b]=o[T]:y[b]=p(_)}}return a.pop(),o.pop(),y}}}),Nw={value:()=>{}};function Hm(){for(var e=0,t=arguments.length,i={},r;e<t;++e){if(!(r=arguments[e]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new so(i)}function so(e){this._=e}function Hw(e,t){return e.trim().split(/^|\s+/).map(function(i){var r="",n=i.indexOf(".");if(n>=0&&(r=i.slice(n+1),i=i.slice(0,n)),i&&!t.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}so.prototype=Hm.prototype={constructor:so,on:function(e,t){var i=this._,r=Hw(e+"",i),n,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((n=(e=r[s]).type)&&(n=zw(i[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=r[s]).type)i[n]=zm(i[n],e.name,t);else if(t==null)for(n in i)i[n]=zm(i[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var i in t)e[i]=t[i].slice();return new so(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var i=new Array(n),r=0,n,s;r<n;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,n=s.length;r<n;++r)s[r].value.apply(t,i)},apply:function(e,t,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],n=0,s=r.length;n<s;++n)r[n].value.apply(t,i)}};function zw(e,t){for(var i=0,r=e.length,n;i<r;++i)if((n=e[i]).name===t)return n.value}function zm(e,t,i){for(var r=0,n=e.length;r<n;++r)if(e[r].name===t){e[r]=Nw,e=e.slice(0,r).concat(e.slice(r+1));break}return i!=null&&e.push({name:t,value:i}),e}var ao=Hm,qu="http://www.w3.org/1999/xhtml",Wm={svg:"http://www.w3.org/2000/svg",xhtml:qu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function oo(e){var t=e+="",i=t.indexOf(":");return i>=0&&(t=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Wm.hasOwnProperty(t)?{space:Wm[t],local:e}:e}function Ww(e){return function(){var t=this.ownerDocument,i=this.namespaceURI;return i===qu&&t.documentElement.namespaceURI===qu?t.createElement(e):t.createElementNS(i,e)}}function Vw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Vm(e){var t=oo(e);return(t.local?Vw:Ww)(t)}function jw(){}function Ku(e){return e==null?jw:function(){return this.querySelector(e)}}function $w(e){typeof e!="function"&&(e=Ku(e));for(var t=this._groups,i=t.length,r=new Array(i),n=0;n<i;++n)for(var s=t[n],a=s.length,o=r[n]=new Array(a),l,h,u=0;u<a;++u)(l=s[u])&&(h=e.call(l,l.__data__,u,s))&&("__data__"in l&&(h.__data__=l.__data__),o[u]=h);return new mi(r,this._parents)}function Xw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Yw(){return[]}function jm(e){return e==null?Yw:function(){return this.querySelectorAll(e)}}function qw(e){return function(){return Xw(e.apply(this,arguments))}}function Kw(e){typeof e=="function"?e=qw(e):e=jm(e);for(var t=this._groups,i=t.length,r=[],n=[],s=0;s<i;++s)for(var a=t[s],o=a.length,l,h=0;h<o;++h)(l=a[h])&&(r.push(e.call(l,l.__data__,h,a)),n.push(l));return new mi(r,n)}function $m(e){return function(){return this.matches(e)}}function Xm(e){return function(t){return t.matches(e)}}var Zw=Array.prototype.find;function Jw(e){return function(){return Zw.call(this.children,e)}}function Qw(){return this.firstElementChild}function eT(e){return this.select(e==null?Qw:Jw(typeof e=="function"?e:Xm(e)))}var tT=Array.prototype.filter;function iT(){return Array.from(this.children)}function rT(e){return function(){return tT.call(this.children,e)}}function nT(e){return this.selectAll(e==null?iT:rT(typeof e=="function"?e:Xm(e)))}function sT(e){typeof e!="function"&&(e=$m(e));for(var t=this._groups,i=t.length,r=new Array(i),n=0;n<i;++n)for(var s=t[n],a=s.length,o=r[n]=[],l,h=0;h<a;++h)(l=s[h])&&e.call(l,l.__data__,h,s)&&o.push(l);return new mi(r,this._parents)}function Ym(e){return new Array(e.length)}function aT(){return new mi(this._enter||this._groups.map(Ym),this._parents)}function lo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}lo.prototype={constructor:lo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function oT(e){return function(){return e}}function lT(e,t,i,r,n,s){for(var a=0,o,l=t.length,h=s.length;a<h;++a)(o=t[a])?(o.__data__=s[a],r[a]=o):i[a]=new lo(e,s[a]);for(;a<l;++a)(o=t[a])&&(n[a]=o)}function hT(e,t,i,r,n,s,a){var o,l,h=new Map,u=t.length,d=s.length,p=new Array(u),f;for(o=0;o<u;++o)(l=t[o])&&(p[o]=f=a.call(l,l.__data__,o,t)+"",h.has(f)?n[o]=l:h.set(f,l));for(o=0;o<d;++o)f=a.call(e,s[o],o,s)+"",(l=h.get(f))?(r[o]=l,l.__data__=s[o],h.delete(f)):i[o]=new lo(e,s[o]);for(o=0;o<u;++o)(l=t[o])&&h.get(p[o])===l&&(n[o]=l)}function uT(e){return e.__data__}function cT(e,t){if(!arguments.length)return Array.from(this,uT);var i=t?hT:lT,r=this._parents,n=this._groups;typeof e!="function"&&(e=oT(e));for(var s=n.length,a=new Array(s),o=new Array(s),l=new Array(s),h=0;h<s;++h){var u=r[h],d=n[h],p=d.length,f=dT(e.call(u,u&&u.__data__,h,r)),y=f.length,b=o[h]=new Array(y),_=a[h]=new Array(y),T=l[h]=new Array(p);i(u,d,b,_,T,f,t);for(var C=0,O=0,R,z;C<y;++C)if(R=b[C]){for(C>=O&&(O=C+1);!(z=_[O])&&++O<y;);R._next=z||null}}return a=new mi(a,r),a._enter=o,a._exit=l,a}function dT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fT(){return new mi(this._exit||this._groups.map(Ym),this._parents)}function pT(e,t,i){var r=this.enter(),n=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),i==null?s.remove():i(s),r&&n?r.merge(n).order():n}function gT(e){for(var t=e.selection?e.selection():e,i=this._groups,r=t._groups,n=i.length,s=r.length,a=Math.min(n,s),o=new Array(n),l=0;l<a;++l)for(var h=i[l],u=r[l],d=h.length,p=o[l]=new Array(d),f,y=0;y<d;++y)(f=h[y]||u[y])&&(p[y]=f);for(;l<n;++l)o[l]=i[l];return new mi(o,this._parents)}function mT(){for(var e=this._groups,t=-1,i=e.length;++t<i;)for(var r=e[t],n=r.length-1,s=r[n],a;--n>=0;)(a=r[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function _T(e){e||(e=vT);function t(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var i=this._groups,r=i.length,n=new Array(r),s=0;s<r;++s){for(var a=i[s],o=a.length,l=n[s]=new Array(o),h,u=0;u<o;++u)(h=a[u])&&(l[u]=h);l.sort(t)}return new mi(n,this._parents).order()}function vT(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function yT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xT(){return Array.from(this)}function bT(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],n=0,s=r.length;n<s;++n){var a=r[n];if(a)return a}return null}function wT(){let e=0;for(let t of this)++e;return e}function TT(){return!this.node()}function ST(e){for(var t=this._groups,i=0,r=t.length;i<r;++i)for(var n=t[i],s=0,a=n.length,o;s<a;++s)(o=n[s])&&e.call(o,o.__data__,s,n);return this}function ET(e){return function(){this.removeAttribute(e)}}function AT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function CT(e,t){return function(){this.setAttribute(e,t)}}function MT(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function PT(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function RT(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function kT(e,t){var i=oo(e);if(arguments.length<2){var r=this.node();return i.local?r.getAttributeNS(i.space,i.local):r.getAttribute(i)}return this.each((t==null?i.local?AT:ET:typeof t=="function"?i.local?RT:PT:i.local?MT:CT)(i,t))}function qm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function BT(e){return function(){this.style.removeProperty(e)}}function IT(e,t,i){return function(){this.style.setProperty(e,t,i)}}function GT(e,t,i){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,i)}}function OT(e,t,i){return arguments.length>1?this.each((t==null?BT:typeof t=="function"?GT:IT)(e,t,i??"")):wn(this.node(),e)}function wn(e,t){return e.style.getPropertyValue(t)||qm(e).getComputedStyle(e,null).getPropertyValue(t)}function UT(e){return function(){delete this[e]}}function FT(e,t){return function(){this[e]=t}}function DT(e,t){return function(){var i=t.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function LT(e,t){return arguments.length>1?this.each((t==null?UT:typeof t=="function"?DT:FT)(e,t)):this.node()[e]}function Km(e){return e.trim().split(/^|\s+/)}function Zu(e){return e.classList||new Zm(e)}function Zm(e){this._node=e,this._names=Km(e.getAttribute("class")||"")}Zm.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Jm(e,t){for(var i=Zu(e),r=-1,n=t.length;++r<n;)i.add(t[r])}function Qm(e,t){for(var i=Zu(e),r=-1,n=t.length;++r<n;)i.remove(t[r])}function NT(e){return function(){Jm(this,e)}}function HT(e){return function(){Qm(this,e)}}function zT(e,t){return function(){(t.apply(this,arguments)?Jm:Qm)(this,e)}}function WT(e,t){var i=Km(e+"");if(arguments.length<2){for(var r=Zu(this.node()),n=-1,s=i.length;++n<s;)if(!r.contains(i[n]))return!1;return!0}return this.each((typeof t=="function"?zT:t?NT:HT)(i,t))}function VT(){this.textContent=""}function jT(e){return function(){this.textContent=e}}function $T(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function XT(e){return arguments.length?this.each(e==null?VT:(typeof e=="function"?$T:jT)(e)):this.node().textContent}function YT(){this.innerHTML=""}function qT(e){return function(){this.innerHTML=e}}function KT(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ZT(e){return arguments.length?this.each(e==null?YT:(typeof e=="function"?KT:qT)(e)):this.node().innerHTML}function JT(){this.nextSibling&&this.parentNode.appendChild(this)}function QT(){return this.each(JT)}function eS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tS(){return this.each(eS)}function iS(e){var t=typeof e=="function"?e:Vm(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rS(){return null}function nS(e,t){var i=typeof e=="function"?e:Vm(e),r=t==null?rS:typeof t=="function"?t:Ku(t);return this.select(function(){return this.insertBefore(i.apply(this,arguments),r.apply(this,arguments)||null)})}function sS(){var e=this.parentNode;e&&e.removeChild(this)}function aS(){return this.each(sS)}function oS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lS(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hS(e){return this.select(e?lS:oS)}function uS(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cS(e){return function(t){e.call(this,t,this.__data__)}}function dS(e){return e.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");return r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),{type:t,name:i}})}function fS(e){return function(){var t=this.__on;if(t){for(var i=0,r=-1,n=t.length,s;i<n;++i)s=t[i],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function pS(e,t,i){return function(){var r=this.__on,n,s=cS(t);if(r){for(var a=0,o=r.length;a<o;++a)if((n=r[a]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=i),n.value=t;return}}this.addEventListener(e.type,s,i),n={type:e.type,name:e.name,value:t,listener:s,options:i},r?r.push(n):this.__on=[n]}}function gS(e,t,i){var r=dS(e+""),n,s=r.length,a;if(arguments.length<2){var o=this.node().__on;if(o){for(var l=0,h=o.length,u;l<h;++l)for(n=0,u=o[l];n<s;++n)if((a=r[n]).type===u.type&&a.name===u.name)return u.value}return}for(o=t?pS:fS,n=0;n<s;++n)this.each(o(r[n],t,i));return this}function e_(e,t,i){var r=qm(e),n=r.CustomEvent;typeof n=="function"?n=new n(t,i):(n=r.document.createEvent("Event"),i?(n.initEvent(t,i.bubbles,i.cancelable),n.detail=i.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function mS(e,t){return function(){return e_(this,e,t)}}function _S(e,t){return function(){return e_(this,e,t.apply(this,arguments))}}function vS(e,t){return this.each((typeof t=="function"?_S:mS)(e,t))}function*yS(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],n=0,s=r.length,a;n<s;++n)(a=r[n])&&(yield a)}var t_=[null];function mi(e,t){this._groups=e,this._parents=t}function i_(){return new mi([[document.documentElement]],t_)}function xS(){return this}mi.prototype=i_.prototype={constructor:mi,select:$w,selectAll:Kw,selectChild:eT,selectChildren:nT,filter:sT,data:cT,enter:aT,exit:fT,join:pT,merge:gT,selection:xS,order:mT,sort:_T,call:yT,nodes:xT,node:bT,size:wT,empty:TT,each:ST,attr:kT,style:OT,property:LT,classed:WT,text:XT,html:ZT,raise:QT,lower:tS,append:iS,insert:nS,remove:aS,clone:hS,datum:uS,on:gS,dispatch:vS,[Symbol.iterator]:yS};var cs=i_;function Bi(e){return typeof e=="string"?new mi([[document.querySelector(e)]],[document.documentElement]):new mi([[e]],t_)}function bS(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=bS(e),t===void 0&&(t=e.currentTarget),t){var i=t.ownerSVGElement||t;if(i.createSVGPoint){var r=i.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}var wS={passive:!1},ds={capture:!0,passive:!1};function Ju(e){e.stopImmediatePropagation()}function Tn(e){e.preventDefault(),e.stopImmediatePropagation()}function r_(e){var t=e.document.documentElement,i=Bi(e).on("dragstart.drag",Tn,ds);"onselectstart"in t?i.on("selectstart.drag",Tn,ds):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function n_(e,t){var i=e.document.documentElement,r=Bi(e).on("dragstart.drag",null);t&&(r.on("click.drag",Tn,ds),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in i?r.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}var ho=e=>()=>e;function Qu(e,{sourceEvent:t,subject:i,target:r,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:u}})}Qu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function TS(e){return!e.ctrlKey&&!e.button}function SS(){return this.parentNode}function ES(e,t){return t??{x:e.x,y:e.y}}function AS(){return navigator.maxTouchPoints||"ontouchstart"in this}function CS(){var e=TS,t=SS,i=ES,r=AS,n={},s=ao("start","drag","end"),a=0,o,l,h,u,d=0;function p(R){R.on("mousedown.drag",f).filter(r).on("touchstart.drag",_).on("touchmove.drag",T,wS).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(R,z){if(!(u||!e.call(this,R,z))){var ee=O(this,t.call(this,R,z),R,z,"mouse");ee&&(Bi(R.view).on("mousemove.drag",y,ds).on("mouseup.drag",b,ds),r_(R.view),Ju(R),h=!1,o=R.clientX,l=R.clientY,ee("start",R))}}function y(R){if(Tn(R),!h){var z=R.clientX-o,ee=R.clientY-l;h=z*z+ee*ee>d}n.mouse("drag",R)}function b(R){Bi(R.view).on("mousemove.drag mouseup.drag",null),n_(R.view,h),Tn(R),n.mouse("end",R)}function _(R,z){if(e.call(this,R,z)){var ee=R.changedTouches,ne=t.call(this,R,z),Q=ee.length,Y,ie;for(Y=0;Y<Q;++Y)(ie=O(this,ne,R,z,ee[Y].identifier,ee[Y]))&&(Ju(R),ie("start",R,ee[Y]))}}function T(R){var z=R.changedTouches,ee=z.length,ne,Q;for(ne=0;ne<ee;++ne)(Q=n[z[ne].identifier])&&(Tn(R),Q("drag",R,z[ne]))}function C(R){var z=R.changedTouches,ee=z.length,ne,Q;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),ne=0;ne<ee;++ne)(Q=n[z[ne].identifier])&&(Ju(R),Q("end",R,z[ne]))}function O(R,z,ee,ne,Q,Y){var ie=s.copy(),Te=or(Y||ee,z),Pe,ce,U;if((U=i.call(R,new Qu("beforestart",{sourceEvent:ee,target:p,identifier:Q,active:a,x:Te[0],y:Te[1],dx:0,dy:0,dispatch:ie}),ne))!=null)return Pe=U.x-Te[0]||0,ce=U.y-Te[1]||0,function ae(K,de,M){var P=Te,A;switch(K){case"start":n[Q]=ae,A=a++;break;case"end":delete n[Q],--a;case"drag":Te=or(M||de,z),A=a;break}ie.call(K,R,new Qu(K,{sourceEvent:de,subject:U,target:p,identifier:Q,active:A,x:Te[0]+Pe,y:Te[1]+ce,dx:Te[0]-P[0],dy:Te[1]-P[1],dispatch:ie}),ne)}}return p.filter=function(R){return arguments.length?(e=typeof R=="function"?R:ho(!!R),p):e},p.container=function(R){return arguments.length?(t=typeof R=="function"?R:ho(R),p):t},p.subject=function(R){return arguments.length?(i=typeof R=="function"?R:ho(R),p):i},p.touchable=function(R){return arguments.length?(r=typeof R=="function"?R:ho(!!R),p):r},p.on=function(){var R=s.on.apply(s,arguments);return R===s?p:R},p.clickDistance=function(R){return arguments.length?(d=(R=+R)*R,p):Math.sqrt(d)},p}function ec(e,t,i){e.prototype=t.prototype=i,i.constructor=e}function s_(e,t){var i=Object.create(e.prototype);for(var r in t)i[r]=t[r];return i}function fs(){}var ps=.7,uo=1/ps,Sn="\\s*([+-]?\\d+)\\s*",gs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",MS=/^#([0-9a-f]{3,8})$/,PS=new RegExp(`^rgb\\(${Sn},${Sn},${Sn}\\)$`),RS=new RegExp(`^rgb\\(${qi},${qi},${qi}\\)$`),kS=new RegExp(`^rgba\\(${Sn},${Sn},${Sn},${gs}\\)$`),BS=new RegExp(`^rgba\\(${qi},${qi},${qi},${gs}\\)$`),IS=new RegExp(`^hsl\\(${gs},${qi},${qi}\\)$`),GS=new RegExp(`^hsla\\(${gs},${qi},${qi},${gs}\\)$`),a_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ec(fs,ms,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:o_,formatHex:o_,formatHex8:OS,formatHsl:US,formatRgb:l_,toString:l_});function o_(){return this.rgb().formatHex()}function OS(){return this.rgb().formatHex8()}function US(){return f_(this).formatHsl()}function l_(){return this.rgb().formatRgb()}function ms(e){var t,i;return e=(e+"").trim().toLowerCase(),(t=MS.exec(e))?(i=t[1].length,t=parseInt(t[1],16),i===6?h_(t):i===3?new hi(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):i===8?co(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):i===4?co(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=PS.exec(e))?new hi(t[1],t[2],t[3],1):(t=RS.exec(e))?new hi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kS.exec(e))?co(t[1],t[2],t[3],t[4]):(t=BS.exec(e))?co(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=IS.exec(e))?d_(t[1],t[2]/100,t[3]/100,1):(t=GS.exec(e))?d_(t[1],t[2]/100,t[3]/100,t[4]):a_.hasOwnProperty(e)?h_(a_[e]):e==="transparent"?new hi(NaN,NaN,NaN,0):null}function h_(e){return new hi(e>>16&255,e>>8&255,e&255,1)}function co(e,t,i,r){return r<=0&&(e=t=i=NaN),new hi(e,t,i,r)}function FS(e){return e instanceof fs||(e=ms(e)),e?(e=e.rgb(),new hi(e.r,e.g,e.b,e.opacity)):new hi}function fo(e,t,i,r){return arguments.length===1?FS(e):new hi(e,t,i,r??1)}function hi(e,t,i,r){this.r=+e,this.g=+t,this.b=+i,this.opacity=+r}ec(hi,fo,s_(fs,{brighter(e){return e=e==null?uo:Math.pow(uo,e),new hi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ps:Math.pow(ps,e),new hi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hi($r(this.r),$r(this.g),$r(this.b),po(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:u_,formatHex:u_,formatHex8:DS,formatRgb:c_,toString:c_}));function u_(){return`#${Xr(this.r)}${Xr(this.g)}${Xr(this.b)}`}function DS(){return`#${Xr(this.r)}${Xr(this.g)}${Xr(this.b)}${Xr((isNaN(this.opacity)?1:this.opacity)*255)}`}function c_(){let e=po(this.opacity);return`${e===1?"rgb(":"rgba("}${$r(this.r)}, ${$r(this.g)}, ${$r(this.b)}${e===1?")":`, ${e})`}`}function po(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $r(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xr(e){return e=$r(e),(e<16?"0":"")+e.toString(16)}function d_(e,t,i,r){return r<=0?e=t=i=NaN:i<=0||i>=1?e=t=NaN:t<=0&&(e=NaN),new Ii(e,t,i,r)}function f_(e){if(e instanceof Ii)return new Ii(e.h,e.s,e.l,e.opacity);if(e instanceof fs||(e=ms(e)),!e)return new Ii;if(e instanceof Ii)return e;e=e.rgb();var t=e.r/255,i=e.g/255,r=e.b/255,n=Math.min(t,i,r),s=Math.max(t,i,r),a=NaN,o=s-n,l=(s+n)/2;return o?(t===s?a=(i-r)/o+(i<r)*6:i===s?a=(r-t)/o+2:a=(t-i)/o+4,o/=l<.5?s+n:2-s-n,a*=60):o=l>0&&l<1?0:a,new Ii(a,o,l,e.opacity)}function LS(e,t,i,r){return arguments.length===1?f_(e):new Ii(e,t,i,r??1)}function Ii(e,t,i,r){this.h=+e,this.s=+t,this.l=+i,this.opacity=+r}ec(Ii,LS,s_(fs,{brighter(e){return e=e==null?uo:Math.pow(uo,e),new Ii(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ps:Math.pow(ps,e),new Ii(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*t,n=2*i-r;return new hi(tc(e>=240?e-240:e+120,n,r),tc(e,n,r),tc(e<120?e+240:e-120,n,r),this.opacity)},clamp(){return new Ii(p_(this.h),go(this.s),go(this.l),po(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=po(this.opacity);return`${e===1?"hsl(":"hsla("}${p_(this.h)}, ${go(this.s)*100}%, ${go(this.l)*100}%${e===1?")":`, ${e})`}`}}));function p_(e){return e=(e||0)%360,e<0?e+360:e}function go(e){return Math.max(0,Math.min(1,e||0))}function tc(e,t,i){return(e<60?t+(i-t)*e/60:e<180?i:e<240?t+(i-t)*(240-e)/60:t)*255}function g_(e,t,i,r,n){var s=e*e,a=s*e;return((1-3*e+3*s-a)*t+(4-6*s+3*a)*i+(1+3*e+3*s-3*a)*r+a*n)/6}function NS(e){var t=e.length-1;return function(i){var r=i<=0?i=0:i>=1?(i=1,t-1):Math.floor(i*t),n=e[r],s=e[r+1],a=r>0?e[r-1]:2*n-s,o=r<t-1?e[r+2]:2*s-n;return g_((i-r/t)*t,a,n,s,o)}}function HS(e){var t=e.length;return function(i){var r=Math.floor(((i%=1)<0?++i:i)*t),n=e[(r+t-1)%t],s=e[r%t],a=e[(r+1)%t],o=e[(r+2)%t];return g_((i-r/t)*t,n,s,a,o)}}var m_=e=>()=>e;function zS(e,t){return function(i){return e+i*t}}function WS(e,t,i){return e=Math.pow(e,i),t=Math.pow(t,i)-e,i=1/i,function(r){return Math.pow(e+r*t,i)}}function VS(e){return(e=+e)==1?__:function(t,i){return i-t?WS(t,i,e):m_(isNaN(t)?i:t)}}function __(e,t){var i=t-e;return i?zS(e,i):m_(isNaN(e)?t:e)}var v_=function e(t){var i=VS(t);function r(n,s){var a=i((n=fo(n)).r,(s=fo(s)).r),o=i(n.g,s.g),l=i(n.b,s.b),h=__(n.opacity,s.opacity);return function(u){return n.r=a(u),n.g=o(u),n.b=l(u),n.opacity=h(u),n+""}}return r.gamma=e,r}(1);function y_(e){return function(t){var i=t.length,r=new Array(i),n=new Array(i),s=new Array(i),a,o;for(a=0;a<i;++a)o=fo(t[a]),r[a]=o.r||0,n[a]=o.g||0,s[a]=o.b||0;return r=e(r),n=e(n),s=e(s),o.opacity=1,function(l){return o.r=r(l),o.g=n(l),o.b=s(l),o+""}}}var _A=y_(NS),vA=y_(HS);function Cr(e,t){return e=+e,t=+t,function(i){return e*(1-i)+t*i}}var ic=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rc=new RegExp(ic.source,"g");function jS(e){return function(){return e}}function $S(e){return function(t){return e(t)+""}}function XS(e,t){var i=ic.lastIndex=rc.lastIndex=0,r,n,s,a=-1,o=[],l=[];for(e=e+"",t=t+"";(r=ic.exec(e))&&(n=rc.exec(t));)(s=n.index)>i&&(s=t.slice(i,s),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Cr(r,n)})),i=rc.lastIndex;return i<t.length&&(s=t.slice(i),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?$S(l[0].x):jS(t):(t=l.length,function(h){for(var u=0,d;u<t;++u)o[(d=l[u]).i]=d.x(h);return o.join("")})}var x_=180/Math.PI,nc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function b_(e,t,i,r,n,s){var a,o,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*i+t*r)&&(i-=e*l,r-=t*l),(o=Math.sqrt(i*i+r*r))&&(i/=o,r/=o,l/=o),e*r<t*i&&(e=-e,t=-t,l=-l,a=-a),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*x_,skewX:Math.atan(l)*x_,scaleX:a,scaleY:o}}var mo;function YS(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?nc:b_(t.a,t.b,t.c,t.d,t.e,t.f)}function qS(e){return e==null?nc:(mo||(mo=document.createElementNS("http://www.w3.org/2000/svg","g")),mo.setAttribute("transform",e),(e=mo.transform.baseVal.consolidate())?(e=e.matrix,b_(e.a,e.b,e.c,e.d,e.e,e.f)):nc)}function w_(e,t,i,r){function n(h){return h.length?h.pop()+" ":""}function s(h,u,d,p,f,y){if(h!==d||u!==p){var b=f.push("translate(",null,t,null,i);y.push({i:b-4,x:Cr(h,d)},{i:b-2,x:Cr(u,p)})}else(d||p)&&f.push("translate("+d+t+p+i)}function a(h,u,d,p){h!==u?(h-u>180?u+=360:u-h>180&&(h+=360),p.push({i:d.push(n(d)+"rotate(",null,r)-2,x:Cr(h,u)})):u&&d.push(n(d)+"rotate("+u+r)}function o(h,u,d,p){h!==u?p.push({i:d.push(n(d)+"skewX(",null,r)-2,x:Cr(h,u)}):u&&d.push(n(d)+"skewX("+u+r)}function l(h,u,d,p,f,y){if(h!==d||u!==p){var b=f.push(n(f)+"scale(",null,",",null,")");y.push({i:b-4,x:Cr(h,d)},{i:b-2,x:Cr(u,p)})}else(d!==1||p!==1)&&f.push(n(f)+"scale("+d+","+p+")")}return function(h,u){var d=[],p=[];return h=e(h),u=e(u),s(h.translateX,h.translateY,u.translateX,u.translateY,d,p),a(h.rotate,u.rotate,d,p),o(h.skewX,u.skewX,d,p),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,d,p),h=u=null,function(f){for(var y=-1,b=p.length,_;++y<b;)d[(_=p[y]).i]=_.x(f);return d.join("")}}}var KS=w_(YS,"px, ","px)","deg)"),ZS=w_(qS,", ",")",")"),JS=1e-12;function T_(e){return((e=Math.exp(e))+1/e)/2}function QS(e){return((e=Math.exp(e))-1/e)/2}function eE(e){return((e=Math.exp(2*e))-1)/(e+1)}var tE=function e(t,i,r){function n(s,a){var o=s[0],l=s[1],h=s[2],u=a[0],d=a[1],p=a[2],f=u-o,y=d-l,b=f*f+y*y,_,T;if(b<JS)T=Math.log(p/h)/t,_=function(ne){return[o+ne*f,l+ne*y,h*Math.exp(t*ne*T)]};else{var C=Math.sqrt(b),O=(p*p-h*h+r*b)/(2*h*i*C),R=(p*p-h*h-r*b)/(2*p*i*C),z=Math.log(Math.sqrt(O*O+1)-O),ee=Math.log(Math.sqrt(R*R+1)-R);T=(ee-z)/t,_=function(ne){var Q=ne*T,Y=T_(z),ie=h/(i*C)*(Y*eE(t*Q+z)-QS(z));return[o+ie*f,l+ie*y,h*Y/T_(t*Q+z)]}}return _.duration=T*1e3*t/Math.SQRT2,_}return n.rho=function(s){var a=Math.max(.001,+s),o=a*a,l=o*o;return e(a,o,l)},n}(Math.SQRT2,2,4),En=0,_s=0,vs=0,S_=1e3,_o,ys,vo=0,Yr=0,yo=0,xs=typeof performance=="object"&&performance.now?performance:Date,E_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sc(){return Yr||(E_(iE),Yr=xs.now()+yo)}function iE(){Yr=0}function xo(){this._call=this._time=this._next=null}xo.prototype=ac.prototype={constructor:xo,restart:function(e,t,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?sc():+i)+(t==null?0:+t),!this._next&&ys!==this&&(ys?ys._next=this:_o=this,ys=this),this._call=e,this._time=i,oc()},stop:function(){this._call&&(this._call=null,this._time=1/0,oc())}};function ac(e,t,i){var r=new xo;return r.restart(e,t,i),r}function rE(){sc(),++En;for(var e=_o,t;e;)(t=Yr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--En}function A_(){Yr=(vo=xs.now())+yo,En=_s=0;try{rE()}finally{En=0,sE(),Yr=0}}function nE(){var e=xs.now(),t=e-vo;t>S_&&(yo-=t,vo=e)}function sE(){for(var e,t=_o,i,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(i=t._next,t._next=null,t=e?e._next=i:_o=i);ys=e,oc(r)}function oc(e){if(!En){_s&&(_s=clearTimeout(_s));var t=e-Yr;t>24?(e<1/0&&(_s=setTimeout(A_,e-xs.now()-yo)),vs&&(vs=clearInterval(vs))):(vs||(vo=xs.now(),vs=setInterval(nE,S_)),En=1,E_(A_))}}function C_(e,t,i){var r=new xo;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,i),r}var aE=ao("start","end","cancel","interrupt"),oE=[],M_=0,P_=1,lc=2,bo=3,R_=4,hc=5,wo=6;function To(e,t,i,r,n,s){var a=e.__transition;if(!a)e.__transition={};else if(i in a)return;lE(e,i,{name:t,index:r,group:n,on:aE,tween:oE,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:M_})}function uc(e,t){var i=Gi(e,t);if(i.state>M_)throw new Error("too late; already scheduled");return i}function Ki(e,t){var i=Gi(e,t);if(i.state>bo)throw new Error("too late; already running");return i}function Gi(e,t){var i=e.__transition;if(!i||!(i=i[t]))throw new Error("transition not found");return i}function lE(e,t,i){var r=e.__transition,n;r[t]=i,i.timer=ac(s,0,i.time);function s(h){i.state=P_,i.timer.restart(a,i.delay,i.time),i.delay<=h&&a(h-i.delay)}function a(h){var u,d,p,f;if(i.state!==P_)return l();for(u in r)if(f=r[u],f.name===i.name){if(f.state===bo)return C_(a);f.state===R_?(f.state=wo,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[u]):+u<t&&(f.state=wo,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[u])}if(C_(function(){i.state===bo&&(i.state=R_,i.timer.restart(o,i.delay,i.time),o(h))}),i.state=lc,i.on.call("start",e,e.__data__,i.index,i.group),i.state===lc){for(i.state=bo,n=new Array(p=i.tween.length),u=0,d=-1;u<p;++u)(f=i.tween[u].value.call(e,e.__data__,i.index,i.group))&&(n[++d]=f);n.length=d+1}}function o(h){for(var u=h<i.duration?i.ease.call(null,h/i.duration):(i.timer.restart(l),i.state=hc,1),d=-1,p=n.length;++d<p;)n[d].call(e,u);i.state===hc&&(i.on.call("end",e,e.__data__,i.index,i.group),l())}function l(){i.state=wo,i.timer.stop(),delete r[t];for(var h in r)return;delete e.__transition}}function So(e,t){var i=e.__transition,r,n,s=!0,a;if(i){t=t==null?null:t+"";for(a in i){if((r=i[a]).name!==t){s=!1;continue}n=r.state>lc&&r.state<hc,r.state=wo,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete i[a]}s&&delete e.__transition}}function hE(e){return this.each(function(){So(this,e)})}function uE(e,t){var i,r;return function(){var n=Ki(this,e),s=n.tween;if(s!==i){r=i=s;for(var a=0,o=r.length;a<o;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}n.tween=r}}function cE(e,t,i){var r,n;if(typeof i!="function")throw new Error;return function(){var s=Ki(this,e),a=s.tween;if(a!==r){n=(r=a).slice();for(var o={name:t,value:i},l=0,h=n.length;l<h;++l)if(n[l].name===t){n[l]=o;break}l===h&&n.push(o)}s.tween=n}}function dE(e,t){var i=this._id;if(e+="",arguments.length<2){for(var r=Gi(this.node(),i).tween,n=0,s=r.length,a;n<s;++n)if((a=r[n]).name===e)return a.value;return null}return this.each((t==null?uE:cE)(i,e,t))}function cc(e,t,i){var r=e._id;return e.each(function(){var n=Ki(this,r);(n.value||(n.value={}))[t]=i.apply(this,arguments)}),function(n){return Gi(n,r).value[t]}}function k_(e,t){var i;return(typeof t=="number"?Cr:t instanceof ms?v_:(i=ms(t))?(t=i,v_):XS)(e,t)}function fE(e){return function(){this.removeAttribute(e)}}function pE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gE(e,t,i){var r,n=i+"",s;return function(){var a=this.getAttribute(e);return a===n?null:a===r?s:s=t(r=a,i)}}function mE(e,t,i){var r,n=i+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===n?null:a===r?s:s=t(r=a,i)}}function _E(e,t,i){var r,n,s;return function(){var a,o=i(this),l;return o==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=o+"",a===l?null:a===r&&l===n?s:(n=l,s=t(r=a,o)))}}function vE(e,t,i){var r,n,s;return function(){var a,o=i(this),l;return o==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=o+"",a===l?null:a===r&&l===n?s:(n=l,s=t(r=a,o)))}}function yE(e,t){var i=oo(e),r=i==="transform"?ZS:k_;return this.attrTween(e,typeof t=="function"?(i.local?vE:_E)(i,r,cc(this,"attr."+e,t)):t==null?(i.local?pE:fE)(i):(i.local?mE:gE)(i,r,t))}function xE(e,t){return function(i){this.setAttribute(e,t.call(this,i))}}function bE(e,t){return function(i){this.setAttributeNS(e.space,e.local,t.call(this,i))}}function wE(e,t){var i,r;function n(){var s=t.apply(this,arguments);return s!==r&&(i=(r=s)&&bE(e,s)),i}return n._value=t,n}function TE(e,t){var i,r;function n(){var s=t.apply(this,arguments);return s!==r&&(i=(r=s)&&xE(e,s)),i}return n._value=t,n}function SE(e,t){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;var r=oo(e);return this.tween(i,(r.local?wE:TE)(r,t))}function EE(e,t){return function(){uc(this,e).delay=+t.apply(this,arguments)}}function AE(e,t){return t=+t,function(){uc(this,e).delay=t}}function CE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?EE:AE)(t,e)):Gi(this.node(),t).delay}function ME(e,t){return function(){Ki(this,e).duration=+t.apply(this,arguments)}}function PE(e,t){return t=+t,function(){Ki(this,e).duration=t}}function RE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ME:PE)(t,e)):Gi(this.node(),t).duration}function kE(e,t){if(typeof t!="function")throw new Error;return function(){Ki(this,e).ease=t}}function BE(e){var t=this._id;return arguments.length?this.each(kE(t,e)):Gi(this.node(),t).ease}function IE(e,t){return function(){var i=t.apply(this,arguments);if(typeof i!="function")throw new Error;Ki(this,e).ease=i}}function GE(e){if(typeof e!="function")throw new Error;return this.each(IE(this._id,e))}function OE(e){typeof e!="function"&&(e=$m(e));for(var t=this._groups,i=t.length,r=new Array(i),n=0;n<i;++n)for(var s=t[n],a=s.length,o=r[n]=[],l,h=0;h<a;++h)(l=s[h])&&e.call(l,l.__data__,h,s)&&o.push(l);return new lr(r,this._parents,this._name,this._id)}function UE(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,i=e._groups,r=t.length,n=i.length,s=Math.min(r,n),a=new Array(r),o=0;o<s;++o)for(var l=t[o],h=i[o],u=l.length,d=a[o]=new Array(u),p,f=0;f<u;++f)(p=l[f]||h[f])&&(d[f]=p);for(;o<r;++o)a[o]=t[o];return new lr(a,this._parents,this._name,this._id)}function FE(e){return(e+"").trim().split(/^|\s+/).every(function(t){var i=t.indexOf(".");return i>=0&&(t=t.slice(0,i)),!t||t==="start"})}function DE(e,t,i){var r,n,s=FE(t)?uc:Ki;return function(){var a=s(this,e),o=a.on;o!==r&&(n=(r=o).copy()).on(t,i),a.on=n}}function LE(e,t){var i=this._id;return arguments.length<2?Gi(this.node(),i).on.on(e):this.each(DE(i,e,t))}function NE(e){return function(){var t=this.parentNode;for(var i in this.__transition)if(+i!==e)return;t&&t.removeChild(this)}}function HE(){return this.on("end.remove",NE(this._id))}function zE(e){var t=this._name,i=this._id;typeof e!="function"&&(e=Ku(e));for(var r=this._groups,n=r.length,s=new Array(n),a=0;a<n;++a)for(var o=r[a],l=o.length,h=s[a]=new Array(l),u,d,p=0;p<l;++p)(u=o[p])&&(d=e.call(u,u.__data__,p,o))&&("__data__"in u&&(d.__data__=u.__data__),h[p]=d,To(h[p],t,i,p,h,Gi(u,i)));return new lr(s,this._parents,t,i)}function WE(e){var t=this._name,i=this._id;typeof e!="function"&&(e=jm(e));for(var r=this._groups,n=r.length,s=[],a=[],o=0;o<n;++o)for(var l=r[o],h=l.length,u,d=0;d<h;++d)if(u=l[d]){for(var p=e.call(u,u.__data__,d,l),f,y=Gi(u,i),b=0,_=p.length;b<_;++b)(f=p[b])&&To(f,t,i,b,p,y);s.push(p),a.push(u)}return new lr(s,a,t,i)}var VE=cs.prototype.constructor;function jE(){return new VE(this._groups,this._parents)}function $E(e,t){var i,r,n;return function(){var s=wn(this,e),a=(this.style.removeProperty(e),wn(this,e));return s===a?null:s===i&&a===r?n:n=t(i=s,r=a)}}function B_(e){return function(){this.style.removeProperty(e)}}function XE(e,t,i){var r,n=i+"",s;return function(){var a=wn(this,e);return a===n?null:a===r?s:s=t(r=a,i)}}function YE(e,t,i){var r,n,s;return function(){var a=wn(this,e),o=i(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(e),wn(this,e))),a===l?null:a===r&&l===n?s:(n=l,s=t(r=a,o))}}function qE(e,t){var i,r,n,s="style."+t,a="end."+s,o;return function(){var l=Ki(this,e),h=l.on,u=l.value[s]==null?o||(o=B_(t)):void 0;(h!==i||n!==u)&&(r=(i=h).copy()).on(a,n=u),l.on=r}}function KE(e,t,i){var r=(e+="")=="transform"?KS:k_;return t==null?this.styleTween(e,$E(e,r)).on("end.style."+e,B_(e)):typeof t=="function"?this.styleTween(e,YE(e,r,cc(this,"style."+e,t))).each(qE(this._id,e)):this.styleTween(e,XE(e,r,t),i).on("end.style."+e,null)}function ZE(e,t,i){return function(r){this.style.setProperty(e,t.call(this,r),i)}}function JE(e,t,i){var r,n;function s(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&ZE(e,a,i)),r}return s._value=t,s}function QE(e,t,i){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,JE(e,t,i??""))}function e2(e){return function(){this.textContent=e}}function t2(e){return function(){var t=e(this);this.textContent=t??""}}function i2(e){return this.tween("text",typeof e=="function"?t2(cc(this,"text",e)):e2(e==null?"":e+""))}function r2(e){return function(t){this.textContent=e.call(this,t)}}function n2(e){var t,i;function r(){var n=e.apply(this,arguments);return n!==i&&(t=(i=n)&&r2(n)),t}return r._value=e,r}function s2(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,n2(e))}function a2(){for(var e=this._name,t=this._id,i=I_(),r=this._groups,n=r.length,s=0;s<n;++s)for(var a=r[s],o=a.length,l,h=0;h<o;++h)if(l=a[h]){var u=Gi(l,t);To(l,e,i,h,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new lr(r,this._parents,e,i)}function o2(){var e,t,i=this,r=i._id,n=i.size();return new Promise(function(s,a){var o={value:a},l={value:function(){--n===0&&s()}};i.each(function(){var h=Ki(this,r),u=h.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(o),t._.interrupt.push(o),t._.end.push(l)),h.on=t}),n===0&&s()})}var l2=0;function lr(e,t,i,r){this._groups=e,this._parents=t,this._name=i,this._id=r}function h2(e){return cs().transition(e)}function I_(){return++l2}var hr=cs.prototype;lr.prototype=h2.prototype={constructor:lr,select:zE,selectAll:WE,selectChild:hr.selectChild,selectChildren:hr.selectChildren,filter:OE,merge:UE,selection:jE,transition:a2,call:hr.call,nodes:hr.nodes,node:hr.node,size:hr.size,empty:hr.empty,each:hr.each,on:LE,attr:yE,attrTween:SE,style:KE,styleTween:QE,text:i2,textTween:s2,remove:HE,tween:dE,delay:CE,duration:RE,ease:BE,easeVarying:GE,end:o2,[Symbol.iterator]:hr[Symbol.iterator]};function u2(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var c2={time:null,delay:0,duration:250,ease:u2};function d2(e,t){for(var i;!(i=e.__transition)||!(i=i[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return i}function f2(e){var t,i;e instanceof lr?(t=e._id,e=e._name):(t=I_(),(i=c2).time=sc(),e=e==null?null:e+"");for(var r=this._groups,n=r.length,s=0;s<n;++s)for(var a=r[s],o=a.length,l,h=0;h<o;++h)(l=a[h])&&To(l,e,t,h,a,i||d2(l,t));return new lr(r,this._parents,e,t)}cs.prototype.interrupt=hE,cs.prototype.transition=f2;var{abs:yA,max:xA,min:bA}=Math;function G_(e){return[+e[0],+e[1]]}function p2(e){return[G_(e[0]),G_(e[1])]}var wA={name:"x",handles:["w","e"].map(dc),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},TA={name:"y",handles:["n","s"].map(dc),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},SA={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(dc),input:function(e){return e==null?null:p2(e)},output:function(e){return e}};function dc(e){return{type:e}}function g2(e,t){var i,r=1;e==null&&(e=0),t==null&&(t=0);function n(){var s,a=i.length,o,l=0,h=0;for(s=0;s<a;++s)o=i[s],l+=o.x,h+=o.y;for(l=(l/a-e)*r,h=(h/a-t)*r,s=0;s<a;++s)o=i[s],o.x-=l,o.y-=h}return n.initialize=function(s){i=s},n.x=function(s){return arguments.length?(e=+s,n):e},n.y=function(s){return arguments.length?(t=+s,n):t},n.strength=function(s){return arguments.length?(r=+s,n):r},n}function m2(e){let t=+this._x.call(null,e),i=+this._y.call(null,e);return O_(this.cover(t,i),t,i,e)}function O_(e,t,i,r){if(isNaN(t)||isNaN(i))return e;var n,s=e._root,a={data:r},o=e._x0,l=e._y0,h=e._x1,u=e._y1,d,p,f,y,b,_,T,C;if(!s)return e._root=a,e;for(;s.length;)if((b=t>=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p,n=s,!(s=s[T=_<<1|b]))return n[T]=a,e;if(f=+e._x.call(null,s.data),y=+e._y.call(null,s.data),t===f&&i===y)return a.next=s,n?n[T]=a:e._root=a,e;do n=n?n[T]=new Array(4):e._root=new Array(4),(b=t>=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p;while((T=_<<1|b)===(C=(y>=p)<<1|f>=d));return n[C]=s,n[T]=a,e}function _2(e){var t,i,r=e.length,n,s,a=new Array(r),o=new Array(r),l=1/0,h=1/0,u=-1/0,d=-1/0;for(i=0;i<r;++i)isNaN(n=+this._x.call(null,t=e[i]))||isNaN(s=+this._y.call(null,t))||(a[i]=n,o[i]=s,n<l&&(l=n),n>u&&(u=n),s<h&&(h=s),s>d&&(d=s));if(l>u||h>d)return this;for(this.cover(l,h).cover(u,d),i=0;i<r;++i)O_(this,a[i],o[i],e[i]);return this}function v2(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var i=this._x0,r=this._y0,n=this._x1,s=this._y1;if(isNaN(i))n=(i=Math.floor(e))+1,s=(r=Math.floor(t))+1;else{for(var a=n-i||1,o=this._root,l,h;i>e||e>=n||r>t||t>=s;)switch(h=(t<r)<<1|e<i,l=new Array(4),l[h]=o,o=l,a*=2,h){case 0:n=i+a,s=r+a;break;case 1:i=n-a,s=r+a;break;case 2:n=i+a,r=s-a;break;case 3:i=n-a,r=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=i,this._y0=r,this._x1=n,this._y1=s,this}function y2(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function x2(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ri(e,t,i,r,n){this.node=e,this.x0=t,this.y0=i,this.x1=r,this.y1=n}function b2(e,t,i){var r,n=this._x0,s=this._y0,a,o,l,h,u=this._x1,d=this._y1,p=[],f=this._root,y,b;for(f&&p.push(new ri(f,n,s,u,d)),i==null?i=1/0:(n=e-i,s=t-i,u=e+i,d=t+i,i*=i);y=p.pop();)if(!(!(f=y.node)||(a=y.x0)>u||(o=y.y0)>d||(l=y.x1)<n||(h=y.y1)<s))if(f.length){var _=(a+l)/2,T=(o+h)/2;p.push(new ri(f[3],_,T,l,h),new ri(f[2],a,T,_,h),new ri(f[1],_,o,l,T),new ri(f[0],a,o,_,T)),(b=(t>=T)<<1|e>=_)&&(y=p[p.length-1],p[p.length-1]=p[p.length-1-b],p[p.length-1-b]=y)}else{var C=e-+this._x.call(null,f.data),O=t-+this._y.call(null,f.data),R=C*C+O*O;if(R<i){var z=Math.sqrt(i=R);n=e-z,s=t-z,u=e+z,d=t+z,r=f.data}}return r}function w2(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,i=this._root,r,n,s,a=this._x0,o=this._y0,l=this._x1,h=this._y1,u,d,p,f,y,b,_,T;if(!i)return this;if(i.length)for(;;){if((y=u>=(p=(a+l)/2))?a=p:l=p,(b=d>=(f=(o+h)/2))?o=f:h=f,t=i,!(i=i[_=b<<1|y]))return this;if(!i.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,T=_)}for(;i.data!==e;)if(n=i,!(i=i.next))return this;return(s=i.next)&&delete i.next,n?(s?n.next=s:delete n.next,this):t?(s?t[_]=s:delete t[_],(i=t[0]||t[1]||t[2]||t[3])&&i===(t[3]||t[2]||t[1]||t[0])&&!i.length&&(r?r[T]=i:this._root=i),this):(this._root=s,this)}function T2(e){for(var t=0,i=e.length;t<i;++t)this.remove(e[t]);return this}function S2(){return this._root}function E2(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function A2(e){var t=[],i,r=this._root,n,s,a,o,l;for(r&&t.push(new ri(r,this._x0,this._y0,this._x1,this._y1));i=t.pop();)if(!e(r=i.node,s=i.x0,a=i.y0,o=i.x1,l=i.y1)&&r.length){var h=(s+o)/2,u=(a+l)/2;(n=r[3])&&t.push(new ri(n,h,u,o,l)),(n=r[2])&&t.push(new ri(n,s,u,h,l)),(n=r[1])&&t.push(new ri(n,h,a,o,u)),(n=r[0])&&t.push(new ri(n,s,a,h,u))}return this}function C2(e){var t=[],i=[],r;for(this._root&&t.push(new ri(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var n=r.node;if(n.length){var s,a=r.x0,o=r.y0,l=r.x1,h=r.y1,u=(a+l)/2,d=(o+h)/2;(s=n[0])&&t.push(new ri(s,a,o,u,d)),(s=n[1])&&t.push(new ri(s,u,o,l,d)),(s=n[2])&&t.push(new ri(s,a,d,u,h)),(s=n[3])&&t.push(new ri(s,u,d,l,h))}i.push(r)}for(;r=i.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function M2(e){return e[0]}function P2(e){return arguments.length?(this._x=e,this):this._x}function R2(e){return e[1]}function k2(e){return arguments.length?(this._y=e,this):this._y}function fc(e,t,i){var r=new pc(t??M2,i??R2,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function pc(e,t,i,r,n,s){this._x=e,this._y=t,this._x0=i,this._y0=r,this._x1=n,this._y1=s,this._root=void 0}function U_(e){for(var t={data:e.data},i=t;e=e.next;)i=i.next={data:e.data};return t}var ni=fc.prototype=pc.prototype;ni.copy=function(){var e=new pc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,i,r;if(!t)return e;if(!t.length)return e._root=U_(t),e;for(i=[{source:t,target:e._root=new Array(4)}];t=i.pop();)for(var n=0;n<4;++n)(r=t.source[n])&&(r.length?i.push({source:r,target:t.target[n]=new Array(4)}):t.target[n]=U_(r));return e},ni.add=m2,ni.addAll=_2,ni.cover=v2,ni.data=y2,ni.extent=x2,ni.find=b2,ni.remove=w2,ni.removeAll=T2,ni.root=S2,ni.size=E2,ni.visit=A2,ni.visitAfter=C2,ni.x=P2,ni.y=k2;function qr(e){return function(){return e}}function Mr(e){return(e()-.5)*1e-6}function B2(e){return e.x+e.vx}function I2(e){return e.y+e.vy}function G2(e){var t,i,r,n=1,s=1;typeof e!="function"&&(e=qr(e==null?1:+e));function a(){for(var h,u=t.length,d,p,f,y,b,_,T=0;T<s;++T)for(d=fc(t,B2,I2).visitAfter(o),h=0;h<u;++h)p=t[h],b=i[p.index],_=b*b,f=p.x+p.vx,y=p.y+p.vy,d.visit(C);function C(O,R,z,ee,ne){var Q=O.data,Y=O.r,ie=b+Y;if(Q){if(Q.index>p.index){var Te=f-Q.x-Q.vx,Pe=y-Q.y-Q.vy,ce=Te*Te+Pe*Pe;ce<ie*ie&&(Te===0&&(Te=Mr(r),ce+=Te*Te),Pe===0&&(Pe=Mr(r),ce+=Pe*Pe),ce=(ie-(ce=Math.sqrt(ce)))/ce*n,p.vx+=(Te*=ce)*(ie=(Y*=Y)/(_+Y)),p.vy+=(Pe*=ce)*ie,Q.vx-=Te*(ie=1-ie),Q.vy-=Pe*ie)}return}return R>f+ie||ee<f-ie||z>y+ie||ne<y-ie}}function o(h){if(h.data)return h.r=i[h.data.index];for(var u=h.r=0;u<4;++u)h[u]&&h[u].r>h.r&&(h.r=h[u].r)}function l(){if(t){var h,u=t.length,d;for(i=new Array(u),h=0;h<u;++h)d=t[h],i[d.index]=+e(d,h,t)}}return a.initialize=function(h,u){t=h,r=u,l()},a.iterations=function(h){return arguments.length?(s=+h,a):s},a.strength=function(h){return arguments.length?(n=+h,a):n},a.radius=function(h){return arguments.length?(e=typeof h=="function"?h:qr(+h),l(),a):e},a}function O2(e){return e.index}function F_(e,t){var i=e.get(t);if(!i)throw new Error("node not found: "+t);return i}function U2(e){var t=O2,i=d,r,n=qr(30),s,a,o,l,h,u=1;e==null&&(e=[]);function d(_){return 1/Math.min(o[_.source.index],o[_.target.index])}function p(_){for(var T=0,C=e.length;T<u;++T)for(var O=0,R,z,ee,ne,Q,Y,ie;O<C;++O)R=e[O],z=R.source,ee=R.target,ne=ee.x+ee.vx-z.x-z.vx||Mr(h),Q=ee.y+ee.vy-z.y-z.vy||Mr(h),Y=Math.sqrt(ne*ne+Q*Q),Y=(Y-s[O])/Y*_*r[O],ne*=Y,Q*=Y,ee.vx-=ne*(ie=l[O]),ee.vy-=Q*ie,z.vx+=ne*(ie=1-ie),z.vy+=Q*ie}function f(){if(a){var _,T=a.length,C=e.length,O=new Map(a.map((z,ee)=>[t(z,ee,a),z])),R;for(_=0,o=new Array(T);_<C;++_)R=e[_],R.index=_,typeof R.source!="object"&&(R.source=F_(O,R.source)),typeof R.target!="object"&&(R.target=F_(O,R.target)),o[R.source.index]=(o[R.source.index]||0)+1,o[R.target.index]=(o[R.target.index]||0)+1;for(_=0,l=new Array(C);_<C;++_)R=e[_],l[_]=o[R.source.index]/(o[R.source.index]+o[R.target.index]);r=new Array(C),y(),s=new Array(C),b()}}function y(){if(a)for(var _=0,T=e.length;_<T;++_)r[_]=+i(e[_],_,e)}function b(){if(a)for(var _=0,T=e.length;_<T;++_)s[_]=+n(e[_],_,e)}return p.initialize=function(_,T){a=_,h=T,f()},p.links=function(_){return arguments.length?(e=_,f(),p):e},p.id=function(_){return arguments.length?(t=_,p):t},p.iterations=function(_){return arguments.length?(u=+_,p):u},p.strength=function(_){return arguments.length?(i=typeof _=="function"?_:qr(+_),y(),p):i},p.distance=function(_){return arguments.length?(n=typeof _=="function"?_:qr(+_),b(),p):n},p}function F2(){let e=1;return()=>(e=(1664525*e+1013904223)%4294967296)/4294967296}function D2(e){return e.x}function L2(e){return e.y}var N2=10,H2=Math.PI*(3-Math.sqrt(5));function z2(e){var t,i=1,r=.001,n=1-Math.pow(r,1/300),s=0,a=.6,o=new Map,l=ac(d),h=ao("tick","end"),u=F2();e==null&&(e=[]);function d(){p(),h.call("tick",t),i<r&&(l.stop(),h.call("end",t))}function p(b){var _,T=e.length,C;b===void 0&&(b=1);for(var O=0;O<b;++O)for(i+=(s-i)*n,o.forEach(function(R){R(i)}),_=0;_<T;++_)C=e[_],C.fx==null?C.x+=C.vx*=a:(C.x=C.fx,C.vx=0),C.fy==null?C.y+=C.vy*=a:(C.y=C.fy,C.vy=0);return t}function f(){for(var b=0,_=e.length,T;b<_;++b){if(T=e[b],T.index=b,T.fx!=null&&(T.x=T.fx),T.fy!=null&&(T.y=T.fy),isNaN(T.x)||isNaN(T.y)){var C=N2*Math.sqrt(.5+b),O=b*H2;T.x=C*Math.cos(O),T.y=C*Math.sin(O)}(isNaN(T.vx)||isNaN(T.vy))&&(T.vx=T.vy=0)}}function y(b){return b.initialize&&b.initialize(e,u),b}return f(),t={tick:p,restart:function(){return l.restart(d),t},stop:function(){return l.stop(),t},nodes:function(b){return arguments.length?(e=b,f(),o.forEach(y),t):e},alpha:function(b){return arguments.length?(i=+b,t):i},alphaMin:function(b){return arguments.length?(r=+b,t):r},alphaDecay:function(b){return arguments.length?(n=+b,t):+n},alphaTarget:function(b){return arguments.length?(s=+b,t):s},velocityDecay:function(b){return arguments.length?(a=1-b,t):1-a},randomSource:function(b){return arguments.length?(u=b,o.forEach(y),t):u},force:function(b,_){return arguments.length>1?(_==null?o.delete(b):o.set(b,y(_)),t):o.get(b)},find:function(b,_,T){var C=0,O=e.length,R,z,ee,ne,Q;for(T==null?T=1/0:T*=T,C=0;C<O;++C)ne=e[C],R=b-ne.x,z=_-ne.y,ee=R*R+z*z,ee<T&&(Q=ne,T=ee);return Q},on:function(b,_){return arguments.length>1?(h.on(b,_),t):h.on(b)}}}function W2(){var e,t,i,r,n=qr(-30),s,a=1,o=1/0,l=.81;function h(f){var y,b=e.length,_=fc(e,D2,L2).visitAfter(d);for(r=f,y=0;y<b;++y)t=e[y],_.visit(p)}function u(){if(e){var f,y=e.length,b;for(s=new Array(y),f=0;f<y;++f)b=e[f],s[b.index]=+n(b,f,e)}}function d(f){var y=0,b,_,T=0,C,O,R;if(f.length){for(C=O=R=0;R<4;++R)(b=f[R])&&(_=Math.abs(b.value))&&(y+=b.value,T+=_,C+=_*b.x,O+=_*b.y);f.x=C/T,f.y=O/T}else{b=f,b.x=b.data.x,b.y=b.data.y;do y+=s[b.data.index];while(b=b.next)}f.value=y}function p(f,y,b,_){if(!f.value)return!0;var T=f.x-t.x,C=f.y-t.y,O=_-y,R=T*T+C*C;if(O*O/l<R)return R<o&&(T===0&&(T=Mr(i),R+=T*T),C===0&&(C=Mr(i),R+=C*C),R<a&&(R=Math.sqrt(a*R)),t.vx+=T*f.value*r/R,t.vy+=C*f.value*r/R),!0;if(!(f.length||R>=o)){(f.data!==t||f.next)&&(T===0&&(T=Mr(i),R+=T*T),C===0&&(C=Mr(i),R+=C*C),R<a&&(R=Math.sqrt(a*R)));do f.data!==t&&(O=s[f.data.index]*r/R,t.vx+=T*O,t.vy+=C*O);while(f=f.next)}}return h.initialize=function(f,y){e=f,i=y,u()},h.strength=function(f){return arguments.length?(n=typeof f=="function"?f:qr(+f),u(),h):n},h.distanceMin=function(f){return arguments.length?(a=f*f,h):Math.sqrt(a)},h.distanceMax=function(f){return arguments.length?(o=f*f,h):Math.sqrt(o)},h.theta=function(f){return arguments.length?(l=f*f,h):Math.sqrt(l)},h}var Eo=e=>()=>e;function V2(e,{sourceEvent:t,target:i,transform:r,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:n}})}function ur(e,t,i){this.k=e,this.x=t,this.y=i}ur.prototype={constructor:ur,scale:function(e){return e===1?this:new ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ao=new ur(1,0,0);j2.prototype=ur.prototype;function j2(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ao;return e.__zoom}function gc(e){e.stopImmediatePropagation()}function bs(e){e.preventDefault(),e.stopImmediatePropagation()}function $2(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function X2(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function D_(){return this.__zoom||Ao}function Y2(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function q2(){return navigator.maxTouchPoints||"ontouchstart"in this}function K2(e,t,i){var r=e.invertX(t[0][0])-i[0][0],n=e.invertX(t[1][0])-i[1][0],s=e.invertY(t[0][1])-i[0][1],a=e.invertY(t[1][1])-i[1][1];return e.translate(n>r?(r+n)/2:Math.min(0,r)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Z2(){var e=$2,t=X2,i=K2,r=Y2,n=q2,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=tE,h=ao("start","zoom","end"),u,d,p,f=500,y=150,b=0,_=10;function T(U){U.property("__zoom",D_).on("wheel.zoom",Q,{passive:!1}).on("mousedown.zoom",Y).on("dblclick.zoom",ie).filter(n).on("touchstart.zoom",Te).on("touchmove.zoom",Pe).on("touchend.zoom touchcancel.zoom",ce).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}T.transform=function(U,ae,K,de){var M=U.selection?U.selection():U;M.property("__zoom",D_),U!==M?z(U,ae,K,de):M.interrupt().each(function(){ee(this,arguments).event(de).start().zoom(null,typeof ae=="function"?ae.apply(this,arguments):ae).end()})},T.scaleBy=function(U,ae,K,de){T.scaleTo(U,function(){var M=this.__zoom.k,P=typeof ae=="function"?ae.apply(this,arguments):ae;return M*P},K,de)},T.scaleTo=function(U,ae,K,de){T.transform(U,function(){var M=t.apply(this,arguments),P=this.__zoom,A=K==null?R(M):typeof K=="function"?K.apply(this,arguments):K,j=P.invert(A),H=typeof ae=="function"?ae.apply(this,arguments):ae;return i(O(C(P,H),A,j),M,a)},K,de)},T.translateBy=function(U,ae,K,de){T.transform(U,function(){return i(this.__zoom.translate(typeof ae=="function"?ae.apply(this,arguments):ae,typeof K=="function"?K.apply(this,arguments):K),t.apply(this,arguments),a)},null,de)},T.translateTo=function(U,ae,K,de,M){T.transform(U,function(){var P=t.apply(this,arguments),A=this.__zoom,j=de==null?R(P):typeof de=="function"?de.apply(this,arguments):de;return i(Ao.translate(j[0],j[1]).scale(A.k).translate(typeof ae=="function"?-ae.apply(this,arguments):-ae,typeof K=="function"?-K.apply(this,arguments):-K),P,a)},de,M)};function C(U,ae){return ae=Math.max(s[0],Math.min(s[1],ae)),ae===U.k?U:new ur(ae,U.x,U.y)}function O(U,ae,K){var de=ae[0]-K[0]*U.k,M=ae[1]-K[1]*U.k;return de===U.x&&M===U.y?U:new ur(U.k,de,M)}function R(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function z(U,ae,K,de){U.on("start.zoom",function(){ee(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){ee(this,arguments).event(de).end()}).tween("zoom",function(){var M=this,P=arguments,A=ee(M,P).event(de),j=t.apply(M,P),H=K==null?R(j):typeof K=="function"?K.apply(M,P):K,J=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Z=M.__zoom,oe=typeof ae=="function"?ae.apply(M,P):ae,be=l(Z.invert(H).concat(J/Z.k),oe.invert(H).concat(J/oe.k));return function(me){if(me===1)me=oe;else{var Oe=be(me),Ne=J/Oe[2];me=new ur(Ne,H[0]-Oe[0]*Ne,H[1]-Oe[1]*Ne)}A.zoom(null,me)}})}function ee(U,ae,K){return!K&&U.__zooming||new ne(U,ae)}function ne(U,ae){this.that=U,this.args=ae,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,ae),this.taps=0}ne.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,ae){return this.mouse&&U!=="mouse"&&(this.mouse[1]=ae.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=ae.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=ae.invert(this.touch1[0])),this.that.__zoom=ae,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var ae=Bi(this.that).datum();h.call(U,this.that,new V2(U,{sourceEvent:this.sourceEvent,target:T,type:U,transform:this.that.__zoom,dispatch:h}),ae)}};function Q(U,...ae){if(!e.apply(this,arguments))return;var K=ee(this,ae).event(U),de=this.__zoom,M=Math.max(s[0],Math.min(s[1],de.k*Math.pow(2,r.apply(this,arguments)))),P=or(U);if(K.wheel)(K.mouse[0][0]!==P[0]||K.mouse[0][1]!==P[1])&&(K.mouse[1]=de.invert(K.mouse[0]=P)),clearTimeout(K.wheel);else{if(de.k===M)return;K.mouse=[P,de.invert(P)],So(this),K.start()}bs(U),K.wheel=setTimeout(A,y),K.zoom("mouse",i(O(C(de,M),K.mouse[0],K.mouse[1]),K.extent,a));function A(){K.wheel=null,K.end()}}function Y(U,...ae){if(p||!e.apply(this,arguments))return;var K=U.currentTarget,de=ee(this,ae,!0).event(U),M=Bi(U.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",J,!0),P=or(U,K),A=U.clientX,j=U.clientY;r_(U.view),gc(U),de.mouse=[P,this.__zoom.invert(P)],So(this),de.start();function H(Z){if(bs(Z),!de.moved){var oe=Z.clientX-A,be=Z.clientY-j;de.moved=oe*oe+be*be>b}de.event(Z).zoom("mouse",i(O(de.that.__zoom,de.mouse[0]=or(Z,K),de.mouse[1]),de.extent,a))}function J(Z){M.on("mousemove.zoom mouseup.zoom",null),n_(Z.view,de.moved),bs(Z),de.event(Z).end()}}function ie(U,...ae){if(e.apply(this,arguments)){var K=this.__zoom,de=or(U.changedTouches?U.changedTouches[0]:U,this),M=K.invert(de),P=K.k*(U.shiftKey?.5:2),A=i(O(C(K,P),de,M),t.apply(this,ae),a);bs(U),o>0?Bi(this).transition().duration(o).call(z,A,de,U):Bi(this).call(T.transform,A,de,U)}}function Te(U,...ae){if(e.apply(this,arguments)){var K=U.touches,de=K.length,M=ee(this,ae,U.changedTouches.length===de).event(U),P,A,j,H;for(gc(U),A=0;A<de;++A)j=K[A],H=or(j,this),H=[H,this.__zoom.invert(H),j.identifier],M.touch0?!M.touch1&&M.touch0[2]!==H[2]&&(M.touch1=H,M.taps=0):(M.touch0=H,P=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(M.taps<2&&(d=H[0],u=setTimeout(function(){u=null},f)),So(this),M.start())}}function Pe(U,...ae){if(this.__zooming){var K=ee(this,ae).event(U),de=U.changedTouches,M=de.length,P,A,j,H;for(bs(U),P=0;P<M;++P)A=de[P],j=or(A,this),K.touch0&&K.touch0[2]===A.identifier?K.touch0[0]=j:K.touch1&&K.touch1[2]===A.identifier&&(K.touch1[0]=j);if(A=K.that.__zoom,K.touch1){var J=K.touch0[0],Z=K.touch0[1],oe=K.touch1[0],be=K.touch1[1],me=(me=oe[0]-J[0])*me+(me=oe[1]-J[1])*me,Oe=(Oe=be[0]-Z[0])*Oe+(Oe=be[1]-Z[1])*Oe;A=C(A,Math.sqrt(me/Oe)),j=[(J[0]+oe[0])/2,(J[1]+oe[1])/2],H=[(Z[0]+be[0])/2,(Z[1]+be[1])/2]}else if(K.touch0)j=K.touch0[0],H=K.touch0[1];else return;K.zoom("touch",i(O(A,j,H),K.extent,a))}}function ce(U,...ae){if(this.__zooming){var K=ee(this,ae).event(U),de=U.changedTouches,M=de.length,P,A;for(gc(U),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),P=0;P<M;++P)A=de[P],K.touch0&&K.touch0[2]===A.identifier?delete K.touch0:K.touch1&&K.touch1[2]===A.identifier&&delete K.touch1;if(K.touch1&&!K.touch0&&(K.touch0=K.touch1,delete K.touch1),K.touch0)K.touch0[1]=this.__zoom.invert(K.touch0[0]);else if(K.end(),K.taps===2&&(A=or(A,this),Math.hypot(d[0]-A[0],d[1]-A[1])<_)){var j=Bi(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return T.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:Eo(+U),T):r},T.filter=function(U){return arguments.length?(e=typeof U=="function"?U:Eo(!!U),T):e},T.touchable=function(U){return arguments.length?(n=typeof U=="function"?U:Eo(!!U),T):n},T.extent=function(U){return arguments.length?(t=typeof U=="function"?U:Eo([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),T):t},T.scaleExtent=function(U){return arguments.length?(s[0]=+U[0],s[1]=+U[1],T):[s[0],s[1]]},T.translateExtent=function(U){return arguments.length?(a[0][0]=+U[0][0],a[1][0]=+U[1][0],a[0][1]=+U[0][1],a[1][1]=+U[1][1],T):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},T.constrain=function(U){return arguments.length?(i=U,T):i},T.duration=function(U){return arguments.length?(o=+U,T):o},T.interpolate=function(U){return arguments.length?(l=U,T):l},T.on=function(){var U=h.on.apply(h,arguments);return U===h?T:U},T.clickDistance=function(U){return arguments.length?(b=(U=+U)*U,T):Math.sqrt(b)},T.tapDistance=function(U){return arguments.length?(_=+U,T):_},T}te();var J2={extension:{type:G.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lb(),ob))}};te();var Q2={extension:{type:G.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(ub(),hb))}};te(),bl(),fl(),te(),Ft(),za();var mc;function eA(e){return mc!==void 0||(mc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??ss.defaultOptions.failIfMajorPerformanceCaveat};try{if(!vt.get().getWebGLRenderingContext())return!1;let i=vt.get().createCanvas().getContext("webgl",t),r=!!i?.getContextAttributes()?.stencil;if(i){let n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}})()),mc}Ft();var _c;async function tA(e={}){return _c!==void 0||(_c=await(async()=>{let t=vt.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),_c}za();var L_=["webgl","webgpu","canvas"];async function iA(e){let t=[];e.preference?(t.push(e.preference),L_.forEach(s=>{s!==e.preference&&t.push(s)})):t=L_.slice();let i,r={};for(let s=0;s<t.length;s++){let a=t[s];if(a==="webgpu"&&await tA()){let{WebGPURenderer:o}=await Promise.resolve().then(()=>(B1(),qg));i=o,r={...e,...e.webgpu};break}else if(a==="webgl"&&eA(e.failIfMajorPerformanceCaveat??ss.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(Dw(),Um));i=o,r={...e,...e.webgl};break}else if(a==="canvas")throw r={...e},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!i)throw new Error("No available renderer for the current environment");let n=new i;return await n.init(r),n}zi(),lg(),wt();var N_=class Pc{constructor(...t){this.stage=new Tt,t[0]!==void 0&&Xe(Ve,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await iA(t),Pc._plugins.forEach(i=>{i.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Xe(Ve,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,i=!1){let r=Pc._plugins.slice(0);r.reverse(),r.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(t),this.renderer=null}};N_._plugins=[];var H_=N_;pe.handleByList(G.Application,H_._plugins),pe.add(zh),kr(),wt(),gl();var rA=class extends zs{constructor(e,t){let{text:i,resolution:r,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=e;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new $t({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e=e||{},this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){let i,r;typeof e!="object"?(i=e,r=t??e):(i=e.width,r=e.height??e.width),i!==void 0&&this._setWidth(i,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}addBounds(e){let t=this.bounds;e.addFrame(t.minX,t.minY,t.maxX,t.maxY)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,r=-t*this.anchor.x,n=0;return e.x>=r&&e.x<=r+t&&(n=-i*this.anchor.y,e.y>=n&&e.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function nA(e,t){let i=e[0]??{};return(typeof i=="string"||e[1])&&(Xe(Ve,`use new ${t}({ text: "hi!", style }) instead`),i={text:i,style:e[1]}),i}Sa(),jn();var sA=class extends rA{constructor(...e){let t=nA(e,"Text");super(t,Xi),this.renderPipeId="text"}_updateBounds(){let e=this._bounds,t=this._anchor,i=Ri.measureText(this._text,this._style),{width:r,height:n}=i;e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*n,e.maxY=e.minY+n}};hf(),xd(),zi(),Wf(),xt();var EA=ht(Nd(),1);pe.add(J2,Q2);var ws=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ws.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?ws.Bounce.In(e*2)*.5:ws.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),Ts=function(){return performance.now()},Co=function(){function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(i){return t._tweens[i]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];for(var n=0,s=i;n<s.length;n++){var a=s[n];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var r=0,n=t;r<n.length;r++){var s=n[r];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,i){t===void 0&&(t=Ts()),i===void 0&&(i=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<r.length;n++){var s=this._tweens[r[n]],a=!i;s&&s.update(t,a)===!1&&!i&&this.remove(s)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),An={Linear:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),s=An.Utils.Linear;return t<0?s(e[0],e[1],r):t>1?s(e[i],e[i-1],i-r):s(e[n],e[n+1>i?i:n+1],r-n)},Bezier:function(e,t){for(var i=0,r=e.length-1,n=Math.pow,s=An.Utils.Bernstein,a=0;a<=r;a++)i+=n(1-t,r-a)*n(t,a)*e[a]*s(r,a);return i},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),s=An.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),s(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(s(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):s(e[n?n-1:0],e[n],e[i<n+1?i:n+1],e[i<n+2?i:n+2],r-n)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=An.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:function(){var e=[1];return function(t){var i=1;if(e[t])return e[t];for(var r=t;r>1;r--)i*=r;return e[t]=i,i}}(),CatmullRom:function(e,t,i,r,n){var s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}}},z_=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),vc=new Co,Mo=function(){function e(t,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ws.Linear.None,this._interpolationFunction=An.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=z_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=vc,vc.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,i){if(t===void 0&&(t=Ts()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,i,r,n,s){for(var a in r){var o=t[a],l=Array.isArray(o),h=l?"array":typeof o,u=!l&&Array.isArray(r[a]);if(!(h==="undefined"||h==="function")){if(u){var d=r[a];if(d.length===0)continue;for(var p=[o],f=0,y=d.length;f<y;f+=1){var b=this._handleRelativeValue(o,d[f]);if(isNaN(b)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(b)}u&&(r[a]=p)}if((h==="object"||l)&&o&&!u){i[a]=l?[]:{};var _=o;for(var T in _)i[a][T]=_[T];n[a]=l?[]:{};var d=r[a];if(!this._isDynamic){var C={};for(var T in d)C[T]=d[T];r[a]=d=C}this._setupProperties(_,i[a],d,n[a],s)}else(typeof i[a]>"u"||s)&&(i[a]=o),l||(i[a]*=1),u?n[a]=r[a].slice().reverse():n[a]=i[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=Ts()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=Ts()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=ws.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=An.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,i){var r=this,n;if(t===void 0&&(t=Ts()),i===void 0&&(i=e.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,o=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*o,h=function(){if(r._duration===0||a>l)return 1;var b=Math.trunc(a/o),_=a-b*o,T=Math.min(_/r._duration,1);return T===0&&a===r._duration?1:T},u=h(),d=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var f=0,y=this._chainedTweens.length;f<y;f++)this._chainedTweens[f].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,i,r,n){for(var s in r)if(i[s]!==void 0){var a=i[s]||0,o=r[s],l=Array.isArray(t[s]),h=Array.isArray(o),u=!l&&h;u?t[s]=this._interpolationFunction(o,n):typeof o=="object"&&o?this._updateProperties(t[s],a,o,n):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(t[s]=a+(o-a)*n))}},e.prototype._handleRelativeValue=function(t,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?t+parseFloat(i):parseFloat(i)},e.prototype._swapEndStartRepeatValues=function(t){var i=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=i},e.autoStartOnUpdate=!1,e}(),AA=z_.nextId,Zi=vc,CA=Zi.getAll.bind(Zi),MA=Zi.removeAll.bind(Zi),PA=Zi.add.bind(Zi),RA=Zi.remove.bind(Zi),kA=Zi.update.bind(Zi);function aA(e,t){if(!e)return;function i(n){n.target===this&&(n.preventDefault(),n.stopPropagation(),t())}function r(n){n.key.startsWith("Esc")&&(n.preventDefault(),t())}e?.addEventListener("click",i),window.addCleanup(()=>e?.removeEventListener("click",i)),document.addEventListener("keydown",r),window.addCleanup(()=>document.removeEventListener("keydown",r))}function oA(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var BA=Object.hasOwnProperty,lA=ht(Lw(),1),IA=(0,lA.default)();function hA(e){return e.document.body.dataset.slug}function Ss(e){let t=pA(fA(e,"index"),!0);return t.length===0?"/":t}function uA(e){let t=e.split("/").filter(i=>i!=="").slice(0,-1).map(i=>"..").join("/");return t.length===0&&(t="."),t}function W_(e,t){return cA(uA(e),Ss(t))}function cA(...e){return e.filter(t=>t!=="").join("/").replace(/\/\/+/g,"/")}function dA(e,t){return e===t||e.endsWith("/"+t)}function fA(e,t){return dA(e,t)&&(e=e.slice(0,-t.length)),e}function pA(e,t){return e.startsWith("/")&&(e=e.substring(1)),!t&&e.endsWith("/")&&(e=e.slice(0,-1)),e}var V_="graph-visited";function j_(){return new Set(JSON.parse(localStorage.getItem(V_)??"[]"))}function gA(e){let t=j_();t.add(e),localStorage.setItem(V_,JSON.stringify([...t]))}async function yc(e,t){let i=Ss(t),r=j_(),n=document.getElementById(e);if(!n)return;oA(n);let{drag:s,zoom:a,depth:o,scale:l,repelForce:h,centerForce:u,linkDistance:d,fontSize:p,opacityScale:f,removeTags:y,showTags:b,focusOnHover:_}=JSON.parse(n.dataset.cfg),T=new Map(Object.entries(await fetchData).map(([q,le])=>[Ss(q),le])),C=[],O=[],R=new Set(T.keys()),z=new Map;for(let[q,le]of T.entries()){let he=le.links??[];for(let ge of he)R.has(ge)&&C.push({source:q,target:ge});if(b){let ge=le.tags.filter(Mt=>!y.includes(Mt)).map(Mt=>Ss("tags/"+Mt));O.push(...ge.filter(Mt=>!O.includes(Mt)));for(let Mt of ge)C.push({source:q,target:Mt})}}let ee=new Set,ne=[i,"__SENTINEL"];if(o>=0)for(;o>=0&&ne.length>0;){let q=ne.shift();if(q==="__SENTINEL")o--,ne.push("__SENTINEL");else{ee.add(q);let le=C.filter(ge=>ge.source===q),he=C.filter(ge=>ge.target===q);ne.push(...le.map(ge=>ge.target),...he.map(ge=>ge.source))}}else R.forEach(q=>ee.add(q)),b&&O.forEach(q=>ee.add(q));let Q=[...ee].map(q=>{let le=q.startsWith("tags/")?"#"+q.substring(5):T.get(q)?.title??q;return{id:q,text:le,tags:T.get(q)?.tags??[]}}),Y={nodes:Q,links:C.filter(q=>ee.has(q.source)&&ee.has(q.target)).map(q=>({source:Q.find(le=>le.id===q.source),target:Q.find(le=>le.id===q.target)}))},ie=z2(Y.nodes).force("charge",W2().strength(-100*h)).force("center",g2().strength(u)).force("link",U2(Y.links).distance(d)).force("collide",G2(q=>ae(q)).iterations(3)),Te=n.offsetWidth,Pe=Math.max(n.offsetHeight,250),ce=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((q,le)=>(q[le]=getComputedStyle(document.documentElement).getPropertyValue(le),q),{}),U=q=>q.id===i?ce["--secondary"]:r.has(q.id)||q.id.startsWith("tags/")?ce["--tertiary"]:ce["--gray"];function ae(q){let le=Y.links.filter(he=>he.source.id===q.id||he.target.id===q.id).length;return 2+Math.sqrt(le)}let K=null,de=new Set,M=[],P=[];function A(q){if(K=q,q===null){de=new Set;for(let le of P)le.active=!1;for(let le of M)le.active=!1}else{de=new Set;for(let le of M){let he=le.simulationData;(he.source.id===q||he.target.id===q)&&(de.add(he.source.id),de.add(he.target.id)),le.active=he.source.id===q||he.target.id===q}for(let le of P)le.active=de.has(le.simulationData.id)}}let j=0,H=!1;function J(){z.get("link")?.stop();let q=new Co;for(let le of M){let he=1;K&&(he=le.active?1:.2),le.color=le.active?ce["--gray"]:ce["--lightgray"],q.add(new Mo(le).to({alpha:he},200))}q.getAll().forEach(le=>le.start()),z.set("link",{update:q.update.bind(q),stop(){q.getAll().forEach(le=>le.stop())}})}function Z(){z.get("label")?.stop();let q=new Co,le=1/l,he=le*1.1;for(let ge of P){let Mt=ge.simulationData.id;K===Mt?q.add(new Mo(ge.label).to({alpha:1,scale:{x:he,y:he}},100)):q.add(new Mo(ge.label).to({alpha:ge.label.alpha,scale:{x:le,y:le}},100))}q.getAll().forEach(ge=>ge.start()),z.set("label",{update:q.update.bind(q),stop(){q.getAll().forEach(ge=>ge.stop())}})}function oe(){z.get("hover")?.stop();let q=new Co;for(let le of P){let he=1;K!==null&&_&&(he=le.active?1:.2),q.add(new Mo(le.gfx,q).to({alpha:he},200))}q.getAll().forEach(le=>le.start()),z.set("hover",{update:q.update.bind(q),stop(){q.getAll().forEach(le=>le.stop())}})}function be(){oe(),J(),Z()}z.forEach(q=>q.stop()),z.clear();let me=new H_;await me.init({width:Te,height:Pe,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),n.appendChild(me.canvas);let Oe=me.stage;Oe.interactive=!1;let Ne=new Tt({zIndex:3}),Ye=new Tt({zIndex:2}),St=new Tt({zIndex:1});Oe.addChild(Ye,Ne,St);for(let q of Y.nodes){let le=q.id,he=new sA({interactive:!1,eventMode:"none",text:q.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:p*15,fill:ce["--dark"],fontFamily:ce["--bodyFont"]},resolution:window.devicePixelRatio*4});he.scale.set(1/l);let ge=0,Mt=le.startsWith("tags/"),Es=new Aa({interactive:!0,label:le,eventMode:"static",hitArea:new jl(0,0,ae(q)),cursor:"pointer"}).circle(0,0,ae(q)).fill({color:Mt?ce["--light"]:U(q)}).stroke({width:Mt?2:0,color:U(q)}).on("pointerover",mA=>{A(mA.target.label),ge=he.alpha,H||be()}).on("pointerleave",()=>{A(null),he.alpha=ge,H||be()});Ye.addChild(Es),Ne.addChild(he);let xc={simulationData:q,gfx:Es,label:he,color:U(q),alpha:1,active:!1};P.push(xc)}for(let q of Y.links){let le=new Aa({interactive:!1,eventMode:"none"});St.addChild(le);let he={simulationData:q,gfx:le,color:ce["--lightgray"],alpha:1,active:!1};M.push(he)}let Ze=Ao;if(s)Bi(me.canvas).call(CS().container(()=>me.canvas).subject(()=>Y.nodes.find(q=>q.id===K)).on("start",function(q){q.active||ie.alphaTarget(1).restart(),q.subject.fx=q.subject.x,q.subject.fy=q.subject.y,q.subject.__initialDragPos={x:q.subject.x,y:q.subject.y,fx:q.subject.fx,fy:q.subject.fy},j=Date.now(),H=!0}).on("drag",function(q){let le=q.subject.__initialDragPos;q.subject.fx=le.x+(q.x-le.x)/Ze.k,q.subject.fy=le.y+(q.y-le.y)/Ze.k}).on("end",function(q){if(q.active||ie.alphaTarget(0),q.subject.fx=null,q.subject.fy=null,H=!1,Date.now()-j<500){let le=Y.nodes.find(ge=>ge.id===q.subject.id),he=W_(t,le.id);window.spaNavigate(new URL(he,window.location.toString()))}}));else for(let q of P)q.gfx.on("click",()=>{let le=W_(t,q.simulationData.id);window.spaNavigate(new URL(le,window.location.toString()))});a&&Bi(me.canvas).call(Z2().extent([[0,0],[Te,Pe]]).scaleExtent([.25,4]).on("zoom",({transform:q})=>{Ze=q,Oe.scale.set(q.k,q.k),Oe.position.set(q.x,q.y);let le=q.k*f,he=Math.max((le-1)/3.75,0),ge=P.filter(Mt=>Mt.active).flatMap(Mt=>Mt.label);for(let Mt of Ne.children)ge.includes(Mt)||(Mt.alpha=he)}));function _i(q){for(let le of P){let{x:he,y:ge}=le.simulationData;!he||!ge||(le.gfx.position.set(he+Te/2,ge+Pe/2),le.label&&le.label.position.set(he+Te/2,ge+Pe/2))}for(let le of M){let he=le.simulationData;le.gfx.clear(),le.gfx.moveTo(he.source.x+Te/2,he.source.y+Pe/2),le.gfx.lineTo(he.target.x+Te/2,he.target.y+Pe/2).stroke({alpha:le.alpha,width:1,color:le.color})}z.forEach(le=>le.update(q)),me.renderer.render(Oe),requestAnimationFrame(_i)}let Oi=requestAnimationFrame(_i);window.addCleanup(()=>cancelAnimationFrame(Oi))}document.addEventListener("nav",async e=>{let t=e.detail.url;gA(Ss(t)),await yc("graph-container",t);let i=()=>{yc("graph-container",t)};document.addEventListener("themechange",i),window.addCleanup(()=>{document.removeEventListener("themechange",i)});let r=document.getElementById("global-graph-outer"),n=r?.closest(".sidebar");function s(){let h=hA(window);r?.classList.add("active"),n&&(n.style.zIndex="1"),yc("global-graph-container",h),aA(r,a)}function a(){r?.classList.remove("active"),n&&(n.style.zIndex="unset")}async function o(h){h.key==="g"&&(h.ctrlKey||h.metaKey)&&!h.shiftKey&&(h.preventDefault(),r?.classList.contains("active")?a():s())}let l=document.getElementById("global-graph-icon");l?.addEventListener("click",s),window.addCleanup(()=>l?.removeEventListener("click",s)),document.addEventListener("keydown",o),window.addCleanup(()=>document.removeEventListener("keydown",o))})}(),function(){var gt=new IntersectionObserver(it=>{for(let Et of it){let Bt=Et.target.id,v=document.querySelector(`a[data-for="${Bt}"]`),Ue=Et.rootBounds?.height;Ue&&v&&(Et.boundingClientRect.y<Ue?v.classList.add("in-view"):v.classList.remove("in-view"))}});function Pt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let it=this.nextElementSibling;it&&(it.classList.toggle("collapsed"),it.style.maxHeight=it.style.maxHeight==="0px"?it.scrollHeight+"px":"0px")}function jt(){let it=document.getElementById("toc");if(it){let Et=it.classList.contains("collapsed"),Bt=it.nextElementSibling;if(!Bt)return;Bt.style.maxHeight=Et?"0px":Bt.scrollHeight+"px",it.addEventListener("click",Pt),window.addCleanup(()=>it.removeEventListener("click",Pt))}}window.addEventListener("resize",jt),document.addEventListener("nav",()=>{jt(),gt.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(it=>gt.observe(it))})}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(E,c)=>()=>(c||E((c={exports:{}}).exports,c),c.exports),Ue=(E,c,g,m)=>{if(c&&typeof c=="object"||typeof c=="function")for(let x of it(c))!Bt.call(E,x)&&x!==g&&Pt(E,x,{get:()=>c[x],enumerable:!(m=jt(c,x))||m.enumerable});return E},ze=(E,c,g)=>(g=E!=null?gt(Et(E)):{},Ue(c||!E||!E.__esModule?Pt(g,"default",{value:E,enumerable:!0}):g,E)),Rt=v((E,c)=>{"use strict";c.exports=m;function g(w){return w instanceof Buffer?Buffer.from(w):new w.constructor(w.buffer.slice(),w.byteOffset,w.length)}function m(w){if(w=w||{},w.circles)return x(w);let S=new Map;if(S.set(Date,F=>new Date(F)),S.set(Map,(F,V)=>new Map(B(Array.from(F),V))),S.set(Set,(F,V)=>new Set(B(Array.from(F),V))),w.constructorHandlers)for(let F of w.constructorHandlers)S.set(F[0],F[1]);let k=null;return w.proto?X:N;function B(F,V){let L=Object.keys(F),I=new Array(L.length);for(let D=0;D<L.length;D++){let $=L[D],se=F[$];typeof se!="object"||se===null?I[$]=se:se.constructor!==Object&&(k=S.get(se.constructor))?I[$]=k(se,V):ArrayBuffer.isView(se)?I[$]=g(se):I[$]=V(se)}return I}function N(F){if(typeof F!="object"||F===null)return F;if(Array.isArray(F))return B(F,N);if(F.constructor!==Object&&(k=S.get(F.constructor)))return k(F,N);let V={};for(let L in F){if(Object.hasOwnProperty.call(F,L)===!1)continue;let I=F[L];typeof I!="object"||I===null?V[L]=I:I.constructor!==Object&&(k=S.get(I.constructor))?V[L]=k(I,N):ArrayBuffer.isView(I)?V[L]=g(I):V[L]=N(I)}return V}function X(F){if(typeof F!="object"||F===null)return F;if(Array.isArray(F))return B(F,X);if(F.constructor!==Object&&(k=S.get(F.constructor)))return k(F,X);let V={};for(let L in F){let I=F[L];typeof I!="object"||I===null?V[L]=I:I.constructor!==Object&&(k=S.get(I.constructor))?V[L]=k(I,X):ArrayBuffer.isView(I)?V[L]=g(I):V[L]=X(I)}return V}}function x(w){let S=[],k=[],B=new Map;if(B.set(Date,L=>new Date(L)),B.set(Map,(L,I)=>new Map(X(Array.from(L),I))),B.set(Set,(L,I)=>new Set(X(Array.from(L),I))),w.constructorHandlers)for(let L of w.constructorHandlers)B.set(L[0],L[1]);let N=null;return w.proto?V:F;function X(L,I){let D=Object.keys(L),$=new Array(D.length);for(let se=0;se<D.length;se++){let xe=D[se],Me=L[xe];if(typeof Me!="object"||Me===null)$[xe]=Me;else if(Me.constructor!==Object&&(N=B.get(Me.constructor)))$[xe]=N(Me,I);else if(ArrayBuffer.isView(Me))$[xe]=g(Me);else{let Ge=S.indexOf(Me);Ge!==-1?$[xe]=k[Ge]:$[xe]=I(Me)}}return $}function F(L){if(typeof L!="object"||L===null)return L;if(Array.isArray(L))return X(L,F);if(L.constructor!==Object&&(N=B.get(L.constructor)))return N(L,F);let I={};S.push(L),k.push(I);for(let D in L){if(Object.hasOwnProperty.call(L,D)===!1)continue;let $=L[D];if(typeof $!="object"||$===null)I[D]=$;else if($.constructor!==Object&&(N=B.get($.constructor)))I[D]=N($,F);else if(ArrayBuffer.isView($))I[D]=g($);else{let se=S.indexOf($);se!==-1?I[D]=k[se]:I[D]=F($)}}return S.pop(),k.pop(),I}function V(L){if(typeof L!="object"||L===null)return L;if(Array.isArray(L))return X(L,V);if(L.constructor!==Object&&(N=B.get(L.constructor)))return N(L,V);let I={};S.push(L),k.push(I);for(let D in L){let $=L[D];if(typeof $!="object"||$===null)I[D]=$;else if($.constructor!==Object&&(N=B.get($.constructor)))I[D]=N($,V);else if(ArrayBuffer.isView($))I[D]=g($);else{let se=S.indexOf($);se!==-1?I[D]=k[se]:I[D]=V($)}}return S.pop(),k.pop(),I}}}),ht=Math.min,G=Math.max,kt=Math.round,je=E=>({x:E,y:E}),pe={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function dt(E,c,g){return G(E,ht(c,g))}function Nt(E,c){return typeof E=="function"?E(c):E}function Je(E){return E.split("-")[0]}function xt(E){return E.split("-")[1]}function Ui(E){return E==="x"?"y":"x"}function It(E){return E==="y"?"height":"width"}function rt(E){return["top","bottom"].includes(Je(E))?"y":"x"}function mt(E){return Ui(rt(E))}function nt(E,c,g){g===void 0&&(g=!1);let m=xt(E),x=mt(E),w=It(x),S=x==="x"?m===(g?"end":"start")?"right":"left":m==="start"?"bottom":"top";return c.reference[w]>c.floating[w]&&(S=Gt(S)),[S,Gt(S)]}function Qi(E){let c=Gt(E);return[yi(E),c,yi(c)]}function yi(E){return E.replace(/start|end/g,c=>te[c])}function cr(E,c,g){let m=["left","right"],x=["right","left"],w=["top","bottom"],S=["bottom","top"];switch(E){case"top":case"bottom":return g?c?x:m:c?m:x;case"left":case"right":return c?w:S;default:return[]}}function ui(E,c,g,m){let x=xt(E),w=cr(Je(E),g==="start",m);return x&&(w=w.map(S=>S+"-"+x),c&&(w=w.concat(w.map(yi)))),w}function Gt(E){return E.replace(/left|right|bottom|top/g,c=>pe[c])}function Fi(E){return{top:0,right:0,bottom:0,left:0,...E}}function si(E){return typeof E!="number"?Fi(E):{top:E,right:E,bottom:E,left:E}}function Ot(E){let{x:c,y:g,width:m,height:x}=E;return{width:m,height:x,top:g,left:c,right:c+m,bottom:g+x,x:c,y:g}}function Di(E,c,g){let{reference:m,floating:x}=E,w=rt(c),S=mt(c),k=It(S),B=Je(c),N=w==="y",X=m.x+m.width/2-x.width/2,F=m.y+m.height/2-x.height/2,V=m[k]/2-x[k]/2,L;switch(B){case"top":L={x:X,y:m.y-x.height};break;case"bottom":L={x:X,y:m.y+m.height};break;case"right":L={x:m.x+m.width,y:F};break;case"left":L={x:m.x-x.width,y:F};break;default:L={x:m.x,y:m.y}}switch(xt(c)){case"start":L[S]-=V*(g&&N?-1:1);break;case"end":L[S]+=V*(g&&N?-1:1);break}return L}var Kt=async(E,c,g)=>{let{placement:m="bottom",strategy:x="absolute",middleware:w=[],platform:S}=g,k=w.filter(Boolean),B=await(S.isRTL==null?void 0:S.isRTL(c)),N=await S.getElementRects({reference:E,floating:c,strategy:x}),{x:X,y:F}=Di(N,m,B),V=m,L={},I=0;for(let D=0;D<k.length;D++){let{name:$,fn:se}=k[D],{x:xe,y:Me,data:Ge,reset:ct}=await se({x:X,y:F,initialPlacement:m,placement:V,strategy:x,middlewareData:L,rects:N,platform:S,elements:{reference:E,floating:c}});X=xe??X,F=Me??F,L={...L,[$]:{...L[$],...Ge}},ct&&I<=50&&(I++,typeof ct=="object"&&(ct.placement&&(V=ct.placement),ct.rects&&(N=ct.rects===!0?await S.getElementRects({reference:E,floating:c,strategy:x}):ct.rects),{x:X,y:F}=Di(N,V,B)),D=-1)}return{x:X,y:F,placement:V,strategy:x,middlewareData:L}};async function Li(E,c){var g;c===void 0&&(c={});let{x:m,y:x,platform:w,rects:S,elements:k,strategy:B}=E,{boundary:N="clippingAncestors",rootBoundary:X="viewport",elementContext:F="floating",altBoundary:V=!1,padding:L=0}=Nt(c,E),I=si(L),D=k[V?F==="floating"?"reference":"floating":F],$=Ot(await w.getClippingRect({element:(g=await(w.isElement==null?void 0:w.isElement(D)))==null||g?D:D.contextElement||await(w.getDocumentElement==null?void 0:w.getDocumentElement(k.floating)),boundary:N,rootBoundary:X,strategy:B})),se=F==="floating"?{...S.floating,x:m,y:x}:S.reference,xe=await(w.getOffsetParent==null?void 0:w.getOffsetParent(k.floating)),Me=await(w.isElement==null?void 0:w.isElement(xe))?await(w.getScale==null?void 0:w.getScale(xe))||{x:1,y:1}:{x:1,y:1},Ge=Ot(w.convertOffsetParentRelativeRectToViewportRelativeRect?await w.convertOffsetParentRelativeRectToViewportRelativeRect({elements:k,rect:se,offsetParent:xe,strategy:B}):se);return{top:($.top-Ge.top+I.top)/Me.y,bottom:(Ge.bottom-$.bottom+I.bottom)/Me.y,left:($.left-Ge.left+I.left)/Me.x,right:(Ge.right-$.right+I.right)/Me.x}}var er=function(E){return E===void 0&&(E={}),{name:"flip",options:E,async fn(c){var g,m;let{placement:x,middlewareData:w,rects:S,initialPlacement:k,platform:B,elements:N}=c,{mainAxis:X=!0,crossAxis:F=!0,fallbackPlacements:V,fallbackStrategy:L="bestFit",fallbackAxisSideDirection:I="none",flipAlignment:D=!0,...$}=Nt(E,c);if((g=w.arrow)!=null&&g.alignmentOffset)return{};let se=Je(x),xe=Je(k)===k,Me=await(B.isRTL==null?void 0:B.isRTL(N.floating)),Ge=V||(xe||!D?[Gt(k)]:Qi(k));!V&&I!=="none"&&Ge.push(...ui(k,D,I,Me));let ct=[k,...Ge],Qt=await Li(c,$),ei=[],qt=((m=w.flip)==null?void 0:m.overflows)||[];if(X&&ei.push(Qt[se]),F){let Be=nt(x,S,Me);ei.push(Qt[Be[0]],Qt[Be[1]])}if(qt=[...qt,{placement:x,overflows:ei}],!ei.every(Be=>Be<=0)){var di,Ut;let Be=(((di=w.flip)==null?void 0:di.index)||0)+1,He=ct[Be];if(He)return{data:{index:Be,overflows:qt},reset:{placement:He}};let ft=(Ut=qt.filter(et=>et.overflows[0]<=0).sort((et,lt)=>et.overflows[1]-lt.overflows[1])[0])==null?void 0:Ut.placement;if(!ft)switch(L){case"bestFit":{var Ae;let et=(Ae=qt.map(lt=>[lt.placement,lt.overflows.filter(zt=>zt>0).reduce((zt,Ci)=>zt+Ci,0)]).sort((lt,zt)=>lt[1]-zt[1])[0])==null?void 0:Ae[0];et&&(ft=et);break}case"initialPlacement":ft=k;break}if(x!==ft)return{reset:{placement:ft}}}return{}}}};function Ai(E){let c=ht(...E.map(w=>w.left)),g=ht(...E.map(w=>w.top)),m=G(...E.map(w=>w.right)),x=G(...E.map(w=>w.bottom));return{x:c,y:g,width:m-c,height:x-g}}function Xt(E){let c=E.slice().sort((x,w)=>x.y-w.y),g=[],m=null;for(let x=0;x<c.length;x++){let w=c[x];!m||w.y-m.y>m.height/2?g.push([w]):g[g.length-1].push(w),m=w}return g.map(x=>Ot(Ai(x)))}var Zt=function(E){return E===void 0&&(E={}),{name:"inline",options:E,async fn(c){let{placement:g,elements:m,rects:x,platform:w,strategy:S}=c,{padding:k=2,x:B,y:N}=Nt(E,c),X=Array.from(await(w.getClientRects==null?void 0:w.getClientRects(m.reference))||[]),F=Xt(X),V=Ot(Ai(X)),L=si(k);function I(){if(F.length===2&&F[0].left>F[1].right&&B!=null&&N!=null)return F.find($=>B>$.left-L.left&&B<$.right+L.right&&N>$.top-L.top&&N<$.bottom+L.bottom)||V;if(F.length>=2){if(rt(g)==="y"){let Ut=F[0],Ae=F[F.length-1],Be=Je(g)==="top",He=Ut.top,ft=Ae.bottom,et=Be?Ut.left:Ae.left,lt=Be?Ut.right:Ae.right,zt=lt-et,Ci=ft-He;return{top:He,bottom:ft,left:et,right:lt,width:zt,height:Ci,x:et,y:He}}let $=Je(g)==="left",se=G(...F.map(Ut=>Ut.right)),xe=ht(...F.map(Ut=>Ut.left)),Me=F.filter(Ut=>$?Ut.left===xe:Ut.right===se),Ge=Me[0].top,ct=Me[Me.length-1].bottom,Qt=xe,ei=se,qt=ei-Qt,di=ct-Ge;return{top:Ge,bottom:ct,left:Qt,right:ei,width:qt,height:di,x:Qt,y:Ge}}return V}let D=await w.getElementRects({reference:{getBoundingClientRect:I},floating:m.floating,strategy:S});return x.reference.x!==D.reference.x||x.reference.y!==D.reference.y||x.reference.width!==D.reference.width||x.reference.height!==D.reference.height?{reset:{rects:D}}:{}}}},Yt=function(E){return E===void 0&&(E={}),{name:"shift",options:E,async fn(c){let{x:g,y:m,placement:x}=c,{mainAxis:w=!0,crossAxis:S=!1,limiter:k={fn:$=>{let{x:se,y:xe}=$;return{x:se,y:xe}}},...B}=Nt(E,c),N={x:g,y:m},X=await Li(c,B),F=rt(Je(x)),V=Ui(F),L=N[V],I=N[F];if(w){let $=V==="y"?"top":"left",se=V==="y"?"bottom":"right",xe=L+X[$],Me=L-X[se];L=dt(xe,L,Me)}if(S){let $=F==="y"?"top":"left",se=F==="y"?"bottom":"right",xe=I+X[$],Me=I-X[se];I=dt(xe,I,Me)}let D=k.fn({...c,[V]:L,[F]:I});return{...D,data:{x:D.x-g,y:D.y-m}}}}};function ai(E){return fe(E)?(E.nodeName||"").toLowerCase():"#document"}function W(E){var c;return(E==null||(c=E.ownerDocument)==null?void 0:c.defaultView)||window}function re(E){var c;return(c=(fe(E)?E.ownerDocument:E.document)||window.document)==null?void 0:c.documentElement}function fe(E){return E instanceof Node||E instanceof W(E).Node}function _e(E){return E instanceof Element||E instanceof W(E).Element}function we(E){return E instanceof HTMLElement||E instanceof W(E).HTMLElement}function ye(E){return typeof ShadowRoot>"u"?!1:E instanceof ShadowRoot||E instanceof W(E).ShadowRoot}function Ce(E){let{overflow:c,overflowX:g,overflowY:m,display:x}=ve(E);return/auto|scroll|overlay|hidden|clip/.test(c+m+g)&&!["inline","contents"].includes(x)}function qe(E){return["table","td","th"].includes(ai(E))}function Ke(E){return[":popover-open",":modal"].some(c=>{try{return E.matches(c)}catch{return!1}})}function ut(E){let c=ue(),g=_e(E)?ve(E):E;return g.transform!=="none"||g.perspective!=="none"||(g.containerType?g.containerType!=="normal":!1)||!c&&(g.backdropFilter?g.backdropFilter!=="none":!1)||!c&&(g.filter?g.filter!=="none":!1)||["transform","perspective","filter"].some(m=>(g.willChange||"").includes(m))||["paint","layout","strict","content"].some(m=>(g.contain||"").includes(m))}function _t(E){let c=$e(E);for(;we(c)&&!Ie(c);){if(ut(c))return c;if(Ke(c))return null;c=$e(c)}return null}function ue(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ie(E){return["html","body","#document"].includes(ai(E))}function ve(E){return W(E).getComputedStyle(E)}function Se(E){return _e(E)?{scrollLeft:E.scrollLeft,scrollTop:E.scrollTop}:{scrollLeft:E.scrollX,scrollTop:E.scrollY}}function $e(E){if(ai(E)==="html")return E;let c=E.assignedSlot||E.parentNode||ye(E)&&E.host||re(E);return ye(c)?c.host:c}function Fe(E){let c=$e(E);return Ie(c)?E.ownerDocument?E.ownerDocument.body:E.body:we(c)&&Ce(c)?c:Fe(c)}function st(E,c,g){var m;c===void 0&&(c=[]),g===void 0&&(g=!0);let x=Fe(E),w=x===((m=E.ownerDocument)==null?void 0:m.body),S=W(x);if(w){let k=Jt(S);return c.concat(S,S.visualViewport||[],Ce(x)?x:[],k&&g?st(k):[])}return c.concat(x,st(x,[],g))}function Jt(E){return E.parent&&Object.getPrototypeOf(E.parent)?E.frameElement:null}function De(E){let c=ve(E),g=parseFloat(c.width)||0,m=parseFloat(c.height)||0,x=we(E),w=x?E.offsetWidth:g,S=x?E.offsetHeight:m,k=kt(g)!==w||kt(m)!==S;return k&&(g=w,m=S),{width:g,height:m,$:k}}function ci(E){return _e(E)?E:E.contextElement}function At(E){let c=ci(E);if(!we(c))return je(1);let g=c.getBoundingClientRect(),{width:m,height:x,$:w}=De(c),S=(w?kt(g.width):g.width)/m,k=(w?kt(g.height):g.height)/x;return(!S||!Number.isFinite(S))&&(S=1),(!k||!Number.isFinite(k))&&(k=1),{x:S,y:k}}var ke=je(0);function Pr(E){let c=W(E);return!ue()||!c.visualViewport?ke:{x:c.visualViewport.offsetLeft,y:c.visualViewport.offsetTop}}function Rr(E,c,g){return c===void 0&&(c=!1),!g||c&&g!==W(E)?!1:c}function We(E,c,g,m){c===void 0&&(c=!1),g===void 0&&(g=!1);let x=E.getBoundingClientRect(),w=ci(E),S=je(1);c&&(m?_e(m)&&(S=At(m)):S=At(E));let k=Rr(w,g,m)?Pr(w):je(0),B=(x.left+k.x)/S.x,N=(x.top+k.y)/S.y,X=x.width/S.x,F=x.height/S.y;if(w){let V=W(w),L=m&&_e(m)?W(m):m,I=V,D=Jt(I);for(;D&&m&&L!==I;){let $=At(D),se=D.getBoundingClientRect(),xe=ve(D),Me=se.left+(D.clientLeft+parseFloat(xe.paddingLeft))*$.x,Ge=se.top+(D.clientTop+parseFloat(xe.paddingTop))*$.y;B*=$.x,N*=$.y,X*=$.x,F*=$.y,B+=Me,N+=Ge,I=W(D),D=Jt(I)}}return Ot({width:X,height:F,x:B,y:N})}function $t(E){let{elements:c,rect:g,offsetParent:m,strategy:x}=E,w=x==="fixed",S=re(m),k=c?Ke(c.floating):!1;if(m===S||k&&w)return g;let B={scrollLeft:0,scrollTop:0},N=je(1),X=je(0),F=we(m);if((F||!F&&!w)&&((ai(m)!=="body"||Ce(S))&&(B=Se(m)),we(m))){let V=We(m);N=At(m),X.x=V.x+m.clientLeft,X.y=V.y+m.clientTop}return{width:g.width*N.x,height:g.height*N.y,x:g.x*N.x-B.scrollLeft*N.x+X.x,y:g.y*N.y-B.scrollTop*N.y+X.y}}function kr(E){return Array.from(E.getClientRects())}function at(E){return We(re(E)).left+Se(E).scrollLeft}function dr(E){let c=re(E),g=Se(E),m=E.ownerDocument.body,x=G(c.scrollWidth,c.clientWidth,m.scrollWidth,m.clientWidth),w=G(c.scrollHeight,c.clientHeight,m.scrollHeight,m.clientHeight),S=-g.scrollLeft+at(E),k=-g.scrollTop;return ve(m).direction==="rtl"&&(S+=G(c.clientWidth,m.clientWidth)-x),{width:x,height:w,x:S,y:k}}function bt(E,c){let g=W(E),m=re(E),x=g.visualViewport,w=m.clientWidth,S=m.clientHeight,k=0,B=0;if(x){w=x.width,S=x.height;let N=ue();(!N||N&&c==="fixed")&&(k=x.offsetLeft,B=x.offsetTop)}return{width:w,height:S,x:k,y:B}}function Xe(E,c){let g=We(E,!0,c==="fixed"),m=g.top+E.clientTop,x=g.left+E.clientLeft,w=we(E)?At(E):je(1),S=E.clientWidth*w.x,k=E.clientHeight*w.y,B=x*w.x,N=m*w.y;return{width:S,height:k,x:B,y:N}}function fr(E,c,g){let m;if(c==="viewport")m=bt(E,g);else if(c==="document")m=dr(re(E));else if(_e(c))m=Xe(c,g);else{let x=Pr(E);m={...c,x:c.x-x.x,y:c.y-x.y}}return Ot(m)}function Ve(E,c){let g=$e(E);return g===c||!_e(g)||Ie(g)?!1:ve(g).position==="fixed"||Ve(g,c)}function wt(E,c){let g=c.get(E);if(g)return g;let m=st(E,[],!1).filter(k=>_e(k)&&ai(k)!=="body"),x=null,w=ve(E).position==="fixed",S=w?$e(E):E;for(;_e(S)&&!Ie(S);){let k=ve(S),B=ut(S);!B&&k.position==="fixed"&&(x=null),(w?!B&&!x:!B&&k.position==="static"&&x&&["absolute","fixed"].includes(x.position)||Ce(S)&&!B&&Ve(E,S))?m=m.filter(N=>N!==S):x=k,S=$e(S)}return c.set(E,m),m}function tr(E){let{element:c,boundary:g,rootBoundary:m,strategy:x}=E,w=[...g==="clippingAncestors"?Ke(c)?[]:wt(c,this._c):[].concat(g),m],S=w[0],k=w.reduce((B,N)=>{let X=fr(c,N,x);return B.top=G(X.top,B.top),B.right=ht(X.right,B.right),B.bottom=ht(X.bottom,B.bottom),B.left=G(X.left,B.left),B},fr(c,S,x));return{width:k.right-k.left,height:k.bottom-k.top,x:k.left,y:k.top}}function Kr(E){let{width:c,height:g}=De(E);return{width:c,height:g}}function Zr(E,c,g){let m=we(c),x=re(c),w=g==="fixed",S=We(E,!0,w,c),k={scrollLeft:0,scrollTop:0},B=je(0);if(m||!m&&!w)if((ai(c)!=="body"||Ce(x))&&(k=Se(c)),m){let F=We(c,!0,w,c);B.x=F.x+c.clientLeft,B.y=F.y+c.clientTop}else x&&(B.x=at(x));let N=S.left+k.scrollLeft-B.x,X=S.top+k.scrollTop-B.y;return{x:N,y:X,width:S.width,height:S.height}}function Le(E){return ve(E).position==="static"}function Ht(E,c){return!we(E)||ve(E).position==="fixed"?null:c?c(E):E.offsetParent}function Br(E,c){let g=W(E);if(Ke(E))return g;if(!we(E)){let x=$e(E);for(;x&&!Ie(x);){if(_e(x)&&!Le(x))return x;x=$e(x)}return g}let m=Ht(E,c);for(;m&&qe(m)&&Le(m);)m=Ht(m,c);return m&&Ie(m)&&Le(m)&&!ut(m)?g:m||_t(E)||g}var Jr=async function(E){let c=this.getOffsetParent||Br,g=this.getDimensions,m=await g(E.floating);return{reference:Zr(E.reference,await c(E.floating),E.strategy),floating:{x:0,y:0,width:m.width,height:m.height}}};function Qr(E){return ve(E).direction==="rtl"}var xi={convertOffsetParentRelativeRectToViewportRelativeRect:$t,getDocumentElement:re,getClippingRect:tr,getOffsetParent:Br,getElementRects:Jr,getClientRects:kr,getDimensions:Kr,getScale:At,isElement:_e,isRTL:Qr},Ct=Yt,Ir=er,Ni=Zt,pr=(E,c,g)=>{let m=new Map,x={platform:xi,...g},w={...x.platform,_c:m};return Kt(E,c,{...x,platform:w})},en=Object.hasOwnProperty,ir=ze(Rt(),1),Gr=(0,ir.default)(),Or=(E,c,g)=>{let m=new URL(E.getAttribute(c),g);E.setAttribute(c,m.pathname+m.hash)};function tn(E,c){E.querySelectorAll('[href^="./"], [href^="../"]').forEach(g=>Or(g,"href",c)),E.querySelectorAll('[src^="./"], [src^="../"]').forEach(g=>Or(g,"src",c))}var Hi=new DOMParser;async function ot({clientX:E,clientY:c}){let g=this;if(g.dataset.noPopover==="true")return;async function m(I){let{x:D,y:$}=await pr(g,I,{middleware:[Ni({x:E,y:c}),Ct(),Ir()]});Object.assign(I.style,{left:`${D}px`,top:`${$}px`})}let x=()=>[...g.children].some(I=>I.classList.contains("popover"));if(x())return m(g.lastChild);let w=new URL(document.location.href);w.hash="",w.search="";let S=new URL(g.href),k=decodeURIComponent(S.hash);S.hash="",S.search="";let B=await fetch(`${S}`).catch(I=>{console.error(I)});if(x()||!B)return;let[N]=B.headers.get("Content-Type").split(";"),[X,F]=N.split("/"),V=document.createElement("div");V.classList.add("popover");let L=document.createElement("div");switch(L.classList.add("popover-inner"),V.appendChild(L),L.dataset.contentType=N??void 0,X){case"image":let I=document.createElement("img");I.src=S.toString(),I.alt=S.pathname,L.appendChild(I);break;case"application":switch(F){case"pdf":let xe=document.createElement("iframe");xe.src=S.toString(),L.appendChild(xe);break;default:break}break;default:let D=await B.text(),$=Hi.parseFromString(D,"text/html");tn($,S);let se=[...$.getElementsByClassName("popover-hint")];if(se.length===0)return;se.forEach(xe=>L.appendChild(xe))}if(m(V),g.appendChild(V),k!==""){let I=L.querySelector(k);I&&L.scroll({top:I.offsetTop-12,behavior:"instant"})}}document.addEventListener("nav",()=>{let E=[...document.getElementsByClassName("internal")];for(let c of E)c.addEventListener("mouseenter",ot),window.addCleanup(()=>c.removeEventListener("mouseenter",ot))})}(),function(){const gt=document.createElement("script");gt.src="https://umami.7wate.com//script.js",gt.setAttribute("data-website-id","c061efdc-95dd-4d21-9d04-a1ffda0a85b9"),gt.async=!0,document.head.appendChild(gt)}(),function(){var gt=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,it=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty,v=(W,re)=>()=>(re||W((re={exports:{}}).exports,re),re.exports),Ue=(W,re,fe,_e)=>{if(re&&typeof re=="object"||typeof re=="function")for(let we of it(re))!Bt.call(W,we)&&we!==fe&&Pt(W,we,{get:()=>re[we],enumerable:!(_e=jt(re,we))||_e.enumerable});return W},ze=(W,re,fe)=>(fe=W!=null?gt(Et(W)):{},Ue(re||!W||!W.__esModule?Pt(fe,"default",{value:W,enumerable:!0}):fe,W)),Rt=v((W,re)=>{"use strict";re.exports=_e;function fe(ye){return ye instanceof Buffer?Buffer.from(ye):new ye.constructor(ye.buffer.slice(),ye.byteOffset,ye.length)}function _e(ye){if(ye=ye||{},ye.circles)return we(ye);let Ce=new Map;if(Ce.set(Date,ue=>new Date(ue)),Ce.set(Map,(ue,Ie)=>new Map(Ke(Array.from(ue),Ie))),Ce.set(Set,(ue,Ie)=>new Set(Ke(Array.from(ue),Ie))),ye.constructorHandlers)for(let ue of ye.constructorHandlers)Ce.set(ue[0],ue[1]);let qe=null;return ye.proto?_t:ut;function Ke(ue,Ie){let ve=Object.keys(ue),Se=new Array(ve.length);for(let $e=0;$e<ve.length;$e++){let Fe=ve[$e],st=ue[Fe];typeof st!="object"||st===null?Se[Fe]=st:st.constructor!==Object&&(qe=Ce.get(st.constructor))?Se[Fe]=qe(st,Ie):ArrayBuffer.isView(st)?Se[Fe]=fe(st):Se[Fe]=Ie(st)}return Se}function ut(ue){if(typeof ue!="object"||ue===null)return ue;if(Array.isArray(ue))return Ke(ue,ut);if(ue.constructor!==Object&&(qe=Ce.get(ue.constructor)))return qe(ue,ut);let Ie={};for(let ve in ue){if(Object.hasOwnProperty.call(ue,ve)===!1)continue;let Se=ue[ve];typeof Se!="object"||Se===null?Ie[ve]=Se:Se.constructor!==Object&&(qe=Ce.get(Se.constructor))?Ie[ve]=qe(Se,ut):ArrayBuffer.isView(Se)?Ie[ve]=fe(Se):Ie[ve]=ut(Se)}return Ie}function _t(ue){if(typeof ue!="object"||ue===null)return ue;if(Array.isArray(ue))return Ke(ue,_t);if(ue.constructor!==Object&&(qe=Ce.get(ue.constructor)))return qe(ue,_t);let Ie={};for(let ve in ue){let Se=ue[ve];typeof Se!="object"||Se===null?Ie[ve]=Se:Se.constructor!==Object&&(qe=Ce.get(Se.constructor))?Ie[ve]=qe(Se,_t):ArrayBuffer.isView(Se)?Ie[ve]=fe(Se):Ie[ve]=_t(Se)}return Ie}}function we(ye){let Ce=[],qe=[],Ke=new Map;if(Ke.set(Date,ve=>new Date(ve)),Ke.set(Map,(ve,Se)=>new Map(_t(Array.from(ve),Se))),Ke.set(Set,(ve,Se)=>new Set(_t(Array.from(ve),Se))),ye.constructorHandlers)for(let ve of ye.constructorHandlers)Ke.set(ve[0],ve[1]);let ut=null;return ye.proto?Ie:ue;function _t(ve,Se){let $e=Object.keys(ve),Fe=new Array($e.length);for(let st=0;st<$e.length;st++){let Jt=$e[st],De=ve[Jt];if(typeof De!="object"||De===null)Fe[Jt]=De;else if(De.constructor!==Object&&(ut=Ke.get(De.constructor)))Fe[Jt]=ut(De,Se);else if(ArrayBuffer.isView(De))Fe[Jt]=fe(De);else{let ci=Ce.indexOf(De);ci!==-1?Fe[Jt]=qe[ci]:Fe[Jt]=Se(De)}}return Fe}function ue(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return _t(ve,ue);if(ve.constructor!==Object&&(ut=Ke.get(ve.constructor)))return ut(ve,ue);let Se={};Ce.push(ve),qe.push(Se);for(let $e in ve){if(Object.hasOwnProperty.call(ve,$e)===!1)continue;let Fe=ve[$e];if(typeof Fe!="object"||Fe===null)Se[$e]=Fe;else if(Fe.constructor!==Object&&(ut=Ke.get(Fe.constructor)))Se[$e]=ut(Fe,ue);else if(ArrayBuffer.isView(Fe))Se[$e]=fe(Fe);else{let st=Ce.indexOf(Fe);st!==-1?Se[$e]=qe[st]:Se[$e]=ue(Fe)}}return Ce.pop(),qe.pop(),Se}function Ie(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return _t(ve,Ie);if(ve.constructor!==Object&&(ut=Ke.get(ve.constructor)))return ut(ve,Ie);let Se={};Ce.push(ve),qe.push(Se);for(let $e in ve){let Fe=ve[$e];if(typeof Fe!="object"||Fe===null)Se[$e]=Fe;else if(Fe.constructor!==Object&&(ut=Ke.get(Fe.constructor)))Se[$e]=ut(Fe,Ie);else if(ArrayBuffer.isView(Fe))Se[$e]=fe(Fe);else{let st=Ce.indexOf(Fe);st!==-1?Se[$e]=qe[st]:Se[$e]=Ie(Fe)}}return Ce.pop(),qe.pop(),Se}}}),ht=W=>(re,fe)=>re[`node${W}`]===fe[`node${W}`],G=ht("Name"),kt=ht("Type"),je=ht("Value");function pe(W,re){if(W.attributes.length===0&&re.attributes.length===0)return[];let fe=[],_e=new Map,we=new Map;for(let ye of W.attributes)_e.set(ye.name,ye.value);for(let ye of re.attributes){let Ce=_e.get(ye.name);ye.value===Ce?_e.delete(ye.name):(typeof Ce<"u"&&_e.delete(ye.name),we.set(ye.name,ye.value))}for(let ye of _e.keys())fe.push({type:5,name:ye});for(let[ye,Ce]of we.entries())fe.push({type:4,name:ye,value:Ce});return fe}function te(W,re=!0){let fe=`${W.localName}`;for(let{name:_e,value:we}of W.attributes)re&&_e.startsWith("data-")||(fe+=`[${_e}=${we}]`);return fe+=W.innerHTML,fe}function dt(W){switch(W.tagName){case"BASE":case"TITLE":return W.localName;case"META":{if(W.hasAttribute("name"))return`meta[name="${W.getAttribute("name")}"]`;if(W.hasAttribute("property"))return`meta[name="${W.getAttribute("property")}"]`;break}case"LINK":{if(W.hasAttribute("rel")&&W.hasAttribute("href"))return`link[rel="${W.getAttribute("rel")}"][href="${W.getAttribute("href")}"]`;if(W.hasAttribute("href"))return`link[href="${W.getAttribute("href")}"]`;break}}return te(W)}function Nt(W){let[re,fe=""]=W.split("?");return`${re}?t=${Date.now()}&${fe.replace(/t=\d+/g,"")}`}function Je(W){if(W.nodeType===1&&W.hasAttribute("data-persist"))return W;if(W.nodeType===1&&W.localName==="script"){let re=document.createElement("script");for(let{name:fe,value:_e}of W.attributes)fe==="src"&&(_e=Nt(_e)),re.setAttribute(fe,_e);return re.innerHTML=W.innerHTML,re}return W.cloneNode(!0)}function xt(W,re){if(W.children.length===0&&re.children.length===0)return[];let fe=[],_e=new Map,we=new Map,ye=new Map;for(let Ce of W.children)_e.set(dt(Ce),Ce);for(let Ce of re.children){let qe=dt(Ce),Ke=_e.get(qe);Ke?te(Ce,!1)!==te(Ke,!1)&&we.set(qe,Je(Ce)):ye.set(qe,Je(Ce)),_e.delete(qe)}for(let Ce of W.childNodes){if(Ce.nodeType===1){let qe=dt(Ce);if(_e.has(qe)){fe.push({type:1});continue}else if(we.has(qe)){let Ke=we.get(qe);fe.push({type:3,attributes:pe(Ce,Ke),children:Ui(Ce,Ke)});continue}}fe.push(void 0)}for(let Ce of ye.values())fe.push({type:0,node:Je(Ce)});return fe}function Ui(W,re){let fe=[],_e=Math.max(W.childNodes.length,re.childNodes.length);for(let we=0;we<_e;we++){let ye=W.childNodes.item(we),Ce=re.childNodes.item(we);fe[we]=It(ye,Ce)}return fe}function It(W,re){if(!W)return{type:0,node:Je(re)};if(!re)return{type:1};if(kt(W,re)){if(W.nodeType===3){let fe=W.nodeValue,_e=re.nodeValue;if(fe.trim().length===0&&_e.trim().length===0)return}if(W.nodeType===1){if(G(W,re)){let fe=W.tagName==="HEAD"?xt:Ui;return{type:3,attributes:pe(W,re),children:fe(W,re)}}return{type:2,node:Je(re)}}else return W.nodeType===9?It(W.documentElement,re.documentElement):je(W,re)?void 0:{type:2,value:re.nodeValue}}return{type:2,node:Je(re)}}function rt(W,re){if(re.length!==0)for(let{type:fe,name:_e,value:we}of re)fe===5?W.removeAttribute(_e):fe===4&&W.setAttribute(_e,we)}async function mt(W,re,fe){if(!re)return;let _e;switch(W.nodeType===9?(W=W.documentElement,_e=W):fe?_e=fe:_e=W,re.type){case 0:{let{node:we}=re;W.appendChild(we);return}case 1:{if(!_e)return;W.removeChild(_e);return}case 2:{if(!_e)return;let{node:we,value:ye}=re;if(typeof ye=="string"){_e.nodeValue=ye;return}_e.replaceWith(we);return}case 3:{if(!_e)return;let{attributes:we,children:ye}=re;rt(_e,we);let Ce=Array.from(_e.childNodes);await Promise.all(ye.map((qe,Ke)=>mt(_e,qe,Ce[Ke])));return}}}function nt(W,re){let fe=It(W,re);return mt(W,fe)}var Qi=Object.hasOwnProperty,yi=ze(Rt(),1),cr=(0,yi.default)();function ui(W){return W.document.body.dataset.slug}var Gt=(W,re,fe)=>{let _e=new URL(W.getAttribute(re),fe);W.setAttribute(re,_e.pathname+_e.hash)};function Fi(W,re){W.querySelectorAll('[href^="./"], [href^="../"]').forEach(fe=>Gt(fe,"href",re)),W.querySelectorAll('[src^="./"], [src^="../"]').forEach(fe=>Gt(fe,"src",re))}var si=1,Ot=document.createElement("route-announcer"),Di=W=>W?.nodeType===si,Kt=W=>{try{let re=new URL(W);if(window.location.origin===re.origin)return!0}catch{}return!1},Li=W=>{let re=W.origin===window.location.origin,fe=W.pathname===window.location.pathname;return re&&fe},er=({target:W})=>{if(!Di(W)||W.attributes.getNamedItem("target")?.value==="_blank")return;let re=W.closest("a");if(!re||"routerIgnore"in re.dataset)return;let{href:fe}=re;if(Kt(fe))return{url:new URL(fe),scroll:"routerNoscroll"in re.dataset?!1:void 0}};function Ai(W){let re=new CustomEvent("nav",{detail:{url:W}});document.dispatchEvent(re)}var Xt=new Set;window.addCleanup=W=>Xt.add(W);var Zt;async function Yt(W,re=!1){Zt=Zt||new DOMParser;let fe=await fetch(`${W}`).then(ye=>{if(ye.headers.get("content-type")?.startsWith("text/html"))return ye.text();window.location.assign(W)}).catch(()=>{window.location.assign(W)});if(!fe)return;Xt.forEach(ye=>ye()),Xt.clear();let _e=Zt.parseFromString(fe,"text/html");Fi(_e,W);let we=_e.querySelector("title")?.textContent;if(we)document.title=we;else{let ye=document.querySelector("h1");we=ye?.innerText??ye?.textContent??W.pathname}Ot.textContent!==we&&(Ot.textContent=we),Ot.dataset.persist="",_e.body.appendChild(Ot),nt(document.body,_e.body),re||(W.hash?document.getElementById(decodeURIComponent(W.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(ye=>ye.remove()),_e.head.querySelectorAll(":not([spa-preserve])").forEach(ye=>document.head.appendChild(ye)),re||history.pushState({},"",W),Ai(ui(window)),delete Ot.dataset.persist}window.spaNavigate=Yt;function ai(){return typeof window<"u"&&(window.addEventListener("click",async W=>{let{url:re}=er(W)??{};if(!(!re||W.ctrlKey||W.metaKey)){if(W.preventDefault(),Li(re)&&re.hash){document.getElementById(decodeURIComponent(re.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",re);return}try{Yt(re,!1)}catch{window.location.assign(re)}}}),window.addEventListener("popstate",W=>{let{url:re}=er(W)??{};if(!(window.location.hash&&window.location.pathname===re?.pathname))try{Yt(new URL(window.location.toString()),!0)}catch{window.location.reload()}})),new class{go(W){let re=new URL(W,window.location.toString());return Yt(re,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(ai(),Ai(ui(window)),!customElements.get("route-announcer")){let W={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};customElements.define("route-announcer",class extends HTMLElement{constructor(){super()}connectedCallback(){for(let[re,fe]of Object.entries(W))this.setAttribute(re,fe)}})}}();
|