952 lines
606 KiB
JavaScript
952 lines
606 KiB
JavaScript
(function(){var kt='<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>',At='<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 Wt=document.getElementsByTagName("pre");for(let Ct=0;Ct<Wt.length;Ct++){let Zt=Wt[Ct].getElementsByTagName("code")[0];if(Zt){let v=function(){navigator.clipboard.writeText(Ne).then(()=>{ze.blur(),ze.innerHTML=At,setTimeout(()=>{ze.innerHTML=kt,ze.style.borderColor=""},2e3)},Mt=>console.error(Mt))};var ut=v;let Ne=Zt.innerText.replace(/\n\n/g,`
|
|
`),ze=document.createElement("button");ze.className="clipboard-button",ze.type="button",ze.innerHTML=kt,ze.ariaLabel="Copy source",ze.addEventListener("click",v),window.addCleanup(()=>ze.removeEventListener("click",v)),Wt[Ct].prepend(ze)}}})})(),function(){var kt=Object.create,At=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyNames,Ct=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,v=(c,f)=>()=>(f||c((f={exports:{}}).exports,f),f.exports),Ne=(c,f,m,y)=>{if(f&&typeof f=="object"||typeof f=="function")for(let w of ut(f))!Zt.call(c,w)&&w!==m&&At(c,w,{get:()=>f[w],enumerable:!(y=Wt(f,w))||y.enumerable});return c},ze=(c,f,m)=>(m=c!=null?kt(Ct(c)):{},Ne(f||!c||!c.__esModule?At(m,"default",{value:c,enumerable:!0}):m,c)),Mt=v(()=>{}),lt=v((c,f)=>{"use strict";f.exports=y;function m(S){return S instanceof Buffer?Buffer.from(S):new S.constructor(S.buffer.slice(),S.byteOffset,S.length)}function y(S){if(S=S||{},S.circles)return w(S);let P=new Map;if(P.set(Date,G=>new Date(G)),P.set(Map,(G,j)=>new Map(U(Array.from(G),j))),P.set(Set,(G,j)=>new Set(U(Array.from(G),j))),S.constructorHandlers)for(let G of S.constructorHandlers)P.set(G[0],G[1]);let R=null;return S.proto?Q:H;function U(G,j){let I=Object.keys(G),B=new Array(I.length);for(let X=0;X<I.length;X++){let V=I[X],ue=G[V];typeof ue!="object"||ue===null?B[V]=ue:ue.constructor!==Object&&(R=P.get(ue.constructor))?B[V]=R(ue,j):ArrayBuffer.isView(ue)?B[V]=m(ue):B[V]=j(ue)}return B}function H(G){if(typeof G!="object"||G===null)return G;if(Array.isArray(G))return U(G,H);if(G.constructor!==Object&&(R=P.get(G.constructor)))return R(G,H);let j={};for(let I in G){if(Object.hasOwnProperty.call(G,I)===!1)continue;let B=G[I];typeof B!="object"||B===null?j[I]=B:B.constructor!==Object&&(R=P.get(B.constructor))?j[I]=R(B,H):ArrayBuffer.isView(B)?j[I]=m(B):j[I]=H(B)}return j}function Q(G){if(typeof G!="object"||G===null)return G;if(Array.isArray(G))return U(G,Q);if(G.constructor!==Object&&(R=P.get(G.constructor)))return R(G,Q);let j={};for(let I in G){let B=G[I];typeof B!="object"||B===null?j[I]=B:B.constructor!==Object&&(R=P.get(B.constructor))?j[I]=R(B,Q):ArrayBuffer.isView(B)?j[I]=m(B):j[I]=Q(B)}return j}}function w(S){let P=[],R=[],U=new Map;if(U.set(Date,I=>new Date(I)),U.set(Map,(I,B)=>new Map(Q(Array.from(I),B))),U.set(Set,(I,B)=>new Set(Q(Array.from(I),B))),S.constructorHandlers)for(let I of S.constructorHandlers)U.set(I[0],I[1]);let H=null;return S.proto?j:G;function Q(I,B){let X=Object.keys(I),V=new Array(X.length);for(let ue=0;ue<X.length;ue++){let Me=X[ue],Ee=I[Me];if(typeof Ee!="object"||Ee===null)V[Me]=Ee;else if(Ee.constructor!==Object&&(H=U.get(Ee.constructor)))V[Me]=H(Ee,B);else if(ArrayBuffer.isView(Ee))V[Me]=m(Ee);else{let Ke=P.indexOf(Ee);Ke!==-1?V[Me]=R[Ke]:V[Me]=B(Ee)}}return V}function G(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return Q(I,G);if(I.constructor!==Object&&(H=U.get(I.constructor)))return H(I,G);let B={};P.push(I),R.push(B);for(let X in I){if(Object.hasOwnProperty.call(I,X)===!1)continue;let V=I[X];if(typeof V!="object"||V===null)B[X]=V;else if(V.constructor!==Object&&(H=U.get(V.constructor)))B[X]=H(V,G);else if(ArrayBuffer.isView(V))B[X]=m(V);else{let ue=P.indexOf(V);ue!==-1?B[X]=R[ue]:B[X]=G(V)}}return P.pop(),R.pop(),B}function j(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return Q(I,j);if(I.constructor!==Object&&(H=U.get(I.constructor)))return H(I,j);let B={};P.push(I),R.push(B);for(let X in I){let V=I[X];if(typeof V!="object"||V===null)B[X]=V;else if(V.constructor!==Object&&(H=U.get(V.constructor)))B[X]=H(V,j);else if(ArrayBuffer.isView(V))B[X]=m(V);else{let ue=P.indexOf(V);ue!==-1?B[X]=R[ue]:B[X]=j(V)}}return P.pop(),R.pop(),B}}}),O;function Pt(c){return typeof c<"u"?c:!0}function Ve(c){let f=Array(c);for(let m=0;m<c;m++)f[m]=ge();return f}function ge(){return Object.create(null)}function te(c,f){return f.length-c.length}function dt(c){return typeof c=="string"}function Ut(c){return typeof c=="object"}function qe(c){return typeof c=="function"}function gt(c,f){var m=Gi;if(c&&(f&&(c=mt(c,f)),this.H&&(c=mt(c,this.H)),this.J&&1<c.length&&(c=mt(c,this.J)),m||m==="")){if(f=c.split(m),this.filter){c=this.filter,m=f.length;let y=[];for(let w=0,S=0;w<m;w++){let P=f[w];P&&!c[P]&&(y[S++]=P)}c=y}else c=f;return c}return c}var Gi=/[\p{Z}\p{S}\p{P}\p{C}]+/u,Bt=/[\u0300-\u036f]/g;function it(c,f){let m=Object.keys(c),y=m.length,w=[],S="",P=0;for(let R=0,U,H;R<y;R++)U=m[R],(H=c[U])?(w[P++]=rt(f?"(?!\\b)"+U+"(\\b|_)":U),w[P++]=H):S+=(S?"|":"")+U;return S&&(w[P++]=rt(f?"(?!\\b)("+S+")(\\b|_)":"("+S+")"),w[P]=""),w}function mt(c,f){for(let m=0,y=f.length;m<y&&(c=c.replace(f[m],f[m+1]),c);m+=2);return c}function rt(c){return new RegExp(c,"g")}function Zi(c){let f="",m="";for(let y=0,w=c.length,S;y<w;y++)(S=c[y])!==m&&(f+=m=S);return f}var vi={encode:fr,F:!1,G:""};function fr(c){return gt.call(this,(""+c).toLowerCase(),!1)}var hi={},It={};function Oi(c){si(c,"add"),si(c,"append"),si(c,"search"),si(c,"update"),si(c,"remove")}function si(c,f){c[f+"Async"]=function(){let m=this,y=arguments;var w=y[y.length-1];let S;return qe(w)&&(S=w,delete y[y.length-1]),w=new Promise(function(P){setTimeout(function(){m.async=!0;let R=m[f].apply(m,y);m.async=!1,P(R)})}),S?(w.then(S),this):w}}function Gt(c,f,m,y){let w=c.length,S=[],P,R,U=0;y&&(y=[]);for(let H=w-1;0<=H;H--){let Q=c[H],G=Q.length,j=ge(),I=!P;for(let B=0;B<G;B++){let X=Q[B],V=X.length;if(V)for(let ue=0,Me,Ee;ue<V;ue++)if(Ee=X[ue],P){if(P[Ee]){if(!H){if(m)m--;else if(S[U++]=Ee,U===f)return S}(H||y)&&(j[Ee]=1),I=!0}if(y&&(Me=(R[Ee]||0)+1,R[Ee]=Me,Me<w)){let Ke=y[Me-2]||(y[Me-2]=[]);Ke[Ke.length]=Ee}}else j[Ee]=1}if(y)P||(R=j);else if(!I)return[];P=j}if(y)for(let H=y.length-1,Q,G;0<=H;H--){Q=y[H],G=Q.length;for(let j=0,I;j<G;j++)if(I=Q[j],!P[I]){if(m)m--;else if(S[U++]=I,U===f)return S;P[I]=1}}return S}function Fi(c,f){let m=ge(),y=ge(),w=[];for(let S=0;S<c.length;S++)m[c[S]]=1;for(let S=0,P;S<f.length;S++){P=f[S];for(let R=0,U;R<P.length;R++)U=P[R],m[U]&&!y[U]&&(y[U]=1,w[w.length]=U)}return w}function Qt(c){this.l=c!==!0&&c,this.cache=ge(),this.h=[]}function Di(c,f,m){Ut(c)&&(c=c.query);let y=this.cache.get(c);return y||(y=this.search(c,f,m),this.cache.set(c,y)),y}Qt.prototype.set=function(c,f){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]=f},Qt.prototype.get=function(c){let f=this.cache[c];if(this.l&&f&&(c=this.h.indexOf(c))){let m=this.h[c-1];this.h[c-1]=this.h[c],this.h[c]=m}return f};var Qi={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 Ei(c,f,m,y,w,S,P,R){setTimeout(function(){let U=c(m?m+"."+y:y,JSON.stringify(P));U&&U.then?U.then(function(){f.export(c,f,m,w,S+1,R)}):f.export(c,f,m,w,S+1,R)})}function Xt(c,f){if(!(this instanceof Xt))return new Xt(c);var m;if(c){dt(c)?c=Qi[c]:(m=c.preset)&&(c=Object.assign({},m[m],c)),m=c.charset;var y=c.lang;dt(m)&&(m.indexOf(":")===-1&&(m+=":default"),m=It[m]),dt(y)&&(y=hi[y])}else c={};let w,S,P=c.context||{};if(this.encode=c.encode||m&&m.encode||fr,this.register=f||ge(),this.D=w=c.resolution||9,this.G=f=m&&m.G||c.tokenize||"strict",this.depth=f==="strict"&&P.depth,this.l=Pt(P.bidirectional),this.s=S=Pt(c.optimize),this.m=Pt(c.fastupdate),this.B=c.minlength||1,this.C=c.boost,this.map=S?Ve(w):ge(),this.A=w=P.resolution||1,this.h=S?Ve(w):ge(),this.F=m&&m.F||c.rtl,this.H=(f=c.matcher||y&&y.H)&&it(f,!1),this.J=(f=c.stemmer||y&&y.J)&&it(f,!0),m=f=c.filter||y&&y.filter){m=f,y=ge();for(let R=0,U=m.length;R<U;R++)y[m[R]]=1;m=y}this.filter=m,this.cache=(f=c.cache)&&new Qt(f)}O=Xt.prototype,O.append=function(c,f){return this.add(c,f,!0)},O.add=function(c,f,m,y){if(f&&(c||c===0)){if(!y&&!m&&this.register[c])return this.update(c,f);if(f=this.encode(f),y=f.length){let H=ge(),Q=ge(),G=this.depth,j=this.D;for(let I=0;I<y;I++){let B=f[this.F?y-1-I:I];var w=B.length;if(B&&w>=this.B&&(G||!Q[B])){var S=Jt(j,y,I),P="";switch(this.G){case"full":if(2<w){for(S=0;S<w;S++)for(var R=w;R>S;R--)if(R-S>=this.B){var U=Jt(j,y,I,w,S);P=B.substring(S,R),Yt(this,Q,P,U,c,m)}break}case"reverse":if(1<w){for(R=w-1;0<R;R--)P=B[R]+P,P.length>=this.B&&Yt(this,Q,P,Jt(j,y,I,w,R),c,m);P=""}case"forward":if(1<w){for(R=0;R<w;R++)P+=B[R],P.length>=this.B&&Yt(this,Q,P,S,c,m);break}default:if(this.C&&(S=Math.min(S/this.C(f,B,I)|0,j-1)),Yt(this,Q,B,S,c,m),G&&1<y&&I<y-1){for(w=ge(),P=this.A,S=B,R=Math.min(G+1,y-I),w[S]=1,U=1;U<R;U++)if((B=f[this.F?y-1-I-U:I+U])&&B.length>=this.B&&!w[B]){w[B]=1;let X=this.l&&B>S;Yt(this,H,X?S:B,Jt(P+(y/2>P?0:1),y,I,R-1,U-1),c,m,X?B:S)}}}}}this.m||(this.register[c]=1)}}return this};function Jt(c,f,m,y,w){return m&&1<c?f+(y||0)<=c?m+(w||0):(c-1)/(f+(y||0))*(m+(w||0))+1|0:0}function Yt(c,f,m,y,w,S,P){let R=P?c.h:c.map;(!f[m]||P&&!f[m][P])&&(c.s&&(R=R[y]),P?(f=f[m]||(f[m]=ge()),f[P]=1,R=R[P]||(R[P]=ge())):f[m]=1,R=R[m]||(R[m]=[]),c.s||(R=R[y]||(R[y]=[])),S&&R.includes(w)||(R[R.length]=w,c.m&&(c=c.register[w]||(c.register[w]=[]),c[c.length]=R)))}O.search=function(c,f,m){m||(!f&&Ut(c)?(m=c,c=m.query):Ut(f)&&(m=f));let y=[],w,S,P=0;if(m){c=m.query||c,f=m.limit,P=m.offset||0;var R=m.context;S=m.suggest}if(c&&(c=this.encode(""+c),w=c.length,1<w)){m=ge();var U=[];for(let Q=0,G=0,j;Q<w;Q++)if((j=c[Q])&&j.length>=this.B&&!m[j])if(this.s||S||this.map[j])U[G++]=j,m[j]=1;else return y;c=U,w=c.length}if(!w)return y;f||(f=100),R=this.depth&&1<w&&R!==!1,m=0;let H;R?(H=c[0],m=1):1<w&&c.sort(te);for(let Q,G;m<w;m++){if(G=c[m],R?(Q=yi(this,y,S,f,P,w===2,G,H),S&&Q===!1&&y.length||(H=G)):Q=yi(this,y,S,f,P,w===1,G),Q)return Q;if(S&&m===w-1){if(U=y.length,!U){if(R){R=0,m=-1;continue}return y}if(U===1)return W(y[0],f,P)}}return Gt(y,f,P,S)};function yi(c,f,m,y,w,S,P,R){let U=[],H=R?c.h:c.map;if(c.s||(H=ee(H,P,R,c.l)),H){let Q=0,G=Math.min(H.length,R?c.A:c.D);for(let j=0,I=0,B,X;j<G&&!((B=H[j])&&(c.s&&(B=ee(B,P,R,c.l)),w&&B&&S&&(X=B.length,X<=w?(w-=X,B=null):(B=B.slice(w),w=0)),B&&(U[Q++]=B,S&&(I+=B.length,I>=y))));j++);if(Q){if(S)return W(U,y,0);f[f.length]=U;return}}return!m&&U}function W(c,f,m){return c=c.length===1?c[0]:[].concat.apply([],c),m||c.length>f?c.slice(m,m+f):c}function ee(c,f,m,y){return m?(y=y&&f>m,c=(c=c[y?f:m])&&c[y?m:f]):c=c[f],c}O.contain=function(c){return!!this.register[c]},O.update=function(c,f){return this.remove(c).add(c,f)},O.remove=function(c,f){let m=this.register[c];if(m){if(this.m)for(let y=0,w;y<m.length;y++)w=m[y],w.splice(w.indexOf(c),1);else le(this.map,c,this.D,this.s),this.depth&&le(this.h,c,this.A,this.s);if(f||delete this.register[c],this.cache){f=this.cache;for(let y=0,w,S;y<f.h.length;y++)S=f.h[y],w=f.cache[S],w.includes(c)&&(f.h.splice(y--,1),delete f.cache[S])}}return this};function le(c,f,m,y,w){let S=0;if(c.constructor===Array)if(w)f=c.indexOf(f),f!==-1?1<c.length&&(c.splice(f,1),S++):S++;else{w=Math.min(c.length,m);for(let P=0,R;P<w;P++)(R=c[P])&&(S=le(R,f,m,y,w),y||S||delete c[P])}else for(let P in c)(S=le(c[P],f,m,y,w))||delete c[P];return S}O.searchCache=Di,O.export=function(c,f,m,y,w,S){let P=!0;typeof S>"u"&&(P=new Promise(H=>{S=H}));let R,U;switch(w||(w=0)){case 0:if(R="reg",this.m){U=ge();for(let H in this.register)U[H]=1}else U=this.register;break;case 1:R="cfg",U={doc:0,opt:this.s?1:0};break;case 2:R="map",U=this.map;break;case 3:R="ctx",U=this.h;break;default:typeof m>"u"&&S&&S();return}return Ei(c,f||this,m,R,y,w,U,S),P},O.import=function(c,f){if(f)switch(dt(f)&&(f=JSON.parse(f)),c){case"cfg":this.s=!!f.opt;break;case"reg":this.m=!1,this.register=f;break;case"map":this.map=f;break;case"ctx":this.h=f}},Oi(Xt.prototype);function Te(c){c=c.data;var f=self._index;let m=c.args;var y=c.task;switch(y){case"init":y=c.options||{},c=c.factory,f=y.encode,y.cache=!1,f&&f.indexOf("function")===0&&(y.encode=Function("return "+f)()),c?(Function("return "+c)()(self),self._index=new self.FlexSearch.Index(y),delete self.FlexSearch):self._index=new Xt(y);break;default:c=c.id,f=f[y].apply(f,m),postMessage(y==="search"?{id:c,msg:f}:{id:c})}}var we=0;function fe(c){if(!(this instanceof fe))return new fe(c);var f;c?qe(f=c.encode)&&(c.encode=f.toString()):c={},(f=(self||window)._factory)&&(f=f.toString());let m=typeof window>"u"&&self.exports,y=this;this.o=He(f,m,c.worker),this.h=ge(),this.o&&(m?this.o.on("message",function(w){y.h[w.id](w.msg),delete y.h[w.id]}):this.o.onmessage=function(w){w=w.data,y.h[w.id](w.msg),delete y.h[w.id]},this.o.postMessage({task:"init",factory:f,options:c}))}Re("add"),Re("append"),Re("search"),Re("update"),Re("remove");function Re(c){fe.prototype[c]=fe.prototype[c+"Async"]=function(){let f=this,m=[].slice.call(arguments);var y=m[m.length-1];let w;return qe(y)&&(w=y,m.splice(m.length-1,1)),y=new Promise(function(S){setTimeout(function(){f.h[++we]=S,f.o.postMessage({task:c,id:we,args:m})})}),w?(y.then(w),this):y}}function He(c,f,m){let y;try{y=f?new(Mt()).Worker(__dirname+"/node/node.js"):c?new Worker(URL.createObjectURL(new Blob(["onmessage="+Te.toString()],{type:"text/javascript"}))):new Worker(dt(m)?m:"worker/worker.js",{type:"module"})}catch{}return y}function Qe(c){if(!(this instanceof Qe))return new Qe(c);var f=c.document||c.doc||c,m;this.K=[],this.h=[],this.A=[],this.register=ge(),this.key=(m=f.key||f.id)&&nt(m,this.A)||"id",this.m=Pt(c.fastupdate),this.C=(m=f.store)&&m!==!0&&[],this.store=m&&ge(),this.I=(m=f.tag)&&nt(m,this.A),this.l=m&&ge(),this.cache=(m=c.cache)&&new Qt(m),c.cache=!1,this.o=c.worker,this.async=!1,m=ge();let y=f.index||f.field||f;dt(y)&&(y=[y]);for(let w=0,S,P;w<y.length;w++)S=y[w],dt(S)||(P=S,S=S.field),P=Ut(P)?Object.assign({},c,P):c,this.o&&(m[S]=new fe(P),m[S].o||(this.o=!1)),this.o||(m[S]=new Xt(P,this.register)),this.K[w]=nt(S,this.A),this.h[w]=S;if(this.C)for(c=f.store,dt(c)&&(c=[c]),f=0;f<c.length;f++)this.C[f]=nt(c[f],this.A);this.index=m}function nt(c,f){let m=c.split(":"),y=0;for(let w=0;w<m.length;w++)c=m[w],0<=c.indexOf("[]")&&(c=c.substring(0,c.length-2))&&(f[y]=!0),c&&(m[y++]=c);return y<m.length&&(m.length=y),1<y?m:m[0]}function ct(c,f){if(dt(f))c=c[f];else for(let m=0;c&&m<f.length;m++)c=c[f[m]];return c}function pe(c,f,m,y,w){if(c=c[w],y===m.length-1)f[w]=c;else if(c)if(c.constructor===Array)for(f=f[w]=Array(c.length),w=0;w<c.length;w++)pe(c,f,m,y,w);else f=f[w]||(f[w]=ge()),w=m[++y],pe(c,f,m,y,w)}function Ie(c,f,m,y,w,S,P,R){if(c=c[P])if(y===f.length-1){if(c.constructor===Array){if(m[y]){for(f=0;f<c.length;f++)w.add(S,c[f],!0,!0);return}c=c.join(" ")}w.add(S,c,R,!0)}else if(c.constructor===Array)for(P=0;P<c.length;P++)Ie(c,f,m,y,w,S,P,R);else P=f[++y],Ie(c,f,m,y,w,S,P,R)}O=Qe.prototype,O.add=function(c,f,m){if(Ut(c)&&(f=c,c=ct(f,this.key)),f&&(c||c===0)){if(!m&&this.register[c])return this.update(c,f);for(let y=0,w,S;y<this.h.length;y++)S=this.h[y],w=this.K[y],dt(w)&&(w=[w]),Ie(f,w,this.A,0,this.index[S],c,w[0],m);if(this.I){let y=ct(f,this.I),w=ge();dt(y)&&(y=[y]);for(let S=0,P,R;S<y.length;S++)if(P=y[S],!w[P]&&(w[P]=1,R=this.l[P]||(this.l[P]=[]),!m||!R.includes(c))&&(R[R.length]=c,this.m)){let U=this.register[c]||(this.register[c]=[]);U[U.length]=R}}if(this.store&&(!m||!this.store[c])){let y;if(this.C){y=ge();for(let w=0,S;w<this.C.length;w++)S=this.C[w],dt(S)?y[S]=f[S]:pe(f,y,S,0,S[0])}this.store[c]=y||f}}return this},O.append=function(c,f){return this.add(c,f,!0)},O.update=function(c,f){return this.remove(c).add(c,f)},O.remove=function(c){if(Ut(c)&&(c=ct(c,this.key)),this.register[c]){for(var f=0;f<this.h.length&&(this.index[this.h[f]].remove(c,!this.o),!this.m);f++);if(this.I&&!this.m)for(let m in this.l){f=this.l[m];let y=f.indexOf(c);y!==-1&&(1<f.length?f.splice(y,1):delete this.l[m])}this.store&&delete this.store[c],delete this.register[c]}return this},O.search=function(c,f,m,y){m||(!f&&Ut(c)?(m=c,c=""):Ut(f)&&(m=f,f=0));let w=[],S=[],P,R,U,H,Q,G,j=0;if(m)if(m.constructor===Array)U=m,m=null;else{if(c=m.query||c,U=(P=m.pluck)||m.index||m.field,H=m.tag,R=this.store&&m.enrich,Q=m.bool==="and",f=m.limit||f||100,G=m.offset||0,H&&(dt(H)&&(H=[H]),!c)){for(let B=0,X;B<H.length;B++)(X=ve.call(this,H[B],f,G,R))&&(w[w.length]=X,j++);return j?w:[]}dt(U)&&(U=[U])}U||(U=this.h),Q=Q&&(1<U.length||H&&1<H.length);let I=!y&&(this.o||this.async)&&[];for(let B=0,X,V,ue;B<U.length;B++){let Me;if(V=U[B],dt(V)||(Me=V,V=Me.field,c=Me.query||c,f=Me.limit||f,R=Me.enrich||R),I)I[B]=this.index[V].searchAsync(c,f,Me||m);else{if(y?X=y[B]:X=this.index[V].search(c,f,Me||m),ue=X&&X.length,H&&ue){let Ee=[],Ke=0;Q&&(Ee[0]=[X]);for(let St=0,ai,$t;St<H.length;St++)ai=H[St],(ue=($t=this.l[ai])&&$t.length)&&(Ke++,Ee[Ee.length]=Q?[$t]:$t);Ke&&(X=Q?Gt(Ee,f||100,G||0):Fi(X,Ee),ue=X.length)}if(ue)S[j]=V,w[j++]=X;else if(Q)return[]}}if(I){let B=this;return new Promise(function(X){Promise.all(I).then(function(V){X(B.search(c,f,m,V))})})}if(!j)return[];if(P&&(!R||!this.store))return w[0];for(let B=0,X;B<S.length;B++){if(X=w[B],X.length&&R&&(X=ye.call(this,X)),P)return X;w[B]={field:S[B],result:X}}return w};function ve(c,f,m,y){let w=this.l[c],S=w&&w.length-m;if(S&&0<S)return(S>f||m)&&(w=w.slice(m,m+f)),y&&(w=ye.call(this,w)),{tag:c,result:w}}function ye(c){let f=Array(c.length);for(let m=0,y;m<c.length;m++)y=c[m],f[m]={id:y,doc:this.store[y]};return f}O.contain=function(c){return!!this.register[c]},O.get=function(c){return this.store[c]},O.set=function(c,f){return this.store[c]=f,this},O.searchCache=Di,O.export=function(c,f,m,y,w,S){let P;if(typeof S>"u"&&(P=new Promise(R=>{S=R})),w||(w=0),y||(y=0),y<this.h.length){let R=this.h[y],U=this.index[R];f=this,setTimeout(function(){U.export(c,f,w?R:"",y,w++,S)||(y++,w=1,f.export(c,f,R,y,w,S))})}else{let R,U;switch(w){case 1:R="tag",U=this.l,m=null;break;case 2:R="store",U=this.store,m=null;break;default:S();return}Ei(c,this,m,R,y,w,U,S)}return P},O.import=function(c,f){if(f)switch(dt(f)&&(f=JSON.parse(f)),c){case"tag":this.l=f;break;case"reg":this.m=!1,this.register=f;for(let y=0,w;y<this.h.length;y++)w=this.index[this.h[y]],w.register=f,w.m=!1;break;case"store":this.store=f;break;default:c=c.split(".");let m=c[0];c=c[1],m&&c&&this.index[m].import(c,f)}},Oi(Qe.prototype);var Je={encode:st,F:!1,G:""},Be=[rt("[\xE0\xE1\xE2\xE3\xE4\xE5]"),"a",rt("[\xE8\xE9\xEA\xEB]"),"e",rt("[\xEC\xED\xEE\xEF]"),"i",rt("[\xF2\xF3\xF4\xF5\xF6\u0151]"),"o",rt("[\xF9\xFA\xFB\xFC\u0171]"),"u",rt("[\xFD\u0177\xFF]"),"y",rt("\xF1"),"n",rt("[\xE7c]"),"k",rt("\xDF"),"s",rt(" & ")," and "];function st(c){var f=c=""+c;return f.normalize&&(f=f.normalize("NFD").replace(Bt,"")),gt.call(this,f.toLowerCase(),!c.normalize&&Be)}var ei={encode:jt,F:!1,G:"strict"},De=/[^a-z0-9]+/,ui={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 jt(c){c=st.call(this,c).join(" ");let f=[];if(c){let m=c.split(De),y=m.length;for(let w=0,S,P=0;w<y;w++)if((c=m[w])&&(!this.filter||!this.filter[c])){S=c[0];let R=ui[S]||S,U=R;for(let H=1;H<c.length;H++){S=c[H];let Q=ui[S]||S;Q&&Q!==U&&(R+=Q,U=Q)}f[P++]=R}}return f}var Ae={encode:pr,F:!1,G:""},Xr=[rt("ae"),"a",rt("oe"),"o",rt("sh"),"s",rt("th"),"t",rt("ph"),"f",rt("pf"),"f",rt("(?![aeo])h(?![aeo])"),"",rt("(?!^[aeo])h(?!^[aeo])"),""];function pr(c,f){return c&&(c=jt.call(this,c).join(" "),2<c.length&&(c=mt(c,Xr)),f||(1<c.length&&(c=Zi(c)),c&&(c=c.split(" ")))),c||[]}var Xe={encode:Cr,F:!1,G:""},Tt=rt("(?!\\b)[aeo]");function Cr(c){return c&&(c=pr.call(this,c,!0),1<c.length&&(c=c.replace(Tt,"")),1<c.length&&(c=Zi(c)),c&&(c=c.split(" "))),c||[]}It["latin:default"]=vi,It["latin:simple"]=Je,It["latin:balance"]=ei,It["latin:advanced"]=Ae,It["latin:extra"]=Xe;var ht={Index:Xt,Document:Qe,Worker:fe,registerCharset:function(c,f){It[c]=f},registerLanguage:function(c,f){hi[c]=f}};function Ui(c,f){if(!c)return;function m(w){w.target===this&&(w.preventDefault(),w.stopPropagation(),f())}function y(w){w.key.startsWith("Esc")&&(w.preventDefault(),f())}c?.addEventListener("click",m),window.addCleanup(()=>c?.removeEventListener("click",m)),document.addEventListener("keydown",y),window.addCleanup(()=>document.removeEventListener("keydown",y))}function yt(c){for(;c.firstChild;)c.removeChild(c.firstChild)}var We=Object.hasOwnProperty,Mr=ze(lt(),1),je=(0,Mr.default)();function Pr(c){let f=Kr(Rr(c,"index"),!0);return f.length===0?"/":f}var _t=(c,f,m)=>{let y=new URL(c.getAttribute(f),m);c.setAttribute(f,y.pathname+y.hash)};function gr(c,f){c.querySelectorAll('[href^="./"], [href^="../"]').forEach(m=>_t(m,"href",f)),c.querySelectorAll('[src^="./"], [src^="../"]').forEach(m=>_t(m,"src",f))}function Yr(c){let f=c.split("/").filter(m=>m!=="").slice(0,-1).map(m=>"..").join("/");return f.length===0&&(f="."),f}function qr(c,f){return Ue(Yr(c),Pr(f))}function Ue(...c){return c.filter(f=>f!=="").join("/").replace(/\/\/+/g,"/")}function Lt(c,f){return c===f||c.endsWith("/"+f)}function Rr(c,f){return Lt(c,f)&&(c=c.slice(0,-f.length)),c}function Kr(c,f){return c.startsWith("/")&&(c=c.substring(1)),!f&&c.endsWith("/")&&(c=c.slice(0,-1)),c}var ci="basic",Vt="",Ji=c=>c.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),Ai=new ht.Document({charset:"latin:extra",encode:Ji,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),Zr=new DOMParser,Li=new Map,kr=30,er=8,Cs=5,mr=c=>{let f=c.split(/\s+/).filter(y=>y.trim()!==""),m=f.length;if(m>1)for(let y=1;y<m;y++)f.push(f.slice(0,y+1).join(" "));return f.sort((y,w)=>w.length-y.length)};function Qr(c,f,m){let y=mr(c),w=f.split(/\s+/).filter(U=>U!==""),S=0,P=w.length-1;if(m){let U=j=>y.some(I=>j.toLowerCase().startsWith(I.toLowerCase())),H=w.map(U),Q=0,G=0;for(let j=0;j<Math.max(w.length-kr,0);j++){let I=H.slice(j,j+kr).reduce((B,X)=>B+(X?1:0),0);I>=Q&&(Q=I,G=j)}S=Math.max(G-kr,0),P=Math.min(S+2*kr,w.length-1),w=w.slice(S,P)}let R=w.map(U=>{for(let H of y)if(U.toLowerCase().includes(H.toLowerCase())){let Q=new RegExp(H.toLowerCase(),"gi");return U.replace(Q,'<span class="highlight">$&</span>')}return U}).join(" ");return`${S===0?"":"..."}${R}${P===w.length-1?"":"..."}`}function tr(c,f){let m=new DOMParser,y=mr(c),w=m.parseFromString(f.innerHTML,"text/html"),S=R=>{let U=document.createElement("span");return U.className="highlight",U.textContent=R,U},P=(R,U)=>{if(R.nodeType===Node.TEXT_NODE){let H=R.nodeValue??"",Q=new RegExp(U.toLowerCase(),"gi"),G=H.match(Q);if(!G||G.length===0)return;let j=document.createElement("span"),I=0;for(let B of G){let X=H.indexOf(B,I);j.appendChild(document.createTextNode(H.slice(I,X))),j.appendChild(S(B)),I=X+B.length}j.appendChild(document.createTextNode(H.slice(I))),R.parentNode?.replaceChild(j,R)}else if(R.nodeType===Node.ELEMENT_NODE){if(R.classList.contains("highlight"))return;Array.from(R.childNodes).forEach(H=>P(H,U))}};for(let R of y)P(w.body,R);return w.body}document.addEventListener("nav",async c=>{let f=c.detail.url,m=await fetchData,y=document.getElementById("search-container"),w=y?.closest(".sidebar"),S=document.getElementById("search-button"),P=document.getElementById("search-bar"),R=document.getElementById("search-layout"),U=Object.keys(m),H=xe=>{R?.querySelector(`#${xe.id}`)===null&&R?.appendChild(xe)},Q=R?.dataset?.preview==="true",G,j,I=document.createElement("div");I.id="results-container",H(I),Q&&(G=document.createElement("div"),G.id="preview-container",H(G));function B(){y?.classList.remove("active"),P&&(P.value=""),w&&(w.style.zIndex="unset"),I&&yt(I),G&&yt(G),R&&R.classList.remove("display-results"),ci="basic",S?.focus()}function X(xe){ci=xe,w&&(w.style.zIndex="1"),y?.classList.add("active"),P?.focus()}let V=null;async function ue(xe){if(xe.key==="k"&&(xe.ctrlKey||xe.metaKey)&&!xe.shiftKey){xe.preventDefault(),y?.classList.contains("active")?B():X("basic");return}else if(xe.shiftKey&&(xe.ctrlKey||xe.metaKey)&&xe.key.toLowerCase()==="k"){xe.preventDefault(),y?.classList.contains("active")?B():X("tags"),P&&(P.value="#");return}if(V&&V.classList.remove("focus"),!!y?.classList.contains("active")){if(xe.key==="Enter")if(I?.contains(document.activeElement)){let Ge=document.activeElement;if(Ge.classList.contains("no-match"))return;await qt(Ge),Ge.click()}else{let Ge=document.getElementsByClassName("result-card")[0];if(!Ge||Ge?.classList.contains("no-match"))return;await qt(Ge),Ge.click()}else if(xe.key==="ArrowUp"||xe.shiftKey&&xe.key==="Tab"){if(xe.preventDefault(),I?.contains(document.activeElement)){let Ge=V||document.activeElement,Oe=Ge?.previousElementSibling;Ge?.classList.remove("focus"),Oe?.focus(),Oe&&(V=Oe),await qt(Oe)}}else if((xe.key==="ArrowDown"||xe.key==="Tab")&&(xe.preventDefault(),document.activeElement===P||V!==null)){let Ge=V||document.getElementsByClassName("result-card")[0],Oe=Ge?.nextElementSibling;Ge?.classList.remove("focus"),Oe?.focus(),Oe&&(V=Oe),await qt(Oe)}}}let Me=(xe,Ge)=>{let Oe=U[Ge];return{id:Ge,slug:Oe,title:ci==="tags"?m[Oe].title:Qr(xe,m[Oe].title??""),content:Qr(xe,m[Oe].content??"",!0),tags:Ee(xe.substring(1),m[Oe].tags)}};function Ee(xe,Ge){return!Ge||ci!=="tags"?[]:Ge.map(Oe=>Oe.toLowerCase().includes(xe.toLowerCase())?`<li><p class="match-tag">#${Oe}</p></li>`:`<li><p>#${Oe}</p></li>`).slice(0,Cs)}function Ke(xe){return new URL(qr(f,xe),location.toString())}let St=({slug:xe,title:Ge,content:Oe,tags:xt})=>{let ot=xt.length>0?`<ul class="tags">${xt.join("")}</ul>`:"",tt=document.createElement("a");tt.classList.add("result-card"),tt.id=xe,tt.href=Ke(xe).toString(),tt.innerHTML=`<h3>${Ge}</h3>${ot}${Q&&window.innerWidth>600?"":`<p>${Oe}</p>`}`,tt.addEventListener("click",Nt=>{Nt.altKey||Nt.ctrlKey||Nt.metaKey||Nt.shiftKey||B()});let Rt=Nt=>{Nt.altKey||Nt.ctrlKey||Nt.metaKey||Nt.shiftKey||B()};async function Kt(Nt){if(!Nt.target)return;let Go=Nt.target;await qt(Go)}return tt.addEventListener("mouseenter",Kt),window.addCleanup(()=>tt.removeEventListener("mouseenter",Kt)),tt.addEventListener("click",Rt),window.addCleanup(()=>tt.removeEventListener("click",Rt)),tt};async function ai(xe){if(I)if(yt(I),xe.length===0?I.innerHTML=`<a class="result-card no-match">
|
|
<h3>No results.</h3>
|
|
<p>Try another search term?</p>
|
|
</a>`:I.append(...xe.map(St)),xe.length===0&&G)yt(G);else{let Ge=I.firstElementChild;Ge.classList.add("focus"),V=Ge,await qt(Ge)}}async function $t(xe){if(Li.has(xe))return Li.get(xe);let Ge=Ke(xe).toString(),Oe=await fetch(Ge).then(xt=>xt.text()).then(xt=>{if(xt===void 0)throw new Error(`Could not fetch ${Ge}`);let ot=Zr.parseFromString(xt??"","text/html");return gr(ot,Ge),[...ot.getElementsByClassName("popover-hint")]});return Li.set(xe,Oe),Oe}async function qt(xe){if(!R||!Q||!xe||!G)return;let Ge=xe.id,Oe=await $t(Ge).then(xt=>xt.flatMap(ot=>[...tr(Vt,ot).children]));j=document.createElement("div"),j.classList.add("preview-inner"),j.append(...Oe),G.replaceChildren(j),[...G.querySelectorAll(".highlight")].sort((xt,ot)=>ot.innerHTML.length-xt.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function ir(xe){if(!R||!Ai)return;Vt=xe.target.value,R.classList.toggle("display-results",Vt!==""),ci=Vt.startsWith("#")?"tags":"basic";let Ge;if(ci==="tags"){Vt=Vt.substring(1).trim();let ot=Vt.indexOf(" ");if(ot!=-1){let tt=Vt.substring(0,ot),Rt=Vt.substring(ot+1).trim();Ge=await Ai.searchAsync({query:Rt,limit:Math.max(er,1e4),index:["title","content"],tag:tt});for(let Kt of Ge)Kt.result=Kt.result.slice(0,er);ci="basic",Vt=Rt}else Ge=await Ai.searchAsync({query:Vt,limit:er,index:["tags"]})}else ci==="basic"&&(Ge=await Ai.searchAsync({query:Vt,limit:er,index:["title","content"]}));let Oe=ot=>{let tt=Ge.filter(Rt=>Rt.field===ot);return tt.length===0?[]:[...tt[0].result]},xt=[...new Set([...Oe("title"),...Oe("content"),...Oe("tags")])].map(ot=>Me(Vt,ot));await ai(xt)}document.addEventListener("keydown",ue),window.addCleanup(()=>document.removeEventListener("keydown",ue)),S?.addEventListener("click",()=>X("basic")),window.addCleanup(()=>S?.removeEventListener("click",()=>X("basic"))),P?.addEventListener("input",ir),window.addCleanup(()=>P?.removeEventListener("input",ir)),Ui(y,B),await at(m)});async function at(c){let f=0,m=[];for(let[y,w]of Object.entries(c))m.push(Ai.addAsync(f++,{id:f,slug:y,title:w.title,content:w.content,tags:w.tags}));return await Promise.all(m)}}(),function(){var kt,At=new IntersectionObserver(Ne=>{let ze=document.getElementById("explorer-ul");if(ze)for(let Mt of Ne)Mt.isIntersecting?ze.classList.add("no-background"):ze.classList.remove("no-background")});function Wt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let Ne=this.nextElementSibling;Ne&&Ne.classList.toggle("collapsed")}function ut(Ne){Ne.stopPropagation();let ze=Ne.target;if(!ze)return;let Mt=ze.nodeName==="svg",lt=Mt?ze.parentElement?.nextSibling:ze.parentElement?.parentElement?.nextElementSibling,O=Mt?ze.nextElementSibling:ze.parentElement;if(!(lt&&O))return;lt.classList.toggle("open");let Pt=lt.classList.contains("open");Zt(lt,!Pt);let Ve=O.dataset.folderpath;v(kt,Ve);let ge=JSON.stringify(kt);localStorage.setItem("fileTree",ge)}function Ct(){let Ne=document.getElementById("explorer");if(!Ne)return;if(Ne.dataset.behavior==="collapse")for(let Ve of document.getElementsByClassName("folder-button"))Ve.addEventListener("click",ut),window.addCleanup(()=>Ve.removeEventListener("click",ut));Ne.addEventListener("click",Wt),window.addCleanup(()=>Ne.removeEventListener("click",Wt));for(let Ve of document.getElementsByClassName("folder-icon"))Ve.addEventListener("click",ut),window.addCleanup(()=>Ve.removeEventListener("click",ut));let ze=localStorage.getItem("fileTree"),Mt=Ne?.dataset.savestate==="true",lt=ze&&Mt?JSON.parse(ze):[],O=new Map(lt.map(Ve=>[Ve.path,Ve.collapsed])),Pt=Ne.dataset.tree?JSON.parse(Ne.dataset.tree):[];kt=[];for(let{path:Ve,collapsed:ge}of Pt)kt.push({path:Ve,collapsed:O.get(Ve)??ge});kt.map(Ve=>{let ge=document.querySelector(`[data-folderpath='${Ve.path}']`)?.parentElement?.nextElementSibling;ge&&Zt(ge,Ve.collapsed)})}window.addEventListener("resize",Ct),document.addEventListener("nav",()=>{Ct(),At.disconnect();let Ne=document.getElementById("explorer-end");Ne&&At.observe(Ne)});function Zt(Ne,ze){return ze?Ne.classList.remove("open"):Ne.classList.add("open")}function v(Ne,ze){let Mt=Ne.find(lt=>lt.path===ze);Mt&&(Mt.collapsed=!Mt.collapsed)}}(),function(){var kt=Object.create,At=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyNames,Ct=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,v=(t,e)=>()=>(t&&(e=t(t=0)),e),Ne=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ze=(t,e)=>{for(var i in e)At(t,i,{get:e[i],enumerable:!0})},Mt=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ut(e))!Zt.call(t,n)&&n!==i&&At(t,n,{get:()=>e[n],enumerable:!(r=Wt(e,n))||r.enumerable});return t},lt=(t,e,i)=>(i=t!=null?kt(Ct(t)):{},Mt(e||!t||!t.__esModule?At(i,"default",{value:t,enumerable:!0}):i,t)),O,Pt,Ve,ge,te=v(()=>{"use strict";O=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(O||{}),Pt=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Ve=(t,e)=>Pt(t).priority??e,ge={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Pt).forEach(e=>{e.type.forEach(i=>this._removeHandlers[i]?.(e))}),this},add(...t){return t.map(Pt).forEach(e=>{e.type.forEach(i=>{let r=this._addHandlers,n=this._queue;r[i]?r[i]?.(e):(n[i]=n[i]||[],n[i]?.push(e))})}),this},handle(t,e,i){let r=this._addHandlers,n=this._removeHandlers;if(r[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,n[t]=i;let s=this._queue;return s[t]&&(s[t]?.forEach(a=>e(a)),delete s[t]),this},handleByMap(t,e){return this.handle(t,i=>{i.name&&(e[i.name]=i.ref)},i=>{i.name&&delete e[i.name]})},handleByNamedList(t,e,i=-1){return this.handle(t,r=>{e.findIndex(n=>n.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((n,s)=>Ve(s.value,i)-Ve(n.value,i)))},r=>{let n=e.findIndex(s=>s.name===r.name);n!==-1&&e.splice(n,1)})},handleByList(t,e,i=-1){return this.handle(t,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((n,s)=>Ve(s,i)-Ve(n,i)))},r=>{let n=e.indexOf(r.ref);n!==-1&&e.splice(n,1)})}}}),dt=Ne((t,e)=>{"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,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var b=new s(d,p||h,g),x=r?r+u:u;return h._events[x]?h._events[x].fn?h._events[x]=[h._events[x],b]:h._events[x].push(b):(h._events[x]=b,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,g=d.length,b=new Array(g);p<g;p++)b[p]=d[p].fn;return b},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,g,b){var x=r?r+h:h;if(!this._events[x])return!1;var _=this._events[x],T=arguments.length,C,F;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,g),!0;case 6:return _.fn.call(_.context,u,d,p,g,b),!0}for(F=1,C=new Array(T-1);F<T;F++)C[F-1]=arguments[F];_.fn.apply(_.context,C)}else{var k=_.length,N;for(F=0;F<k;F++)switch(_[F].once&&this.removeListener(h,_[F].fn,void 0,!0),T){case 1:_[F].fn.call(_[F].context);break;case 2:_[F].fn.call(_[F].context,u);break;case 3:_[F].fn.call(_[F].context,u,d);break;case 4:_[F].fn.call(_[F].context,u,d,p);break;default:if(!C)for(N=1,C=new Array(T-1);N<T;N++)C[N-1]=arguments[N];_[F].fn.apply(_[F].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 g=r?r+h:h;if(!this._events[g])return this;if(!u)return o(this,g),this;var b=this._events[g];if(b.fn)b.fn===u&&(!p||b.once)&&(!d||b.context===d)&&o(this,g);else{for(var x=0,_=[],T=b.length;x<T;x++)(b[x].fn!==u||p&&!b[x].once||d&&b[x].context!==d)&&_.push(b[x]);_.length?this._events[g]=_.length===1?_[0]:_:o(this,g)}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 e<"u"&&(e.exports=l)}),Ut,qe,gt=v(()=>{Ut=lt(dt(),1),qe=Ut.default}),Gi,Bt,it,mt,rt,Zi,vi,fr,hi,It,Oi,si,Gt,Fi,Qt,Di,Qi,Ei,Xt,Jt,Yt,yi,W,ee,le,Te,we,fe,Re,He=v(()=>{Gi={grad:.9,turn:360,rad:360/(2*Math.PI)},Bt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},it=function(t,e,i){return e===void 0&&(e=0),i===void 0&&(i=Math.pow(10,e)),Math.round(i*t)/i+0},mt=function(t,e,i){return e===void 0&&(e=0),i===void 0&&(i=1),t>i?i:t>e?t:e},rt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Zi=function(t){return{r:mt(t.r,0,255),g:mt(t.g,0,255),b:mt(t.b,0,255),a:mt(t.a)}},vi=function(t){return{r:it(t.r),g:it(t.g),b:it(t.b),a:it(t.a,3)}},fr=/^#([0-9a-f]{3,8})$/i,hi=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},It=function(t){var e=t.r,i=t.g,r=t.b,n=t.a,s=Math.max(e,i,r),a=s-Math.min(e,i,r),o=a?s===e?(i-r)/a:s===i?2+(r-e)/a:4+(e-i)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},Oi=function(t){var e=t.h,i=t.s,r=t.v,n=t.a;e=e/360*6,i/=100,r/=100;var s=Math.floor(e),a=r*(1-i),o=r*(1-(e-s)*i),l=r*(1-(1-e+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(t){return{h:rt(t.h),s:mt(t.s,0,100),l:mt(t.l,0,100),a:mt(t.a)}},Gt=function(t){return{h:it(t.h),s:it(t.s),l:it(t.l),a:it(t.a,3)}},Fi=function(t){return Oi((i=(e=t).s,{h:e.h,s:(i*=((r=e.l)<50?r:100-r)/100)>0?2*i/(r+i)*100:0,v:r+i,a:e.a}));var e,i,r},Qt=function(t){return{h:(e=It(t)).h,s:(n=(200-(i=e.s))*(r=e.v)/100)>0&&n<200?i*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,i,r,n},Di=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qi=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ei=/^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,Jt={string:[[function(t){var e=fr.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?it(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?it(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Ei.exec(t)||Xt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Zi({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Di.exec(t)||Qi.exec(t);if(!e)return null;var i,r,n=si({h:(i=e[1],r=e[2],r===void 0&&(r="deg"),Number(i)*(Gi[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Fi(n)},"hsl"]],object:[[function(t){var e=t.r,i=t.g,r=t.b,n=t.a,s=n===void 0?1:n;return Bt(e)&&Bt(i)&&Bt(r)?Zi({r:Number(e),g:Number(i),b:Number(r),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,i=t.s,r=t.l,n=t.a,s=n===void 0?1:n;if(!Bt(e)||!Bt(i)||!Bt(r))return null;var a=si({h:Number(e),s:Number(i),l:Number(r),a:Number(s)});return Fi(a)},"hsl"],[function(t){var e=t.h,i=t.s,r=t.v,n=t.a,s=n===void 0?1:n;if(!Bt(e)||!Bt(i)||!Bt(r))return null;var a=function(o){return{h:rt(o.h),s:mt(o.s,0,100),v:mt(o.v,0,100),a:mt(o.a)}}({h:Number(e),s:Number(i),v:Number(r),a:Number(s)});return Oi(a)},"hsv"]]},Yt=function(t,e){for(var i=0;i<e.length;i++){var r=e[i][0](t);if(r)return[r,e[i][1]]}return[null,void 0]},yi=function(t){return typeof t=="string"?Yt(t.trim(),Jt.string):typeof t=="object"&&t!==null?Yt(t,Jt.object):[null,void 0]},W=function(t,e){var i=Qt(t);return{h:i.h,s:mt(i.s+100*e,0,100),l:i.l,a:i.a}},ee=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},le=function(t,e){var i=Qt(t);return{h:i.h,s:i.s,l:mt(i.l+100*e,0,100),a:i.a}},Te=function(){function t(e){this.parsed=yi(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return it(ee(this.rgba),2)},t.prototype.isDark=function(){return ee(this.rgba)<.5},t.prototype.isLight=function(){return ee(this.rgba)>=.5},t.prototype.toHex=function(){return e=vi(this.rgba),i=e.r,r=e.g,n=e.b,a=(s=e.a)<1?hi(it(255*s)):"","#"+hi(i)+hi(r)+hi(n)+a;var e,i,r,n,s,a},t.prototype.toRgb=function(){return vi(this.rgba)},t.prototype.toRgbString=function(){return e=vi(this.rgba),i=e.r,r=e.g,n=e.b,(s=e.a)<1?"rgba("+i+", "+r+", "+n+", "+s+")":"rgb("+i+", "+r+", "+n+")";var e,i,r,n,s},t.prototype.toHsl=function(){return Gt(Qt(this.rgba))},t.prototype.toHslString=function(){return e=Gt(Qt(this.rgba)),i=e.h,r=e.s,n=e.l,(s=e.a)<1?"hsla("+i+", "+r+"%, "+n+"%, "+s+")":"hsl("+i+", "+r+"%, "+n+"%)";var e,i,r,n,s},t.prototype.toHsv=function(){return e=It(this.rgba),{h:it(e.h),s:it(e.s),v:it(e.v),a:it(e.a,3)};var e},t.prototype.invert=function(){return we({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),we(W(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),we(W(this.rgba,-e))},t.prototype.grayscale=function(){return we(W(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),we(le(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),we(le(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?we({r:(i=this.rgba).r,g:i.g,b:i.b,a:e}):it(this.rgba.a,3);var i},t.prototype.hue=function(e){var i=Qt(this.rgba);return typeof e=="number"?we({h:e,s:i.s,l:i.l,a:i.a}):it(i.h)},t.prototype.isEqual=function(e){return this.toHex()===we(e).toHex()},t}(),we=function(t){return t instanceof Te?t:new Te(t)},fe=[],Re=function(t){t.forEach(function(e){fe.indexOf(e)<0&&(e(Te,Jt),fe.push(e))})}});function Qe(t,e){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={};t.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 g in i)s[g]=new t(i[g]).toRgb();for(var b in i){var x=(o=u,l=s[b],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));x<d&&(d=x,p=b)}return p}},e.string.push([function(a){var o=a.toLowerCase(),l=o==="transparent"?"#0000":i[o];return l?new t(l).toRgb():null},"name"])}var nt=v(()=>{}),ct,pe,Ie=v(()=>{He(),nt(),Re([Qe]),ct=class Es{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof Es)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,i){let r=typeof e;if(r!==typeof i)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===i;if(Array.isArray(e)&&Array.isArray(i)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(i))return e.length!==i.length?!1:e.every((n,s)=>n===i[s]);if(e!==null&&i!==null){let n=Object.keys(e),s=Object.keys(i);return n.length!==s.length?!1:n.every(a=>e[a]===i[a])}return e===i}toRgba(){let[e,i,r,n]=this._components;return{r:e,g:i,b:r,a:n}}toRgb(){let[e,i,r]=this._components;return{r:e,g:i,b:r}}toRgbaString(){let[e,i,r]=this.toUint8RgbArray();return`rgba(${e},${i},${r},${this.alpha})`}toUint8RgbArray(e){let[i,r,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e=e||this._arrayRgb,e[0]=Math.round(i*255),e[1]=Math.round(r*255),e[2]=Math.round(n*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e=e||this._arrayRgba;let[i,r,n,s]=this._components;return e[0]=i,e[1]=r,e[2]=n,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e=e||this._arrayRgb;let[i,r,n]=this._components;return e[0]=i,e[1]=r,e[2]=n,e}toNumber(){return this._int}toBgrNumber(){let[e,i,r]=this.toUint8RgbArray();return(r<<16)+(i<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[i,r,n,s]=Es._temp.setValue(e)._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(e,i=!0){return i&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,i=!0){if(e===1)return(255<<24)+this._int;if(e===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*e+.5|0,n=n*e+.5|0,s=s*e+.5|0),(e*255<<24)+(r<<16)+(n<<8)+s}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let i,r,n,s;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let a=e;i=(a>>16&255)/255,r=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[i,r,n,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[i,r,n,s=255]=e,i/=255,r/=255,n/=255,s/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let o=Es.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}let a=we(e);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 ${e}`)}_refreshInt(){this._clamp(this._components);let[e,i,r]=this._components;this._int=(e*255<<16)+(i*255<<8)+(r*255|0)}_clamp(e,i=0,r=1){return typeof e=="number"?Math.min(Math.max(e,i),r):(e.forEach((n,s)=>{e[s]=Math.min(Math.max(n,i),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Es||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}},ct.shared=new ct,ct._temp=new ct,ct.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,pe=ct}),ve,ye=v(()=>{"use strict";ve={cullArea:null,cullable:!1,cullableChildren:!0}}),Je,Be,st,ei=v(()=>{"use strict";Je=Math.PI*2,Be=180/Math.PI,st=Math.PI/180}),De,ui,jt=v(()=>{"use strict";De=class Q_{constructor(e=0,i=0){this.x=0,this.y=0,this.x=e,this.y=i}clone(){return new Q_(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,i=e){return this.x=e,this.y=i,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ui.x=0,ui.y=0,ui}},ui=new De}),Ae,Xr,pr,Xe=v(()=>{ei(),jt(),Ae=class J_{constructor(e=1,i=0,r=0,n=1,s=0,a=0){this.array=null,this.a=e,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,i,r,n,s,a){return this.a=e,this.b=i,this.c=r,this.d=n,this.tx=s,this.ty=a,this}toArray(e,i){this.array||(this.array=new Float32Array(9));let r=i||this.array;return e?(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(e,i){i=i||new De;let r=e.x,n=e.y;return i.x=this.a*r+this.c*n+this.tx,i.y=this.b*r+this.d*n+this.ty,i}applyInverse(e,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=e.x,d=e.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(e,i){return this.tx+=e,this.ty+=i,this}scale(e,i){return this.a*=e,this.d*=i,this.c*=e,this.b*=i,this.tx*=e,this.ty*=i,this}rotate(e){let i=Math.cos(e),r=Math.sin(e),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(e){let i=this.a,r=this.b,n=this.c,s=this.d;return this.a=e.a*i+e.b*n,this.b=e.a*r+e.b*s,this.c=e.c*i+e.d*n,this.d=e.c*r+e.d*s,this.tx=e.tx*i+e.ty*n+this.tx,this.ty=e.tx*r+e.ty*s+this.ty,this}appendFrom(e,i){let r=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,l=e.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(e,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=e-(r*this.a+n*this.c),this.ty=i-(r*this.b+n*this.d),this}prepend(e){let i=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let r=this.a,n=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=i*e.a+this.ty*e.c+e.tx,this.ty=i*e.b+this.ty*e.d+e.ty,this}decompose(e){let i=this.a,r=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),l=Math.atan2(r,i),h=Math.abs(o+l);return h<1e-5||Math.abs(Je-h)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=l),e.scale.x=Math.sqrt(i*i+r*r),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*i+a.y*n),e.position.y=this.ty+(a.x*r+a.y*s),e}invert(){let e=this.a,i=this.b,r=this.c,n=this.d,s=this.tx,a=e*n-i*r;return this.a=n/a,this.b=-i/a,this.c=-r/a,this.d=e/a,this.tx=(r*this.ty-n*s)/a,this.ty=-(e*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 e=new J_;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}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 pr.identity()}static get shared(){return Xr.identity()}},Xr=new Ae,pr=new Ae}),Tt,Cr=v(()=>{"use strict";Tt=class ev{constructor(e,i,r){this._x=i||0,this._y=r||0,this._observer=e}clone(e){return new ev(e??this._observer,this._x,this._y)}set(e=0,i=e){return(this._x!==e||this._y!==i)&&(this._x=e,this._y=i,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function ht(t="default"){return Ui[t]===void 0&&(Ui[t]=-1),++Ui[t]}var Ui,yt=v(()=>{"use strict";Ui={default:-1}});function We(t,e,i=3){if(Mr[e])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
Deprecated since v${t}`):(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",`${e}
|
|
Deprecated since v${t}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
Deprecated since v${t}`),console.warn(r))),Mr[e]=!0}var Mr,je,Pr,_t=v(()=>{"use strict";Mr={},je="8.0.0",Pr="8.3.4"}),gr,Yr=v(()=>{"use strict";gr=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}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}}}),qr,Ue,Lt=v(()=>{Yr(),qr=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new gr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},Ue=new qr});function Rr(t,e,i){let r=t.length,n;if(e>=r||i===0)return;i=e+i>r?r-e:i;let s=r-i;for(n=e;n<s;++n)t[n]=t[n+i];t.length=s}var Kr=v(()=>{"use strict"}),ci,Vt=v(()=>{Kr(),_t(),ci={allowChildren:!0,removeChildren(t=0,e){let i=e??this.children.length,r=i-t,n=[];if(r>0&&r<=i){for(let a=i-1;a>=t;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}Rr(this.children,t,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(t){let e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){let e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||We(je,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:i}=this;if(e<0||e>i.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${i.length}`);if(t.parent){let n=t.parent.children.indexOf(t);if(t.parent===this&&n===e)return t;n!==-1&&t.parent.children.splice(n,1)}e===i.length?i.push(t):i.splice(e,0,t),t.parent=this,t.didChange=!0,t.didViewUpdate=!1,t._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;let i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;let i=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let r=this.worldTransform.clone();return r.invert(),i.prepend(r),t.setFromMatrix(i),t}}}),Ji,Ai=v(()=>{"use strict";Ji=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}}),Zr,Li,kr=v(()=>{te(),Lt(),Zr=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let i=this._tests[e];if(i.test(t))return Ue.get(i.maskClass,t)}return t}returnMaskEffect(t){Ue.return(t)}},Li=new Zr,ge.handleByList(O.MaskEffect,Li._effectClasses)}),er,Cs=v(()=>{Ai(),kr(),er={_maskEffect:null,_filterEffect:null,effects:[],addEffect(t){if(this.effects.indexOf(t)!==-1)return;this.effects.push(t),this.effects.sort((i,r)=>i.priority-r.priority);let e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0),this._updateIsSimple()},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),Li.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Li.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new Ji);t=t;let i=t?.length>0,r=e.filters?.length>0,n=i!==r;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Ji),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}}),mr,Qr=v(()=>{_t(),mr={label:null,get name(){return We(je,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){We(je,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){let i=this.children;for(let r=0;r<i.length;r++){let n=i[r];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let r=0;r<i.length;r++){let n=i[r].getChildByLabel(t,!0);if(n)return n}return null},getChildrenByLabel(t,e=!1,i=[]){let r=this.children;for(let n=0;n<r.length;n++){let s=r[n];(s.label===t||t instanceof RegExp&&t.test(s.label))&&i.push(s)}if(e)for(let n=0;n<r.length;n++)r[n].getChildrenByLabel(t,!0,i);return i}}}),tr,at,c=v(()=>{jt(),tr=[new De,new De,new De,new De],at=class Bo{constructor(e=0,i=0,r=0,n=0){this.type="rectangle",this.x=Number(e),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 Bo(0,0,0,0)}clone(){return new Bo(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,i){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height}strokeContains(e,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,g=a+n-r/2,b=o+r/2,x=o+s-r/2;return e>=l&&e<=h&&i>=u&&i<=d&&!(e>p&&e<g&&i>b&&i<x)}intersects(e,i){if(!i){let J=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=J)return!1;let $=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>$}let r=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=r||a<=s)return!1;let o=tr[0].set(e.left,e.top),l=tr[1].set(e.left,e.bottom),h=tr[2].set(e.right,e.top),u=tr[3].set(e.right,e.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),g=d*(o.x-l.x),b=p*r+g*s,x=p*n+g*s,_=p*r+g*a,T=p*n+g*a;if(Math.max(b,x,_,T)<=p*o.x+g*o.y||Math.min(b,x,_,T)>=p*u.x+g*u.y)return!1;let C=d*(o.y-h.y),F=d*(h.x-o.x),k=C*r+F*s,N=C*n+F*s,re=C*r+F*a,ne=C*n+F*a;return!(Math.max(k,N,re,ne)<=C*o.x+F*o.y||Math.min(k,N,re,ne)>=C*u.x+F*u.y)}pad(e=0,i=e){return this.x-=e,this.y-=i,this.width+=e*2,this.height+=i*2,this}fit(e){let i=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=i,this.width=Math.max(r-i,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,i=.001){let r=Math.ceil((this.x+this.width-i)*e)/e,n=Math.ceil((this.y+this.height-i)*e)/e;return this.x=Math.floor((this.x+i)*e)/e,this.y=Math.floor((this.y+i)*e)/e,this.width=r-this.x,this.height=n-this.y,this}enlarge(e){let i=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=i,this.width=r-i,this.y=n,this.height=s-n,this}getBounds(e){return e=e||new Bo,e.copyFrom(this),e}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),f,m,y=v(()=>{Xe(),c(),f=new Ae,m=class tv{constructor(e=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=f,this.minX=e,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 at);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=f,this}set(e,i,r,n){this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}addFrame(e,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,g=this.minY,b=this.maxX,x=this.maxY,_=a*e+l*i+u,T=o*e+h*i+d;_<p&&(p=_),T<g&&(g=T),_>b&&(b=_),T>x&&(x=T),_=a*r+l*i+u,T=o*r+h*i+d,_<p&&(p=_),T<g&&(g=T),_>b&&(b=_),T>x&&(x=T),_=a*e+l*n+u,T=o*e+h*n+d,_<p&&(p=_),T<g&&(g=T),_>b&&(b=_),T>x&&(x=T),_=a*r+l*n+u,T=o*r+h*n+d,_<p&&(p=_),T<g&&(g=T),_>b&&(b=_),T>x&&(x=T),this.minX=p,this.minY=g,this.maxX=b,this.maxY=x}addRect(e,i){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,i)}addBounds(e,i){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,i)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let i=this.minX,r=this.minY,n=this.maxX,s=this.maxY,{a,b:o,c:l,d:h,tx:u,ty:d}=e,p=a*i+l*r+u,g=o*i+h*r+d;this.minX=p,this.minY=g,this.maxX=p,this.maxY=g,p=a*n+l*r+u,g=o*n+h*r+d,this.minX=p<this.minX?p:this.minX,this.minY=g<this.minY?g:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY,p=a*i+l*s+u,g=o*i+h*s+d,this.minX=p<this.minX?p:this.minX,this.minY=g<this.minY?g:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY,p=a*n+l*s+u,g=o*n+h*s+d,this.minX=p<this.minX?p:this.minX,this.minY=g<this.minY?g:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,i,r,n){return this.minX<e&&(this.minX=e),this.maxX>i&&(this.maxX=i),this.minY<r&&(this.minY=r),this.maxY>n&&(this.maxY=n),this}pad(e,i=e){return this.minX-=e,this.maxX+=e,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 tv(this.minX,this.minY,this.maxX,this.maxY)}scale(e,i=e){return this.minX*=e,this.minY*=i,this.maxX*=e,this.maxY*=i,this}get x(){return this.minX}set x(e){let i=this.maxX-this.minX;this.minX=e,this.maxX=e+i}get y(){return this.minY}set y(e){let i=this.maxY-this.minY;this.minY=e,this.maxY=e+i}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}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(e,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,g=n.tx,b=n.ty;for(let x=i;x<r;x+=2){let _=e[x],T=e[x+1],C=h*_+d*T+g,F=u*_+p*T+b;s=C<s?C:s,a=F<a?F:a,o=C>o?C:o,l=F>l?F:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(e,i){return this.minX<=e&&this.minY<=i&&this.maxX>=e&&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}]`}}}),w,S,P=v(()=>{Xe(),Yr(),y(),w=new gr(Ae),S=new gr(m)});function R(t,e,i){i.clear();let r,n;return t.parent?e?r=t.parent.worldTransform:(n=w.get().identity(),r=H(t,n)):r=Ae.IDENTITY,U(t,i,r,e),n&&w.return(n),i.isValid||i.set(0,0,0,0),i}function U(t,e,i,r){if(!t.visible||!t.measurable)return;let n;r?n=t.worldTransform:(t.updateLocalTransform(),n=w.get(),n.appendFrom(t.localTransform,i));let s=e,a=!!t.effects.length;if(a&&(e=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,n);else{t.addBounds&&(e.matrix=n,t.addBounds(e));for(let o=0;o<t.children.length;o++)U(t.children[o],e,n,r)}if(a){for(let o=0;o<t.effects.length;o++)t.effects[o].addBounds?.(e);s.addBounds(e,Ae.IDENTITY),S.return(e)}r||w.return(n)}function H(t,e){let i=t.parent;return i&&(H(i,e),i.updateLocalTransform(),e.append(i.localTransform)),e}var Q=v(()=>{Xe(),P()});function G(...t){j!==I&&(j++,j===I?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var j,I,B=v(()=>{"use strict";j=0,I=500});function X(t,e,i){return e.clear(),i||(i=Ae.IDENTITY),V(t,e,i,t,!0),e.isValid||e.set(0,0,0,0),e}function V(t,e,i,r,n){let s;if(n)s=w.get(),s=i.copyTo(s);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;s=w.get(),s.appendFrom(l,i)}let a=e,o=!!t.effects.length;if(o&&(e=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.renderPipeId&&(e.matrix=s,t.addBounds(e));let l=t.children;for(let h=0;h<l.length;h++)V(l[h],e,s,r,!1)}if(o){for(let l=0;l<t.effects.length;l++)t.effects[l].addLocalBounds?.(e,r);a.addBounds(e,Ae.IDENTITY),S.return(e)}w.return(s)}var ue=v(()=>{Xe(),P()});function Me(t,e){let i=t.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=e.index;(e.data[o]!==s||e.data[o+1]!==a)&&(e.data[e.index]=s,e.data[e.index+1]=a,e.didChange=!0),e.index=o+2,n.children.length&&Me(n,e)}return e.didChange}var Ee=v(()=>{"use strict"}),Ke,St,ai=v(()=>{Xe(),y(),Q(),ue(),Ee(),Ke=new Ae,St={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let i=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*i:this.scale.x=i},_setHeight(t,e){let i=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*i:this.scale.y=i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new m});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),Me(this,t),t.didChange&&X(this,t.localBounds,Ke),t.localBounds},getBounds(t,e){return R(this,t,e||new m)}}}),$t,qt=v(()=>{"use strict";$t={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function ir(t,e){return t._zIndex-e._zIndex}var xe,Ge=v(()=>{"use strict";xe={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,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(ir))}}}),Oe,xt=v(()=>{Xe(),jt(),Q(),Oe={getGlobalPosition(t=new De,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,i=!1){if(!i){this.updateLocalTransform();let r=H(this,new Ae);return r.append(this.localTransform),r.apply(t,e)}return this.worldTransform.apply(t,e)},toLocal(t,e,i,r){if(e&&(t=e.toGlobal(t,i,r)),!r){this.updateLocalTransform();let n=H(this,new Ae);return n.append(this.localTransform),n.applyInverse(t,i)}return this.worldTransform.applyInverse(t,i)}}}),ot,tt,Rt=v(()=>{yt(),ot=0,tt=class{constructor(){this.uid=ht("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=ot++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}}),Kt,Nt=v(()=>{Xe(),Rt(),Kt=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Ae,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 tt,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.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(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(t.didViewUpdate=!1,this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t))}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let i=t.children;for(let r=0;r<i.length;r++)this._getChildren(i[r],e);return e}}});function Go(t,e,i={}){for(let r in e)!i[r]&&e[r]!==void 0&&(t[r]=e[r])}var Iv=v(()=>{"use strict"}),Ms,Ps,Rs,Cn,ks,Jr,bt,Ni=v(()=>{gt(),Ie(),ye(),Xe(),ei(),Cr(),yt(),_t(),Lt(),Vt(),Cs(),Qr(),ai(),qt(),Ge(),xt(),Nt(),Iv(),Ms=new Tt(null),Ps=new Tt(null),Rs=new Tt(null,1,1),Cn=1,ks=2,Jr=4,bt=class iv extends qe{constructor(e={}){super(),this.uid=ht("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 Ae,this.relativeGroupTransform=new Ae,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Tt(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=[],Go(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(i=>this.addChild(i)),e.parent?.addChild(this)}static mixin(e){Object.defineProperties(iv.prototype,Object.getOwnPropertyDescriptors(e))}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||We(je,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n<e.length;n++)this.addChild(e[n]);return e[0]}let i=e[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(...e){if(e.length>1){for(let n=0;n<e.length;n++)this.removeChild(e[n]);return e[0]}let i=e[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(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Ue.get(Kt,this),this.groupTransform=Ae.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),Ue.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new Ae),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(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Be}set angle(e){this.rotation=e*st}get pivot(){return this._pivot===Ps&&(this._pivot=new Tt(this,0,0)),this._pivot}set pivot(e){this._pivot===Ps&&(this._pivot=new Tt(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Ms&&(this._skew=new Tt(this,0,0)),this._skew}set skew(e){this._skew===Ms&&(this._skew=new Tt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Rs&&(this._scale=new Tt(this,1,1)),this._scale}set scale(e){this._scale===Rs&&(this._scale=new Tt(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let i=this.getLocalBounds().width;this._setWidth(e,i)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let i=this.getLocalBounds().height;this._setHeight(e,i)}getSize(e){e||(e={});let i=this.getLocalBounds();return e.width=Math.abs(this.scale.x*i.width),e.height=Math.abs(this.scale.y*i.height),e}setSize(e,i){let r=this.getLocalBounds();typeof e=="object"?(i=e.height??e.width,e=e.width):i??(i=e),e!==void 0&&this._setWidth(e,r.width),i!==void 0&&this._setHeight(i,r.height)}_updateSkew(){let e=this._rotation,i=this._skew;this._cx=Math.cos(e+i._y),this._sx=Math.sin(e+i._y),this._cy=-Math.sin(e-i._x),this._sy=Math.cos(e-i._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;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(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Cn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=pe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Cn,this._onUpdate())}get tint(){let e=this.localColor;return((e&255)<<16)+(e&65280)+(e>>16&255)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let i=e?2:0;(this.localDisplayStatus&2)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Jr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let i=e?0:4;(this.localDisplayStatus&4)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Jr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let i=e?1:0;(this.localDisplayStatus&1)!==i&&(this._updateFlags|=Jr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!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 e=="boolean"?e:e?.children)for(let r=0;r<i.length;++r)i[r].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}},bt.mixin(ci),bt.mixin(Oe),bt.mixin($t),bt.mixin(St),bt.mixin(er),bt.mixin(mr),bt.mixin(xe),bt.mixin(ve)}),Bs,Oo=v(()=>{jt(),Bs=class rv{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=rv.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=e}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(e,i,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,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 Gv(t){return function(e){return e.test(t)}}function Bc(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var i=e.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=Gv(i),s={apple:{phone:n(Is)&&!n(Hi),ipod:n(Fo),tablet:!n(Is)&&(n(Do)||$o(e))&&!n(Hi),universal:n(Uo),device:(n(Is)||n(Fo)||n(Do)||n(Uo)||$o(e))&&!n(Hi)},amazon:{phone:n(Br),tablet:!n(Br)&&n(Mn),device:n(Br)||n(Mn)},android:{phone:!n(Hi)&&n(Br)||!n(Hi)&&n(Gs),tablet:!n(Hi)&&!n(Br)&&!n(Gs)&&(n(Mn)||n(Lo)),device:!n(Hi)&&(n(Br)||n(Mn)||n(Gs)||n(Lo))||n(/\bokhttp\b/i)},windows:{phone:n(Hi),tablet:n(No),device:n(Hi)||n(No)},other:{blackberry:n(Ho),blackberry10:n(zo),opera:n(Wo),firefox:n(Vo),chrome:n(jo),device:n(Ho)||n(zo)||n(Wo)||n(Vo)||n(jo)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Is,Fo,Do,Uo,Gs,Lo,Br,Mn,Hi,No,Ho,zo,Wo,jo,Vo,$o,Ic=v(()=>{Is=/iPhone/i,Fo=/iPod/i,Do=/iPad/i,Uo=/\biOS-universal(?:.+)Mac\b/i,Gs=/\bAndroid(?:.+)Mobile\b/i,Lo=/Android/i,Br=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Mn=/Silk/i,Hi=/Windows Phone/i,No=/\bWindows(?:.+)ARM\b/i,Ho=/BlackBerry/i,zo=/BB10/i,Wo=/Opera Mini/i,jo=/\b(CriOS|Chrome)(?:.+)Mobile/i,Vo=/Mobile(?:.+)Firefox\b/i,$o=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}}),Ov=v(()=>{Ic(),Ic()}),Gc,Oc,Fv=v(()=>{Ov(),Gc=Bc.default??Bc,Oc=Gc(globalThis.navigator)}),Fc,Pn,Dc,Uc,Xo,Yo,Lc,Nc,Hc,qo,Dv=v(()=>{Oo(),te(),Fv(),Kr(),Fc=9,Pn=100,Dc=0,Uc=0,Xo=2,Yo=1,Lc=-1e3,Nc=-1e3,Hc=2,qo=class{constructor(t,e=Oc){this._mobileInfo=e,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,(e.tablet||e.phone)&&this._createTouchHook();let i=document.createElement("div");i.style.width=`${Pn}px`,i.style.height=`${Pn}px`,i.style.position="absolute",i.style.top=`${Dc}px`,i.style.left=`${Uc}px`,i.style.zIndex=Xo.toString(),this._div=i,this._renderer=t,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 t=document.createElement("button");t.style.width=`${Yo}px`,t.style.height=`${Yo}px`,t.style.position="absolute",t.style.top=`${Lc}px`,t.style.left=`${Nc}px`,t.style.zIndex=Hc.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_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(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){this.debug=t?.debug??this.debug,this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);let{x:e,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=`${e}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,Rr(this._children,d,1),this._div.removeChild(p._accessibleDiv),this._pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{u=p._accessibleDiv;let g=p.hitArea,b=p.worldTransform;p.hitArea?(u.style.left=`${(b.tx+g.x*b.a)*l}px`,u.style.top=`${(b.ty+g.y*b.d)*h}px`,u.style.width=`${g.width*b.a*l}px`,u.style.height=`${g.height*b.d*h}px`):(g=p.getBounds().rectangle,this._capHitArea(g),u.style.left=`${g.x*l}px`,u.style.top=`${g.y*h}px`,u.style.width=`${g.width*l}px`,u.style.height=`${g.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(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(e=document.createElement("button"),e.style.width=`${Pn}px`,e.style.height=`${Pn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Xo.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){let{container:i}=t.target,r=this._renderer.events.rootBoundary,n=Object.assign(new Bs(r),{target:i});r.rootTarget=this._renderer.lastObjectRendered,e.forEach(s=>r.dispatchEvent(n,s))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===Fc&&this._activate()}_onMouseMove(t){t.movementX===0&&t.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}},qo.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"accessibility"}}),zc,Uv=v(()=>{"use strict";zc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Lv=v(()=>{te(),Ni(),Dv(),Uv(),ge.add(qo),bt.mixin(zc)}),Ko,Nv=v(()=>{te(),Ko=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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 e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},Ko.extension=O.Application}),en,Zo=v(()=>{"use strict";en=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(en||{})}),Os,Hv=v(()=>{"use strict";Os=class{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}}),Qo,Ci,Fs=v(()=>{Zo(),Hv(),Qo=class _i{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/_i.targetFPMS,this.elapsedMS=1/_i.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,i,r=en.NORMAL){return this._addListener(new Os(e,i,r))}addOnce(e,i,r=en.NORMAL){return this._addListener(new Os(e,i,r,!0))}_addListener(e){let i=this._head.next,r=this._head;if(!i)e.connect(r);else{for(;i;){if(e.priority>i.priority){e.connect(r);break}r=i,i=i.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,i){let r=this._head.next;for(;r;)r.match(e,i)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,i=this._head;for(;i=i.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let i;if(e>this.lastTime){if(i=this.elapsedMS=e-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let s=e-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=e-s%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*_i.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=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let i=Math.min(this.maxFPS,e),r=Math.min(Math.max(0,i)/1e3,_i.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let i=Math.max(this.minFPS,e);this._minElapsedMS=1/(i/1e3)}}static get shared(){if(!_i._shared){let e=_i._shared=new _i;e.autoStart=!0,e._protected=!0}return _i._shared}static get system(){if(!_i._system){let e=_i._system=new _i;e.autoStart=!0,e._protected=!0}return _i._system}},Qo.targetFPMS=.06,Ci=Qo}),Jo,zv=v(()=>{te(),Zo(),Fs(),Jo=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,en.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ci.shared:new Ci,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}},Jo.extension=O.Application}),Wc=v(()=>{te(),Nv(),zv(),ge.add(Ko),ge.add(Jo)}),jc,rr,Vc=v(()=>{Zo(),Fs(),jc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Ci.system.add(this._tickerUpdate,this,en.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ci.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 t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},rr=new jc}),Rn,el=v(()=>{jt(),Oo(),Rn=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(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,s,a,o,l,h,u,d,p,g,b){throw new Error("Method not implemented.")}}}),xi,$c=v(()=>{el(),xi=class extends Rn{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!")}}}),Ir,Xc=v(()=>{el(),Ir=class extends Rn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Ir.DOM_DELTA_PIXEL=0,Ir.DOM_DELTA_LINE=1,Ir.DOM_DELTA_PAGE=2}),Yc,qc,tn,Kc,Wv=v(()=>{gt(),jt(),B(),Vc(),el(),$c(),Xc(),Yc=2048,qc=new De,tn=new De,Kc=class{constructor(t){this.dispatch=new qe,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,r)=>i.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,r=e.length;i<r;i++)e[i].fn(t);else G(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){rr.pauseUpdate=!0;let i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,qc.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let r=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)r.forEach(s=>{t.currentTarget=i[n],this.notifyTarget(t,s)})}propagationPath(t){let e=[t];for(let i=0;i<Yc&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,r,n,s=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(rr.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,r,n,s||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;let g=t.isInteractive();(p.length>0||g)&&(g&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}let o=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(t,i)&&r(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,r,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(rr.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children,l=i;for(let h=o.length-1;h>=0;h--){let u=o[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let p=t.isInteractive();return(d.length>0||p)&&d.push(t),d}}}let s=this._isInteractive(e),a=t.isInteractive();return s&&r(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.includeInBuild||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,tn),!t.hitArea.contains(tn.x,tn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){let r=t.effects[i];if(r.containsPoint&&!r.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,tn),t.containsPoint(tn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e=e??t.type;let i=`on${e}`;t.currentTarget[i]?.(t);let r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}let i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&n!==e.target){let o=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,o,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){let h=this.createPointerEvent(t,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!e.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!==e.target){let o=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,o);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(e,"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(e,"pointermove"),a&&s.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&s.push("globaltouchmove")),i&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&s.push("globalmousemove"),this.cursor=e.target?.cursor),s.length>0&&this.all(e,s),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),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;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"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;e.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);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(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.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[t.button],s=a}if(s){let a=this.clonePointerEvent(i,"click");a.target=s,a.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let o=r.clicksByButton[t.button];if(o.target===a.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=e,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(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);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 e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof Ir)){G("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let r=this.allocateEvent(xi);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){let e=this.allocateEvent(Ir);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(xi);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof xi&&e instanceof xi&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Rn&&e instanceof Rn&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}}),Zc,Qc,Ds,tl,Jc=v(()=>{te(),Wv(),Vc(),$c(),Xc(),Zc=1,Qc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ds=class Tc{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Kc(null),rr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new xi(null),this._rootWheelEvent=new Ir(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Tc.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(e){let{canvas:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,Tc._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e=e||"default";let i=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(i=!1),this._currentCursor===e)return;this._currentCursor=e;let r=this.cursorStyles[e];if(r)switch(typeof r){case"string":i&&(this.domElement.style.cursor=r);break;case"function":r(e);break;case"object":i&&Object.assign(this.domElement.style,r);break}else i&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(e);this.autoPreventDefault&&i[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.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(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,rr.pointerMoved();let i=this._normalizeToPointerData(e);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(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=e.target;e.composedPath&&e.composedPath().length>0&&(i=e.composedPath()[0]);let r=i!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);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(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(e);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(e){if(!this.features.wheel)return;let i=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(i)}setTargetElement(e){this._removeEvents(),this.domElement=e,rr.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;rr.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.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 e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.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(e,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;e.x=(i-n.left)*(this.domElement.width/n.width)*s,e.y=(r-n.top)*(this.domElement.height/n.height)*s}_normalizeToPointerData(e){let i=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let r=0,n=e.changedTouches.length;r<n;r++){let s=e.changedTouches[r];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.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=e.type,i.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let r=e;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=Zc),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(e);return i}normalizeWheelEvent(e){let i=this._rootWheelEvent;return this._transferMouseData(i,e),i.deltaX=e.deltaX,i.deltaY=e.deltaY,i.deltaZ=e.deltaZ,i.deltaMode=e.deltaMode,this.mapPositionToPoint(i.screen,e.clientX,e.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.nativeEvent=e,i.type=e.type,i}_bootstrapEvent(e,i){return e.originalEvent=null,e.nativeEvent=i,e.pointerId=i.pointerId,e.width=i.width,e.height=i.height,e.isPrimary=i.isPrimary,e.pointerType=i.pointerType,e.pressure=i.pressure,e.tangentialPressure=i.tangentialPressure,e.tiltX=i.tiltX,e.tiltY=i.tiltY,e.twist=i.twist,this._transferMouseData(e,i),this.mapPositionToPoint(e.screen,i.clientX,i.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=i.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Qc[e.type]||e.type),e}_transferMouseData(e,i){e.isTrusted=i.isTrusted,e.srcElement=i.srcElement,e.timeStamp=performance.now(),e.type=i.type,e.altKey=i.altKey,e.button=i.button,e.buttons=i.buttons,e.client.x=i.clientX,e.client.y=i.clientY,e.ctrlKey=i.ctrlKey,e.metaKey=i.metaKey,e.movement.x=i.movementX,e.movement.y=i.movementY,e.page.x=i.pageX,e.page.y=i.pageY,e.relatedTarget=null,e.shiftKey=i.shiftKey}},Ds.extension={name:"events",type:[O.WebGLSystem,O.CanvasSystem,O.WebGPUSystem],priority:-1},Ds.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},tl=Ds}),ed,jv=v(()=>{Jc(),Oo(),ed={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(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??tl.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,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 e=="function"?void 0:e;t=r?`${t}capture`:t;let o=typeof e=="function"?e:e.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(t,o,a)}),s?l.once(t,o,a):l.on(t,o,a)},removeEventListener(t,e,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof e=="function"?void 0:e;t=r?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof Bs))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}}),Vv=v(()=>{te(),Ni(),Jc(),jv(),ge.add(tl),bt.mixin(ed)}),il,$v=v(()=>{"use strict";il=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(il||{})}),td,Xv=v(()=>{"use strict";td={createCanvas:(t,e)=>{let i=document.createElement("canvas");return i.width=t,i.height=e,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}}),rl,ft,Ot=v(()=>{Xv(),rl=td,ft={get(){return rl},set(t){rl=t}}});function Mi(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function kn(t){return t.split("?")[0].split("#")[0]}function Yv(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qv(t,e,i){return t.replace(new RegExp(Yv(e),"g"),i)}function Kv(t,e){let i="",r=0,n=-1,s=0,a=-1;for(let o=0;o<=t.length;++o){if(o<t.length)a=t.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}}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${t.slice(n+1,o)}`:i=t.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return i}var rn,id=v(()=>{Ot(),rn={toPosix(t){return qv(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Mi(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if(Mi(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let r=kn(this.toPosix(e??ft.get().getBaseUrl())),n=kn(this.toPosix(i??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?rn.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Mi(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",i=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let r=t.endsWith("/");return t=Kv(t,!1),t.length>0&&r&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return Mi(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let i=0;i<t.length;++i){let r=t[i];if(Mi(r),r.length>0)if(e===void 0)e=r;else{let n=t[i-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(Mi(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),i=e===47,r=-1,n=!0,s=this.getProtocol(t),a=t;t=t.slice(s.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":this.isUrl(a)?s+t:s:i&&r===1?"//":s+t.slice(0,r)},rootname(t){Mi(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let i=t.indexOf("/",e.length);i!==-1?e=t.slice(0,i):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Mi(t),e&&Mi(e),t=kn(this.toPosix(t));let i=0,r=-1,n=!0,s;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){let l=t.charCodeAt(s);if(l===47){if(!n){i=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return i===r?r=o:r===-1&&(r=t.length),t.slice(i,r)}for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":t.slice(i,r)},extname(t){Mi(t),t=kn(this.toPosix(t));let e=-1,i=0,r=-1,n=!0,s=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(o===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),o===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||r===-1||s===0||s===1&&e===r-1&&e===i+1?"":t.slice(e,r)},parse(t){Mi(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=kn(this.toPosix(t));let i=t.charCodeAt(0),r=this.isAbsolute(t),n,s="";e.root=this.rootname(t),r||this.hasProtocol(t)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=t.length-1,d=0;for(;u>=n;--u){if(i=t.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?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(o,l)):(o===0&&r?(e.name=t.slice(1,a),e.base=t.slice(1,l)):(e.name=t.slice(o,a),e.base=t.slice(o,l)),e.ext=t.slice(a,l)),e.dir=this.dirname(t),s&&(e.dir=s+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Gr,rd=v(()=>{"use strict";Gr=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||i?e(r):r):t)});function nd(t,e,i,r,n){let s=e[i];for(let a=0;a<s.length;a++){let o=s[a];i<e.length-1?nd(t.replace(r[i],o),e,i+1,r,n):n.push(t.replace(r[i],o))}}function Zv(t){let e=/\{(.*?)\}/g,i=t.match(e),r=[];if(i){let n=[];i.forEach(s=>{let a=s.substring(1,s.length-1).split(",");n.push(a)}),nd(t,n,0,i,r)}else r.push(t);return r}var Qv=v(()=>{"use strict"}),nl,Jv=v(()=>{"use strict";nl=t=>!Array.isArray(t)});function ey(t){return t.split(".").pop().split("?").shift().split("#").shift()}var sl,ty=v(()=>{B(),id(),rd(),Qv(),Jv(),sl=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${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(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}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(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Gr(e||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(n=>n?.src??n):r?.src?r.src:r,!0)}addManifest(t){this._manifest&&G("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],r=e;Array.isArray(e)||(r=Object.entries(e).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(t,a);i.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));i.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=r=>{this.hasKey(r)&&G(`[Resolver] already has key: ${r} overwriting`)},Gr(e).forEach(r=>{let{src:n}=r,{data:s,format:a,loadParser:o}=r,l=Gr(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 g={};if(typeof p!="object"){g.src=p;for(let b=0;b<this._parsers.length;b++){let x=this._parsers[b];if(x.test(p)){g=x.parse(p);break}}}else s=p.data??s,a=p.format??a,o=p.loadParser??o,g={...g,...p};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:h,data:s,format:a,loadParser:o}),u.push(g)})}),h.forEach(d=>{this._assetMap[d]=u})})}resolveBundle(t){let e=nl(t);t=Gr(t);let i={};return t.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}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let r in e)i[r]=e[r].src;return i}return e.src}resolve(t){let e=nl(t);t=Gr(t);let i={};return t.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]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let i=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:r,loadParser:n,format:s}=e;return(this._basePath||this._rootPath)&&(t.src=rn.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=s??t.format??ey(t.src),t}},sl.RETINA_PREFIX=/@([0-9\.]+)x/}),al,iy=v(()=>{"use strict";al=(t,e)=>{let i=e.split("?")[1];return i&&(t+=`?${i}`),t}});function ry(){for(let t=0;t<16;t++){let e=[];Us.push(e);for(let i=0;i<16;i++){let r=Bn(_r[t]*_r[i]+yr[t]*vr[i]),n=Bn(vr[t]*_r[i]+xr[t]*vr[i]),s=Bn(_r[t]*yr[i]+yr[t]*xr[i]),a=Bn(vr[t]*yr[i]+xr[t]*xr[i]);for(let o=0;o<16;o++)if(_r[o]===r&&vr[o]===n&&yr[o]===s&&xr[o]===a){e.push(o);break}}}for(let t=0;t<16;t++){let e=new Ae;e.set(_r[t],vr[t],yr[t],xr[t],0,0),ol.push(e)}}var _r,vr,yr,xr,Us,ol,Bn,vt,ny=v(()=>{Xe(),_r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],vr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],yr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],xr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Us=[],ol=[],Bn=Math.sign,ry(),vt={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:t=>_r[t],uY:t=>vr[t],vX:t=>yr[t],vY:t=>xr[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Us[t][e],sub:(t,e)=>Us[t][vt.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?vt.S:vt.N:Math.abs(e)*2<=Math.abs(t)?t>0?vt.E:vt.W:e>0?t>0?vt.SE:vt.SW:t>0?vt.NE:vt.NW,matrixAppendRotationInv:(t,e,i=0,r=0)=>{let n=ol[vt.inv(e)];n.tx=i,n.ty=r,t.append(n)}}}),ll,sy=v(()=>{"use strict";ll=()=>{}});function nn(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function sd(t){return!(t&t-1)&&!!t}var Ls=v(()=>{"use strict"});function ay(t){let e={};for(let i in t)t[i]!==void 0&&(e[i]=t[i]);return e}var oy=v(()=>{"use strict"});function ly(t){let e=hl[t];return e===void 0&&(hl[t]=ht("resource")),e}var hl,ul,ad,hy=v(()=>{gt(),yt(),_t(),hl=Object.create(null),ul=class nv extends qe{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...nv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){We(je,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,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 e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ly(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},ul.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},ad=ul}),cl,Ft,di=v(()=>{gt(),Ls(),oy(),yt(),hy(),cl=class sv extends qe{constructor(e={}){super(),this.options=e,this.uid=ht("textureSource"),this._resourceType="textureSource",this._resourceId=ht("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,e={...sv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.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=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new ad(ay(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))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=ht("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,i,r){r=r||this._resolution,e=e||this.width,i=i||this.height;let n=Math.round(e*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=ht("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=sd(this.pixelWidth)&&sd(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}},cl.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Ft=cl}),Ns,od=v(()=>{te(),di(),Ns=class extends Ft{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}},Ns.extension=O.TextureSource}),dl,fl,ld=v(()=>{Xe(),dl=new Ae,fl=class{constructor(t,e){this.mapCoord=new Ae,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let r=0;r<t.length;r+=2){let n=t[r],s=t[r+1];e[r]=n*i.a+s*i.c+i.tx,e[r+1]=n*i.b+s*i.d+i.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let i=t.orig,r=t.trim;r&&(dl.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(dl));let n=t.source,s=this.uClampFrame,a=this.clampMargin/n._resolution,o=this.clampOffset/n._resolution;return s[0]=(t.frame.x+a+o)/n.width,s[1]=(t.frame.y+a+o)/n.height,s[2]=(t.frame.x+t.frame.width-a+o)/n.width,s[3]=(t.frame.y+t.frame.height-a+o)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}}),ke,pt=v(()=>{gt(),ny(),c(),yt(),_t(),sy(),od(),di(),ld(),ke=class extends qe{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=ht("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new at,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Ft,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(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new fl(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:r}=this._source,n=e.x/i,s=e.y/r,a=e.width/i,o=e.height/r,l=this.rotate;if(l){let h=a/2,u=o/2,d=n+h,p=s+u;l=vt.add(l,vt.NW),t.x0=d+h*vt.uX(l),t.y0=p+u*vt.uY(l),l=vt.add(l,2),t.x1=d+h*vt.uX(l),t.y1=p+u*vt.uY(l),l=vt.add(l,2),t.x2=d+h*vt.uX(l),t.y2=p+u*vt.uY(l),l=vt.add(l,2),t.x3=d+h*vt.uX(l),t.y3=p+u*vt.uY(l)}else t.x0=n,t.y0=s,t.x1=n+a,t.y1=s,t.x2=n+a,t.y2=s+o,t.x3=n,t.y3=s+o}destroy(t=!1){this._source&&t&&(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 We(je,"Texture.baseTexture is now Texture.source"),this._source}},ke.EMPTY=new ke({label:"EMPTY",source:new Ft({label:"EMPTY"})}),ke.EMPTY.destroy=ll,ke.WHITE=new ke({source:new Ns({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),ke.WHITE.destroy=ll}),pl,gl,uy=v(()=>{c(),pt(),pl=class As{constructor(e,i){this.linkedSheets=[],this._texture=e instanceof ke?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=i;let r=parseFloat(i.meta.scale);r?(this.resolution=r,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=As.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let i=e,r=As.BATCH_SIZE;for(;i-e<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 at(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);s.rotated?o=new at(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 at(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 at(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 ke({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 e=this.data.animations||{};for(let i in e){this.animations[i]=[];for(let r=0;r<e[i].length;r++){let n=e[i][r];this.animations[i].push(this.textures[n])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*As.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*As.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}},pl.BATCH_SIZE=1e3,gl=pl});function hd(t,e,i){let r={};if(t.forEach(n=>{r[n]=e}),Object.keys(e.textures).forEach(n=>{r[n]=e.textures[n]}),!i){let n=rn.dirname(t[0]);e.linkedSheets.forEach((s,a)=>{let o=hd([`${n}/${e.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(r,o)})}return r}var ud,cd,cy=v(()=>{$v(),ty(),iy(),te(),pt(),id(),uy(),ud=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],cd={extension:O.Asset,cache:{test:t=>t instanceof gl,getCacheableAssets:(t,e)=>hd(t,e,!1)},resolver:{extension:{type:O.ResolveParser,name:"resolveSpritesheet"},test:t=>{let e=t.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&ud.includes(r)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(sl.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:O.LoadParser,priority:il.Normal,name:"spritesheetLoader"},async testParse(t,e){return rn.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,i){let{texture:r,imageFilename:n}=e?.data??{},s=rn.dirname(e.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(r instanceof ke)a=r;else{let h=al(s+(n??t.meta.image),e.src);a=(await i.load([h]))[h]}let o=new gl(a.source,t);await o.parse();let l=t?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let p=s+d;e.data?.ignoreMultiPack||(p=al(p,e.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(t,e,i){await i.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}}),ml=v(()=>{te(),cy(),ge.add(cd)});function Hs(t,e,i,r){let{width:n,height:s}=i.orig,a=i.trim;if(a){let o=a.width,l=a.height;t.minX=a.x-e._x*n-r,t.maxX=t.minX+o,t.minY=a.y-e._y*s-r,t.maxY=t.minY+l}else t.minX=-e._x*n-r,t.maxX=t.minX+n,t.minY=-e._y*s-r,t.maxY=t.minY+s}var _l=v(()=>{"use strict"}),zs,vl=v(()=>{y(),Ni(),zs=class extends bt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new m(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:r}=t;return i>=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}}),Ws,dd=v(()=>{Cr(),pt(),_l(),vl(),Ws=class Sc extends zs{constructor(e=ke.EMPTY){e instanceof ke&&(e={texture:e});let{texture:i=ke.EMPTY,anchor:r,roundPixels:n,width:s,height:a,...o}=e;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 Tt({_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(e,i=!1){return e instanceof ke?new Sc(e):new Sc(ke.from(e,i))}set texture(e){e||(e=ke.EMPTY);let i=this._texture;i!==e&&(i&&i.dynamic&&i.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,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(e){let i=this.sourceBounds;return e.x>=i.maxX&&e.x<=i.minX&&e.y>=i.maxY&&e.y<=i.minY}addBounds(e){let i=this._texture.trim?this.sourceBounds:this.bounds;e.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 e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}_updateBounds(){Hs(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){let e=this._anchor,i=this._texture,r=this._sourceBounds,{width:n,height:s}=i.orig;r.maxX=-e._x*n,r.minX=r.maxX+n,r.maxY=-e._y*s,r.minY=r.maxY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,i){typeof e=="object"?(i=e.height??e.width,e=e.width):i??(i=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),i!==void 0&&this._setHeight(i,this._texture.orig.height)}}});function fd(t,e,i){let r=pd;t.measurable=!0,R(t,i,r),e.addBoundsMask(r),t.measurable=!1}var pd,gd=v(()=>{y(),Q(),pd=new m});function md(t,e,i){let r=S.get();t.measurable=!0;let n=w.get().identity(),s=_d(t,i,n);X(t,r,s),t.measurable=!1,e.addBoundsMask(r),w.return(n),S.return(r)}function _d(t,e,i){return t?(t!==e&&(_d(t.parent,e,i),t.updateLocalTransform(),i.append(t.localTransform)),i):(G("Mask bounds, renderable is not inside the root container"),i)}var vd=v(()=>{ue(),P(),B()}),yl,dy=v(()=>{te(),dd(),gd(),vd(),yl=class{constructor(t){this.priority=0,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t 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(t,e){fd(this.mask,t,e)}addLocalBounds(t,e){md(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Ws}},yl.extension=O.MaskEffect}),xl,fy=v(()=>{te(),xl=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}},xl.extension=O.MaskEffect}),bl,py=v(()=>{te(),Ni(),gd(),vd(),bl=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){fd(this.mask,t,e)}addLocalBounds(t,e){md(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof bt}},bl.extension=O.MaskEffect}),nr,In=v(()=>{Ot(),te(),di(),nr=class extends Ft{constructor(t){t.resource||(t.resource=ft.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;let e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.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(t=this.width,e=this.height,i=this._resolution){let r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}},nr.extension=O.TextureSource}),Gn,wl=v(()=>{Ot(),te(),B(),di(),Gn=class extends Ft{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=ft.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,G("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}},Gn.extension=O.TextureSource});async function gy(){return Tl??(Tl=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=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(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Tl}var Tl,my=v(()=>{"use strict"}),On,yd,_y=v(()=>{te(),Fs(),my(),di(),On=class av extends Ft{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...av.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.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),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Ci.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,i=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(i.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await gy(),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`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.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 e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.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 e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ci.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||(Ci.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ci.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}},On.extension=O.TextureSource,On.defaultOptions={...Ft.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"},yd=On}),xd,Ht,js=v(()=>{B(),rd(),xd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||G(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Gr(t),r;for(let o=0;o<this.parsers.length;o++){let l=this.parsers[o];if(l.test(e)){r=l.getCacheableAssets(i,e);break}}let n=new Map(Object.entries(r||{}));r||i.forEach(o=>{n.set(o,e)});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]:e;this._cache.has(o)&&this._cache.get(o)!==l&&G("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(t){if(!this._cacheMap.has(t)){G(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}},Ht=new xd});function bd(t={}){let e=t&&t.resource,i=e?t.resource:t,r=e?t:{resource:t};for(let n=0;n<Vs.length;n++){let s=Vs[n];if(s.test(i))return new s(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function vy(t={},e=!1){let i=t&&t.resource,r=i?t.resource:t,n=i?t:{resource:t};if(!e&&Ht.has(r))return Ht.get(r);let s=new ke({source:bd(n)});return s.on("destroy",()=>{Ht.has(r)&&Ht.remove(r)}),e||Ht.set(r,s),s}function yy(t,e=!1){return typeof t=="string"?Ht.get(t):t instanceof Ft?new ke({source:t}):vy(t,e)}var Vs,wd=v(()=>{js(),te(),di(),pt(),Vs=[],ge.handleByList(O.TextureSource,Vs),ke.from=yy,Ft.from=bd}),Sl=v(()=>{te(),dy(),fy(),py(),od(),In(),wl(),_y(),wd(),ge.add(yl,xl,bl,yd,Gn,nr,Ns)}),zi,Or=v(()=>{"use strict";zi=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function Td(){return(!$s||$s?.isContextLost())&&($s=ft.get().createCanvas().getContext("webgl",{})),$s}var $s,Sd=v(()=>{Ot()});function xy(t){let e="";for(let i=0;i<t;++i)i>0&&(e+=`
|
|
else `),i<t-1&&(e+=`if(test == ${i}.0){}`);return e}function by(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let i=e.createShader(e.FRAGMENT_SHADER);try{for(;;){let r=Ed.replace(/%forloop%/gi,xy(t));if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(i)}return t}var Ed,wy=v(()=>{"use strict";Ed=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
`)});function sn(){if(Fr)return Fr;let t=Td();return Fr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Fr=by(Fr,t),t.getExtension("WEBGL_lose_context")?.loseContext(),Fr}var Fr,an=v(()=>{Sd(),wy(),Fr=null});function El(t,e){let i=2166136261;for(let r=0;r<e;r++)i^=t[r].uid,i=Math.imul(i,16777619),i>>>=0;return Al[i]||Ty(t,e,i)}function Ty(t,e,i){let r={},n=0;Xs||(Xs=sn());for(let a=0;a<Xs;a++){let o=a<e?t[a]:ke.EMPTY.source;r[n++]=o.source,r[n++]=o.style}let s=new zi(r);return Al[i]=s,s}var Al,Xs,Cl=v(()=>{Or(),pt(),an(),Al={},Xs=0}),Ml,Sy=v(()=>{"use strict";Ml=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),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(t){return this[`${t}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(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Pl(t,e){let i=t.byteLength/8|0,r=new Float64Array(t,0,i);new Float64Array(e,0,i).set(r);let n=t.byteLength-i*8;if(n>0){let s=new Uint8Array(t,i*8,n);new Uint8Array(e,i*8,n).set(s)}}var Ad=v(()=>{"use strict"}),Cd,Dt,on=v(()=>{"use strict";Cd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Dt=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",t[t.NONE=4]="NONE",t))(Dt||{})});function Ys(t,e){return e.alphaMode==="no-premultiply-alpha"&&Cd[t]||t}var Rl=v(()=>{on()}),Md,Ey=v(()=>{"use strict";Md=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function Pd(){return qs>0?kl[--qs]:new kd}function Rd(t){kl[qs++]=t}var kd,kl,qs,ln,Bl,Bd,Ay=v(()=>{yt(),Sy(),Ad(),Rl(),an(),Ey(),kd=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Md,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},kl=[],qs=0,ln=0,Bl=class Io{constructor(e={}){this.uid=ht("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Io.defaultOptions.maxTextures=Io.defaultOptions.maxTextures??sn(),e={...Io.defaultOptions,...e};let{maxTextures:i,attributesInitialSize:r,indicesInitialSize:n}=e;this.attributeBuffer=new Ml(r*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)Rd(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,i){let r=e._batch.textures.ids[i._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=i,!0)}updateElement(e){this.dirty=!0;let i=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,i.float32View,i.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,i.float32View,i.uint32View,e._attributeStart,e._textureId)}break(e){let i=this._elements;if(!i[this.elementStart])return;let r=Pd(),n=r.textures;n.clear();let s=i[this.elementStart],a=Ys(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",g=this.maxTextures;for(let b=this.elementStart;b<this.elementSize;++b){let x=i[b];i[b]=null;let _=x.texture._source,T=Ys(x.blendMode,_),C=a!==T;if(_._batchTick===ln&&!C){x._textureId=_._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,o,l,x._attributeStart,x._textureId),this.packQuadIndex(h,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,o,l,x._attributeStart,x._textureId),this.packIndex(x,h,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}_._batchTick=ln,(n.count>=g||C)&&(this._finishBatch(r,d,u-d,n,a,e,p),p="renderBatch",d=u,a=T,r=Pd(),n=r.textures,n.clear(),++ln),x._textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,o,l,x._attributeStart,x._textureId),this.packQuadIndex(h,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,o,l,x._attributeStart,x._textureId),this.packIndex(x,h,x._indexStart,x._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(r,d,u-d,n,a,e,p),d=u,++ln),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(e,i,r,n,s,a,o){e.gpuBindGroup=null,e.bindGroup=null,e.action=o,e.batcher=this,e.textures=n,e.blendMode=s,e.start=i,e.size=r,++ln,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let i=Math.max(e,this.attributeBuffer.size*2),r=new Ml(i);Pl(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){let i=this.indexBuffer,r=Math.max(e,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 Pl(i.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(e,i,r){e[i]=r+0,e[i+1]=r+1,e[i+2]=r+2,e[i+3]=r+0,e[i+4]=r+2,e[i+5]=r+3}packIndex(e,i,r,n){let s=e.indices,a=e.indexSize,o=e.indexOffset,l=e.attributeOffset;for(let h=0;h<a;h++)i[r++]=n+s[h+o]-l}destroy(){for(let e=0;e<this.batches.length;e++)Rd(this.batches[e]);this.batches=null;for(let e=0;e<this._elements.length;e++)this._elements[e]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}},Bl.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6},Bd=Bl}),et,Dr=v(()=>{"use strict";et=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(et||{})}),bi,hn=v(()=>{gt(),yt(),Dr(),bi=class extends qe{constructor(t){let{data:e,size:i}=t,{usage:r,label:n,shrinkToFit:s}=t;super(),this.uid=ht("buffer"),this._resourceType="buffer",this._resourceId=ht("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i??e?.byteLength;let a=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&et.STATIC)}set static(t){t?this.descriptor.usage|=et.STATIC:this.descriptor.usage&=~et.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let r=this._data;if(this._data=t,r.length!==t.length){!this.shrinkToFit&&t.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ht("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??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 Id(t,e){if(!(t instanceof bi)){let i=e?et.INDEX:et.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),i=et.INDEX|et.COPY_DST):(t=new Float32Array(t),i=et.VERTEX|et.COPY_DST)),t=new bi({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:i})}return t}var Cy=v(()=>{hn(),Dr()});function My(t,e,i){let r=t.getAttribute(e);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 g=n[p],b=n[p+1];g>o&&(o=g),b>l&&(l=b),g<s&&(s=g),b<a&&(a=b)}return i.minX=s,i.minY=a,i.maxX=o,i.maxY=l,i}var Py=v(()=>{"use strict"});function Ry(t){return(t instanceof bi||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Id(t.buffer,!1),t}var Fn,Ks=v(()=>{gt(),y(),yt(),hn(),Cy(),Py(),Fn=class extends qe{constructor(t){let{attributes:e,indexBuffer:i,topology:r}=t;super(),this.uid=ht("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new m,this._boundsDirty=!0,this.attributes=e,this.buffers=[],this.instanceCount=t.instanceCount||1;for(let n in e){let s=e[n]=Ry(e[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=Id(i,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,My(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Gd,Od,Fd,ky=v(()=>{hn(),Dr(),Ks(),Gd=new Float32Array(1),Od=new Uint32Array(1),Fd=class extends Fn{constructor(){let t=new bi({data:Gd,label:"attribute-batch-buffer",usage:et.VERTEX|et.COPY_DST,shrinkToFit:!1}),e=new bi({data:Od,label:"index-batch-buffer",usage:et.INDEX|et.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:e})}}});function Dn(t,e){let i=Il[t];return i===void 0&&(Zs[e]===void 0&&(Zs[e]=1),Il[t]=i=Zs[e]++),i}var Zs,Il,Qs=v(()=>{"use strict";Zs=Object.create(null),Il=Object.create(null)});function By(){if(!Js){Js="mediump";let t=Td();t&&t.getShaderPrecisionFormat&&(Js=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Js}var Js,Iy=v(()=>{Sd()});function Gy(t,e,i){return e?t:i?(t=t.replace("out vec4 finalColor;",""),`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in varying
|
|
#define finalColor gl_FragColor
|
|
#define texture texture2D
|
|
#endif
|
|
${t}
|
|
`):`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in attribute
|
|
#define out varying
|
|
#endif
|
|
${t}
|
|
`}var Oy=v(()=>{"use strict"});function Fy(t,e,i){let r=i?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let n=i?e.requestedFragmentPrecision:e.requestedVertexPrecision;return n==="highp"&&r!=="highp"&&(n="mediump"),`precision ${n} float;
|
|
${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var Dy=v(()=>{"use strict"});function Uy(t,e){return e?`#version 300 es
|
|
${t}`:t}var Ly=v(()=>{"use strict"});function Ny(t,{name:e="pixi-program"},i=!0){e=e.replace(/\s+/g,"-"),e+=i?"-fragment":"-vertex";let r=i?Dd:Ud;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
|
|
${t}`}var Dd,Ud,Hy=v(()=>{"use strict";Dd={},Ud={}});function zy(t,e){return e?t.replace("#version 300 es",""):t}var Wy=v(()=>{"use strict"}),ea,ta,Gl,un,Un=v(()=>{Qs(),Iy(),Oy(),Dy(),Ly(),Hy(),Wy(),ea={stripVersion:zy,ensurePrecision:Fy,addProgramDefines:Gy,setProgramName:Ny,insertVersion:Uy},ta=Object.create(null),Gl=class Ec{constructor(e){e={...Ec.defaultOptions,...e};let i=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:By()},setProgramName:{name:e.name},addProgramDefines:i,insertVersion:i},n=e.fragment,s=e.vertex;Object.keys(ea).forEach(a=>{let o=r[a];n=ea[a](n,o,!0),s=ea[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(e){let i=`${e.vertex}:${e.fragment}`;return ta[i]||(ta[i]=new Ec(e)),ta[i]}},Gl.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},un=Gl});function Ln(t){return Ol[t]??Ol.float32}var Ol,ia=v(()=>{"use strict";Ol={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 jy({source:t,entryPoint:e}){let i={},r=t.indexOf(`fn ${e}`);if(r!==-1){let n=t.indexOf("->",r);if(n!==-1){let s=t.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=Ld[o[3]]??"float32";i[o[2]]={location:parseInt(o[1],10),format:l,stride:Ln(l).stride,offset:0,instance:!1,start:0}}}}return i}var Ld,Vy=v(()=>{ia(),Ld={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 Fl(t){let e=/(^|[^/])@(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=t.match(e)?.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=t.match(a)?.map(d=>{let p=d.match(l)[1],g=d.match(o).reduce((b,x)=>{let[_,T]=x.split(":");return b[_.trim()]=T.trim(),b},{});return g?{name:p,members:g}:null}).filter(({name:d})=>h.some(p=>p.type===d))??[];return{groups:h,structs:u}}var $y=v(()=>{"use strict"}),cn,Xy=v(()=>{"use strict";cn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(cn||{})});function Yy({groups:t}){let e=[];for(let i=0;i<t.length;i++){let r=t[i];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:cn.VERTEX|cn.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:cn.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&e[r.group].push({binding:r.binding,visibility:cn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return e}var qy=v(()=>{Xy()});function Ky({groups:t}){let e=[];for(let i=0;i<t.length;i++){let r=t[i];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}var Zy=v(()=>{"use strict"});function Qy(t,e){let i=new Set,r=new Set,n=[...t.structs,...e.structs].filter(a=>i.has(a.name)?!1:(i.add(a.name),!0)),s=[...t.groups,...e.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:s}}var Jy=v(()=>{"use strict"}),ra,Nn,na=v(()=>{Qs(),Vy(),$y(),qy(),Zy(),Jy(),ra=Object.create(null),Nn=class ov{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:i,vertex:r,layout:n,gpuLayout:s,name:a}=e;if(this.name=a,this.fragment=i,this.vertex=r,i.source===r.source){let o=Fl(i.source);this.structsAndGroups=o}else{let o=Fl(r.source),l=Fl(i.source);this.structsAndGroups=Qy(o,l)}this.layout=n??Ky(this.structsAndGroups),this.gpuLayout=s??Yy(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:e,fragment:i}=this,r=e.source+i.source+e.entryPoint+i.entryPoint;this._layoutKey=Dn(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=jy(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(e){let i=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return ra[i]||(ra[i]=new ov(e)),ra[i]}}});function Nd(t,e,i){if(t)for(let r in t){let n=r.toLocaleLowerCase(),s=e[n];if(s){let a=t[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&s.push(`//----${i}----//`),s.push(a)}else G(`${r} placement hook does not exist in shader`)}}var ex=v(()=>{B()});function Hd(t){let e={};return(t.match(zd)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{e[i]=[]}),e}var zd,tx=v(()=>{"use strict";zd=/\{\{(.*?)\}\}/g});function Wd(t,e){let i,r=/@in\s+([^;]+);/g;for(;(i=r.exec(t))!==null;)e.push(i[1])}function jd(t,e,i=!1){let r=[];Wd(e,r),t.forEach(o=>{o.header&&Wd(o.header,r)});let n=r;i&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
|
|
`),a=e.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
|
|
${s}
|
|
`),a}var ix=v(()=>{"use strict"});function Vd(t,e){let i,r=/@out\s+([^;]+);/g;for(;(i=r.exec(t))!==null;)e.push(i[1])}function rx(t){let e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}function nx(t){let e=/@.*?\s+/g;return t.replace(e,"")}function sx(t,e){let i=[];Vd(e,i),t.forEach(l=>{l.header&&Vd(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 ${nx(l)};`).join(`
|
|
`),a=`return VSOutput(
|
|
${i.sort().map(l=>` ${rx(l)}`).join(`,
|
|
`)});`,o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
${n}
|
|
`),o=o.replace("{{start}}",`
|
|
${s}
|
|
`),o=o.replace("{{return}}",`
|
|
${a}
|
|
`),o}var ax=v(()=>{"use strict"});function $d(t,e){let i=t;for(let r in e){let n=e[r];n.join(`
|
|
`).length?i=i.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
${n.join(`
|
|
`)}
|
|
//----${r} FINISH----//`):i=i.replace(`{{${r}}}`,"")}return i}var ox=v(()=>{"use strict"});function lx({template:t,bits:e}){let i=Xd(t,e);if(br[i])return br[i];let{vertex:r,fragment:n}=ux(t,e);return br[i]=Yd(r,n,e),br[i]}function hx({template:t,bits:e}){let i=Xd(t,e);return br[i]||(br[i]=Yd(t.vertex,t.fragment,e)),br[i]}function ux(t,e){let i=e.map(a=>a.vertex).filter(a=>!!a),r=e.map(a=>a.fragment).filter(a=>!!a),n=jd(i,t.vertex,!0);n=sx(i,n);let s=jd(r,t.fragment,!0);return{vertex:n,fragment:s}}function Xd(t,e){return e.map(i=>(sa.has(i)||sa.set(i,qd++),sa.get(i))).sort((i,r)=>i-r).join("-")+t.vertex+t.fragment}function Yd(t,e,i){let r=Hd(t),n=Hd(e);return i.forEach(s=>{Nd(s.vertex,r,s.name),Nd(s.fragment,n,s.name)}),{vertex:$d(t,r),fragment:$d(e,n)}}var br,sa,qd,cx=v(()=>{ex(),tx(),ix(),ax(),ox(),br=Object.create(null),sa=new Map,qd=0}),Kd,Zd,Qd,Jd,dx=v(()=>{"use strict";Kd=`
|
|
@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}}
|
|
};
|
|
`,Zd=`
|
|
@in vUV : vec2<f32>;
|
|
@in vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
@fragment
|
|
fn main(
|
|
{{in}}
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
{{start}}
|
|
|
|
var outColor:vec4<f32>;
|
|
|
|
{{main}}
|
|
|
|
var finalColor:vec4<f32> = outColor * vColor;
|
|
|
|
{{end}}
|
|
|
|
return finalColor;
|
|
};
|
|
`,Qd=`
|
|
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}}
|
|
}
|
|
`,Jd=`
|
|
|
|
in vec4 vColor;
|
|
in vec2 vUV;
|
|
|
|
out vec4 finalColor;
|
|
|
|
{{header}}
|
|
|
|
void main(void) {
|
|
|
|
{{start}}
|
|
|
|
vec4 outColor;
|
|
|
|
{{main}}
|
|
|
|
finalColor = outColor * vColor;
|
|
|
|
{{end}}
|
|
}
|
|
`}),ef,tf,fx=v(()=>{"use strict";ef={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;
|
|
`}},tf={name:"global-uniforms-bit",vertex:{header:`
|
|
uniform mat3 uProjectionMatrix;
|
|
uniform mat3 uWorldTransformMatrix;
|
|
uniform vec4 uWorldColorAlpha;
|
|
uniform vec2 uResolution;
|
|
`}}});function Hn({bits:t,name:e}){let i=lx({template:{fragment:Zd,vertex:Kd},bits:[ef,...t]});return Nn.from({name:e,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function zn({bits:t,name:e}){return new un({name:e,...hx({template:{vertex:Qd,fragment:Jd},bits:[tf,...t]})})}var Ur=v(()=>{Un(),na(),cx(),dx(),fx()}),aa,oa,la=v(()=>{"use strict";aa={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 px(t){let e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${i++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${i++}) var textureSampler${r+1}: sampler;`)}return e.join(`
|
|
`)}function gx(t){let e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let i=0;i<t;i++)i===t-1?e.push(" default:{"):e.push(` case ${i}:{`),e.push(` outColor = textureSampleGrad(textureSource${i+1}, textureSampler${i+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
|
|
`)}function Dl(t){return ha[t]||(ha[t]={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;
|
|
|
|
${px(t)}
|
|
`,main:`
|
|
var uvDx = dpdx(vUV);
|
|
var uvDy = dpdy(vUV);
|
|
|
|
${gx(t)}
|
|
`}}),ha[t]}function mx(t){let e=[];for(let i=0;i<t;i++)i>0&&e.push("else"),i<t-1&&e.push(`if(vTextureId < ${i}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${i}], vUV);`),e.push("}");return e.join(`
|
|
`)}function Ul(t){return ua[t]||(ua[t]={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[${t}];
|
|
|
|
`,main:`
|
|
|
|
${mx(t)}
|
|
`}}),ua[t]}var ha,ua,ca=v(()=>{"use strict";ha={},ua={}}),dn,fn,Lr=v(()=>{"use strict";dn={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;
|
|
}
|
|
`}},fn={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;
|
|
}
|
|
`}}}),Ll,rf,_x=v(()=>{"use strict";Ll=["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>"],rf=Ll.reduce((t,e)=>(t[e]=!0,t),{})});function vx(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);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 yx=v(()=>{"use strict"}),Nl,ti,fi=v(()=>{yt(),Qs(),_x(),yx(),Nl=class lv{constructor(e,i){this._touched=0,this.uid=ht("uniform"),this._resourceType="uniformGroup",this._resourceId=ht("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...lv.defaultOptions,...i},this.uniformStructures=e;let r={};for(let n in e){let s=e[n];if(s.name=n,s.size=s.size??1,!rf[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ll.join(", ")}`);s.value??(s.value=vx(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}-${e[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Nl.defaultOptions={ubo:!1,isStatic:!1},ti=Nl});function Hl(t){let e=zl[t];if(e)return e;let i=new Int32Array(t);for(let r=0;r<t;r++)i[r]=r;return e=zl[t]=new ti({uTextures:{value:i,type:"i32",size:t}},{isStatic:!0}),e}var zl,Wl=v(()=>{fi(),zl={}}),wi,sr=v(()=>{"use strict";wi=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(wi||{})}),Wi,ar=v(()=>{gt(),Un(),Or(),na(),sr(),fi(),Wi=class hv extends qe{constructor(e){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:i,glProgram:r,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=e;this.gpuProgram=i,this.glProgram=r,a===void 0&&(a=0,i&&(a|=wi.WEBGPU),r&&(a|=wi.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 zi,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 g=l[d];g&&(n[g.group]||(n[g.group]=new zi,this._ownedBindGroups.push(n[g.group])),n[g.group].setResource(p,g.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,i,r){var n,s;(n=this._uniformBindMap)[i]||(n[i]={}),(s=this._uniformBindMap[i])[r]||(s[r]=e),this.groups[i]||(this.groups[i]=new zi,this._ownedBindGroups.push(this.groups[i]))}_buildResourceAccessor(e,i){let r={};for(let n in i){let s=i[n];Object.defineProperty(r,s.name,{get(){return e[s.group].getResource(s.binding)},set(a){e[s.group].setResource(a,s.binding)}})}return r}destroy(e=!1){this.emit("destroy",this),e&&(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(e){let{gpu:i,gl:r,...n}=e,s,a;return i&&(s=Nn.from(i)),r&&(a=un.from(r)),new hv({gpuProgram:s,glProgram:a,...n})}}}),nf,xx=v(()=>{Ur(),la(),ca(),Lr(),Wl(),ar(),nf=class extends Wi{constructor(t){let e=zn({name:"batch",bits:[oa,Ul(t),fn]}),i=Hn({name:"batch",bits:[aa,Dl(t),dn]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Hl(t)}})}}}),jl,Vl,da,sf=v(()=>{te(),Ay(),ky(),xx(),jl=null,Vl=class uv extends Bd{constructor(){super(...arguments),this.geometry=new Fd,this.shader=jl||(jl=new nf(this.maxTextures)),this.name=uv.extension.name,this.vertexSize=6}packAttributes(e,i,r,n,s){let a=s<<16|e.roundPixels&65535,o=e.transform,l=o.a,h=o.b,u=o.c,d=o.d,p=o.tx,g=o.ty,{positions:b,uvs:x}=e,_=e.color,T=e.attributeOffset,C=T+e.attributeSize;for(let F=T;F<C;F++){let k=F*2,N=b[k],re=b[k+1];i[n++]=l*N+u*re+p,i[n++]=d*re+h*N+g,i[n++]=x[k],i[n++]=x[k+1],r[n++]=_,r[n++]=a}}packQuadAttributes(e,i,r,n,s){let a=e.texture,o=e.transform,l=o.a,h=o.b,u=o.c,d=o.d,p=o.tx,g=o.ty,b=e.bounds,x=b.maxX,_=b.minX,T=b.maxY,C=b.minY,F=a.uvs,k=e.color,N=s<<16|e.roundPixels&65535;i[n+0]=l*_+u*C+p,i[n+1]=d*C+h*_+g,i[n+2]=F.x0,i[n+3]=F.y0,r[n+4]=k,r[n+5]=N,i[n+6]=l*x+u*C+p,i[n+7]=d*C+h*x+g,i[n+8]=F.x1,i[n+9]=F.y1,r[n+10]=k,r[n+11]=N,i[n+12]=l*x+u*T+p,i[n+13]=d*T+h*x+g,i[n+14]=F.x2,i[n+15]=F.y2,r[n+16]=k,r[n+17]=N,i[n+18]=l*_+u*T+p,i[n+19]=d*T+h*_+g,i[n+20]=F.x3,i[n+21]=F.y3,r[n+22]=k,r[n+23]=N}},Vl.extension={type:[O.Batcher],name:"default"},da=Vl});function bx(t,e,i,r,n,s,a,o=null){let l=0;i*=e,n*=s;let h=o.a,u=o.b,d=o.c,p=o.d,g=o.tx,b=o.ty;for(;l<a;){let x=t[i],_=t[i+1];r[n]=h*x+d*_+g,r[n+1]=u*x+p*_+b,n+=s,i+=e,l++}}function wx(t,e,i,r){let n=0;for(e*=i;n<r;)t[e]=0,t[e+1]=0,e+=i,n++}var Tx=v(()=>{"use strict"});function af(t,e,i,r,n){let s=e.a,a=e.b,o=e.c,l=e.d,h=e.tx,u=e.ty;i=i||0,r=r||2,n=n||t.length/r-i;let d=i*r;for(let p=0;p<n;p++){let g=t[d],b=t[d+1];t[d]=s*g+o*b+h,t[d+1]=a*g+l*b+u,d+=r}}var Sx=v(()=>{"use strict"});function Ex(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let i=t>>16&255,r=t>>8&255,n=t&255,s=e>>16&255,a=e>>8&255,o=e&255,l=i*s/255,h=r*a/255,u=n*o/255;return(l<<16)+(h<<8)+u}var Ax=v(()=>{"use strict"}),of,fa,lf=v(()=>{Xe(),Ax(),of=new Ae,fa=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Ex(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||of}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0,this.renderable=null}}}),pn,hf,uf,Cx=v(()=>{te(),pn={extension:{type:O.ShapeBuilder,name:"circle"},build(t,e){let i,r,n,s,a,o;if(t.type==="circle"){let k=t;i=k.x,r=k.y,a=o=k.radius,n=s=0}else if(t.type==="ellipse"){let k=t;i=k.x,r=k.y,a=k.halfWidth,o=k.halfHeight,n=s=0}else{let k=t,N=k.width/2,re=k.height/2;i=k.x+N,r=k.y+re,a=o=Math.max(0,Math.min(k.radius,Math.min(N,re))),n=N-a,s=re-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return e;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return e;if(l===0)return e[0]=e[6]=i+n,e[1]=e[3]=r+s,e[2]=e[4]=i-n,e[5]=e[7]=r-s,e;let u=0,d=l*4+(n?2:0)+2,p=d,g=h,b=n+a,x=s,_=i+b,T=i-b,C=r+x;if(e[u++]=_,e[u++]=C,e[--d]=C,e[--d]=T,s){let k=r-x;e[p++]=T,e[p++]=k,e[--g]=k,e[--g]=_}for(let k=1;k<l;k++){let N=Math.PI/2*(k/l),re=n+Math.cos(N)*a,ne=s+Math.sin(N)*o,J=i+re,$=i-re,ie=r+ne,Se=r-ne;e[u++]=J,e[u++]=ie,e[--d]=ie,e[--d]=$,e[p++]=$,e[p++]=Se,e[--g]=Se,e[--g]=J}b=n,x=s+o,_=i+b,T=i-b,C=r+x;let F=r-x;return e[u++]=_,e[u++]=C,e[--g]=F,e[--g]=_,n&&(e[u++]=T,e[u++]=C,e[--g]=F,e[--g]=T),e},triangulate(t,e,i,r,n,s){if(t.length===0)return;let a=0,o=0;for(let u=0;u<t.length;u+=2)a+=t[u],o+=t[u+1];a/=t.length/2,o/=t.length/2;let l=r;e[l*i]=a,e[l*i+1]=o;let h=l++;for(let u=0;u<t.length;u+=2)e[l*i]=t[u],e[l*i+1]=t[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}},hf={...pn,extension:{...pn.extension,name:"ellipse"}},uf={...pn,extension:{...pn.extension,name:"roundedRectangle"}}});function Mx(t){let e=t.length;if(e<6)return 1;let i=0;for(let r=0,n=t[e-2],s=t[e-1];r<e;r+=2){let a=t[r],o=t[r+1];i+=(a-n)*(o+s),n=a,s=o}return i<0?-1:1}var Px=v(()=>{"use strict"});function cf(t,e,i,r,n,s,a,o){let l=t-i*n,h=e-r*n,u=t+i*s,d=e+r*s,p,g;a?(p=r,g=-i):(p=-r,g=i);let b=l+p,x=h+g,_=u+p,T=d+g;return o.push(b,x),o.push(_,T),2}function Nr(t,e,i,r,n,s,a,o){let l=i-t,h=r-e,u=Math.atan2(l,h),d=Math.atan2(n-t,s-e);o&&u<d?u+=Math.PI*2:!o&&u>d&&(d+=Math.PI*2);let p=u,g=d-u,b=Math.abs(g),x=Math.sqrt(l*l+h*h),_=(15*b*Math.sqrt(x)/Math.PI>>0)+1,T=g/_;if(p+=T,o){a.push(t,e),a.push(i,r);for(let C=1,F=p;C<_;C++,F+=T)a.push(t,e),a.push(t+Math.sin(F)*x,e+Math.cos(F)*x);a.push(t,e),a.push(n,s)}else{a.push(i,r),a.push(t,e);for(let C=1,F=p;C<_;C++,F+=T)a.push(t+Math.sin(F)*x,e+Math.cos(F)*x),a.push(t,e);a.push(n,s),a.push(t,e)}return _*2}function Rx(t,e,i,r,n,s,a,o,l){let h=1e-4;if(t.length===0)return;let u=e,d=u.alignment;if(e.alignment!==.5){let L=Mx(t);i&&(L*=-1),d=(d-.5)*L+.5}let p=new De(t[0],t[1]),g=new De(t[t.length-2],t[t.length-1]),b=r,x=Math.abs(p.x-g.x)<h&&Math.abs(p.y-g.y)<h;if(b){t=t.slice(),x&&(t.pop(),t.pop(),g.set(t[t.length-2],t[t.length-1]));let L=(p.x+g.x)*.5,Z=(g.y+p.y)*.5;t.unshift(L,Z),t.push(L,Z)}let _=n,T=t.length/2,C=t.length,F=_.length/2,k=u.width/2,N=k*k,re=u.miterLimit*u.miterLimit,ne=t[0],J=t[1],$=t[2],ie=t[3],Se=0,Pe=0,ce=-(J-ie),D=ne-$,se=0,q=0,de=Math.sqrt(ce*ce+D*D);ce/=de,D/=de,ce*=k,D*=k;let A=d,M=(1-A)*2,E=A*2;b||(u.cap==="round"?C+=Nr(ne-ce*(M-E)*.5,J-D*(M-E)*.5,ne-ce*M,J-D*M,ne+ce*E,J+D*E,_,!0)+2:u.cap==="square"&&(C+=cf(ne,J,ce,D,M,E,!0,_))),_.push(ne-ce*M,J-D*M),_.push(ne+ce*E,J+D*E);for(let L=1;L<T-1;++L){ne=t[(L-1)*2],J=t[(L-1)*2+1],$=t[L*2],ie=t[L*2+1],Se=t[(L+1)*2],Pe=t[(L+1)*2+1],ce=-(J-ie),D=ne-$,de=Math.sqrt(ce*ce+D*D),ce/=de,D/=de,ce*=k,D*=k,se=-(ie-Pe),q=$-Se,de=Math.sqrt(se*se+q*q),se/=de,q/=de,se*=k,q*=k;let Z=$-ne,K=J-ie,ae=$-Se,be=Pe-ie,_e=Z*ae+K*be,Fe=K*ae-be*Z,Le=Fe<0;if(Math.abs(Fe)<.001*Math.abs(_e)){_.push($-ce*M,ie-D*M),_.push($+ce*E,ie+D*E),_e>=0&&(u.join==="round"?C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+4:C+=2,_.push($-se*E,ie-q*E),_.push($+se*M,ie+q*M));continue}let $e=(-ce+ne)*(-D+ie)-(-ce+$)*(-D+J),wt=(-se+Se)*(-q+ie)-(-se+$)*(-q+Pe),Ye=(Z*wt-ae*$e)/Fe,mi=(be*$e-K*wt)/Fe,Ii=(Ye-$)*(Ye-$)+(mi-ie)*(mi-ie),Y=$+(Ye-$)*M,oe=ie+(mi-ie)*M,he=$-(Ye-$)*E,me=ie-(mi-ie)*E,Et=Math.min(Z*Z+K*K,ae*ae+be*be),Ss=Le?M:E,wc=Et+Ss*Ss*N;Ii<=wc?u.join==="bevel"||Ii/N>re?(Le?(_.push(Y,oe),_.push($+ce*E,ie+D*E),_.push(Y,oe),_.push($+se*E,ie+q*E)):(_.push($-ce*M,ie-D*M),_.push(he,me),_.push($-se*M,ie-q*M),_.push(he,me)),C+=2):u.join==="round"?Le?(_.push(Y,oe),_.push($+ce*E,ie+D*E),C+=Nr($,ie,$+ce*E,ie+D*E,$+se*E,ie+q*E,_,!0)+4,_.push(Y,oe),_.push($+se*E,ie+q*E)):(_.push($-ce*M,ie-D*M),_.push(he,me),C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+4,_.push($-se*M,ie-q*M),_.push(he,me)):(_.push(Y,oe),_.push(he,me)):(_.push($-ce*M,ie-D*M),_.push($+ce*E,ie+D*E),u.join==="round"?Le?C+=Nr($,ie,$+ce*E,ie+D*E,$+se*E,ie+q*E,_,!0)+2:C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+2:u.join==="miter"&&Ii/N<=re&&(Le?(_.push(he,me),_.push(he,me)):(_.push(Y,oe),_.push(Y,oe)),C+=2),_.push($-se*M,ie-q*M),_.push($+se*E,ie+q*E),C+=2)}ne=t[(T-2)*2],J=t[(T-2)*2+1],$=t[(T-1)*2],ie=t[(T-1)*2+1],ce=-(J-ie),D=ne-$,de=Math.sqrt(ce*ce+D*D),ce/=de,D/=de,ce*=k,D*=k,_.push($-ce*M,ie-D*M),_.push($+ce*E,ie+D*E),b||(u.cap==="round"?C+=Nr($-ce*(M-E)*.5,ie-D*(M-E)*.5,$-ce*M,ie-D*M,$+ce*E,ie+D*E,_,!1)+2:u.cap==="square"&&(C+=cf($,ie,ce,D,M,E,!1,_)));let z=1e-4*1e-4;for(let L=F;L<C+F-2;++L)ne=_[L*2],J=_[L*2+1],$=_[(L+1)*2],ie=_[(L+1)*2+1],Se=_[(L+2)*2],Pe=_[(L+2)*2+1],!(Math.abs(ne*(ie-Pe)+$*(Pe-J)+Se*(J-ie))<z)&&o.push(L,L+1,L+2)}var kx=v(()=>{jt(),Px()}),df=Ne((t,e)=>{"use strict";e.exports=i,e.exports.default=i;function i(A,M,E){E=E||2;var z=M&&M.length,L=z?M[0]*E:A.length,Z=r(A,0,L,E,!0),K=[];if(!Z||Z.next===Z.prev)return K;var ae,be,_e,Fe,Le,$e,wt;if(z&&(Z=u(A,M,Z,E)),A.length>80*E){ae=_e=A[0],be=Fe=A[1];for(var Ye=E;Ye<L;Ye+=E)Le=A[Ye],$e=A[Ye+1],Le<ae&&(ae=Le),$e<be&&(be=$e),Le>_e&&(_e=Le),$e>Fe&&(Fe=$e);wt=Math.max(_e-ae,Fe-be),wt=wt!==0?32767/wt:0}return s(Z,K,E,ae,be,wt,0),K}function r(A,M,E,z,L){var Z,K;if(L===de(A,M,E,z)>0)for(Z=M;Z<E;Z+=z)K=D(Z,A[Z],A[Z+1],K);else for(Z=E-z;Z>=M;Z-=z)K=D(Z,A[Z],A[Z+1],K);return K&&re(K,K.next)&&(se(K),K=K.next),K}function n(A,M){if(!A)return A;M||(M=A);var E=A,z;do if(z=!1,!E.steiner&&(re(E,E.next)||N(E.prev,E,E.next)===0)){if(se(E),E=M=E.prev,E===E.next)break;z=!0}else E=E.next;while(z||E!==M);return M}function s(A,M,E,z,L,Z,K){if(A){!K&&Z&&x(A,z,L,Z);for(var ae=A,be,_e;A.prev!==A.next;){if(be=A.prev,_e=A.next,Z?o(A,z,L,Z):a(A)){M.push(be.i/E|0),M.push(A.i/E|0),M.push(_e.i/E|0),se(A),A=_e.next,ae=_e.next;continue}if(A=_e,A===ae){K?K===1?(A=l(n(A),M,E),s(A,M,E,z,L,Z,2)):K===2&&h(A,M,E,z,L,Z):s(n(A),M,E,z,L,Z,1);break}}}}function a(A){var M=A.prev,E=A,z=A.next;if(N(M,E,z)>=0)return!1;for(var L=M.x,Z=E.x,K=z.x,ae=M.y,be=E.y,_e=z.y,Fe=L<Z?L<K?L:K:Z<K?Z:K,Le=ae<be?ae<_e?ae:_e:be<_e?be:_e,$e=L>Z?L>K?L:K:Z>K?Z:K,wt=ae>be?ae>_e?ae:_e:be>_e?be:_e,Ye=z.next;Ye!==M;){if(Ye.x>=Fe&&Ye.x<=$e&&Ye.y>=Le&&Ye.y<=wt&&F(L,ae,Z,be,K,_e,Ye.x,Ye.y)&&N(Ye.prev,Ye,Ye.next)>=0)return!1;Ye=Ye.next}return!0}function o(A,M,E,z){var L=A.prev,Z=A,K=A.next;if(N(L,Z,K)>=0)return!1;for(var ae=L.x,be=Z.x,_e=K.x,Fe=L.y,Le=Z.y,$e=K.y,wt=ae<be?ae<_e?ae:_e:be<_e?be:_e,Ye=Fe<Le?Fe<$e?Fe:$e:Le<$e?Le:$e,mi=ae>be?ae>_e?ae:_e:be>_e?be:_e,Ii=Fe>Le?Fe>$e?Fe:$e:Le>$e?Le:$e,Y=T(wt,Ye,M,E,z),oe=T(mi,Ii,M,E,z),he=A.prevZ,me=A.nextZ;he&&he.z>=Y&&me&&me.z<=oe;){if(he.x>=wt&&he.x<=mi&&he.y>=Ye&&he.y<=Ii&&he!==L&&he!==K&&F(ae,Fe,be,Le,_e,$e,he.x,he.y)&&N(he.prev,he,he.next)>=0||(he=he.prevZ,me.x>=wt&&me.x<=mi&&me.y>=Ye&&me.y<=Ii&&me!==L&&me!==K&&F(ae,Fe,be,Le,_e,$e,me.x,me.y)&&N(me.prev,me,me.next)>=0))return!1;me=me.nextZ}for(;he&&he.z>=Y;){if(he.x>=wt&&he.x<=mi&&he.y>=Ye&&he.y<=Ii&&he!==L&&he!==K&&F(ae,Fe,be,Le,_e,$e,he.x,he.y)&&N(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;me&&me.z<=oe;){if(me.x>=wt&&me.x<=mi&&me.y>=Ye&&me.y<=Ii&&me!==L&&me!==K&&F(ae,Fe,be,Le,_e,$e,me.x,me.y)&&N(me.prev,me,me.next)>=0)return!1;me=me.nextZ}return!0}function l(A,M,E){var z=A;do{var L=z.prev,Z=z.next.next;!re(L,Z)&&ne(L,z,z.next,Z)&&Se(L,Z)&&Se(Z,L)&&(M.push(L.i/E|0),M.push(z.i/E|0),M.push(Z.i/E|0),se(z),se(z.next),z=A=Z),z=z.next}while(z!==A);return n(z)}function h(A,M,E,z,L,Z){var K=A;do{for(var ae=K.next.next;ae!==K.prev;){if(K.i!==ae.i&&k(K,ae)){var be=ce(K,ae);K=n(K,K.next),be=n(be,be.next),s(K,M,E,z,L,Z,0),s(be,M,E,z,L,Z,0);return}ae=ae.next}K=K.next}while(K!==A)}function u(A,M,E,z){var L=[],Z,K,ae,be,_e;for(Z=0,K=M.length;Z<K;Z++)ae=M[Z]*z,be=Z<K-1?M[Z+1]*z:A.length,_e=r(A,ae,be,z,!1),_e===_e.next&&(_e.steiner=!0),L.push(C(_e));for(L.sort(d),Z=0;Z<L.length;Z++)E=p(L[Z],E);return E}function d(A,M){return A.x-M.x}function p(A,M){var E=g(A,M);if(!E)return M;var z=ce(E,A);return n(z,z.next),n(E,E.next)}function g(A,M){var E=M,z=A.x,L=A.y,Z=-1/0,K;do{if(L<=E.y&&L>=E.next.y&&E.next.y!==E.y){var ae=E.x+(L-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(ae<=z&&ae>Z&&(Z=ae,K=E.x<E.next.x?E:E.next,ae===z))return K}E=E.next}while(E!==M);if(!K)return null;var be=K,_e=K.x,Fe=K.y,Le=1/0,$e;E=K;do z>=E.x&&E.x>=_e&&z!==E.x&&F(L<Fe?z:Z,L,_e,Fe,L<Fe?Z:z,L,E.x,E.y)&&($e=Math.abs(L-E.y)/(z-E.x),Se(E,A)&&($e<Le||$e===Le&&(E.x>K.x||E.x===K.x&&b(K,E)))&&(K=E,Le=$e)),E=E.next;while(E!==be);return K}function b(A,M){return N(A.prev,A,M.prev)<0&&N(M.next,A,A.next)<0}function x(A,M,E,z){var L=A;do L.z===0&&(L.z=T(L.x,L.y,M,E,z)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==A);L.prevZ.nextZ=null,L.prevZ=null,_(L)}function _(A){var M,E,z,L,Z,K,ae,be,_e=1;do{for(E=A,A=null,Z=null,K=0;E;){for(K++,z=E,ae=0,M=0;M<_e&&(ae++,z=z.nextZ,!!z);M++);for(be=_e;ae>0||be>0&&z;)ae!==0&&(be===0||!z||E.z<=z.z)?(L=E,E=E.nextZ,ae--):(L=z,z=z.nextZ,be--),Z?Z.nextZ=L:A=L,L.prevZ=Z,Z=L;E=z}Z.nextZ=null,_e*=2}while(K>1);return A}function T(A,M,E,z,L){return A=(A-E)*L|0,M=(M-z)*L|0,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,M=(M|M<<8)&16711935,M=(M|M<<4)&252645135,M=(M|M<<2)&858993459,M=(M|M<<1)&1431655765,A|M<<1}function C(A){var M=A,E=A;do(M.x<E.x||M.x===E.x&&M.y<E.y)&&(E=M),M=M.next;while(M!==A);return E}function F(A,M,E,z,L,Z,K,ae){return(L-K)*(M-ae)>=(A-K)*(Z-ae)&&(A-K)*(z-ae)>=(E-K)*(M-ae)&&(E-K)*(Z-ae)>=(L-K)*(z-ae)}function k(A,M){return A.next.i!==M.i&&A.prev.i!==M.i&&!ie(A,M)&&(Se(A,M)&&Se(M,A)&&Pe(A,M)&&(N(A.prev,A,M.prev)||N(A,M.prev,M))||re(A,M)&&N(A.prev,A,A.next)>0&&N(M.prev,M,M.next)>0)}function N(A,M,E){return(M.y-A.y)*(E.x-M.x)-(M.x-A.x)*(E.y-M.y)}function re(A,M){return A.x===M.x&&A.y===M.y}function ne(A,M,E,z){var L=$(N(A,M,E)),Z=$(N(A,M,z)),K=$(N(E,z,A)),ae=$(N(E,z,M));return!!(L!==Z&&K!==ae||L===0&&J(A,E,M)||Z===0&&J(A,z,M)||K===0&&J(E,A,z)||ae===0&&J(E,M,z))}function J(A,M,E){return M.x<=Math.max(A.x,E.x)&&M.x>=Math.min(A.x,E.x)&&M.y<=Math.max(A.y,E.y)&&M.y>=Math.min(A.y,E.y)}function $(A){return A>0?1:A<0?-1:0}function ie(A,M){var E=A;do{if(E.i!==A.i&&E.next.i!==A.i&&E.i!==M.i&&E.next.i!==M.i&&ne(E,E.next,A,M))return!0;E=E.next}while(E!==A);return!1}function Se(A,M){return N(A.prev,A,A.next)<0?N(A,M,A.next)>=0&&N(A,A.prev,M)>=0:N(A,M,A.prev)<0||N(A,A.next,M)<0}function Pe(A,M){var E=A,z=!1,L=(A.x+M.x)/2,Z=(A.y+M.y)/2;do E.y>Z!=E.next.y>Z&&E.next.y!==E.y&&L<(E.next.x-E.x)*(Z-E.y)/(E.next.y-E.y)+E.x&&(z=!z),E=E.next;while(E!==A);return z}function ce(A,M){var E=new q(A.i,A.x,A.y),z=new q(M.i,M.x,M.y),L=A.next,Z=M.prev;return A.next=M,M.prev=A,E.next=L,L.prev=E,z.next=E,E.prev=z,Z.next=z,z.prev=Z,z}function D(A,M,E,z){var L=new q(A,M,E);return z?(L.next=z.next,L.prev=z,z.next.prev=L,z.next=L):(L.prev=L,L.next=L),L}function se(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function q(A,M,E){this.i=A,this.x=M,this.y=E,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(A,M,E,z){var L=M&&M.length,Z=L?M[0]*E:A.length,K=Math.abs(de(A,0,Z,E));if(L)for(var ae=0,be=M.length;ae<be;ae++){var _e=M[ae]*E,Fe=ae<be-1?M[ae+1]*E:A.length;K-=Math.abs(de(A,_e,Fe,E))}var Le=0;for(ae=0;ae<z.length;ae+=3){var $e=z[ae]*E,wt=z[ae+1]*E,Ye=z[ae+2]*E;Le+=Math.abs((A[$e]-A[Ye])*(A[wt+1]-A[$e+1])-(A[$e]-A[wt])*(A[Ye+1]-A[$e+1]))}return K===0&&Le===0?0:Math.abs((Le-K)/K)};function de(A,M,E,z){for(var L=0,Z=M,K=E-z;Z<E;Z+=z)L+=(A[K]-A[Z])*(A[Z+1]+A[K+1]),K=Z;return L}i.flatten=function(A){for(var M=A[0][0].length,E={vertices:[],holes:[],dimensions:M},z=0,L=0;L<A.length;L++){for(var Z=0;Z<A[L].length;Z++)for(var K=0;K<M;K++)E.vertices.push(A[L][Z][K]);L>0&&(z+=A[L-1].length,E.holes.push(z))}return E}});function ff(t,e,i,r,n,s,a){let o=(0,pf.default)(t,e,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<t.length;h+=2)i[l]=t[h],i[l+1]=t[h+1],l+=r}var pf,gf=v(()=>{pf=lt(df(),1)}),mf,_f,Bx=v(()=>{te(),gf(),mf=[],_f={extension:{type:O.ShapeBuilder,name:"polygon"},build(t,e){for(let i=0;i<t.points.length;i++)e[i]=t.points[i];return e},triangulate(t,e,i,r,n,s){ff(t,mf,e,i,r,n,s)}}}),vf,Ix=v(()=>{te(),vf={extension:{type:O.ShapeBuilder,name:"rectangle"},build(t,e){let i=t,r=i.x,n=i.y,s=i.width,a=i.height;return s>=0&&a>=0&&(e[0]=r,e[1]=n,e[2]=r+s,e[3]=n,e[4]=r+s,e[5]=n+a,e[6]=r,e[7]=n+a),e},triangulate(t,e,i,r,n,s){let a=0;r*=i,e[r+a]=t[0],e[r+a+1]=t[1],a+=i,e[r+a]=t[2],e[r+a+1]=t[3],a+=i,e[r+a]=t[6],e[r+a+1]=t[7],a+=i,e[r+a]=t[4],e[r+a+1]=t[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}}}),yf,Gx=v(()=>{te(),yf={extension:{type:O.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e},triangulate(t,e,i,r,n,s){let a=0;r*=i,e[r+a]=t[0],e[r+a+1]=t[1],a+=i,e[r+a]=t[2],e[r+a+1]=t[3],a+=i,e[r+a]=t[4],e[r+a+1]=t[5];let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Ox(t,e){let{geometryData:i,batches:r}=e;r.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let n=0;n<t.instructions.length;n++){let s=t.instructions[n];if(s.action==="texture")Fx(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&&xf(h.shapePath,l,null,!0,r,i),xf(o,l,h,a,r,i)}}}function Fx(t,e,i){let{vertices:r,uvs:n,indices:s}=i,a=s.length,o=r.length/2,l=[],h=Wn.rectangle,u=bf,d=t.image;u.x=t.dx,u.y=t.dy,u.width=t.dw,u.height=t.dh;let p=t.transform;h.build(u,l),p&&af(l,p),h.triangulate(l,r,2,o,s,a);let g=d.uvs;n.push(g.x0,g.y0,g.x1,g.y1,g.x3,g.y3,g.x2,g.y2);let b=Ue.get(fa);b.indexOffset=a,b.indexSize=s.length-a,b.attributeOffset=o,b.attributeSize=r.length/2-o,b.baseColor=t.style,b.alpha=t.alpha,b.texture=d,b.geometryData=i,e.push(b)}function xf(t,e,i,r,n,s){let{vertices:a,uvs:o,indices:l}=s,h=t.shapePrimitives.length-1;t.shapePrimitives.forEach(({shape:u,transform:d},p)=>{let g=l.length,b=a.length/2,x=[],_=Wn[u.type];if(_.build(u,x),d&&af(x,d),r){let k=u.closePath??!0;Rx(x,e,!1,k,a,2,b,l,g)}else if(i&&h===p){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let k=[],N=x.slice();Dx(i.shapePath).forEach(re=>{k.push(N.length/2),N.push(...re)}),ff(N,k,a,2,b,l,g)}else _.triangulate(x,a,2,b,l,g);let T=o.length/2,C=e.texture;if(C!==ke.WHITE){let k=e.matrix;k&&(d&&k.append(d.clone().invert()),bx(a,2,b,o,T,2,a.length/2-b,k))}else wx(o,T,2,a.length/2-b);let F=Ue.get(fa);F.indexOffset=g,F.indexSize=l.length-g,F.attributeOffset=b,F.attributeSize=a.length/2-b,F.baseColor=e.color,F.alpha=e.alpha,F.texture=C,F.geometryData=s,n.push(F)})}function Dx(t){if(!t)return[];let e=t.shapePrimitives,i=[];for(let r=0;r<e.length;r++){let n=e[r].shape,s=[];Wn[n.type].build(n,s),i.push(s)}return i}var Wn,bf,Ux=v(()=>{te(),c(),Tx(),Sx(),pt(),Lt(),lf(),Cx(),kx(),Bx(),Ix(),Gx(),gf(),Wn={},ge.handleByMap(O.ShapeBuilder,Wn),ge.add(vf,_f,yf,pn,hf,uf),bf=new at}),wf,Tf,pa,ga,$l=v(()=>{te(),Cl(),sf(),Rt(),_t(),Lt(),Ux(),wf=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Tf=class{constructor(){this.batcher=new da,this.instructions=new tt}init(){this.instructions.reset()}get geometry(){return We(Pr,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},pa=class Ac{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(e){Ac.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Ac.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let i=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){i?this._cleanGraphicsContextData(e):i=this._initContext(e),Ox(e,i);let r=e.batchMode;e.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"&&(i.isBatchable=i.geometryData.vertices.length<400),e.dirty=!1}return i}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let i=Ue.get(Tf),{batches:r,geometryData:n}=this._gpuContextHash[e.uid],s=n.vertices.length,a=n.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;let o=i.batcher;o.ensureAttributeBuffer(s),o.ensureIndexBuffer(a),o.begin();for(let u=0;u<r.length;u++){let d=r[u];o.add(d)}o.finish(i.instructions);let l=o.geometry;l.indexBuffer.setDataWithSize(o.indexBuffer,o.indexSize,!0),l.buffers[0].setDataWithSize(o.attributeBuffer.float32View,o.attributeSize,!0);let h=o.batches;for(let u=0;u<h.length;u++){let d=h[u];d.bindGroup=El(d.textures.textures,d.textures.count)}return this._graphicsDataContextHash[e.uid]=i,i}_initContext(e){let i=new wf;return i.context=e,this._gpuContextHash[e.uid]=i,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let i=this._gpuContextHash[e.uid];i.isBatchable||this._graphicsDataContextHash[e.uid]&&(Ue.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),i.batches&&i.batches.forEach(r=>{Ue.return(r)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}},pa.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"graphicsContext"},pa.defaultOptions={bezierSmoothness:.5},ga=pa}),Sf,ma,_a,va,ya,xa,ba,wa,ji,or=v(()=>{"use strict";Sf={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},ma=0,_a=1,va=2,ya=3,xa=4,ba=5,wa=class cv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ma)}set blend(e){!!(this.data&1<<ma)!==e&&(this.data^=1<<ma)}get offsets(){return!!(this.data&1<<_a)}set offsets(e){!!(this.data&1<<_a)!==e&&(this.data^=1<<_a)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<va)}set culling(e){!!(this.data&1<<va)!==e&&(this.data^=1<<va)}get depthTest(){return!!(this.data&1<<ya)}set depthTest(e){!!(this.data&1<<ya)!==e&&(this.data^=1<<ya)}get depthMask(){return!!(this.data&1<<ba)}set depthMask(e){!!(this.data&1<<ba)!==e&&(this.data^=1<<ba)}get clockwiseFrontFace(){return!!(this.data&1<<xa)}set clockwiseFrontFace(e){!!(this.data&1<<xa)!==e&&(this.data^=1<<xa)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Sf[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new cv;return e.depthTest=!1,e.blend=!0,e}},wa.default2d=wa.for2d(),ji=wa});function Ta(t,e,i){let r=(t>>24&255)/255;e[i++]=(t&255)/255*r,e[i++]=(t>>8&255)/255*r,e[i++]=(t>>16&255)/255*r,e[i++]=r}var Sa=v(()=>{"use strict"}),Xl,Lx=v(()=>{te(),or(),Lt(),Sa(),lf(),Xl=class{constructor(t,e){this.state=ji.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(e);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t._didGraphicsUpdate&&(t._didGraphicsUpdate=!1,this._rebuild(t)),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){let r=e[i];r._batcher.updateElement(r)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;let r=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=r.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ta(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){let i=this.renderer.renderPipes.batch,r=this._getBatchesForRenderable(t);for(let n=0;n<r.length;n++){let s=r[n];i.addToBatch(s,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),r=this.renderer._roundPixels|t._roundPixels,n=i.batches.map(s=>{let a=Ue.get(fa);return s.copyTo(a),a.renderable=t,a.roundPixels=r,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{Ue.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}},Xl.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"graphics"}}),Ef=v(()=>{te(),$l(),Lx(),ge.add(Xl),ge.add(ga)}),Ea,Yl=v(()=>{"use strict";Ea=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){let t=this.geometry.getBuffer("aUV"),e=t.data,i=e,r=this.texture.textureMatrix;return r.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==r._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length<e.length)&&(i=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=r._updateID,this._uvUpdateId=t._updateID,r.multiplyUvs(e,i))),i}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}}),ql,Nx=v(()=>{te(),Xe(),Or(),fi(),Rl(),Lt(),Sa(),Yl(),ql=class{constructor(t,e){this.localUniforms=new ti({uTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new zi({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,r=t.batched;if(e.batched=r,i!==r)return!0;if(r){let n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(t),a=t.texture;if(s.texture._source!==a._source&&s.texture._source!==a._source)return!s._batcher.checkAndUpdateTexture(s,a)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:r}=this._getMeshData(t);if(r){let n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,i.addToBatch(n,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(Ue.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ys(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ta(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=Ue.get(Ea);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&Ue.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},ql.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"mesh"}}),Af=v(()=>{te(),Nx(),ge.add(ql)}),Aa,Kl=v(()=>{"use strict";Aa=class{constructor(){this.batcherName="default",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}}),Zl,Hx=v(()=>{te(),_l(),Lt(),Kl(),Zl=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();if(e.currentKey!==i){let{width:r,height:n}=this._renderer.canvasText.getTextureSize(t.text,t.resolution,t._style);return!(this._renderer.canvasText.getReferenceCount(e.currentKey)===1&&r===e.texture._source.width&&n===e.texture._source.height)}return!1}addRenderable(t,e){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),Ue.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),r=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;let n=t._style.padding;Hs(r.bounds,t._anchor,r.texture,n)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:Ue.get(Aa)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},Zl.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"text"}}),Cf,Vi,Ca=v(()=>{Ot(),Ls(),Cf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=ft.get().createCanvas();i.width=t,i.height=e;let r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=nn(t),e=nn(e);let r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},Vi=new Cf}),Mf,Pf,pi,jn=v(()=>{Ls(),di(),pt(),Mf=0,Pf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let r=new Ft({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!0});return new ke({source:r,label:`texturePool_${Mf++}`})}getOptimalTexture(t,e,i=1,r){let n=Math.ceil(t*i-1e-6),s=Math.ceil(e*i-1e-6);n=nn(n),s=nn(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=t,o.frame.height=e,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}},pi=new Pf});function Rf(t,e,i){for(let r=0,n=4*i*e;r<e;++r,n+=4)if(t[n+3]!==0)return!1;return!0}function kf(t,e,i,r,n){let s=4*e;for(let a=r,o=r*s+4*i;a<=n;++a,o+=s)if(t[o+3]!==0)return!1;return!0}function zx(t,e=1){let{width:i,height:r}=t,n=t.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&&Rf(s,i,o);)++o;if(o===r)return at.EMPTY;for(;Rf(s,i,h);)--h;for(;kf(s,i,a,o,h);)++a;for(;kf(s,i,l,o,h);)--l;return++l,++h,new at(a/e,o/e,(l-a)/e,(h-o)/e)}var Wx=v(()=>{c()}),Ql,gn,Jl=v(()=>{Ie(),Ot(),Xe(),wl(),pt(),yt(),Ql=class Cc{constructor(e,i,r,n){this.uid=ht("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=e,this.y0=i,this.x1=r,this.y1=n}addColorStop(e,i){return this.gradientStops.push({offset:e,color:pe.shared.setValue(i).toHexa()}),this._styleKey=null,this}buildLinearGradient(){let e=Cc.defaultTextureSize,{gradientStops:i}=this,r=ft.get().createCanvas();r.width=e,r.height=e;let n=r.getContext("2d"),s=n.createLinearGradient(0,0,Cc.defaultTextureSize,1);for(let x=0;x<i.length;x++){let _=i[x];s.addColorStop(_.offset,_.color)}n.fillStyle=s,n.fillRect(0,0,e,e),this.texture=new ke({source:new Gn({resource:r,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});let{x0:a,y0:o,x1:l,y1:h}=this,u=new Ae,d=l-a,p=h-o,g=Math.sqrt(d*d+p*p),b=Math.atan2(p,d);u.translate(-a,-o),u.scale(1/e,1/e),u.rotate(-b),u.scale(256/g,1),this.transform=u,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;let e=this.gradientStops.map(n=>`${n.offset}-${n.color}`).join("-"),i=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${e}-${i}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},Ql.defaultTextureSize=256,gn=Ql}),eh,Vn,th=v(()=>{Xe(),yt(),eh={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"}},Vn=class{constructor(t,e){this.uid=ht("fillPattern"),this.transform=new Ae,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=eh[e].addressModeU,t.source.style.addressModeV=eh[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.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)}}}),jx=Ne((t,e)=>{e.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 Vx(t,e){let i=(0,Bf.default)(t),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],e.moveTo(s,a);break;case"m":s+=u[1],a+=u[2],e.moveTo(s,a);break;case"H":s=u[1],e.lineTo(s,a);break;case"h":s+=u[1],e.lineTo(s,a);break;case"V":a=u[1],e.lineTo(s,a);break;case"v":a+=u[1],e.lineTo(s,a);break;case"L":s=u[1],a=u[2],e.lineTo(s,a);break;case"l":s+=u[1],a+=u[2],e.lineTo(s,a);break;case"C":s=u[5],a=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],s,a);break;case"c":e.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],e.bezierCurveToShort(u[1],u[2],s,a);break;case"s":e.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],e.quadraticCurveTo(u[1],u[2],s,a);break;case"q":e.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],e.quadraticCurveToShort(s,a);break;case"t":s+=u[1],a+=u[2],e.quadraticCurveToShort(s,a);break;case"A":s=u[6],a=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"a":s+=u[6],a+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"Z":case"z":e.closePath(),r.length>0&&(n=r.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:G(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},r.push(n))}return e}var Bf,$x=v(()=>{Bf=lt(jx(),1),B()}),ih,If=v(()=>{c(),ih=class dv{constructor(e=0,i=0,r=0){this.type="circle",this.x=e,this.y=i,this.radius=r}clone(){return new dv(this.x,this.y,this.radius)}contains(e,i){if(this.radius<=0)return!1;let r=this.radius*this.radius,n=this.x-e,s=this.y-i;return n*=n,s*=s,n+s<=r}strokeContains(e,i,r){if(this.radius===0)return!1;let n=this.x-e,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(e){return e=e||new at,e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),Gf,Xx=v(()=>{c(),Gf=class fv{constructor(e=0,i=0,r=0,n=0){this.type="ellipse",this.x=e,this.y=i,this.halfWidth=r,this.halfHeight=n}clone(){return new fv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,i){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,n=(i-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(e,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=e-this.x,p=i-this.y,g=d*d/(o*o)+p*p/(l*l),b=d*d/(h*h)+p*p/(u*u);return g>1&&b<=1}getBounds(e){return e=e||new at,e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Yx(t,e,i,r,n,s){let a=t-i,o=e-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 g,b;p<0?(g=i,b=r):p>1?(g=n,b=s):(g=i+p*l,b=r+p*h);let x=t-g,_=e-b;return x*x+_*_}var qx=v(()=>{"use strict"}),Ma,Kx=v(()=>{qx(),c(),Ma=class pv{constructor(...e){this.type="polygon";let i=Array.isArray(e[0])?e[0]:e;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 e=this.points.slice(),i=new pv(e);return i.closePath=this.closePath,i}contains(e,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&&e<(h-o)*((i-l)/(u-l))+o&&(r=!r)}return r}strokeContains(e,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(Yx(e,i,h,u,d,p)<=s)return!0}return!1}getBounds(e){e=e||new at;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 e.x=r,e.width=n-r,e.y=s,e.height=a-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,i)=>`${e}, ${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]}}}),$n,Of,Zx=v(()=>{c(),$n=(t,e,i,r,n,s)=>{let a=t-i,o=e-r,l=Math.sqrt(a*a+o*o);return l>=n-s&&l<=n+s},Of=class gv{constructor(e=0,i=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=i,this.width=r,this.height=n,this.radius=s}getBounds(e){return e=e||new at,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new gv(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,i){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=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||e>=this.x+r&&e<=this.x+this.width-r)return!0;let n=e-(this.x+r),s=i-(this.y+r),a=r*r;if(n*n+s*s<=a||(n=e-(this.x+this.width-r),n*n+s*s<=a)||(s=i-(this.y+this.height-r),n*n+s*s<=a)||(n=e-(this.x+r),n*n+s*s<=a))return!0}return!1}strokeContains(e,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,g=o-l*2,b=n+a,x=s+o;return(e>=n-h&&e<=n+h||e>=b-h&&e<=b+h)&&i>=d&&i<=d+g||(i>=s-h&&i<=s+h||i>=x-h&&i<=x+h)&&e>=u&&e<=u+p?!0:e<u&&i<d&&$n(e,i,u,d,l,h)||e>b-l&&i<d&&$n(e,i,b-l,d,l,h)||e>b-l&&i>x-l&&$n(e,i,b-l,x-l,l,h)||e<u&&i>x-l&&$n(e,i,u,x-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 Ff(t,e,i,r,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ga.defaultOptions.bezierSmoothness)),d=(Uf-u)/1;return d*=d,Qx(e,i,r,n,s,a,o,l,t,d),t}function Qx(t,e,i,r,n,s,a,o,l,h){rh(t,e,i,r,n,s,a,o,l,h,0),l.push(a,o)}function rh(t,e,i,r,n,s,a,o,l,h,u){if(u>Df)return;let d=Math.PI,p=(t+i)/2,g=(e+r)/2,b=(i+n)/2,x=(r+s)/2,_=(n+a)/2,T=(s+o)/2,C=(p+b)/2,F=(g+x)/2,k=(b+_)/2,N=(x+T)/2,re=(C+k)/2,ne=(F+N)/2;if(u>0){let J=a-t,$=o-e,ie=Math.abs((i-a)*$-(r-o)*J),Se=Math.abs((n-a)*$-(s-o)*J),Pe,ce;if(ie>Xn&&Se>Xn){if((ie+Se)*(ie+Se)<=h*(J*J+$*$)){if(Hr<Pa){l.push(re,ne);return}let D=Math.atan2(s-r,n-i);if(Pe=Math.abs(D-Math.atan2(r-e,i-t)),ce=Math.abs(Math.atan2(o-s,a-n)-D),Pe>=d&&(Pe=2*d-Pe),ce>=d&&(ce=2*d-ce),Pe+ce<Hr){l.push(re,ne);return}if(wr!==0){if(Pe>wr){l.push(i,r);return}if(ce>wr){l.push(n,s);return}}}}else if(ie>Xn){if(ie*ie<=h*(J*J+$*$)){if(Hr<Pa){l.push(re,ne);return}if(Pe=Math.abs(Math.atan2(s-r,n-i)-Math.atan2(r-e,i-t)),Pe>=d&&(Pe=2*d-Pe),Pe<Hr){l.push(i,r),l.push(n,s);return}if(wr!==0&&Pe>wr){l.push(i,r);return}}}else if(Se>Xn){if(Se*Se<=h*(J*J+$*$)){if(Hr<Pa){l.push(re,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<Hr){l.push(i,r),l.push(n,s);return}if(wr!==0&&Pe>wr){l.push(n,s);return}}}else if(J=re-(t+a)/2,$=ne-(e+o)/2,J*J+$*$<=h){l.push(re,ne);return}}rh(t,e,p,g,C,F,re,ne,l,h,u+1),rh(re,ne,k,N,_,T,a,o,l,h,u+1)}var Df,Xn,Uf,Pa,Hr,wr,Lf=v(()=>{$l(),Df=8,Xn=11920929e-14,Uf=1,Pa=.01,Hr=0,wr=0});function Jx(t,e,i,r,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ga.defaultOptions.bezierSmoothness)),h=(zf-l)/1;return h*=h,eb(e,i,r,n,s,a,t,h),t}function eb(t,e,i,r,n,s,a,o){nh(a,t,e,i,r,n,s,o,0),a.push(n,s)}function nh(t,e,i,r,n,s,a,o,l){if(l>Nf)return;let h=Math.PI,u=(e+r)/2,d=(i+n)/2,p=(r+s)/2,g=(n+a)/2,b=(u+p)/2,x=(d+g)/2,_=s-e,T=a-i,C=Math.abs((r-s)*T-(n-a)*_);if(C>Hf){if(C*C<=o*(_*_+T*T)){if(sh<Wf){t.push(b,x);return}let F=Math.abs(Math.atan2(a-n,s-r)-Math.atan2(n-i,r-e));if(F>=h&&(F=2*h-F),F<sh){t.push(b,x);return}}}else if(_=b-(e+s)/2,T=x-(i+a)/2,_*_+T*T<=o){t.push(b,x);return}nh(t,e,i,u,d,b,x,o,l+1),nh(t,b,x,p,g,s,a,o,l+1)}var Nf,Hf,zf,Wf,sh,tb=v(()=>{$l(),Nf=8,Hf=11920929e-14,zf=1,Wf=.01,sh=0});function jf(t,e,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),g=Math.sin(u),b=e+p*r,x=i+g*r;t.push(b,x),u+=h}}var Vf=v(()=>{"use strict"});function ib(t,e,i,r,n,s){let a=t[t.length-2],o=t[t.length-1]-i,l=a-e,h=n-i,u=r-e,d=Math.abs(o*u-l*h);if(d<1e-8||s===0){(t[t.length-2]!==e||t[t.length-1]!==i)&&t.push(e,i);return}let p=o*o+l*l,g=h*h+u*u,b=o*h+l*u,x=s*Math.sqrt(p)/d,_=s*Math.sqrt(g)/d,T=x*b/p,C=_*b/g,F=x*u+_*l,k=x*h+_*o,N=l*(_+T),re=o*(_+T),ne=u*(x+C),J=h*(x+C),$=Math.atan2(re-k,N-F),ie=Math.atan2(J-k,ne-F);jf(t,F+e,k+i,s,$,ie,l*h>u*o)}var rb=v(()=>{Vf()});function nb(t,e){let i=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:i,n=Math.cos(t),s=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-s*r,y:s+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}function sb(t,e,i,r,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*mn/360),d=Math.cos(o*mn/360),p=d*(e-r)/2+u*(i-n)/2,g=-u*(e-r)/2+d*(i-n)/2;if(p===0&&g===0)return;s=Math.abs(s),a=Math.abs(a);let b=Math.pow(p,2)/Math.pow(s,2)+Math.pow(g,2)/Math.pow(a,2);b>1&&(s*=Math.sqrt(b),a*=Math.sqrt(b)),$f(e,i,r,n,s,a,l,h,u,d,p,g,Ra);let{ang1:x,ang2:_}=Ra,{centerX:T,centerY:C}=Ra,F=Math.abs(_)/(mn/4);Math.abs(1-F)<1e-7&&(F=1);let k=Math.max(Math.ceil(F),1);_/=k;let N=t[t.length-2],re=t[t.length-1],ne={x:0,y:0};for(let J=0;J<k;J++){let $=nb(x,_),{x:ie,y:Se}=ka($[0],s,a,d,u,T,C,ne),{x:Pe,y:ce}=ka($[1],s,a,d,u,T,C,ne),{x:D,y:se}=ka($[2],s,a,d,u,T,C,ne);Ff(t,N,re,ie,Se,Pe,ce,D,se),N=D,re=se,x+=_}}var mn,Ra,ka,ah,$f,ab=v(()=>{Lf(),mn=Math.PI*2,Ra={centerX:0,centerY:0,ang1:0,ang2:0},ka=({x:t,y:e},i,r,n,s,a,o,l)=>{t*=i,e*=r;let h=n*t-s*e,u=s*t+n*e;return l.x=h+a,l.y=u+o,l},ah=(t,e,i,r)=>{let n=t*r-e*i<0?-1:1,s=t*i+e*r;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},$f=(t,e,i,r,n,s,a,o,l,h,u,d,p)=>{let g=Math.pow(n,2),b=Math.pow(s,2),x=Math.pow(u,2),_=Math.pow(d,2),T=g*b-g*_-b*x;T<0&&(T=0),T/=g*_+b*x,T=Math.sqrt(T)*(a===o?-1:1);let C=T*n/s*d,F=T*-s/n*u,k=h*C-l*F+(t+i)/2,N=l*C+h*F+(e+r)/2,re=(u-C)/n,ne=(d-F)/s,J=(-u-C)/n,$=(-d-F)/s,ie=ah(1,0,re,ne),Se=ah(re,ne,J,$);o===0&&Se>0&&(Se-=mn),o===1&&Se<0&&(Se+=mn),p.centerX=k,p.centerY=N,p.ang1=ie,p.ang2=Se}});function ob(t,e,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?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)},s=e[e.length-1];for(let a=0;a<e.length;a++){let o=e[a%e.length],l=o.radius??i;if(l<=0){n(a,o),s=o;continue}let h=e[(a+1)%e.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),g=1,b=!1;u.nx*d.nx-u.ny*-d.ny<0?p<0?p=Math.PI+p:(p=Math.PI-p,g=-1,b=!0):p>0&&(g=-1,b=!0);let x=p/2,_,T=Math.abs(Math.cos(x)*l/Math.sin(x));T>Math.min(u.len/2,d.len/2)?(T=Math.min(u.len/2,d.len/2),_=Math.abs(T*Math.sin(x)/Math.cos(x))):_=l;let C=o.x+d.nx*T+-d.ny*_*g,F=o.y+d.ny*T+d.nx*_*g,k=Math.atan2(u.ny,u.nx)+Math.PI/2*g,N=Math.atan2(d.ny,d.nx)-Math.PI/2*g;a===0&&t.moveTo(C+Math.cos(k)*_,F+Math.sin(k)*_),t.arc(C,F,_,k,N,b),s=o}}function lb(t,e,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=e.length;for(let o=0;o<a;o++){let l=e[(o+1)%a],h=l.radius??i;if(h<=0){o===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}let u=e[o],d=e[(o+2)%a],p=n(u,l),g;if(p<1e-4)g=l;else{let _=Math.min(p/2,h);g=s(l,u,_/p)}let b=n(d,l),x;if(b<1e-4)x=l;else{let _=Math.min(b/2,h);x=s(l,d,_/b)}o===0?t.moveTo(g.x,g.y):t.lineTo(g.x,g.y),t.quadraticCurveTo(l.x,l.y,x.x,x.y,r)}}var hb=v(()=>{"use strict"}),Xf,Yf,ub=v(()=>{If(),Xx(),Kx(),c(),Zx(),y(),Lf(),tb(),Vf(),rb(),ab(),hb(),Xf=new at,Yf=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new m,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,r,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return jf(a,t,e,i,r,n,s),this}arcTo(t,e,i,r,n){this._ensurePoly();let s=this._currentPoly.points;return ib(s,t,e,i,r,n),this}arcToSvg(t,e,i,r,n,s,a){let o=this._currentPoly.points;return sb(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,s,a){this._ensurePoly();let o=this._currentPoly;return Ff(this._currentPoly.points,o.lastX,o.lastY,t,e,i,r,n,s,a),this}quadraticCurveTo(t,e,i,r,n){this._ensurePoly();let s=this._currentPoly;return Jx(this._currentPoly.points,s.lastX,s.lastY,t,e,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let i=0;i<t.instructions.length;i++){let r=t.instructions[i];this[r.action](...r.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,r,n){return this.drawShape(new at(t,e,i,r),n),this}circle(t,e,i,r){return this.drawShape(new ih(t,e,i),r),this}poly(t,e,i){let r=new Ma(t);return r.closePath=e,this.drawShape(r,i),this}regularPoly(t,e,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(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(l,!0,s),this}roundPoly(t,e,i,r,n,s=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(t,e,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,g=t+i*Math.cos(p),b=e+i*Math.sin(p),x=p+Math.PI+u,_=p-Math.PI-u,T=g+n*Math.cos(x),C=b+n*Math.sin(x),F=g+n*Math.cos(_),k=b+n*Math.sin(_);d===0?this.moveTo(T,C):this.lineTo(T,C),this.quadraticCurveTo(g,b,F,k,a)}return this.closePath()}roundShape(t,e,i=!1,r){return t.length<3?this:(i?lb(this,t,e,r):ob(this,t,e),this.closePath())}filletRect(t,e,i,r,n){if(n===0)return this.rect(t,e,i,r);let s=Math.min(i,r)/2,a=Math.min(s,Math.max(-s,n)),o=t+i,l=e+r,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(o-u,e).arcTo(o-h,e+h,o,e+u,u).lineTo(o,l-u).arcTo(o-h,l-h,t+i-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,t,l-u,u).closePath()}chamferRect(t,e,i,r,n,s){if(n<=0)return this.rect(t,e,i,r);let a=Math.min(n,Math.min(i,r)/2),o=t+i,l=e+r,h=[t+a,e,o-a,e,o,e+a,o,l-a,o-a,l,t+a,l,t,l-a,t,e+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(t,e,i,r,n){return this.drawShape(new Gf(t,e,i,r),n),this}roundRect(t,e,i,r,n,s){return this.drawShape(new Of(t,e,i,r,n),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ma,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ma,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let n=e.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 t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let i=0;i<e.length;i++){let r=e[i],n=r.shape.getBounds(Xf);r.transform?t.addRect(n,r.transform):t.addRect(n)}return t}}});function Yn(t,e){return t?t.prepend(e):e.clone()}var qn,qf=v(()=>{jt(),yt(),B(),$x(),ub(),qn=class mv{constructor(e){this.instructions=[],this.uid=ht("graphicsPath"),this._dirty=!0,typeof e=="string"?Vx(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Yf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,i){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,i]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,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,e,i,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,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,e,i,r]}),this._dirty=!0,this}rect(e,i,r,n,s){return this.instructions.push({action:"rect",data:[e,i,r,n,s]}),this._dirty=!0,this}circle(e,i,r,n){return this.instructions.push({action:"circle",data:[e,i,r,n]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,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 g=p%2?s:n,b=p*u+l;d.push(e+g*Math.cos(b),i+g*Math.sin(b))}return this.poly(d,!0,o),this}clone(e=!1){let i=new mv;if(!e)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(e){if(e.isIdentity())return this;let i=e.a,r=e.b,n=e.c,s=e.d,a=e.tx,o=e.ty,l=0,h=0,u=0,d=0,p=0,g=0,b=0,x=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],g=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*g+a,C[3]=r*p+s*g+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],b=C[0],x=C[1],C[0]=i*b+n*x,C[1]=r*b+s*x,C[5]=i*l+n*h+a,C[6]=r*l+s*h+o;break;case"circle":C[4]=Yn(C[3],e);break;case"rect":C[4]=Yn(C[4],e);break;case"ellipse":C[8]=Yn(C[8],e);break;case"roundRect":C[5]=Yn(C[5],e);break;case"addPath":C[0].transform(e);break;case"poly":C[2]=Yn(C[2],e);break;default:G("unknown transform action",T.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let i=this.instructions.length-1,r=this.instructions[i];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(i--,i<0)return e.x=0,e.y=0,e;r=this.instructions[i]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}});function cb(t,e){if(typeof t=="string"){let r=document.createElement("div");r.innerHTML=t.trim(),t=r.querySelector("svg")}let i={context:e,path:new qn};return Kf(t,i,null,null),e}function Kf(t,e,i,r){let n=t.children,{fillStyle:s,strokeStyle:a}=db(t);s&&i?i={...i,...s}:s&&(i=s),a&&r?r={...r,...a}:a&&(r=a),e.context.fillStyle=i,e.context.strokeStyle=r;let o,l,h,u,d,p,g,b,x,_,T,C,F,k,N,re,ne;switch(t.nodeName.toLowerCase()){case"path":k=t.getAttribute("d"),N=new qn(k),e.context.path(N),i&&e.context.fill(),r&&e.context.stroke();break;case"circle":g=zt(t,"cx",0),b=zt(t,"cy",0),x=zt(t,"r",0),e.context.ellipse(g,b,x,x),i&&e.context.fill(),r&&e.context.stroke();break;case"rect":o=zt(t,"x",0),l=zt(t,"y",0),re=zt(t,"width",0),ne=zt(t,"height",0),_=zt(t,"rx",0),T=zt(t,"ry",0),_||T?e.context.roundRect(o,l,re,ne,_||T):e.context.rect(o,l,re,ne),i&&e.context.fill(),r&&e.context.stroke();break;case"ellipse":g=zt(t,"cx",0),b=zt(t,"cy",0),_=zt(t,"rx",0),T=zt(t,"ry",0),e.context.beginPath(),e.context.ellipse(g,b,_,T),i&&e.context.fill(),r&&e.context.stroke();break;case"line":h=zt(t,"x1",0),u=zt(t,"y1",0),d=zt(t,"x2",0),p=zt(t,"y2",0),e.context.beginPath(),e.context.moveTo(h,u),e.context.lineTo(d,p),r&&e.context.stroke();break;case"polygon":F=t.getAttribute("points"),C=F.match(/\d+/g).map(J=>parseInt(J,10)),e.context.poly(C,!0),i&&e.context.fill(),r&&e.context.stroke();break;case"polyline":F=t.getAttribute("points"),C=F.match(/\d+/g).map(J=>parseInt(J,10)),e.context.poly(C,!1),r&&e.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}for(let J=0;J<n.length;J++)Kf(n[J],e,i,r)}function zt(t,e,i){let r=t.getAttribute(e);return r?Number(r):i}function db(t){let e=t.getAttribute("style"),i={},r={},n=!1,s=!1;if(e){let a=e.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=pe.shared.setValue(u).toNumber(),s=!0);break;case"stroke-width":i.width=Number(u);break;case"fill":u!=="none"&&(n=!0,r.color=pe.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=t.getAttribute("stroke");a&&a!=="none"&&(s=!0,i.color=pe.shared.setValue(a).toNumber(),i.width=zt(t,"stroke-width",1));let o=t.getAttribute("fill");o&&o!=="none"&&(n=!0,r.color=pe.shared.setValue(o).toNumber())}return{strokeStyle:s?i:null,fillStyle:n?r:null}}var fb=v(()=>{Ie(),qf()});function pb(t){return pe.isColorLike(t)}function Zf(t){return t instanceof Vn}function Qf(t){return t instanceof gn}function gb(t,e,i){let r=pe.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?i.alpha:r.alpha,t.texture=ke.WHITE,{...i,...t}}function Jf(t,e,i){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function ep(t,e,i){return e.buildLinearGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function mb(t,e){let i={...e,...t};if(i.texture){if(i.texture!==ke.WHITE){let s=i.matrix?.invert()||new Ae;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=pe.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function zr(t,e){if(t==null)return null;let i={},r=t;return pb(t)?gb(i,t,e):Zf(t)?Jf(i,t,e):Qf(t)?ep(i,t,e):r.fill&&Zf(r.fill)?Jf(r,r.fill,e):r.fill&&Qf(r.fill)?ep(r,r.fill,e):mb(r,e)}function Ba(t,e){let{width:i,alignment:r,miterLimit:n,cap:s,join:a,...o}=e,l=zr(t,o);return l?{width:i,alignment:r,miterLimit:n,cap:s,join:a,...l}:null}var tp=v(()=>{Ie(),Xe(),pt(),Jl(),th()}),ip,oh,Ia,Ti,rp=v(()=>{gt(),Ie(),Xe(),jt(),pt(),yt(),_t(),y(),qf(),fb(),tp(),ip=new De,oh=new Ae,Ia=class Ki extends qe{constructor(){super(...arguments),this.uid=ht("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new qn,this._transform=new Ae,this._fillStyle={...Ki.defaultFillStyle},this._strokeStyle={...Ki.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new m,this._boundsDirty=!0}clone(){let e=new Ki;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=zr(e,Ki.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Ba(e,Ki.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=zr(e,Ki.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=zr(e,Ki.defaultStrokeStyle),this}texture(e,i,r,n,s,a){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:n||0,dw:s||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:i?pe.shared.setValue(i).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new qn,this}fill(e,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?(e!=null&&(i!==void 0&&typeof e=="number"&&(We(je,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:i}),this._fillStyle=zr(e,Ki.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:i}=this._activePath.getLastPoint(De.shared);this._activePath.clear(),this._activePath.moveTo(e,i)}stroke(e){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?(e!=null&&(this._strokeStyle=Ba(e,Ki.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let i=this.instructions[this.instructions.length-1-e],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(e,i,r,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*i+o.tx,o.b*e+o.d*i+o.ty,r,n,s,a),this}arcTo(e,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*i+a.tx,a.b*e+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}arcToSvg(e,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,i,r,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(e,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*i+l.tx,l.b*e+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(e,i,r,n){return this._tick++,this._activePath.ellipse(e,i,r,n,this._transform.clone()),this}circle(e,i,r){return this._tick++,this._activePath.circle(e,i,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,i){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*e+r.c*i+r.tx,r.b*e+r.d*i+r.ty),this}moveTo(e,i){this._tick++;let r=this._transform,n=this._activePath.instructions,s=r.a*e+r.c*i+r.tx,a=r.b*e+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(e,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*i+a.tx,a.b*e+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}rect(e,i,r,n){return this._tick++,this._activePath.rect(e,i,r,n,this._transform.clone()),this}roundRect(e,i,r,n,s){return this._tick++,this._activePath.roundRect(e,i,r,n,s,this._transform.clone()),this}poly(e,i){return this._tick++,this._activePath.poly(e,i,this._transform.clone()),this}regularPoly(e,i,r,n,s=0,a){return this._tick++,this._activePath.regularPoly(e,i,r,n,s,a),this}roundPoly(e,i,r,n,s,a){return this._tick++,this._activePath.roundPoly(e,i,r,n,s,a),this}roundShape(e,i,r,n){return this._tick++,this._activePath.roundShape(e,i,r,n),this}filletRect(e,i,r,n,s){return this._tick++,this._activePath.filletRect(e,i,r,n,s),this}chamferRect(e,i,r,n,s,a){return this._tick++,this._activePath.chamferRect(e,i,r,n,s,a),this}star(e,i,r,n,s=0,a=0){return this._tick++,this._activePath.star(e,i,r,n,s,a,this._transform.clone()),this}svg(e){return this._tick++,cb(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.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(e){return this._transform.rotate(e),this}scale(e,i=e){return this._transform.scale(e,i),this}setTransform(e,i,r,n,s,a){return e instanceof Ae?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,i,r,n,s,a),this)}transform(e,i,r,n,s,a){return e instanceof Ae?(this._transform.append(e),this):(oh.set(e,i,r,n,s,a),this._transform.append(oh),this)}translate(e,i=e){return this._transform.translate(e,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 e=this._bounds;e.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;e.addBounds(s.path.bounds)}else if(n==="texture"){let s=r.data;e.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;e.addFrame(o.minX-a,o.minY-a,o.maxX+a,o.maxY+a)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.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,g=p?p.applyInverse(e,ip):e;s.action==="fill"?r=d.contains(g.x,g.y):r=d.strokeContains(g.x,g.y,l.width);let b=a.hole;if(b){let x=b.shapePath?.shapePrimitives;if(x)for(let _=0;_<x.length;_++)x[_].shape.contains(g.x,g.y)&&(r=!1)}if(r)return!0}}return r}destroy(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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}},Ia.defaultFillStyle={color:16777215,alpha:1,texture:ke.WHITE,matrix:null,fill:null},Ia.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:ke.WHITE,matrix:null,fill:null},Ti=Ia});function np(t){let e=[],i=0;for(let r=0;r<lh.length;r++){let n=`_${lh[r]}`;e[i++]=t[n]}return i=sp(t._fill,e,i),i=_b(t._stroke,e,i),i=vb(t.dropShadow,e,i),e.join("-")}function sp(t,e,i){return t&&(e[i++]=t.color,e[i++]=t.alpha,e[i++]=t.fill?.styleKey),i}function _b(t,e,i){return t&&(i=sp(t,e,i),e[i++]=t.width,e[i++]=t.alignment,e[i++]=t.cap,e[i++]=t.join,e[i++]=t.miterLimit),i}function vb(t,e,i){return t&&(e[i++]=t.alpha,e[i++]=t.angle,e[i++]=t.blur,e[i++]=t.distance,e[i++]=pe.shared.setValue(t.color).toNumber()),i}var lh,ap=v(()=>{Ie(),lh=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function yb(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let i=$i.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??i.alpha,angle:e.dropShadowAngle??i.angle,blur:e.dropShadowBlur??i.blur,color:e.dropShadowColor??i.color,distance:e.dropShadowDistance??i.distance}}if(e.strokeThickness!==void 0){We(je,"strokeThickness is now a part of stroke");let i=e.stroke,r={};if(pe.isColorLike(i))r.color=i;else if(i instanceof gn||i instanceof Vn)r.fill=i;else if(Object.hasOwnProperty.call(i,"color")||Object.hasOwnProperty.call(i,"fill"))r=i;else throw new Error("Invalid stroke value.");t.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){We(je,"gradient fill is now a fill pattern: `new FillGradient(...)`");let i;t.fontSize==null?t.fontSize=$i.defaultTextStyle.fontSize:typeof t.fontSize=="string"?i=parseInt(t.fontSize,10):i=t.fontSize;let r=new gn(0,0,0,i*1.7),n=e.fillGradientStops.map(s=>pe.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);r.addColorStop(o,s)}),t.fill={fill:r}}}var Ga,$i,Kn=v(()=>{gt(),Ie(),_t(),Jl(),th(),rp(),tp(),ap(),Ga=class An extends qe{constructor(e={}){super(),yb(e);let i={...An.defaultTextStyle,...e};for(let r in i){let n=r;this[n]=i[r]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...An.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...An.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Ti.defaultFillStyle,...e},()=>{this._fill=zr({...this._originalFill},Ti.defaultFillStyle)})),this._fill=zr(e===0?"black":e,Ti.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Ti.defaultStrokeStyle,...e},()=>{this._stroke=Ba({...this._originalStroke},Ti.defaultStrokeStyle)})),this._stroke=Ba(e,Ti.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=np(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=An.defaultTextStyle;for(let i in e)this[i]=e[i]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new An({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(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.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(e,i){return new Proxy(e,{set:(r,n,s)=>(r[n]=s,i?.(n,s),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(pe.isColorLike(e)||e instanceof gn||e instanceof Vn)}},Ga.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Ga.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},$i=Ga});function op(t,e,i,r){let n=lp;n.minX=0,n.minY=0,n.maxX=t.width/r|0,n.maxY=t.height/r|0;let s=pi.getOptimalTexture(n.width,n.height,r,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/r,s.frame.height=i/r,s.source.emit("update",s.source),s.updateUvs(),s}var lp,hp=v(()=>{jn(),y(),lp=new m});function Oa(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,i=t.fontFamily;Array.isArray(t.fontFamily)||(i=t.fontFamily.split(","));for(let r=i.length-1;r>=0;r--){let n=i[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!up.includes(n)&&(n=`"${n}"`),i[r]=n}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${i.join(",")}`}var up,hh=v(()=>{"use strict";up=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Fa,Si,Pi,Da=v(()=>{Ot(),hh(),Fa={willReadFrequently:!0},Si=class Ce{static get experimentalLetterSpacingSupported(){let e=Ce._experimentalLetterSpacingSupported;if(e!==void 0){let i=ft.get().getCanvasRenderingContext2D().prototype;e=Ce._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(e,i,r,n,s,a,o,l,h){this.text=e,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(e=" ",i,r=Ce._canvas,n=i.wordWrap){let s=`${e}:${i.styleKey}`;if(Ce._measurementCache[s])return Ce._measurementCache[s];let a=Oa(i),o=Ce.measureFont(a);o.fontSize===0&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);let l=Ce.__context;l.font=a;let h=(n?Ce._wordWrap(e,i,r):e).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let _=0;_<h.length;_++){let T=Ce._measureText(h[_],i.letterSpacing,l);u[_]=T,d=Math.max(d,T)}let p=i._stroke?.width||0,g=d+p;i.dropShadow&&(g+=i.dropShadow.distance);let b=i.lineHeight||o.fontSize,x=Math.max(b,o.fontSize+p)+(h.length-1)*(b+i.leading);return i.dropShadow&&(x+=i.dropShadow.distance),new Ce(e,i,g,x,h,u,b+i.leading,d,o)}static _measureText(e,i,r){let n=!1;Ce.experimentalLetterSpacingSupported&&(Ce.experimentalLetterSpacing?(r.letterSpacing=`${i}px`,r.textLetterSpacing=`${i}px`,n=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let s=r.measureText(e).width;return s>0&&(n?s-=i:s+=(Ce.graphemeSegmenter(e).length-1)*i),s}static _wordWrap(e,i,r=Ce._canvas){let n=r.getContext("2d",Fa),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=Ce._collapseSpaces(u),p=Ce._collapseNewlines(u),g=!d,b=i.wordWrapWidth+h,x=Ce._tokenize(e);for(let _=0;_<x.length;_++){let T=x[_];if(Ce._isNewline(T)){if(!p){o+=Ce._addLine(a),g=!d,a="",s=0;continue}T=" "}if(d){let F=Ce.isBreakingSpace(T),k=Ce.isBreakingSpace(a[a.length-1]);if(F&&k)continue}let C=Ce._getFromCache(T,h,l,n);if(C>b)if(a!==""&&(o+=Ce._addLine(a),a="",s=0),Ce.canBreakWords(T,i.breakWords)){let F=Ce.wordWrapSplit(T);for(let k=0;k<F.length;k++){let N=F[k],re=N,ne=1;for(;F[k+ne];){let $=F[k+ne];if(!Ce.canBreakChars(re,$,T,k,i.breakWords))N+=$;else break;re=$,ne++}k+=ne-1;let J=Ce._getFromCache(N,h,l,n);J+s>b&&(o+=Ce._addLine(a),g=!1,a="",s=0),a+=N,s+=J}}else{a.length>0&&(o+=Ce._addLine(a),a="",s=0);let F=_===x.length-1;o+=Ce._addLine(T,!F),g=!1,a="",s=0}else C+s>b&&(g=!1,o+=Ce._addLine(a),a="",s=0),(a.length>0||!Ce.isBreakingSpace(T)||g)&&(a+=T,s+=C)}return o+=Ce._addLine(a,!1),o}static _addLine(e,i=!0){return e=Ce._trimRight(e),e=i?`${e}
|
|
`:e,e}static _getFromCache(e,i,r,n){let s=r[e];return typeof s!="number"&&(s=Ce._measureText(e,i,n)+i,r[e]=s),s}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let i=e.length-1;i>=0;i--){let r=e[i];if(!Ce.isBreakingSpace(r))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:Ce._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,i){return typeof e!="string"?!1:Ce._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let i=[],r="";if(typeof e!="string")return i;for(let n=0;n<e.length;n++){let s=e[n],a=e[n+1];if(Ce.isBreakingSpace(s,a)||Ce._isNewline(s)){r!==""&&(i.push(r),r=""),i.push(s);continue}r+=s}return r!==""&&i.push(r),i}static canBreakWords(e,i){return i}static canBreakChars(e,i,r,n,s){return!0}static wordWrapSplit(e){return Ce.graphemeSegmenter(e)}static measureFont(e){if(Ce._fonts[e])return Ce._fonts[e];let i=Ce._context;i.font=e;let r=i.measureText(Ce.METRICS_STRING+Ce.BASELINE_SYMBOL),n={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return Ce._fonts[e]=n,n}static clearMetrics(e=""){e?delete Ce._fonts[e]:Ce._fonts={}}static get _canvas(){if(!Ce.__canvas){let e;try{let i=new OffscreenCanvas(0,0);if(i.getContext("2d",Fa)?.measureText)return Ce.__canvas=i,i;e=ft.get().createCanvas()}catch{e=ft.get().createCanvas()}e.width=e.height=10,Ce.__canvas=e}return Ce.__canvas}static get _context(){return Ce.__context||(Ce.__context=Ce._canvas.getContext("2d",Fa)),Ce.__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 t=new Intl.Segmenter;return e=>[...t.segment(e)].map(i=>i.segment)}return t=>[...t]})(),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={},Pi=Si});function Ua(t,e){if(t.texture===ke.WHITE&&!t.fill)return pe.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof Vn){let i=t.fill,r=e.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(Ae.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),r.setTransform(n),r}else if(t.fill instanceof gn){let i=t.fill;if(i.type==="linear"){let r=e.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{r.addColorStop(n.offset,pe.shared.setValue(n.color).toHex())}),r}}}else{let i=e.createPattern(t.texture.source.resource,"repeat"),r=t.matrix.copyTo(Ae.shared);return r.scale(t.texture.frame.width,t.texture.frame.height),i.setTransform(r),i}return G("FillStyle not recognised",t),"red"}var cp=v(()=>{Ie(),Xe(),pt(),B(),Jl(),th()}),uh,xb=v(()=>{Ie(),te(),Ls(),Ca(),jn(),Wx(),_t(),Kn(),hp(),Da(),hh(),cp(),uh=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let r=Pi.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,r.width)+i.padding*2)*e),s=Math.ceil(Math.ceil(Math.max(1,r.height)+i.padding*2)*e);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=nn(n),s=nn(s),{width:n,height:s}}getTexture(t,e,i,r){typeof t=="string"&&(We("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof $i||(t.style=new $i(t.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Vi.returnCanvasAndContext(s),n}createTextureAndCanvas(t){let{text:e,style:i}=t,r=t.resolution??this._renderer.resolution,n=Pi.measureText(e||" ",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=Vi.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(e,i,r,o);let h=op(l,s,a,r);if(i.trim){let u=zx(l,r);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:r}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:r,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Vi.returnCanvasAndContext(e.canvasAndContext),pi.returnTexture(e.texture);let i=e.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,r){let{canvas:n,context:s}=r,a=Oa(e),o=Pi.measureText(t||" ",e),l=o.lines,h=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,p=o.fontProperties,g=n.height;s.resetTransform(),s.scale(i,i);let b=e.padding*2;if(s.clearRect(0,0,o.width+4+b,o.height+4+b),e._stroke?.width){let C=e._stroke;s.lineWidth=C.width,s.miterLimit=C.miterLimit,s.lineJoin=C.join,s.lineCap=C.cap}s.font=a;let x,_,T=e.dropShadow?2:1;for(let C=0;C<T;++C){let F=e.dropShadow&&C===0,k=F?Math.ceil(Math.max(1,g)+e.padding*2):0,N=k*i;if(F){s.fillStyle="black",s.strokeStyle="black";let J=e.dropShadow,$=J.color,ie=J.alpha;s.shadowColor=pe.shared.setValue($).setAlpha(ie).toRgbaString();let Se=J.blur*i,Pe=J.distance*i;s.shadowBlur=Se,s.shadowOffsetX=Math.cos(J.angle)*Pe,s.shadowOffsetY=Math.sin(J.angle)*Pe+N}else s.globalAlpha=e._fill?.alpha??1,s.fillStyle=e._fill?Ua(e._fill,s):null,e._stroke?.width&&(s.strokeStyle=Ua(e._stroke,s)),s.shadowColor="black";let re=(h-p.fontSize)/2;h-p.fontSize<0&&(re=0);let ne=e._stroke?.width??0;for(let J=0;J<l.length;J++)x=ne/2,_=ne/2+J*h+p.ascent+re,e.align==="right"?x+=d-u[J]:e.align==="center"&&(x+=(d-u[J])/2),e._stroke?.width&&this._drawLetterSpacing(l[J],e,r,x+e.padding,_+e.padding-k,!0),e._fill!==void 0&&this._drawLetterSpacing(l[J],e,r,x+e.padding,_+e.padding-k)}}_drawLetterSpacing(t,e,i,r,n,s=!1){let{context:a}=i,o=e.letterSpacing,l=!1;if(Pi.experimentalLetterSpacingSupported&&(Pi.experimentalLetterSpacing?(a.letterSpacing=`${o}px`,a.textLetterSpacing=`${o}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),o===0||l){s?a.strokeText(t,r,n):a.fillText(t,r,n);return}let h=r,u=Pi.graphemeSegmenter(t),d=a.measureText(t).width,p=0;for(let g=0;g<u.length;++g){let b=u[g];s?a.strokeText(b,h,n):a.fillText(b,h,n);let x="";for(let _=g+1;_<u.length;++_)x+=u[_];p=a.measureText(x).width,h+=d-p+o,d=p}}destroy(){this._activeTextures=null}},uh.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"canvasText"}}),dp=v(()=>{te(),Hx(),xb(),ge.add(uh),ge.add(Zl)}),La,fp=v(()=>{_t(),vl(),rp(),La=class Mc extends zs{constructor(e){e instanceof Ti&&(e={context:e});let{context:i,roundPixels:r,...n}=e||{};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(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(e){e.addBounds(this._context.bounds)}containsPoint(e){return this._context.containsPoint(e)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,i){return this.context[e](...i),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Mc(this._context.clone()):(this._ownedContext=null,new Mc(this._context))}lineStyle(e,i,r){We(je,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return e&&(n.width=e),i&&(n.color=i),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(e,i){We(je,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return e&&(r.color=e),i&&(r.alpha=i),this.context.fillStyle=r,this}endFill(){We(je,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Ti.defaultStrokeStyle.width||e.color!==Ti.defaultStrokeStyle.color||e.alpha!==Ti.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return We(je,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return We(je,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return We(je,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return We(je,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return We(je,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return We(je,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}}),pp,gp,bb=v(()=>{"use strict";pp={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));
|
|
`}},gp={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));
|
|
`}}}),mp,_p,wb=v(()=>{"use strict";mp={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;
|
|
|
|
}
|
|
`}},_p={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;
|
|
}
|
|
`}}}),ch,dh,vp,Tb=v(()=>{Xe(),an(),Ur(),la(),ca(),Lr(),Wl(),ar(),fi(),bb(),wb(),vp=class extends Wi{constructor(){let t=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=sn();ch??(ch=Hn({name:"sdf-shader",bits:[aa,Dl(e),pp,mp,dn]})),dh??(dh=zn({name:"sdf-shader",bits:[oa,Ul(e),gp,_p,fn]})),super({glProgram:dh,gpuProgram:ch,resources:{localUniforms:t,batchSamplers:Hl(e)}})}}}),yp,Sb=v(()=>{gt(),_t(),yp=class extends qe{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 We(je,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return We(je,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return We(je,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return We(je,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return We(je,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function xp(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let i=0,r=t.length;i<r;i++){let n=t[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++)e.push(String.fromCharCode(o))}else e.push(...Array.from(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}var bp=v(()=>{"use strict"}),fh,ph,Eb=v(()=>{Ie(),c(),Ca(),wl(),pt(),_t(),Da(),hh(),cp(),Kn(),Sb(),bp(),fh=class _v extends yp{constructor(e){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={..._v.defaultOptions,...e};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=ke.WHITE,r._fill.fill=null),this.applyFillAsTint=i.overrideFill;let n=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let s=Oa(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=Pi.measureFont(s),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(e){let i=xp(e).filter(x=>!this._currentChars.includes(x)).filter((x,_,T)=>T.indexOf(x)===_);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,g=0,b=!1;for(let x=0;x<i.length;x++){let _=i[x],T=Pi.measureText(_,o,n,!1);T.lineHeight=T.height;let C=p*T.width*u,F=T.height*u,k=C+d*2,N=F+d*2;if(b=!1,_!==`
|
|
`&&_!=="\r"&&_!==" "&&_!==" "&&(b=!0,g=Math.ceil(Math.max(N,g))),l+k>this._textureSize&&(h+=g,g=N,l=0,h+g>this._textureSize)){a.update();let ne=this._nextPage();n=ne.canvasAndContext.canvas,s=ne.canvasAndContext.context,a=ne.texture.source,h=0}let re=C/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:re,kerning:{}},b){this._drawGlyph(s,T,l+d,h+d,u,o);let ne=a.width*u,J=a.height*u,$=new at(l/ne*a.width,h/J*a.height,k/ne*a.width,N/J*a.height);this.chars[_].texture=new ke({source:a,frame:$}),l+=Math.ceil(k)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(i,s)}get pageTextures(){return We(je,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,i){let r=this._measureCache;for(let n=0;n<e.length;n++){let s=e[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 e=this.resolution,i=Vi.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(i.context,this._style,e);let r=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n=new ke({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(e,i,r){i.fontSize=this.baseRenderedFontSize,e.scale(r,r),e.font=Oa(i),i.fontSize=this.baseMeasurementFontSize,e.textBaseline=i.textBaseline;let n=i._stroke,s=n?.width??0;if(n&&(e.lineWidth=s,e.lineJoin=n.join,e.miterLimit=n.miterLimit,e.strokeStyle=Ua(n,e)),i._fill&&(e.fillStyle=Ua(i._fill,e)),i.dropShadow){let a=i.dropShadow,o=pe.shared.setValue(a.color).toArray(),l=a.blur*r,h=a.distance*r;e.shadowColor=`rgba(${o[0]*255},${o[1]*255},${o[2]*255},${a.alpha})`,e.shadowBlur=l,e.shadowOffsetX=Math.cos(a.angle)*h,e.shadowOffsetY=Math.sin(a.angle)*h}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,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,g=i.lineHeight*s;a.stroke&&h&&e.strokeText(o,u,d+g-p),a._fill&&e.fillText(o,u,d+g-p)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{canvasAndContext:i,texture:r}=this.pages[e];i.canvas.width=i.canvas.width,Vi.returnCanvasAndContext(i),r.destroy(!0)}this.pages=null}},fh.defaultOptions={textureSize:512,style:new $i,mipmap:!0},ph=fh});function wp(t,e,i,r){let n={width:0,height:0,offsetY:0,scale:e.fontSize/i.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};n.offsetY=i.baseLineOffset;let s=n.lines[0],a=null,o=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=b=>{let x=s.width;for(let _=0;_<l.index;_++){let T=b.positions[_];s.chars.push(b.chars[_]),s.charPositions.push(T+x)}s.width+=b.width,o=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let b=s.chars.length-1;if(r){let x=s.chars[b];for(;x===" ";)s.width-=i.chars[x].xAdvance,x=s.chars[--b]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=i.lineHeight},d=i.baseMeasurementFontSize/e.fontSize,p=e.letterSpacing*d,g=e.wordWrapWidth*d;for(let b=0;b<t.length+1;b++){let x,_=b===t.length;_||(x=t[b]);let T=i.chars[x]||i.chars[" "];if(/(?:\s)/.test(x)||x==="\r"||x===`
|
|
`||_){if(!o&&e.wordWrap&&s.width+l.width-p>g?(u(),h(l),_||s.charPositions.push(0)):(l.start=s.width,h(l),_||s.charPositions.push(0)),x==="\r"||x===`
|
|
`)s.width!==0&&u();else if(!_){let C=T.xAdvance+(T.kerning[a]||0)+p;s.width+=C,s.spaceWidth=C,s.spacesIndex.push(s.charPositions.length),s.chars.push(x)}}else{let C=T.kerning[a]||0,F=T.xAdvance+C+p;l.positions[l.index++]=l.width+C,l.chars.push(x),l.width+=F}a=x}return u(),e.align==="center"?Ab(n):e.align==="right"?Cb(n):e.align==="justify"&&Mb(n),n}function Ab(t){for(let e=0;e<t.lines.length;e++){let i=t.lines[e],r=t.width/2-i.width/2;for(let n=0;n<i.charPositions.length;n++)i.charPositions[n]+=r}}function Cb(t){for(let e=0;e<t.lines.length;e++){let i=t.lines[e],r=t.width-i.width;for(let n=0;n<i.charPositions.length;n++)i.charPositions[n]+=r}}function Mb(t){let e=t.width;for(let i=0;i<t.lines.length;i++){let r=t.lines[i],n=0,s=r.spacesIndex[n++],a=0,o=r.spacesIndex.length,l=(e-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 Tp=v(()=>{"use strict"}),Zn,Sp,Ep,Pb=v(()=>{js(),_t(),B(),Kn(),Eb(),Tp(),bp(),Zn=0,Sp=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(t,e){let i=`${e.fontFamily}-bitmap`,r=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,r=!1;else if(e._stroke||e.dropShadow){let s=e.styleKey;s=s.substring(0,s.lastIndexOf("-")),i=`${s}-bitmap`,r=!1}if(!Ht.has(i)){let s=new ph({style:e,overrideFill:r,overrideSize:!0,...this.defaultOptions});Zn++,Zn>50&&G("BitmapText",`You have dynamically created ${Zn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Zn--,Ht.remove(i)}),Ht.set(i,s)}let n=Ht.get(i);return n.ensureCharacters?.(t),n}getLayout(t,e,i=!0){let r=this.getFont(t,e);return wp([...t],e,r,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},We(je,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let r=e.style,n=r instanceof $i?r:new $i(r),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new ph({style:n,overrideFill:s,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),o=xp(e.chars);return a.ensureCharacters(o.join("")),Ht.set(`${i}-bitmap`,a),a.once("destroy",()=>Ht.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=Ht.get(e);i&&(Ht.remove(e),i.destroy())}},Ep=new Sp});function Ap(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}var gh,Rb=v(()=>{js(),te(),Lt(),fp(),Tb(),Pb(),Tp(),gh=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);Ap(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(Ue.return(e.customShader),e.customShader=null),Ue.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);Ap(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,r=Ep.getFont(t.text,t._style);i.clear(),r.distanceField.type!=="none"&&(i.customShader||(i.customShader=Ue.get(vp)));let n=Array.from(t.text),s=t._style,a=r.baseLineOffset,o=wp(n,s,r,!0),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(-t._anchor._x*d-h,-t._anchor._y*p-h).scale(u,u);let g=r.applyFillAsTint?s._fill.color:16777215;for(let b=0;b<o.lines.length;b++){let x=o.lines[b];for(let _=0;_<x.charPositions.length;_++){let T=n[l++],C=r.chars[T];C?.texture&&i.texture(C.texture,g||"black",Math.round(x.charPositions[_]+C.xOffset),Math.round(a+C.yOffset))}a+=r.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=Ue.get(La);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,r=Ht.get(`${i}-bitmap`),{a:n,b:s,c:a,d:o}=t.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/t._style.fontSize,p=u*r.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=p}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}},gh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"bitmapText"}}),Cp=v(()=>{te(),Rb(),ge.add(gh)}),mh,kb=v(()=>{te(),pt(),_l(),Lt(),Kl(),mh=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),Ue.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),r=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(s=>{console.error(s)}),t._didTextUpdate=!1;let n=t._style.padding;Hs(r.bounds,t._anchor,r.texture,n)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let r=t.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(t.text,r,t._style,t._getKey()),s=e.batchableSprite;s.texture=e.texture=n,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate();let a=t._style.padding;Hs(s.bounds,t._anchor,s.texture,a)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:ke.EMPTY,currentKey:"--",batchableSprite:Ue.get(Aa),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=ke.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},mh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"htmlText"}});function Bb(){let{userAgent:t}=ft.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var Ib=v(()=>{Ot()}),_h,vh,yh,Mp=v(()=>{"use strict";_h="http://www.w3.org/2000/svg",vh="http://www.w3.org/1999/xhtml",yh=class{constructor(){this.svgRoot=document.createElementNS(_h,"svg"),this.foreignObject=document.createElementNS(_h,"foreignObject"),this.domElement=document.createElementNS(vh,"div"),this.styleElement=document.createElementNS(vh,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:r}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(r)}}});function Gb(t){let e=t._stroke,i=t._fill,r=[`div { ${[`color: ${pe.shared.setValue(i.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${t.whiteSpace==="pre"&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?[`word-wrap: ${t.breakWords?"break-all":"break-word"}`,`max-width: ${t.wordWrapWidth}px`]:[],...e?[Rp(e)]:[],...t.dropShadow?[Pp(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return Ob(t.tagStyles,r),r.join(" ")}function Pp(t){let e=pe.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),i=Math.round(Math.cos(t.angle)*t.distance),r=Math.round(Math.sin(t.angle)*t.distance),n=`${i}px ${r}px`;return t.blur>0?`text-shadow: ${n} ${t.blur}px ${e}`:`text-shadow: ${n} ${e}`}function Rp(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${pe.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${pe.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}function Ob(t,e){for(let i in t){let r=t[i],n=[];for(let s in r)bh[s]?n.push(bh[s](r[s])):xh[s]&&n.push(xh[s].replace("{{VALUE}}",r[s]));e.push(`${i} { ${n.join(";")} }`)}}var xh,bh,Fb=v(()=>{Ie(),xh={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"},bh={fill:t=>`color: ${pe.shared.setValue(t).toHex()}`,breakWords:t=>`word-wrap: ${t?"break-all":"break-word"}`,stroke:Rp,dropShadow:Pp}}),kp,Db=v(()=>{B(),Kn(),ap(),Fb(),kp=class vv extends $i{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=np(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new vv({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=Gb(this)),this._cssStyle}addOverride(...e){let i=e.filter(r=>!this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides.push(...i),this.update())}removeOverride(...e){let i=e.filter(r=>this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!i.includes(r)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&G("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&G("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function Ub(t,e){let i=e.fontFamily,r=[],n={},s=/font-family:([^;"\s]+)/g,a=t.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 e.tagStyles){let h=e.tagStyles[l].fontFamily;o(h)}return r}var Lb=v(()=>{"use strict"});async function Nb(t){let e=await(await ft.get().fetch(t)).blob(),i=new FileReader;return await new Promise((r,n)=>{i.onloadend=()=>r(i.result),i.onerror=n,i.readAsDataURL(e)})}var Hb=v(()=>{Ot()});async function Bp(t,e){let i=await Nb(e);return`@font-face {
|
|
font-family: "${t.fontFamily}";
|
|
src: url('${i}');
|
|
font-weight: ${t.fontWeight};
|
|
font-style: ${t.fontStyle};
|
|
}`}var zb=v(()=>{Hb()});async function Wb(t,e,i){let r=t.filter(n=>Ht.has(`${n}-and-url`)).map((n,s)=>{if(!Qn.has(n)){let{url:a}=Ht.get(`${n}-and-url`);s===0?Qn.set(n,Bp({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:n},a)):Qn.set(n,Bp({fontWeight:i.fontWeight,fontStyle:i.fontStyle,fontFamily:n},a))}return Qn.get(n)});return(await Promise.all(r)).join(`
|
|
`)}var Qn,jb=v(()=>{js(),zb(),Qn=new Map});function Vb(t,e,i,r,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`<style>${e.cssStyle}</style><div style='padding:0;'>${t}</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 $b=v(()=>{"use strict"});function Xb(t,e){let i=Vi.getOptimalCanvasAndContext(t.width,t.height,e),{context:r}=i;return r.clearRect(0,0,t.width,t.height),r.drawImage(t,0,0),Vi.returnCanvasAndContext(i),i.canvas}var Yb=v(()=>{Ca()});function qb(t,e,i){return new Promise(async r=>{i&&await new Promise(n=>setTimeout(n,100)),t.onload=()=>{r()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"})}var Kb=v(()=>{"use strict"});function Zb(t,e,i,r){r=r||Ip||(Ip=new yh);let{domElement:n,styleElement:s,svgRoot:a}=r;n.innerHTML=`<style>${e.cssStyle};</style><div style='padding:0'>${t}</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=Pi.measureFont(e.fontStyle).descent,h=e.padding*2;return{width:o.width-h,height:o.height+l-h}}var Ip,Qb=v(()=>{Da(),Mp()}),Na,Jb=v(()=>{te(),jn(),sr(),Ib(),B(),Lt(),hp(),Mp(),Db(),Lb(),jb(),$b(),Yb(),Kb(),Qb(),Na=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===wi.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,r){if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].promise;let n=this._buildTexturePromise(t,e,i).then(s=>(this._activeTextures[r].texture=s,s));return this._activeTextures[r]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,i){let r=Ue.get(yh),n=Ub(t,i),s=await Wb(n,i,kp.defaultTextStyle),a=Zb(t,i,s,r),o=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),h=r.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let d=Vb(t,i,e,s,r);await qb(h,d,Bb()&&n.length>0);let p=h;this._createCanvas&&(p=Xb(h,e));let g=op(p,h.width-u,h.height-u,e);return this._createCanvas&&this._renderer.texture.initSource(g.source),Ue.return(r),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{G("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){pi.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}},Na.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"htmlText"},Na.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Gp=v(()=>{te(),kb(),Jb(),ge.add(Na),ge.add(mh)}),wh,Ha,Th=v(()=>{hn(),Dr(),Ks(),_t(),wh=class yv extends Fn{constructor(...e){let i=e[0]??{};i instanceof Float32Array&&(We(je,"use new MeshGeometry({ positions, uvs, indices }) instead"),i={positions:i,uvs:e[1],indices:e[2]}),i={...yv.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 bi({data:r,label:"attribute-mesh-positions",shrinkToFit:a,usage:et.VERTEX|et.COPY_DST}),l=new bi({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:et.VERTEX|et.COPY_DST}),h=new bi({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:et.INDEX|et.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(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}},wh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},Ha=wh}),_n,Op,za,Jn=v(()=>{"use strict";_n={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);
|
|
}
|
|
`}},Op={..._n,vertex:{..._n.vertex,header:_n.vertex.header.replace("group(1)","group(2)")}},za={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);
|
|
}
|
|
`}}}),Fp,Dp,e0=v(()=>{"use strict";Fp={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);
|
|
`}},Dp={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
|
|
|
|
`}}}),Sh,Eh,Up,t0=v(()=>{Xe(),Ur(),Jn(),Lr(),ar(),fi(),pt(),e0(),Up=class extends Wi{constructor(){Sh??(Sh=Hn({name:"tiling-sprite-shader",bits:[_n,Fp,dn]})),Eh??(Eh=zn({name:"tiling-sprite-shader",bits:[za,Dp,fn]}));let t=new ti({uMapCoord:{value:new Ae,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 Ae,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Eh,gpuProgram:Sh,resources:{localUniforms:new ti({uTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:ke.EMPTY.source,uSampler:ke.EMPTY.source.style}})}updateUniforms(t,e,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/t,i.b*o/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),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]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=r,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),Lp,i0=v(()=>{Th(),Lp=class extends Ha{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 r0(t,e){let i=t.anchor.x,r=t.anchor.y;e[0]=-i*t.width,e[1]=-r*t.height,e[2]=(1-i)*t.width,e[3]=-r*t.height,e[4]=(1-i)*t.width,e[5]=(1-r)*t.height,e[6]=-i*t.width,e[7]=(1-r)*t.height}var n0=v(()=>{"use strict"});function s0(t,e,i,r){let n=0,s=t.length/(e||2),a=r.a,o=r.b,l=r.c,h=r.d,u=r.tx,d=r.ty;for(i*=e;n<s;){let p=t[i],g=t[i+1];t[i]=a*p+l*g+u,t[i+1]=o*p+h*g+d,i+=e,n++}}var a0=v(()=>{"use strict"});function o0(t,e){let i=t.texture,r=i.frame.width,n=i.frame.height,s=0,a=0;t._applyAnchorToTexture&&(s=t.anchor.x,a=t.anchor.y),e[0]=e[6]=-s,e[2]=e[4]=1-s,e[1]=e[3]=-a,e[5]=e[7]=1-a;let o=Ae.shared;o.copyFrom(t._tileTransform.matrix),o.tx/=t.width,o.ty/=t.height,o.invert(),o.scale(t.width/r,t.height/n),s0(e,2,0,o)}var l0=v(()=>{Xe(),a0()}),es,Ah,h0=v(()=>{te(),Rl(),or(),sr(),Sa(),Yl(),Th(),t0(),i0(),n0(),l0(),es=new Lp,Ah=class{constructor(t){this._state=ji.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let r=e.canBatch;if(r&&r===i){let{batchableMesh:n}=e;if(n&&n.texture._source!==t.texture._source)return!n._batcher.checkAndUpdateTexture(n,t.texture)}return i!==r}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let r=this._getTilingSpriteData(t),{geometry:n,canBatch:s}=r;if(s){r.batchableMesh||(r.batchableMesh=new Ea);let a=r.batchableMesh;t._didTilingSpriteUpdate&&(t._didTilingSpriteUpdate=!1,this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.texture=t._texture),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),r.shader||(r.shader=new Up),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Ta(t.groupColorAlpha,i.uColor,0),this._state.blendMode=Ys(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:es,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:r}=e;t._didTilingSpriteUpdate&&this._updateBatchableMesh(t),r._batcher.updateElement(r)}else if(t._didTilingSpriteUpdate){let{shader:r}=e;r.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}t._didTilingSpriteUpdate=!1}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ha({indices:es.indices,positions:es.positions.slice(),uvs:es.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,r=t.texture.source.style;r.addressMode!=="repeat"&&(r.addressMode="repeat",r.update()),o0(t,i.uvs),r0(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,r=!0;return this._renderer.type===wi.WEBGL&&(r=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(r||i.source.isPowerOfTwo),e.canBatch}},Ah.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"tilingSprite"}}),Np=v(()=>{te(),h0(),ge.add(Ah)}),Ch,Hp,u0=v(()=>{_t(),Th(),Ch=class xv extends Ha{constructor(...e){super({});let i=e[0]??{};typeof i=="number"&&(We(je,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),i={width:i,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(i)}build(e){e={...xv.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.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,g=d/this.verticesX|0;r.push(p*l,g*h),n.push(p/a,g/o)}let u=a*o;for(let d=0;d<u;d++){let p=d%a,g=d/a|0,b=g*this.verticesX+p,x=g*this.verticesX+p+1,_=(g+1)*this.verticesX+p,T=(g+1)*this.verticesX+p+1;s.push(b,x,_,x,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()}},Ch.defaultOptions={width:100,height:100,verticesX:10,verticesY:10},Hp=Ch}),Mh,zp,c0=v(()=>{u0(),Mh=class bv extends Hp{constructor(e={}){e={...bv.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let e=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);e[9]=e[11]=e[13]=e[15]=this._topHeight*a,e[17]=e[19]=e[21]=e[23]=this.height-this._bottomHeight*a,e[25]=e[27]=e[29]=e[31]=this.height,e[2]=e[10]=e[18]=e[26]=this._leftWidth*a,e[4]=e[12]=e[20]=e[28]=this.width-this._rightWidth*a,e[6]=e[14]=e[22]=e[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let i=1/this._originalWidth,r=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}},Mh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},zp=Mh}),Ph,d0=v(()=>{te(),Lt(),Yl(),c0(),Ph=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){let i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];Ue.return(e.geometry),Ue.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=Ue.get(Ea);return e.geometry=Ue.get(zp),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._didSpriteUpdate=!0,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Ph.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"nineSliceSprite"}}),Wp=v(()=>{te(),d0(),ge.add(Ph)}),Rh,f0=v(()=>{te(),Rh=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Rh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"filter"}});function p0(t,e){return e.clear(),jp(t,e),e.isValid||e.set(0,0,0,0),t.renderGroup?e.applyMatrix(t.renderGroup.localTransform):e.applyMatrix(t.parentRenderGroup.worldTransform),e}function jp(t,e){if(t.localDisplayStatus!==7||!t.measurable)return;let i=!!t.effects.length,r=e;if((t.renderGroup||i)&&(r=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,t.worldTransform);else{if(t.renderPipeId){let s=t.bounds;r.addFrame(s.minX,s.minY,s.maxX,s.maxY,t.groupTransform)}let n=t.children;for(let s=0;s<n.length;s++)jp(n[s],r)}if(i){let n=!1;for(let s=0;s<t.effects.length;s++)t.effects[s].addBounds&&(n||(n=!0,r.applyMatrix(t.parentRenderGroup.worldTransform)),t.effects[s].addBounds(r,!0));n&&(r.applyMatrix(t.parentRenderGroup.worldTransform.copyTo(Vp).invert()),e.addBounds(r,t.relativeGroupTransform)),e.addBounds(r),S.return(r)}else t.renderGroup&&(e.addBounds(r,t.relativeGroupTransform),S.return(r))}var Vp,g0=v(()=>{Xe(),P(),Vp=new Ae});function m0(t,e){e.clear();let i=e.matrix;for(let r=0;r<t.length;r++){let n=t[r];n.globalDisplayStatus<7||(e.matrix=n.worldTransform,n.addBounds(e))}return e.matrix=i,e}var _0=v(()=>{"use strict"}),$p,kh,v0=v(()=>{te(),Xe(),jt(),Or(),Ks(),fi(),pt(),jn(),sr(),y(),g0(),_0(),B(),$p=new Fn({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])}),kh=class{constructor(t){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 zi({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.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;t.renderables?m0(t.renderables,n):t.filterEffect.filterArea?(n.clear(),n.addRect(t.filterEffect.filterArea),n.applyMatrix(t.container.worldTransform)):p0(t.container,n);let s=e.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1;for(let p=0;p<i.length;p++){let g=i[p];if(a=Math.min(a,g.resolution==="inherit"?s._resolution:g.resolution),o+=g.padding,g.antialias==="off"?l=!1:g.antialias==="inherit"&&l&&(l=s.antialias),!(g.compatibleRenderers&e.type)){u=!1;break}if(g.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){G("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=g.enabled||u,h=h||g.blendRequired}if(!u){r.skip=!0;return}let d=e.renderTarget.rootViewPort;if(n.scale(a).fitBounds(0,d.width,0,d.height).ceil().scale(1/a).pad(o|0),!n.isPositive){r.skip=!0;return}r.skip=!1,r.bounds=n,r.blendRequired=h,r.container=t.container,r.filterEffect=t.filterEffect,r.previousRenderSurface=e.renderTarget.renderSurface,r.inputTexture=pi.getOptimalTexture(n.width,n.height,a,l),e.renderTarget.bind(r.inputTexture,!0),e.globalUniforms.push({offset:n})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,r=e.bounds,n=ke.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,o=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(o,r,a)}e.backTexture=n;let s=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),s.length===1)s[0].apply(this,i,e.previousRenderSurface,!1),pi.returnTexture(i);else{let a=e.inputTexture,o=pi.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,e.previousRenderSurface,!1),pi.returnTexture(a),pi.returnTexture(o)}e.blendRequired&&pi.returnTexture(n)}getBackTexture(t,e,i){let r=t.colorTexture.source._resolution,n=pi.getOptimalTexture(e.width,e.height,r,!1),s=e.minX,a=e.minY;i&&(s-=i.minX,a-=i.minY),s=Math.floor(s*r),a=Math.floor(a*r);let o=Math.ceil(e.width*r),l=Math.ceil(e.height*r);return this.renderer.renderTarget.copyToTexture(t,n,{x:s,y:a},{width:o,height:l},{x:0,y:0}),n}applyFilter(t,e,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,g=p.uOutputFrame,b=p.uInputSize,x=p.uInputPixel,_=p.uInputClamp,T=p.uGlobalFrame,C=p.uOutputTexture;if(l){let N=this._filterStackIndex;for(;N>0;){N--;let re=this._filterStack[this._filterStackIndex-1];if(!re.skip){o.x=re.bounds.minX,o.y=re.bounds.minY;break}}g[0]=a.minX-o.x,g[1]=a.minY-o.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,b[0]=e.source.width,b[1]=e.source.height,b[2]=1/b[0],b[3]=1/b[1],x[0]=e.source.pixelWidth,x[1]=e.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],_[0]=.5*x[2],_[1]=.5*x[3],_[2]=e.frame.width*b[2]-.5*x[2],_[3]=e.frame.height*b[3]-.5*x[3];let F=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=o.x*h,T[1]=o.y*h,T[2]=F.source.width*h,T[3]=F.source.height*h;let k=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!r),i instanceof ke?(C[0]=i.frame.width,C[1]=i.frame.height):(C[0]=k.width,C[1]=k.height),C[2]=k.isRoot?-1:1,d.update(),n.renderPipes.uniformBatch){let N=n.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(N,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:$p,shader:t,state:t._state,topology:"triangle-list"}),n.type===wi.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new m,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,r=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=e.worldTransform.copyTo(Ae.shared);return n.invert(),r.prepend(n),r.scale(1/e.texture.frame.width,1/e.texture.frame.height),r.translate(e.anchor.x,e.anchor.y),r}},kh.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"filter"}}),Xp=v(()=>{te(),f0(),v0(),ge.add(kh),ge.add(Rh)}),y0={},x0=v(()=>{Lv(),Wc(),Vv(),ml(),Sl(),Ef(),Af(),dp(),Cp(),Gp(),Np(),Wp(),Xp()}),b0={},w0=v(()=>{Wc(),ml(),Sl(),Ef(),Af(),dp(),Cp(),Gp(),Np(),Wp(),Xp()}),Bh,Yp,T0=v(()=>{Un(),na(),ar(),or(),Bh=class Pc extends Wi{constructor(e){e={...Pc.defaultOptions,...e},super(e),this.enabled=!0,this._state=ji.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.addResource("uTexture",0,1)}apply(e,i,r,n){e.applyFilter(this,i,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:i,gl:r,...n}=e,s,a;return i&&(s=Nn.from(i)),r&&(a=un.from(r)),new Pc({gpuProgram:s,glProgram:a,...n})}},Bh.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1},Yp=Bh});async function S0(t){if(!t)for(let e=0;e<Wa.length;e++){let i=Wa[e];if(i.value.test()){await i.value.load();return}}}var Wa,E0=v(()=>{te(),Wa=[],ge.handleByNamedList(O.Environment,Wa)});function qp(){if(typeof ts=="boolean")return ts;try{ts=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ts=!1}return ts}var ts,Kp=v(()=>{"use strict"}),oi,is=v(()=>{"use strict";oi=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(oi||{})}),Ih,Zp=v(()=>{"use strict";Ih=class{constructor(t){this.items=[],this._name=t}emit(t,e,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](t,e,i,r,n,s,a,o);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-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}}}),Qp,Gh,rs,ja=v(()=>{Ie(),E0(),Ni(),Kp(),_t(),is(),Zp(),gt(),Qp=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],Gh=class wv extends qe{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let i=[...Qp,...this.config.runners??[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(e={}){let i=e.skipExtensionImports===!0?!0:e.manageImports===!1;await S0(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)e={...this._systemsHash[r].constructor.defaultOptions,...e};e={...wv.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(e);this._initOptions=e}render(e,i){let r=e;if(r instanceof bt&&(r={container:r},i&&(We(je,"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:pe.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(e,i,r){let n=this.view.resolution;this.view.resize(e,i,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==n&&this.runners.resolutionChange.emit(r)}clear(e={}){let i=this;e.target||(e.target=i.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=oi.ALL);let{clear:r,clearColor:n,target:s}=e;pe.shared.setValue(n??this.background.colorRgba),i.renderTarget.clear(s,r,pe.shared.toArray())}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}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(...e){e.forEach(i=>{this.runners[i]=new Ih(i)})}_addSystems(e){let i;for(i in e){let r=e[i];this._addSystem(r.value,r.name)}}_addSystem(e,i){let r=new e(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(e,i){let r=i.reduce((n,s)=>(n[s.name]=s.value,n),{});e.forEach(n=>{let s=n.value,a=n.name,o=r[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(i=>{i.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!qp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}},Gh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},rs=Gh}),Oh,A0=v(()=>{te(),Xe(),an(),Cl(),Ur(),la(),ca(),Jn(),Lr(),ar(),fi(),Oh=class{init(){let t=new ti({uTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Hn({name:"graphics",bits:[aa,Dl(sn()),Op,dn]});this.shader=new Wi({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,r=i.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(i),l=n.encoder;l.setPipelineFromGeometryProgramAndState(a.geometry,r.gpuProgram,t.state),l.setGeometry(a.geometry,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 g=d[p];if(r.groups[1]=g.bindGroup,!g.gpuBindGroup){let b=g.textures;g.bindGroup=El(b.textures,b.count),g.gpuBindGroup=n.bindGroup.getBindGroup(g.bindGroup,r.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,r.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}},Oh.extension={type:[O.WebGPUPipesAdaptor],name:"graphics"}}),Jp,eg,tg=v(()=>{"use strict";Jp={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);
|
|
`}},eg={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);
|
|
`}}}),Fh,C0=v(()=>{te(),Xe(),Ur(),Jn(),Lr(),tg(),ar(),pt(),B(),Fh=class{init(){let t=Hn({name:"mesh",bits:[_n,Jp,dn]});this._shader=new Wi({gpuProgram:t,resources:{uTexture:ke.EMPTY._source,uSampler:ke.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new Ae}}}})}execute(t,e){let i=t.renderer,r=e._shader;if(!r)r=this._shader,r.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!r.gpuProgram){G("Mesh shader has no gpuProgram",e.shader);return}let n=r.gpuProgram;if(n.autoAssignGlobalUniforms&&(r.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=t.localUniforms;r.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}i.encoder.draw({geometry:e._geometry,shader:r,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Fh.extension={type:[O.WebGPUPipesAdaptor],name:"mesh"}}),ns,Dh,M0=v(()=>{te(),or(),Cl(),ns=ji.for2d(),Dh=class{start(t,e,i){let r=t.renderer,n=r.encoder,s=i.gpuProgram;this._shader=i,this._geometry=e,n.setGeometry(e,s),ns.blendMode="normal",r.pipeline.getPipeline(e,s,ns);let a=r.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,s)}execute(t,e){let i=this._shader.gpuProgram,r=t.renderer,n=r.encoder;if(!e.bindGroup){let o=e.textures;e.bindGroup=El(o.textures,o.count)}ns.blendMode=e.blendMode;let s=r.bindGroup.getBindGroup(e.bindGroup,i,1),a=r.pipeline.getPipeline(this._geometry,i,ns);e.bindGroup._touch(r.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}},Dh.extension={type:[O.WebGPUPipesAdaptor],name:"batch"}}),Uh,P0=v(()=>{te(),Uh=class{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}},Uh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"customRender"}});function ig(t,e){let i=t.instructionSet,r=i.instructions;for(let n=0;n<i.instructionSize;n++){let s=r[n];e[s.renderPipeId].execute(s)}}var rg=v(()=>{"use strict"}),Lh,R0=v(()=>{te(),rg(),Lh=class{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),ig(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}},Lh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"renderGroup"}});function k0(t,e){let i=t.root,r=t.instructionSet;r.reset();let n=e.renderPipes?e:e.batch.renderer,s=n.renderPipes;s.batch.buildStart(r),s.blendMode.buildStart(),s.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),ng(i,r,n,!0),s.batch.buildEnd(r),s.blendMode.buildEnd(r)}function Va(t,e,i){let r=i.renderPipes?i:i.batch.renderer;t.globalDisplayStatus<7||!t.includeInBuild||(t.sortableChildren&&t.sortChildren(),t.isSimple?B0(t,e,r):ng(t,e,r,!1))}function B0(t,e,i){if(t.renderPipeId){let{renderPipes:r,renderableGC:n}=i;r.blendMode.setBlendMode(t,t.groupBlendMode,e),t.didViewUpdate=!1,r[t.renderPipeId].addRenderable(t,e),n.addRenderable(t,e)}if(!t.renderGroup){let r=t.children,n=r.length;for(let s=0;s<n;s++)Va(r[s],e,i)}}function ng(t,e,i,r){let{renderPipes:n,renderableGC:s}=i;if(!r&&t.renderGroup)n.renderGroup.addRenderGroup(t.renderGroup,e);else{for(let l=0;l<t.effects.length;l++){let h=t.effects[l];n[h.pipe].push(h,t,e)}let a=t.renderPipeId;a&&(n.blendMode.setBlendMode(t,t.groupBlendMode,e),t.didViewUpdate=!1,n[a].addRenderable(t,e),s.addRenderable(t,e));let o=t.children;if(o.length)for(let l=0;l<o.length;l++)Va(o[l],e,i);for(let l=t.effects.length-1;l>=0;l--){let h=t.effects[l];n[h.pipe].pop(h,t,e)}}}var Nh=v(()=>{"use strict"});function Hh(t,e){e||(e=0);for(let i=e;i<t.length&&t[i];i++)t[i]=null}var sg=v(()=>{"use strict"});function ag(t,e=[]){e.push(t);for(let i=0;i<t.renderGroupChildren.length;i++)ag(t.renderGroupChildren[i],e);return e}var I0=v(()=>{"use strict"});function G0(t,e,i){let r=t>>16&255,n=t>>8&255,s=t&255,a=e>>16&255,o=e>>8&255,l=e&255,h=r+(a-r)*i,u=n+(o-n)*i,d=s+(l-s)*i;return(h<<16)+(u<<8)+d}var O0=v(()=>{"use strict"});function og(t,e){return t===$a||e===$a?t+e-$a:G0(t,e,.5)}var $a,F0=v(()=>{O0(),$a=16777215});function lg(t,e=!1){D0(t);let i=t.childrenToUpdate,r=t.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===t&&u.relativeRenderGroupDepth===s&&hg(u,r,0)}Hh(o,l),a.index=0}if(e)for(let n=0;n<t.renderGroupChildren.length;n++)lg(t.renderGroupChildren[n],e)}function D0(t){let e=t.root,i;if(t.renderGroupParent){let r=t.renderGroupParent;t.worldTransform.appendFrom(e.relativeGroupTransform,r.worldTransform),t.worldColor=og(e.groupColor,r.worldColor),i=e.groupAlpha*r.worldAlpha}else t.worldTransform.copyFrom(e.localTransform),t.worldColor=e.localColor,i=e.localAlpha;i=i<0?0:i>1?1:i,t.worldAlpha=i,t.worldColorAlpha=t.worldColor+((i*255|0)<<24)}function hg(t,e,i){if(e===t.updateTick)return;t.updateTick=e,t.didChange=!1;let r=t.localTransform;t.updateLocalTransform();let n=t.parent;if(n&&!n.renderGroup?(i=i|t._updateFlags,t.relativeGroupTransform.appendFrom(r,n.relativeGroupTransform),i&zh&&ug(t,n,i)):(i=t._updateFlags,t.relativeGroupTransform.copyFrom(r),i&zh&&ug(t,cg,i)),!t.renderGroup){let s=t.children,a=s.length;for(let l=0;l<a;l++)hg(s[l],e,i);let o=t.parentRenderGroup;t.renderPipeId&&!o.structureDidChange&&o.updateRenderable(t)}}function ug(t,e,i){if(i&Cn){t.groupColor=og(t.localColor,e.groupColor);let r=t.localAlpha*e.groupAlpha;r=r<0?0:r>1?1:r,t.groupAlpha=r,t.groupColorAlpha=t.groupColor+((r*255|0)<<24)}i&ks&&(t.groupBlendMode=t.localBlendMode==="inherit"?e.groupBlendMode:t.localBlendMode),i&Jr&&(t.globalDisplayStatus=t.localDisplayStatus&e.globalDisplayStatus),t._updateFlags=0}var cg,zh,U0=v(()=>{Ni(),sg(),F0(),cg=new bt,zh=Jr|Cn|ks});function L0(t,e){let{list:i,index:r}=t.childrenRenderablesToUpdate,n=!1;for(let s=0;s<r;s++){let a=i[s];if(n=e[a.renderPipeId].validateRenderable(a),n)break}return t.structureDidChange=n,n}var N0=v(()=>{"use strict"});function H0(t){let{list:e,index:i}=t.childrenRenderablesToUpdate;for(let r=0;r<i;r++){let n=e[r];n.didViewUpdate&&t.updateRenderable(n)}Hh(e,i)}var dg,Wh,z0=v(()=>{te(),Xe(),Nh(),sg(),I0(),rg(),U0(),N0(),dg=new Ae,Wh=class{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;let i=t.parent,r=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let n=this._renderer,s=ag(t.renderGroup,[]),a=dg;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let o=n.renderPipes;for(let l=0;l<s.length;l++){let h=s[l];h.runOnRender(),h.instructionSet.renderPipes=o,h.structureDidChange?Hh(h.childrenRenderablesToUpdate.list,0):L0(h,o),lg(h),h.structureDidChange?(h.structureDidChange=!1,k0(h,n)):H0(h),h.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(h.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),ig(t.renderGroup,o),o.uniformBatch&&o.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=i,t.renderGroup.renderGroupParent=r}destroy(){this._renderer=null}},Wh.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"renderGroup"}}),jh,W0=v(()=>{te(),Lt(),Kl(),jh=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){let i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];Ue.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=Ue.get(Aa);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)Ue.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}},jh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"sprite"}}),ss,fg=v(()=>{gt(),ss="8.4.1"}),Vh,$h,pg=v(()=>{te(),fg(),Vh=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,ss)}static destroy(){}},Vh.extension=O.Application,$h=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,ss)}destroy(){this._renderer=null}},$h.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"initHook",priority:-10}}),Xa,Xh,j0=v(()=>{te(),or(),sf(),Xa=class Tv{constructor(e,i){this.state=ji.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=i,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let i=this._batchersByInstructionSet[e.uid];i||(i=this._batchersByInstructionSet[e.uid]=Object.create(null),i.default||(i.default=new da)),this._activeBatches=i,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(e,i){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(i);let r=this._activeBatches[e.batcherName];r||(r=this._activeBatches[e.batcherName]=Tv.getBatcher(e.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let i=this._activeBatches;for(let r in i){let n=i[r],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(e){let i=this._batchersByInstructionSet[e.uid];for(let r in i){let n=i[r],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let i=e.batcher,r=i.geometry,n=i.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}},Xa.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"batch"},Xa._availableBatchers=Object.create(null),Xh=Xa,ge.handleByMap(O.Batcher,Xh._availableBatchers),ge.add(da)}),gg,V0=v(()=>{gg=`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;
|
|
}
|
|
`}),mg,$0=v(()=>{mg=`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);
|
|
}
|
|
`}),Yh,X0=v(()=>{Yh=`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;
|
|
}`}),_g,Y0=v(()=>{Xe(),Un(),na(),fi(),ld(),T0(),V0(),$0(),X0(),_g=class extends Yp{constructor(t){let{sprite:e,...i}=t,r=new fl(e.texture),n=new ti({uFilterMatrix:{value:new Ae,type:"mat3x3<f32>"},uMaskClamp:{value:r.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"}}),s=Nn.from({vertex:{source:Yh,entryPoint:"mainVertex"},fragment:{source:Yh,entryPoint:"mainFragment"}}),a=un.from({vertex:mg,fragment:gg,name:"mask-filter"});super({...i,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=r}apply(t,e,i,r){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,r)}}}),vg,yg,qh,q0=v(()=>{te(),Ai(),Y0(),y(),Q(),Nh(),dd(),Lt(),pt(),jn(),sr(),vg=new m,yg=class extends Ji{constructor(){super(),this.filters=[new _g({sprite:new Ws(ke.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}},qh=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let r=this._renderer;if(r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,canBundle:!1,maskedContainer:e}),t.renderMaskToTexture){let n=t.mask;n.includeInBuild=!0,Va(n,i,r),n.includeInBuild=!1}r.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let r=Ue.get(yg);if(i){t.mask.mask.measurable=!0;let n=R(t.mask.mask,!0,vg);t.mask.mask.measurable=!1,n.ceil();let s=e.renderTarget.renderTarget.colorTexture.source,a=pi.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);e.renderTarget.push(a,!0),e.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:t.maskedContainer,filterTexture:a})}else r.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:r,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let r=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===wi.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:r.maskedContainer,filterEffect:r.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let r=this._activeMaskStage.pop();i&&pi.returnTexture(r.filterTexture),Ue.return(r.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},qh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"alphaMask"}}),Kh,K0=v(()=>{te(),Kh=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let r=this._colorStack;r[this._colorStackIndex]=r[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,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(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}},Kh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"colorMask"}}),Zh,Z0=v(()=>{te(),Nh(),is(),on(),Zh=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var r;let n=t,s=this._renderer;s.renderPipes.batch.break(i),s.renderPipes.blendMode.setBlendMode(n.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,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,Va(a,i,s),a.includeInBuild=!1,s.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,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(t,e,i){let r=t,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(t);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(t){var e;let i=this._renderer,r=i.renderTarget.renderTarget.uid,n=(e=this._maskStackHash)[r]??(e[r]=0);t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Dt.RENDERING_MASK_ADD,n),n++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(i.stencil.setStencilMode(Dt.MASK_ACTIVE,n),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),n!==0?i.stencil.setStencilMode(Dt.RENDERING_MASK_REMOVE,n):(i.renderTarget.clear(null,oi.STENCIL),i.stencil.setStencilMode(Dt.DISABLED,n)),n--):t.action==="popMaskEnd"&&(i.stencil.setStencilMode(Dt.MASK_ACTIVE,n),i.colorMask.setMask(15)),this._maskStackHash[r]=n}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}},Zh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"stencilMask"}}),Ya,xg,Q0=v(()=>{Ie(),te(),Ya=class Sv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new pe(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...Sv.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},Ya.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"background",priority:0},Ya.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},xg=Ya}),vn,Qh,J0=v(()=>{te(),Ai(),B(),vn={},ge.handle(O.BlendMode,t=>{if(!t.name)throw new Error("BlendMode extension must have a name property");vn[t.name]=t.ref},t=>{delete vn[t.name]}),Qh=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!vn[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!vn[e]){G(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new Ji,i.filters=[new vn[e]]);let r={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=r.renderables,t.add(r)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}},Qh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"blendMode"}}),qa,Ka,bg,e1=v(()=>{te(),Ni(),pt(),qa={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Ka=class Ev{constructor(e){this._renderer=e}_normalizeOptions(e,i={}){return e instanceof bt||e instanceof ke?{target:e,...i}:{...i,...e}}async image(e){let i=new Image;return i.src=await this.base64(e),i}async base64(e){e=this._normalizeOptions(e,Ev.defaultImageOptions);let{format:i,quality:r}=e,n=this.canvas(e);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)},qa[i],r)});if(n.toDataURL!==void 0)return n.toDataURL(qa[i],r);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:qa[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(e){e=this._normalizeOptions(e);let i=e.target,r=this._renderer;if(i instanceof ke)return r.texture.generateCanvas(i);let n=r.textureGenerator.generateTexture(e),s=r.texture.generateCanvas(n);return n.destroy(),s}pixels(e){e=this._normalizeOptions(e);let i=e.target,r=this._renderer,n=i instanceof ke?i:r.textureGenerator.generateTexture(e),s=r.texture.getPixels(n);return i instanceof bt&&n.destroy(),s}texture(e){return e=this._normalizeOptions(e),e.target instanceof ke?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let i=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=i.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){let i=e.width??200;e=this._normalizeOptions(e);let r=this.canvas(e),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}},Ka.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"extract"},Ka.defaultImageOptions={format:"png",quality:1},bg=Ka}),wg,t1=v(()=>{di(),pt(),wg=class Av extends ke{static create(e){return new Av({source:new Ft(e)})}resize(e,i,r){return this.source.resize(e,i,r),this}}}),Tg,Sg,Eg,Jh,i1=v(()=>{Ie(),te(),Xe(),c(),y(),ue(),Ni(),t1(),Tg=new at,Sg=new m,Eg=[0,0,0,0],Jh=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof bt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,r=t.target,n=t.clearColor;n?n=Array.isArray(n)&&n.length===4?n:pe.shared.setValue(n).toArray():n=Eg;let s=t.frame?.copyTo(Tg)||X(r,Sg).rectangle;s.width=Math.max(s.width,1/e)|0,s.height=Math.max(s.height,1/e)|0;let a=wg.create({...t.textureSourceOptions,width:s.width,height:s.height,resolution:e,antialias:i}),o=Ae.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}},Jh.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"textureGenerator"}}),eu,r1=v(()=>{te(),Xe(),jt(),Sa(),Or(),sr(),fi(),eu=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:r,offset:n}){let s=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:s,worldTransformMatrix:new Ae,worldColor:4294967295,offset:new De},o={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||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,Ta(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 zi,this._activeBindGroups.push(u),u.setResource(l,0)),o.bindGroup=u,this._currentGlobalUniformData=o}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===wi.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 Ae,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}},eu.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"globalUniforms"}}),Ag,tu,n1=v(()=>{te(),Fs(),Ag=1,tu=class{constructor(){this._tasks=[]}init(){Ci.system.add(this._update,this)}repeat(t,e){let i=Ag++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let i=this._tasks[e];if(t-i.last>=i.duration){let r=t-i.start;i.func(r),i.last=t}}}destroy(){Ci.system.remove(this._update,this),this._tasks.length=0}},tu.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"scheduler",priority:0}});function s1(t){if(!iu){if(ft.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${ss} (${t}) 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(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${ss} - ${t} - http://www.pixijs.com/`);iu=!0}}var iu,a1=v(()=>{Ot(),fg(),iu=!1}),Za,o1=v(()=>{te(),a1(),sr(),Za=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===wi.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),s1(e)}}},Za.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"hello",priority:-2},Za.defaultOptions={hello:!1}}),Qa,Cg,l1=v(()=>{te(),Qa=class Cv{constructor(e){this._managedRenderables=[],this._renderer=e}init(e){e={...Cv.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(e,i){this.enabled&&(e._lastUsed=this._now,e._lastInstructionTick===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastInstructionTick=i.tick)}run(){let e=performance.now(),i=this._managedRenderables,r=this._renderer.renderPipes,n=0;for(let s=0;s<i.length;s++){let a=i[s];if(a===null){n++;continue}let o=(a.renderGroup??a.parentRenderGroup)?.instructionSet?.tick??-1;a._lastInstructionTick!==o&&e-a._lastUsed>this.maxUnusedTime?(a.destroyed||r[a.renderPipeId].destroyRenderable(a),a._lastInstructionTick=-1,n++,a.off("destroyed",this._removeRenderable,this)):i[s-n]=a}i.length=i.length-n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}_removeRenderable(e){let i=this._managedRenderables.indexOf(e);i>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[i]=null)}},Qa.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"renderableGC"},Qa.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},Cg=Qa}),Ja,Mg,h1=v(()=>{te(),Ja=class Mv{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(e){e={...Mv.defaultOptions,...e},this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=e.textureGCAMaxIdle??e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let i=0;i<e.length;i++){let r=e[i];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}},Ja.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"textureGC"},Ja.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600},Mg=Ja}),ru,eo,Pg=v(()=>{yt(),di(),pt(),ru=class Pv{constructor(e={}){if(this.uid=ht("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...Pv.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let i=0;i<e.colorTextures;i++)this.colorTextures.push(new Ft({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}))}else{this.colorTextures=[...e.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),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof ke||e.depthStencilTexture instanceof Ft?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}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(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Ft({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,i,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(e,i,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,i,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},ru.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},eo=ru});function Rg(t,e){if(!yn.has(t)){let i=new ke({source:new nr({resource:t,...e})}),r=()=>{yn.get(t)===i&&yn.delete(t)};i.once("destroy",r),i.source.once("destroy",r),yn.set(t,i)}return yn.get(t)}var yn,kg=v(()=>{In(),pt(),yn=new Map}),to,Bg,u1=v(()=>{Ot(),te(),c(),_t(),Pg(),kg(),to=class Rv{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Rv.defaultOptions,...e},e.view&&(We(je,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new at(0,0,e.width,e.height),this.canvas=e.canvas||ft.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Rg(this.canvas,e),this.renderTarget=new eo({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,i,r){this.texture.source.resize(e,i,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},to.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"view",priority:0},to.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},Bg=to}),nu,su,Ig=v(()=>{P0(),R0(),z0(),W0(),pg(),j0(),q0(),K0(),Z0(),Q0(),J0(),e1(),i1(),r1(),n1(),o1(),l1(),h1(),u1(),nu=[xg,eu,Za,Bg,Wh,Mg,Jh,bg,$h,Cg,tu],su=[Qh,Xh,jh,Lh,qh,Zh,Kh,Uh]}),au,c1=v(()=>{te(),au=class{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let r=this._gpu.device,n=e.layout[i],s=[],a=this._renderer;for(let h in n){let u=t.resources[h]??t.resources[n[h]],d;if(u._resourceType==="uniformGroup"){let p=u;a.ubo.updateUniformGroup(p);let g=p.buffer;d={buffer:a.buffer.getGPUBuffer(g),offset:0,size:g.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(e).bindGroups[i],l=r.createBindGroup({layout:o,entries:s});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}},au.extension={type:[O.WebGPUSystem],name:"bindGroup"}}),ou,d1=v(()=>{te(),Ad(),ou=class{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Pl(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}},ou.extension={type:[O.WebGPUSystem],name:"buffer"}}),lu,f1=v(()=>{te(),lu=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}},lu.extension={type:[O.WebGPUSystem],name:"colorMask"}}),io,p1=v(()=>{Ot(),te(),io=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await ft.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),r=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:r}}destroy(){this.gpu=null,this._renderer=null}},io.extension={type:[O.WebGPUSystem],name:"device"},io.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),hu,g1=v(()=>{te(),hu=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,r){let n=this._renderer.pipeline.getPipeline(t,e,i,r);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let r=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,r)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let r in i)this._setVertexBuffer(r,t.attributes[i[r]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let r=t.groups[i];e||this._syncBindGroup(r),this.setBindGroup(i,r,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:r,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,r,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(s||e.indexBuffer.data.length,o||e.instanceCount,a||0):this.renderPassEncoder.draw(s||e.getSize(),o||e.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 t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=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(e);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 t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=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(t){this._gpu=t}},hu.extension={type:[O.WebGPUSystem],name:"encoder",priority:1}}),uu,m1=v(()=>{te(),on(),uu=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Dt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let r=this._renderer;r.pipeline.setStencilMode(t),r.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},uu.extension={type:[O.WebGPUSystem],name:"stencil"}}),cu,Gg=v(()=>{Kp(),hn(),Dr(),cu=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!qp())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new bi({data:new Float32Array(e.layout.size/4),usage:et.UNIFORM|et.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let r=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(r),s=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[e]={layout:n,syncFunction:s}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let r=this.getUniformGroupData(t);return t.buffer||(t.buffer=new bi({data:new Float32Array(r.layout.size/4),usage:et.UNIFORM|et.COPY_DST})),e||(e=t.buffer.data),i||(i=0),r.syncFunction(t.uniforms,e,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function _1(t){let e=t.map(r=>({data:r,offset:0,size:0})),i=0;for(let r=0;r<e.length;r++){let n=e[r],s=as[n.data.type].size,a=as[n.data.type].align;if(!as[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:e,size:i}}var as,Og=v(()=>{"use strict";as={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}}}),Tr,Fg=v(()=>{"use strict";Tr=[{type:"mat3x3<f32>",test:t=>t.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:t=>t.type==="vec4<f32>"&&t.size===1&&t.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:t=>t.type==="vec2<f32>"&&t.size===1&&t.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:t=>t.type==="vec4<f32>"&&t.size===1&&t.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:t=>t.type==="vec3<f32>"&&t.size===1&&t.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 Dg(t,e,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<t.length;o++){let l=t[o],h=l.data.name,u=!1,d=0;for(let p=0;p<Tr.length;p++)if(Tr[p].test(l.data)){d=l.offset/4,n.push(`name = "${h}";`,`offset += ${d-s};`,Tr[p][e]||Tr[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 Ug=v(()=>{Fg()});function xn(t,e){return`
|
|
for (let i = 0; i < ${t*e}; i++) {
|
|
data[offset + (((i / ${t})|0) * 4) + (i % ${t})] = v[i];
|
|
}
|
|
`}var du,Lg,Ng=v(()=>{"use strict";du={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>":xn(3,2),"mat4x2<f32>":xn(4,2),"mat2x3<f32>":xn(2,3),"mat4x3<f32>":xn(4,3),"mat2x4<f32>":xn(2,4),"mat3x4<f32>":xn(3,4)},Lg={...du,"mat2x2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 3] = v[3];
|
|
`}});function v1(t,e){let{size:i,align:r}=as[t.data.type],n=(r-i)/4;return`
|
|
v = uv.${t.data.name};
|
|
${e!==0?`offset += ${e};`:""}
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${t.data.size*(i/4)}; i++)
|
|
{
|
|
for(var j = 0; j < ${i/4}; j++)
|
|
{
|
|
data[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var y1=v(()=>{Og()});function x1(t){return Dg(t,"uboWgsl",v1,Lg)}var b1=v(()=>{Ug(),Ng(),y1()}),fu,w1=v(()=>{te(),Gg(),Og(),b1(),fu=class extends cu{constructor(){super({createUboElements:_1,generateUboSync:x1})}},fu.extension={type:[O.WebGPUSystem],name:"ubo"}}),ro,pu=v(()=>{gt(),yt(),ro=class extends qe{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ht("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ht("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ht("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),Hg,T1=v(()=>{"use strict";Hg=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*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,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}}),lr,gu,S1=v(()=>{te(),hn(),pu(),Dr(),T1(),Or(),lr=128,gu=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new Hg({minUniformOffsetAlignment:lr});let e=256/lr;for(let i=0;i<e;i++){let r=et.UNIFORM|et.COPY_DST;i===0&&(r|=et.COPY_SRC),this._buffers.push(new bi({data:this._batchBuffer.data,usage:r}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let i=t.buffer.data,r=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,r/4),this._bindGroupHash[t.uid]=this._getBindGroup(r/lr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/lr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/lr)}getArrayBufferResource(t){let e=this._batchBuffer.addGroup(t)/lr;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new ro({buffer:e,offset:(t/2|0)*256,size:lr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new zi({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let i=this._renderer.gpu.device.createCommandEncoder();for(let r=1;r<this._buffers.length;r++){let n=this._buffers[r];i.copyBufferToBuffer(t.getGPUBuffer(e),lr,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}},gu.extension={type:[O.WebGPUPipes],name:"uniformBatch"}});function zg(t,e){for(let i in t.attributes){let r=t.attributes[i],n=e[i];n?(r.format??(r.format=n.format),r.offset??(r.offset=n.offset),r.instance??(r.instance=n.instance)):G(`Attribute ${i} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}E1(t)}function E1(t){let{buffers:e,attributes:i}=t,r={},n={};for(let s in e){let a=e[s];r[a.uid]=0,n[a.uid]=0}for(let s in i){let a=i[s];r[a.buffer.uid]+=Ln(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]+=Ln(a.format).stride}}var Wg=v(()=>{B(),ia()}),Sr,jg=v(()=>{on(),Sr=[],Sr[Dt.NONE]=void 0,Sr[Dt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Sr[Dt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Sr[Dt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Sr[Dt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}}});function A1(t,e,i,r,n){return t<<24|e<<16|i<<10|r<<5|n}function C1(t,e,i,r){return i<<6|t<<3|r<<1|e}var Vg,mu,M1=v(()=>{te(),B(),Wg(),on(),Qs(),jg(),Vg={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},mu=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Dt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Sr[t],this._updatePipeHash())}setPipeline(t,e,i,r){let n=this.getPipeline(t,e,i);r.setPipeline(n)}getPipeline(t,e,i,r){t._layoutKey||(zg(t,e.attributeData),this._generateBufferKey(t)),r=r||t.topology;let n=A1(t._layoutKey,e._layoutKey,i.data,i._blendModeId,Vg[r]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,i,r),this._pipeCache[n])}_createPipeline(t,e,i,r){let n=this._gpu.device,s=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Dt.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.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(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,r=Object.keys(t.attributes).sort();for(let s=0;s<r.length;s++){let a=t.attributes[r[s]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}let n=e.join("|");return t._layoutKey=Dn(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],i=0,r=Object.keys(t.attributeData).sort();for(let s=0;s<r.length;s++){let a=t.attributeData[r[s]];e[i++]=a.location}let n=e.join("|");return t._attributeLocationsKey=Dn(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];let r=this._createVertexBufferLayouts(t,e),n=Object.create(null),s=e.attributeData;for(let a=0;a<r.length;a++)for(let o in s)if(s[o].location===a){n[a]=o;break}return this._bindingNamesCache[i]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];let r=[];return t.buffers.forEach(n=>{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in e.attributeData){let l=t.attributes[o];(l.divisor??1)!==1&&G(`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:e.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&r.push(s)}),this._bufferLayoutsCache[i]=r,r}_updatePipeHash(){let t=C1(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},mu.extension={type:[O.WebGPUSystem],name:"pipeline"}});function P1(t,e,i,r,n,s){let a=s?1:-1;return t.identity(),t.a=1/r*2,t.d=a*(1/n*2),t.tx=-1-e*t.a,t.ty=-a-i*t.d,t}var R1=v(()=>{"use strict"});function k1(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var B1=v(()=>{"use strict"}),_u,$g=v(()=>{Xe(),c(),is(),R1(),Zp(),In(),di(),pt(),kg(),B1(),Pg(),_u=class{constructor(t){this.rootViewPort=new at,this.viewport=new at,this.onRenderTargetChange=new Ih("onRenderTargetChange"),this.projectionMatrix=new Ae,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:r}){this._renderTargetStack.length=0,this.push(t,e,i,r),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=k1(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,r){let n=this.getRenderTarget(t),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;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&&t instanceof ke&&(r=t.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 P1(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,i,l),s&&this.onRenderTargetChange.emit(n),n}clear(t,e=oi.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=oi.ALL,i,r){let n=this.bind(t,e,i,r);return this._renderTargetStack.push({renderTarget:n,frame:r}),n}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,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}=t;return r.width=Math.min(r.width,s-i.x),r.height=Math.min(r.height,a-i.y),this.adaptor.copyToTexture(t,e,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((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return nr.test(t)&&(t=Rg(t).source),t instanceof eo?e=t:t instanceof Ft&&(e=new eo({colorTextures:[t]}),nr.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}}),Xg,I1=v(()=>{"use strict";Xg=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),Yg,G1=v(()=>{is(),In(),di(),I1(),Yg=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,r,n){let s=this._renderer,a=this._getGpuColorTexture(t),o=s.texture.getGpuSource(e.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:o,origin:n},r),e}startRenderPass(t,e=!0,i,r){let n=this._renderTargetSystem.getGpuRenderTarget(t),s=this.getDescriptor(t,e,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(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?oi.ALL:oi.NONE);let r=this._renderTargetSystem,n=r.getGpuRenderTarget(t),s=t.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=e&oi.COLOR?"clear":"load";return i??(i=r.defaultClearColor),{view:u,resolveTarget:d,clearValue:i,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){let o=e&oi.STENCIL?"clear":"load",l=e&oi.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(t,e=!0,i,r){if(!e)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(t,e,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(t,e,i,r)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Xg;return t.colorTextures.forEach((i,r)=>{if(nr.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)}e.contexts[r]=n}if(e.msaa=i.source.antialias,i.source.antialias){let n=new Ft({width:0,height:0,sampleCount:4});e.msaaTextures[r]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,r)=>{e.msaaTextures[r]?.resize(i.source.width,i.source.height,i.source._resolution)})}}}),vu,O1=v(()=>{te(),$g(),G1(),vu=class extends _u{constructor(t){super(t),this.adaptor=new Yg,this.adaptor.init(t,this)}},vu.extension={type:[O.WebGPUSystem],name:"renderTarget"}}),yu,F1=v(()=>{te(),yu=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),r={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(r)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},yu.extension={type:[O.WebGPUSystem],name:"shader"}}),ii,D1=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"}}}),xu,U1=v(()=>{te(),or(),D1(),xu=class{constructor(){this.defaultState=new ji,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:ii[t.blendMode]||ii.normal}]}destroy(){this.gpu=null}},xu.extension={type:[O.WebGPUSystem],name:"state"}}),qg,L1=v(()=>{"use strict";qg={type:"image",upload(t,e,i){let r=t.resource,n=(t.pixelWidth|0)*(t.pixelHeight|0),s=r.byteLength/n;i.device.queue.writeTexture({texture:e},r,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*s},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}}),bu,Kg,Zg,N1=v(()=>{"use strict";bu={"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}},Kg={blockBytes:4,blockWidth:1,blockHeight:1},Zg={type:"compressed",upload(t,e,i){let r=t.pixelWidth,n=t.pixelHeight,s=bu[t.format]||Kg;for(let a=0;a<t.resource.length;a++){let o=t.resource[a],l=Math.ceil(r/s.blockWidth)*s.blockBytes;i.device.queue.writeTexture({texture:e,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)}}}}),wu,Qg=v(()=>{"use strict";wu={type:"image",upload(t,e,i){let r=t.resource;if(!r)return;let n=Math.min(e.width,t.resourceWidth||t.pixelWidth),s=Math.min(e.height,t.resourceHeight||t.pixelHeight),a=t.alphaMode==="premultiply-alpha-on-upload";i.device.queue.copyExternalImageToTexture({source:r},{texture:e,premultipliedAlpha:a},{width:n,height:s})}}}),Jg,H1=v(()=>{Qg(),Jg={type:"video",upload(t,e,i){wu.upload(t,e,i)}}}),em,z1=v(()=>{"use strict";em=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(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);
|
|
}
|
|
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,r=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:r},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let o=0;o<r;++o){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),h=n?1:0;for(let u=1;u<t.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}}]}),g=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});p.setPipeline(e),p.setBindGroup(0,g),p.draw(3,1,0,0),p.end(),l=d}}if(!n){let o={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:r};for(let l=1;l<t.mipLevelCount;++l)s.copyTextureToTexture({texture:i,mipLevel:l-1},{texture:t,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(),t}}}),Tu,W1=v(()=>{Ot(),te(),fi(),Ca(),Or(),L1(),N1(),Qg(),H1(),z1(),Tu=class{constructor(t){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:wu,buffer:qg,video:Jg,compressed:Zg},this._renderer=t}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let o=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(o))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=bu[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},r=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,n=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,s={label:t.label,size:{width:r,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(s);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new em(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new zi({0:e,1:e.style,2:new ti({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),r=ft.get().createCanvas();r.width=t.source.pixelWidth,r.height=t.source.pixelHeight;let n=r.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:ft.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:r.width,height:r.height}),e.gpu.device.queue.submit([i.finish()]),r}getPixels(t){let e=this.generateCanvas(t),i=Vi.getOptimalCanvasAndContext(e.width,e.height),r=i.context;r.drawImage(e,0,0);let{width:n,height:s}=e,a=r.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return Vi.returnCanvasAndContext(i),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},Tu.extension={type:[O.WebGPUSystem],name:"texture"}}),tm={};ze(tm,{WebGPURenderer:()=>sm});var im,rm,nm,Su,Eu,Au,sm,j1=v(()=>{te(),A0(),C0(),M0(),ja(),Ig(),sr(),c1(),d1(),f1(),p1(),g1(),m1(),w1(),S1(),M1(),O1(),F1(),U1(),W1(),im=[...nu,fu,hu,io,ou,Tu,vu,yu,xu,mu,lu,uu,au],rm=[...su,gu],nm=[Dh,Fh,Oh],Su=[],Eu=[],Au=[],ge.handleByNamedList(O.WebGPUSystem,Su),ge.handleByNamedList(O.WebGPUPipes,Eu),ge.handleByNamedList(O.WebGPUPipesAdaptor,Au),ge.add(...im,...rm,...nm),sm=class extends rs{constructor(){let t={name:"webgpu",type:wi.WEBGPU,systems:Su,renderPipes:Eu,renderPipeAdaptors:Au};super(t)}}}),Cu,V1=v(()=>{te(),Xe(),an(),Ur(),la(),ca(),Jn(),Lr(),Wl(),ar(),fi(),Cu=class{init(){let t=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new Ae,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=sn(),i=zn({name:"graphics",bits:[oa,Ul(e),za,fn]});this.shader=new Wi({glProgram:i,resources:{localUniforms:t,batchSamplers:Hl(e)}})}execute(t,e){let i=e.context,r=i.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(i);r.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(r),n.geometry.bind(a.geometry,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}},Cu.extension={type:[O.WebGLPipesAdaptor],name:"graphics"}}),Mu,$1=v(()=>{te(),Xe(),Ur(),Jn(),Lr(),tg(),ar(),pt(),B(),Mu=class{init(){let t=zn({name:"mesh",bits:[za,eg,fn]});this._shader=new Wi({glProgram:t,resources:{uTexture:ke.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new Ae}}}})}execute(t,e){let i=t.renderer,r=e._shader;if(r){if(!r.glProgram){G("Mesh shader has no glProgram",e.shader);return}}else{r=this._shader;let n=e.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]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:r,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Mu.extension={type:[O.WebGLPipesAdaptor],name:"mesh"}}),Pu,X1=v(()=>{te(),or(),Pu=class{constructor(){this._didUpload=!1,this._tempState=ji.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,i){let r=t.renderer;r.shader.bind(i,this._didUpload),r.shader.updateUniformGroup(r.globalUniforms.uniformGroup),r.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let r=e.textures.textures;for(let n=0;n<e.textures.count;n++)i.texture.bind(r[n],n);i.geometry.draw("triangle-list",e.size,e.start)}},Pu.extension={type:[O.WebGLPipesAdaptor],name:"batch"}}),os,Y1=v(()=>{"use strict";os=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(os||{})}),am,q1=v(()=>{"use strict";am=class{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}}),Ru,K1=v(()=>{te(),Dr(),Y1(),q1(),Ru=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t}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(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;if(this._boundBufferBases[e]!==t){let r=this.getGlBuffer(t);this._boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,r.buffer)}}bindBufferRange(t,e,i){let{_gl:r}=this;i=i||0;let n=this.getGlBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let r=t.data;if(i.byteLength>=t.data.byteLength)e.bufferSubData(i.type,0,r,0,t._updateSize/r.BYTES_PER_ELEMENT);else{let n=t.descriptor.usage&et.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=r.byteLength,e.bufferData(i.type,r,n)}return i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],r=this._gl;e||r.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=os.ARRAY_BUFFER;t.descriptor.usage&et.INDEX?i=os.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&et.UNIFORM&&(i=os.UNIFORM_BUFFER);let r=new am(e.createBuffer(),i);return this._gpuBuffers[t.uid]=r,t.on("destroy",this.onBufferDestroy,this),r}},Ru.extension={type:[O.WebGLSystem],name:"buffer"}}),no,om,Z1=v(()=>{Ot(),te(),B(),no=class kv{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,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(e){this.gl=e,this._renderer.gl=e}init(e){e={...kv.defaultOptions,...e};let i=this.multiView=e.multiView;if(e.context&&i&&(G("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),i=!1),i?this.canvas=ft.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let r=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:r,premultipliedAlpha:n,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&G("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:i}=this;(i.width<e.width||i.height<e.height)&&(i.width=Math.max(e.width,e.width),i.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof ft.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);let i=this._renderer.view.canvas;i.addEventListener("webglcontextlost",this.handleContextLost,!1),i.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,i){let r,n=this.canvas;if(e===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:e}=this,i={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...i,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...i,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};let r=e.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.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 e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let i=e.getContextAttributes();i&&!i.stencil&&G("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||G("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},no.extension={type:[O.WebGLSystem],name:"context"},no.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1},om=no}),so,ku,Ze,lm=v(()=>{"use strict";so=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(so||{}),ku=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(ku||{}),Ze=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(Ze||{})});function Q1(t){return Bu[t]??Bu.float32}var Bu,J1=v(()=>{lm(),Bu={uint8x2:Ze.UNSIGNED_BYTE,uint8x4:Ze.UNSIGNED_BYTE,sint8x2:Ze.BYTE,sint8x4:Ze.BYTE,unorm8x2:Ze.UNSIGNED_BYTE,unorm8x4:Ze.UNSIGNED_BYTE,snorm8x2:Ze.BYTE,snorm8x4:Ze.BYTE,uint16x2:Ze.UNSIGNED_SHORT,uint16x4:Ze.UNSIGNED_SHORT,sint16x2:Ze.SHORT,sint16x4:Ze.SHORT,unorm16x2:Ze.UNSIGNED_SHORT,unorm16x4:Ze.UNSIGNED_SHORT,snorm16x2:Ze.SHORT,snorm16x4:Ze.SHORT,float16x2:Ze.HALF_FLOAT,float16x4:Ze.HALF_FLOAT,float32:Ze.FLOAT,float32x2:Ze.FLOAT,float32x3:Ze.FLOAT,float32x4:Ze.FLOAT,uint32:Ze.UNSIGNED_INT,uint32x2:Ze.UNSIGNED_INT,uint32x3:Ze.UNSIGNED_INT,uint32x4:Ze.UNSIGNED_INT,sint32:Ze.INT,sint32x2:Ze.INT,sint32x3:Ze.INT,sint32x4:Ze.INT}}),hm,Iu,ew=v(()=>{te(),ia(),Wg(),J1(),hm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Iu=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){let t=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 e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=r=>e.bindVertexArrayOES(r),t.deleteVertexArray=r=>e.deleteVertexArrayOES(r));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(r,n,s,a)=>{i.drawArraysInstancedANGLE(r,n,s,a)},t.drawElementsInstanced=(r,n,s,a,o)=>{i.drawElementsInstancedANGLE(r,n,s,a,o)},t.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let r=this.getVao(t,e);this._activeVao!==r&&(this._activeVao=r,i.bindVertexArray(r)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){let r=t.buffers[i];e.updateBuffer(r)}}checkCompatibility(t,e){let i=t.attributes,r=e._attributeData;for(let n in r)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){let i=t.attributes,r=e._attributeData,n=["g",t.uid];for(let s in i)r[s]&&n.push(s,r[s].location);return n.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){let r=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let s=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],o=a[s];if(o)return a[e._key]=o,o;zg(t,e._attributeData);let l=t.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(t,e),a[e._key]=o,a[s]=o,r.bindVertexArray(null),o}onGeometryDestroy(t,e){let i=this._geometryVaoHash[t.uid],r=this.gl;if(i){if(e)for(let n in i)this._activeVao!==i[n]&&this.unbind(),r.deleteVertexArray(i[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let i in this._geometryVaoHash){if(t)for(let r in this._geometryVaoHash[i]){let n=this._geometryVaoHash[i];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[r])}this._geometryVaoHash[i]=null}}activateVao(t,e){let i=this._renderer.gl,r=this._renderer.buffer,n=t.attributes;t.indexBuffer&&r.bind(t.indexBuffer);let s=null;for(let a in n){let o=n[a],l=o.buffer,h=r.getGlBuffer(l),u=e._attributeData[a];if(u){s!==h&&(r.bind(l),s=h);let d=u.location;i.enableVertexAttribArray(d);let p=Ln(o.format),g=Q1(o.format);if(u.format?.substring(1,4)==="int"?i.vertexAttribIPointer(d,p.size,g,o.stride,o.offset):i.vertexAttribPointer(d,p.size,g,p.normalised,o.stride,o.offset),o.instance)if(this.hasInstance){let b=o.divisor??1;i.vertexAttribDivisor(d,b)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,r){let{gl:n}=this._renderer,s=this._activeGeometry,a=hm[s.topology||t];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,e||s.indexBuffer.data.length,l,(i||0)*o,r):n.drawElements(a,e||s.indexBuffer.data.length,l,(i||0)*o)}else r>1?n.drawArraysInstanced(a,i||0,e||s.getSize(),r):n.drawArrays(a,i||0,e||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}},Iu.extension={type:[O.WebGLSystem],name:"geometry"}}),um,ao,cm,tw=v(()=>{te(),B(),Ks(),ar(),or(),di(),pt(),Un(),um=new Fn({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ao=class Bv{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:i,antialias:r}={...Bv.defaultOptions,...e};this.useBackBuffer=i,this._antialias=r,this._renderer.context.supports.msaa||(G("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=ji.for2d();let n=new un({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 Wi({glProgram:n,resources:{uTexture:ke.WHITE.source}})}renderStart(e){let i=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!i.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=r.colorTexture,e.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:um,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new ke({source:new Ft({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},ao.extension={type:[O.WebGLSystem],name:"backBuffer",priority:1},ao.defaultOptions={useBackBuffer:!1},cm=ao}),Gu,iw=v(()=>{te(),Gu=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}},Gu.extension={type:[O.WebGLSystem],name:"colorMask"}}),Ou,rw=v(()=>{te(),Ou=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:i,shader:r,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=t;e.shader.bind(r,s),e.geometry.bind(i,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,o,l,h??i.instanceCount)}destroy(){this._renderer=null}},Ou.extension={type:[O.WebGLSystem],name:"encoder"}}),Fu,nw=v(()=>{te(),jg(),on(),Fu=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Dt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Dt.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Dt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],r=this._gl,n=Sr[t],s=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===Dt.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)),(t!==s.stencilMode||s.stencilReference!==e)&&(s.stencilMode=t,s.stencilReference=e,r.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),r.stencilOp(r.KEEP,r.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Fu.extension={type:[O.WebGLSystem],name:"stencil"}});function sw(t){let e=t.map(s=>({data:s,offset:0,size:0})),i=0,r=0,n=0;for(let s=0;s<e.length;s++){let a=e[s];if(i=Du[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:e,size:n}}var Du,dm=v(()=>{"use strict";Du={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function aw(t,e){let i=Math.max(Du[t.data.type]/16,1),r=t.data.value.length/t.data.size,n=(4-r%4)%4;return`
|
|
v = uv.${t.data.name};
|
|
offset += ${e};
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${t.data.size*i}; i++)
|
|
{
|
|
for(var j = 0; j < ${r}; j++)
|
|
{
|
|
data[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var ow=v(()=>{dm()});function lw(t){return Dg(t,"uboStd40",aw,du)}var hw=v(()=>{Ug(),Ng(),ow()}),Uu,uw=v(()=>{te(),Gg(),dm(),hw(),Uu=class extends cu{constructor(){super({createUboElements:sw,generateUboSync:lw})}},Uu.extension={type:[O.WebGLSystem],name:"ubo"}}),fm,cw=v(()=>{"use strict";fm=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),pm,dw=v(()=>{c(),B(),In(),is(),cw(),pm=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new at}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new at}copyToTexture(t,e,i,r,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,i.x,i.y,r.width,r.height),e}startRenderPass(t,e=!0,i,r){let n=this._renderTargetSystem,s=t.colorTexture,a=n.getGpuRenderTarget(t),o=r.y;t.isRoot&&(o=s.pixelHeight-r.height),t.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&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;let i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,e.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,e.framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){let e=this._renderer.gl,i=new fm,r=t.colorTexture;return nr.test(r.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),i.framebuffer=null,i):(this._initColor(t,i),e.bindFramebuffer(e.FRAMEBUFFER,null),i)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let r=this._renderTargetSystem;typeof e=="boolean"&&(e=e?oi.ALL:oi.NONE);let n=this._renderer.gl;if(e&oi.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(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){let i=this._renderer,r=i.gl,n=r.createFramebuffer();if(e.resolveTargetFramebuffer=n,r.bindFramebuffer(r.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(i.context.supports.msaa?e.msaa=!0:G("[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)}),e.msaa){let s=r.createFramebuffer();e.framebuffer=s,r.bindFramebuffer(r.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=r.createRenderbuffer();e.msaaRenderBuffer[o]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){let i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((r,n)=>{n!==0&&r.source.resize(i.width,i.height,i._resolution)}),e.msaa){let r=this._renderer,n=r.gl,s=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=a.source;r.texture.bindSource(l,0);let h=r.texture.getGlSource(l).internalFormat,u=e.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(t){if(t.framebuffer===null)return;let e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}postrender(t){if(this._renderer.context.multiView&&nr.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}}),Lu,fw=v(()=>{te(),$g(),dw(),Lu=class extends _u{constructor(t){super(t),this.adaptor=new pm,this.adaptor.init(t,this)}},Lu.extension={type:[O.WebGLSystem],name:"renderTarget"}});function pw(t,e){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=e._getProgramData(t.glProgram);for(let h in t.groups){let u=t.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 ro)i.push(`
|
|
sS.bindUniformBlock(
|
|
resources[${d}],
|
|
sS._uniformBindMap[${h}[${d}],
|
|
${s++}
|
|
);
|
|
`);else if(p instanceof Ft){let g=t._uniformBindMap[h][d],b=o.uniformData[g];b&&(n||(n=!0,r.push(`
|
|
var tS = r.texture;
|
|
`)),e._gl.uniform1i(b.location,a),i.push(`
|
|
tS.bind(resources[${d}], ${a});
|
|
`),a++)}}}let l=[...r,...i].join(`
|
|
`);return new Function("r","s","sD",l)}var gw=v(()=>{pu(),fi(),di()}),gm,mw=v(()=>{"use strict";gm=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function mm(t,e,i){let r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}var _w=v(()=>{"use strict"});function Nu(t){let e=new Array(t);for(let i=0;i<e.length;i++)e[i]=!1;return e}function _m(t,e){switch(t){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Nu(2*e);case"bvec3":return Nu(3*e);case"bvec4":return Nu(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var vm=v(()=>{"use strict"});function ym(t,e){if(!ls){let i=Object.keys(Hu);ls={};for(let r=0;r<i.length;++r){let n=i[r];ls[t[n]]=Hu[n]}}return ls[e]}function vw(t,e){let i=ym(t,e);return xm[i]||"float32"}var ls,Hu,xm,bm=v(()=>{"use strict";ls=null,Hu={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"},xm={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 yw(t,e,i=!1){let r={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<n;a++){let o=e.getActiveAttrib(t,a);if(o.name.startsWith("gl_"))continue;let l=vw(e,o.type);r[o.name]={location:0,format:l,stride:Ln(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,e.bindAttribLocation(t,a,s[a]);e.linkProgram(t)}else for(let a=0;a<s.length;a++)r[s[a]].location=e.getAttribLocation(t,s[a]);return r}var xw=v(()=>{ia(),bm()});function bw(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};let i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n<r;n++){let s=e.getActiveUniformBlockName(t,n),a=e.getUniformBlockIndex(t,s),o=e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_DATA_SIZE);i[s]={name:s,index:a,size:o}}return i}var ww=v(()=>{"use strict"});function Tw(t,e){let i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<r;n++){let s=e.getActiveUniform(t,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),l=ym(e,s.type);i[a]={name:a,index:n,type:l,size:s.size,isArray:o,value:_m(l,s.size)}}return i}var Sw=v(()=>{vm(),bm()});function wm(t,e){let i=t.getShaderSource(e).split(`
|
|
`).map((h,u)=>`${u}: ${h}`),r=t.getShaderInfoLog(e),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 Ew(t,e,i,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||wm(t,i),t.getShaderParameter(r,t.COMPILE_STATUS)||wm(t,r),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var Aw=v(()=>{"use strict"});function Cw(t,e){let i=mm(t,t.VERTEX_SHADER,e.vertex),r=mm(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,i),t.attachShader(n,r);let s=e.transformFeedbackVaryings;s&&(typeof t.transformFeedbackVaryings!="function"?G("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||Ew(t,n,i,r),e._attributeData=yw(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=Tw(n,t),e._uniformBlockData=bw(n,t),t.deleteShader(i),t.deleteShader(r);let a={};for(let o in e._uniformData){let l=e._uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:_m(l.type,l.size)}}return new gm(n,a)}var Mw=v(()=>{B(),mw(),_w(),vm(),xw(),ww(),Sw(),Aw()}),hs,zu,Pw=v(()=>{te(),an(),gw(),Mw(),hs={textureCount:0,blockIndex:0},zu=class{constructor(t){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=t}contextChange(t){this._gl=t,this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.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=sn()}bind(t,e){if(this._setProgram(t.glProgram),e)return;hs.textureCount=0,hs.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),i(this._renderer,t,hs)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,hs)}bindUniformBlock(t,e,i=0){let r=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=t._bufferResource;s&&this._renderer.ubo.updateUniformGroup(t),r.updateBuffer(t.buffer);let a=this._boundUniformsIdsToIndexHash[t.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[t.uid]=h,this._boundIndexToUniformsHash[h]=t,s?r.bindBufferRange(t.buffer,h,t.offset):r.bindBufferBase(t.buffer,h)}let o=this._gl,l=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[i]!==a&&(n.uniformBlockBindings[i]=a,o.uniformBlockBinding(n.program,l,a))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=Cw(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(t,e){return pw(t,e)}},zu.extension={type:[O.WebGLSystem],name:"shader"}}),Tm,Sm,Rw=v(()=>{"use strict";Tm={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);"},Sm={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 kw(t,e){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 t.uniforms){if(!e[r]){t.uniforms[r]instanceof ti?t.uniforms[r].ubo?i.push(`
|
|
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
`):i.push(`
|
|
renderer.shader.updateUniformGroup(uv.${r});
|
|
`):t.uniforms[r]instanceof ro&&i.push(`
|
|
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
`);continue}let n=t.uniformStructures[r],s=!1;for(let a=0;a<Tr.length;a++){let o=Tr[a];if(n.type===o.type&&o.test(n)){i.push(`name = "${r}";`,Tr[a].uniform),s=!0;break}}if(!s){let a=(n.size===1?Tm:Sm)[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 Bw=v(()=>{pu(),fi(),Fg(),Rw()}),Wu,Iw=v(()=>{te(),Bw(),Wu=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let r=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==r.uniformDirtyGroups[t.uid])&&(r.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(r.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),r=this._getSignature(t,e._uniformData,"u");return this._cache[r]||(this._cache[r]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[r],i[e._key]}_generateUniformsSync(t,e){return kw(t,e)}_getSignature(t,e,i){let r=t.uniforms,n=[`${i}-`];for(let s in r)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Wu.extension={type:[O.WebGLSystem],name:"uniformGroup"}});function Gw(t){let e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof ft.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{let i=t.getExtension("EXT_blend_minmax");i&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var Ow=v(()=>{Ot()}),Em,Am,Cm,Mm,Pm,Rm,ju,km,Fw=v(()=>{te(),or(),Ow(),Em=0,Am=1,Cm=2,Mm=3,Pm=4,Rm=5,ju=class Rc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[Em]=this.setBlend,this.map[Am]=this.setOffset,this.map[Cm]=this.setCullFace,this.map[Mm]=this.setDepthTest,this.map[Pm]=this.setFrontFace,this.map[Rm]=this.setDepthMask,this.checks=[],this.defaultState=ji.for2d()}contextChange(e){this.gl=e,this.blendModesMap=Gw(e),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let i=this.stateId^e.data,r=0;for(;i;)i&1&&this.map[r].call(this,!!(e.data&1<<r)),i=i>>1,r++;this.stateId=e.data}for(let i=0;i<this.checks.length;i++)this.checks[i](this,e)}forceState(e){e=e||this.defaultState;for(let i=0;i<this.map.length;i++)this.map[i].call(this,!!(e.data&1<<i));for(let i=0;i<this.checks.length;i++)this.checks[i](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(Rc._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(Rc._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let i=this.blendModesMap[e],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(e,i){this.gl.polygonOffset(e,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(e,i){let r=this.checks.indexOf(e);i&&r===-1?this.checks.push(e):!i&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(e,i){e.setBlendMode(i.blendMode)}static _checkPolygonOffset(e,i){e.setPolygonOffset(1,i.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}},ju.extension={type:[O.WebGLSystem],name:"state"},km=ju}),Bm,Dw=v(()=>{lm(),Bm=class{constructor(t){this.target=ku.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Ze.UNSIGNED_BYTE,this.internalFormat=so.RGBA,this.format=so.RGBA,this.samplerType=0}}}),Im,Uw=v(()=>{"use strict";Im={id:"buffer",upload(t,e,i){e.width===t.width||e.height===t.height?i.texSubImage2D(i.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):i.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}}}),Gm,Om,Lw=v(()=>{"use strict";Gm={"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},Om={id:"compressed",upload(t,e,i){i.pixelStorei(i.UNPACK_ALIGNMENT,4);let r=t.pixelWidth,n=t.pixelHeight,s=!!Gm[t.format];for(let a=0;a<t.resource.length;a++){let o=t.resource[a];s?i.compressedTexImage2D(i.TEXTURE_2D,a,e.internalFormat,r,n,0,o):i.texImage2D(i.TEXTURE_2D,a,e.internalFormat,r,n,0,e.format,e.type,o),r=Math.max(r>>1,1),n=Math.max(n>>1,1)}}}}),Vu,Fm=v(()=>{"use strict";Vu={id:"image",upload(t,e,i,r){let n=t.alphaMode==="premultiply-alpha-on-upload";i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n);let s=e.width,a=e.height,o=t.pixelWidth,l=t.pixelHeight,h=t.resourceWidth,u=t.resourceHeight;h<o||u<l?((s!==o||a!==l)&&i.texImage2D(e.target,0,e.internalFormat,o,l,0,e.format,e.type,null),r===2?i.texSubImage2D(i.TEXTURE_2D,0,0,0,h,u,e.format,e.type,t.resource):i.texSubImage2D(i.TEXTURE_2D,0,0,0,e.format,e.type,t.resource)):s===o||a===l?i.texSubImage2D(i.TEXTURE_2D,0,0,0,e.format,e.type,t.resource):r===2?i.texImage2D(e.target,0,e.internalFormat,o,l,0,e.format,e.type,t.resource):i.texImage2D(e.target,0,e.internalFormat,e.format,e.type,t.resource),e.width=o,e.height=l}}}),Dm,Nw=v(()=>{Fm(),Dm={id:"video",upload(t,e,i,r){if(!t.isValid){i.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Vu.upload(t,e,i,r)}}}),$u,Um,oo,Lm,Hw=v(()=>{"use strict";$u={linear:9729,nearest:9728},Um={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},oo={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Lm={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Nm(t,e,i,r,n,s,a,o){let l=s;if(!o||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let h=oo[a?"clamp-to-edge":t.addressModeU],u=oo[a?"clamp-to-edge":t.addressModeV],d=oo[a?"clamp-to-edge":t.addressModeW];e[n](l,e.TEXTURE_WRAP_S,h),e[n](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[n](l,e.TEXTURE_WRAP_R,d)}if((!o||t.magFilter!=="linear")&&e[n](l,e.TEXTURE_MAG_FILTER,$u[t.magFilter]),i){if(!o||t.mipmapFilter!=="linear"){let h=Um[t.minFilter][t.mipmapFilter];e[n](l,e.TEXTURE_MIN_FILTER,h)}}else e[n](l,e.TEXTURE_MIN_FILTER,$u[t.minFilter]);if(r&&t.maxAnisotropy>1){let h=Math.min(t.maxAnisotropy,e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](l,r.TEXTURE_MAX_ANISOTROPY_EXT,h)}t.compare&&e[n](l,e.TEXTURE_COMPARE_FUNC,Lm[t.compare])}var zw=v(()=>{Hw()});function Ww(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var jw=v(()=>{"use strict"});function Vw(t,e){let i={},r=t.RGBA;return t instanceof ft.get().getWebGLRenderingContext()?e.srgb&&(i={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(i={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},r=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...i,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:r,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var $w=v(()=>{Ot()});function Xw(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}var Yw=v(()=>{"use strict"}),Hm,Xu,qw=v(()=>{Ot(),te(),pt(),Dw(),Uw(),Lw(),Fm(),Nw(),zw(),jw(),$w(),Yw(),Hm=4,Xu=class{constructor(t){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:Vu,buffer:Im,video:Dm,compressed:Om},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Vw(t,this._renderer.context.extensions),this._mapFormatToType=Xw(t),this._mapFormatToFormat=Ww(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(ke.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||ke.EMPTY.source;let r=this.getGlSource(t);i.bindTexture(r.target,r.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let r=this._getGlSampler(t);this._boundSamplers[e]!==r&&(this._boundSamplers[e]=r,i.bindSampler(e,r))}unbind(t){let e=t.source,i=this._boundTextures,r=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);let s=this.getGlSource(e);r.bindTexture(s.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,i=new Bm(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let r=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(r))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let i=this._gl,r=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t,Nm(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Nm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:r}=this.getPixels(t),n=ft.get().createCanvas();n.width=i,n.height=r;let s=n.getContext("2d");if(s){let a=s.createImageData(i,r);a.data.set(e),s.putImageData(a,0,0)}return n}getPixels(t){let e=t.source.resolution,i=t.frame,r=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),s=new Uint8Array(Hm*r*n),a=this._renderer,o=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(i.x*e),Math.round(i.y*e),r,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:r,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}},Xu.extension={type:[O.WebGLSystem],name:"texture"}}),zm={};ze(zm,{WebGLRenderer:()=>$m});var Wm,jm,Vm,Yu,qu,Ku,$m,Kw=v(()=>{te(),V1(),$1(),X1(),ja(),Ig(),sr(),K1(),Z1(),ew(),tw(),iw(),rw(),nw(),uw(),fw(),Pw(),Iw(),Fw(),qw(),Wm=[...nu,Uu,cm,om,Ru,Xu,Lu,Iu,Wu,zu,Ou,km,Fu,Gu],jm=[...su],Vm=[Pu,Mu,Cu],Yu=[],qu=[],Ku=[],ge.handleByNamedList(O.WebGLSystem,Yu),ge.handleByNamedList(O.WebGLPipes,qu),ge.handleByNamedList(O.WebGLPipesAdaptor,Ku),ge.add(...Wm,...jm,...Vm),$m=class extends rs{constructor(){let t={name:"webgl",type:wi.WEBGL,systems:Yu,renderPipes:qu,renderPipeAdaptors:Ku};super(t)}}}),Zw=Ne((t,e)=>{"use strict";e.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 g=Object.keys(d),b=new Array(g.length);for(let x=0;x<g.length;x++){let _=g[x],T=d[_];typeof T!="object"||T===null?b[_]=T:T.constructor!==Object&&(o=a.get(T.constructor))?b[_]=o(T,p):ArrayBuffer.isView(T)?b[_]=i(T):b[_]=p(T)}return b}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 g in d){if(Object.hasOwnProperty.call(d,g)===!1)continue;let b=d[g];typeof b!="object"||b===null?p[g]=b:b.constructor!==Object&&(o=a.get(b.constructor))?p[g]=o(b,h):ArrayBuffer.isView(b)?p[g]=i(b):p[g]=h(b)}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 g in d){let b=d[g];typeof b!="object"||b===null?p[g]=b:b.constructor!==Object&&(o=a.get(b.constructor))?p[g]=o(b,u):ArrayBuffer.isView(b)?p[g]=i(b):p[g]=u(b)}return p}}function n(s){let a=[],o=[],l=new Map;if(l.set(Date,g=>new Date(g)),l.set(Map,(g,b)=>new Map(u(Array.from(g),b))),l.set(Set,(g,b)=>new Set(u(Array.from(g),b))),s.constructorHandlers)for(let g of s.constructorHandlers)l.set(g[0],g[1]);let h=null;return s.proto?p:d;function u(g,b){let x=Object.keys(g),_=new Array(x.length);for(let T=0;T<x.length;T++){let C=x[T],F=g[C];if(typeof F!="object"||F===null)_[C]=F;else if(F.constructor!==Object&&(h=l.get(F.constructor)))_[C]=h(F,b);else if(ArrayBuffer.isView(F))_[C]=i(F);else{let k=a.indexOf(F);k!==-1?_[C]=o[k]:_[C]=b(F)}}return _}function d(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return u(g,d);if(g.constructor!==Object&&(h=l.get(g.constructor)))return h(g,d);let b={};a.push(g),o.push(b);for(let x in g){if(Object.hasOwnProperty.call(g,x)===!1)continue;let _=g[x];if(typeof _!="object"||_===null)b[x]=_;else if(_.constructor!==Object&&(h=l.get(_.constructor)))b[x]=h(_,d);else if(ArrayBuffer.isView(_))b[x]=i(_);else{let T=a.indexOf(_);T!==-1?b[x]=o[T]:b[x]=d(_)}}return a.pop(),o.pop(),b}function p(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return u(g,p);if(g.constructor!==Object&&(h=l.get(g.constructor)))return h(g,p);let b={};a.push(g),o.push(b);for(let x in g){let _=g[x];if(typeof _!="object"||_===null)b[x]=_;else if(_.constructor!==Object&&(h=l.get(_.constructor)))b[x]=h(_,p);else if(ArrayBuffer.isView(_))b[x]=i(_);else{let T=a.indexOf(_);T!==-1?b[x]=o[T]:b[x]=p(_)}}return a.pop(),o.pop(),b}}}),Qw={value:()=>{}};function Xm(){for(var t=0,e=arguments.length,i={},r;t<e;++t){if(!(r=arguments[t]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new lo(i)}function lo(t){this._=t}function Jw(t,e){return t.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&&!e.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}lo.prototype=Xm.prototype={constructor:lo,on:function(t,e){var i=this._,r=Jw(t+"",i),n,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((n=(t=r[s]).type)&&(n=eT(i[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(n=(t=r[s]).type)i[n]=Ym(i[n],t.name,e);else if(e==null)for(n in i)i[n]=Ym(i[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new lo(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,n=s.length;r<n;++r)s[r].value.apply(e,i)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],n=0,s=r.length;n<s;++n)r[n].value.apply(e,i)}};function eT(t,e){for(var i=0,r=t.length,n;i<r;++i)if((n=t[i]).name===e)return n.value}function Ym(t,e,i){for(var r=0,n=t.length;r<n;++r)if(t[r].name===e){t[r]=Qw,t=t.slice(0,r).concat(t.slice(r+1));break}return i!=null&&t.push({name:e,value:i}),t}var ho=Xm,Zu="http://www.w3.org/1999/xhtml",qm={svg:"http://www.w3.org/2000/svg",xhtml:Zu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function uo(t){var e=t+="",i=e.indexOf(":");return i>=0&&(e=t.slice(0,i))!=="xmlns"&&(t=t.slice(i+1)),qm.hasOwnProperty(e)?{space:qm[e],local:t}:t}function tT(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===Zu&&e.documentElement.namespaceURI===Zu?e.createElement(t):e.createElementNS(i,t)}}function iT(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Km(t){var e=uo(t);return(e.local?iT:tT)(e)}function rT(){}function Qu(t){return t==null?rT:function(){return this.querySelector(t)}}function nT(t){typeof t!="function"&&(t=Qu(t));for(var e=this._groups,i=e.length,r=new Array(i),n=0;n<i;++n)for(var s=e[n],a=s.length,o=r[n]=new Array(a),l,h,u=0;u<a;++u)(l=s[u])&&(h=t.call(l,l.__data__,u,s))&&("__data__"in l&&(h.__data__=l.__data__),o[u]=h);return new gi(r,this._parents)}function sT(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function aT(){return[]}function Zm(t){return t==null?aT:function(){return this.querySelectorAll(t)}}function oT(t){return function(){return sT(t.apply(this,arguments))}}function lT(t){typeof t=="function"?t=oT(t):t=Zm(t);for(var e=this._groups,i=e.length,r=[],n=[],s=0;s<i;++s)for(var a=e[s],o=a.length,l,h=0;h<o;++h)(l=a[h])&&(r.push(t.call(l,l.__data__,h,a)),n.push(l));return new gi(r,n)}function Qm(t){return function(){return this.matches(t)}}function Jm(t){return function(e){return e.matches(t)}}var hT=Array.prototype.find;function uT(t){return function(){return hT.call(this.children,t)}}function cT(){return this.firstElementChild}function dT(t){return this.select(t==null?cT:uT(typeof t=="function"?t:Jm(t)))}var fT=Array.prototype.filter;function pT(){return Array.from(this.children)}function gT(t){return function(){return fT.call(this.children,t)}}function mT(t){return this.selectAll(t==null?pT:gT(typeof t=="function"?t:Jm(t)))}function _T(t){typeof t!="function"&&(t=Qm(t));for(var e=this._groups,i=e.length,r=new Array(i),n=0;n<i;++n)for(var s=e[n],a=s.length,o=r[n]=[],l,h=0;h<a;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&o.push(l);return new gi(r,this._parents)}function e_(t){return new Array(t.length)}function vT(){return new gi(this._enter||this._groups.map(e_),this._parents)}function co(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}co.prototype={constructor:co,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function yT(t){return function(){return t}}function xT(t,e,i,r,n,s){for(var a=0,o,l=e.length,h=s.length;a<h;++a)(o=e[a])?(o.__data__=s[a],r[a]=o):i[a]=new co(t,s[a]);for(;a<l;++a)(o=e[a])&&(n[a]=o)}function bT(t,e,i,r,n,s,a){var o,l,h=new Map,u=e.length,d=s.length,p=new Array(u),g;for(o=0;o<u;++o)(l=e[o])&&(p[o]=g=a.call(l,l.__data__,o,e)+"",h.has(g)?n[o]=l:h.set(g,l));for(o=0;o<d;++o)g=a.call(t,s[o],o,s)+"",(l=h.get(g))?(r[o]=l,l.__data__=s[o],h.delete(g)):i[o]=new co(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(p[o])===l&&(n[o]=l)}function wT(t){return t.__data__}function TT(t,e){if(!arguments.length)return Array.from(this,wT);var i=e?bT:xT,r=this._parents,n=this._groups;typeof t!="function"&&(t=yT(t));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,g=ST(t.call(u,u&&u.__data__,h,r)),b=g.length,x=o[h]=new Array(b),_=a[h]=new Array(b),T=l[h]=new Array(p);i(u,d,x,_,T,g,e);for(var C=0,F=0,k,N;C<b;++C)if(k=x[C]){for(C>=F&&(F=C+1);!(N=_[F])&&++F<b;);k._next=N||null}}return a=new gi(a,r),a._enter=o,a._exit=l,a}function ST(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ET(){return new gi(this._exit||this._groups.map(e_),this._parents)}function AT(t,e,i){var r=this.enter(),n=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(n=e(n),n&&(n=n.selection())),i==null?s.remove():i(s),r&&n?r.merge(n).order():n}function CT(t){for(var e=t.selection?t.selection():t,i=this._groups,r=e._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),g,b=0;b<d;++b)(g=h[b]||u[b])&&(p[b]=g);for(;l<n;++l)o[l]=i[l];return new gi(o,this._parents)}function MT(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var r=t[e],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 PT(t){t||(t=RT);function e(d,p){return d&&p?t(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(e)}return new gi(n,this._parents).order()}function RT(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function kT(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function BT(){return Array.from(this)}function IT(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var r=t[e],n=0,s=r.length;n<s;++n){var a=r[n];if(a)return a}return null}function GT(){let t=0;for(let e of this)++t;return t}function OT(){return!this.node()}function FT(t){for(var e=this._groups,i=0,r=e.length;i<r;++i)for(var n=e[i],s=0,a=n.length,o;s<a;++s)(o=n[s])&&t.call(o,o.__data__,s,n);return this}function DT(t){return function(){this.removeAttribute(t)}}function UT(t){return function(){this.removeAttributeNS(t.space,t.local)}}function LT(t,e){return function(){this.setAttribute(t,e)}}function NT(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function HT(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttribute(t):this.setAttribute(t,i)}}function zT(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function WT(t,e){var i=uo(t);if(arguments.length<2){var r=this.node();return i.local?r.getAttributeNS(i.space,i.local):r.getAttribute(i)}return this.each((e==null?i.local?UT:DT:typeof e=="function"?i.local?zT:HT:i.local?NT:LT)(i,e))}function t_(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function jT(t){return function(){this.style.removeProperty(t)}}function VT(t,e,i){return function(){this.style.setProperty(t,e,i)}}function $T(t,e,i){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,i)}}function XT(t,e,i){return arguments.length>1?this.each((e==null?jT:typeof e=="function"?$T:VT)(t,e,i??"")):bn(this.node(),t)}function bn(t,e){return t.style.getPropertyValue(e)||t_(t).getComputedStyle(t,null).getPropertyValue(e)}function YT(t){return function(){delete this[t]}}function qT(t,e){return function(){this[t]=e}}function KT(t,e){return function(){var i=e.apply(this,arguments);i==null?delete this[t]:this[t]=i}}function ZT(t,e){return arguments.length>1?this.each((e==null?YT:typeof e=="function"?KT:qT)(t,e)):this.node()[t]}function i_(t){return t.trim().split(/^|\s+/)}function Ju(t){return t.classList||new r_(t)}function r_(t){this._node=t,this._names=i_(t.getAttribute("class")||"")}r_.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function n_(t,e){for(var i=Ju(t),r=-1,n=e.length;++r<n;)i.add(e[r])}function s_(t,e){for(var i=Ju(t),r=-1,n=e.length;++r<n;)i.remove(e[r])}function QT(t){return function(){n_(this,t)}}function JT(t){return function(){s_(this,t)}}function eS(t,e){return function(){(e.apply(this,arguments)?n_:s_)(this,t)}}function tS(t,e){var i=i_(t+"");if(arguments.length<2){for(var r=Ju(this.node()),n=-1,s=i.length;++n<s;)if(!r.contains(i[n]))return!1;return!0}return this.each((typeof e=="function"?eS:e?QT:JT)(i,e))}function iS(){this.textContent=""}function rS(t){return function(){this.textContent=t}}function nS(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function sS(t){return arguments.length?this.each(t==null?iS:(typeof t=="function"?nS:rS)(t)):this.node().textContent}function aS(){this.innerHTML=""}function oS(t){return function(){this.innerHTML=t}}function lS(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function hS(t){return arguments.length?this.each(t==null?aS:(typeof t=="function"?lS:oS)(t)):this.node().innerHTML}function uS(){this.nextSibling&&this.parentNode.appendChild(this)}function cS(){return this.each(uS)}function dS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function fS(){return this.each(dS)}function pS(t){var e=typeof t=="function"?t:Km(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function gS(){return null}function mS(t,e){var i=typeof t=="function"?t:Km(t),r=e==null?gS:typeof e=="function"?e:Qu(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),r.apply(this,arguments)||null)})}function _S(){var t=this.parentNode;t&&t.removeChild(this)}function vS(){return this.each(_S)}function yS(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xS(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function bS(t){return this.select(t?xS:yS)}function wS(t){return arguments.length?this.property("__data__",t):this.node().__data__}function TS(t){return function(e){t.call(this,e,this.__data__)}}function SS(t){return t.trim().split(/^|\s+/).map(function(e){var i="",r=e.indexOf(".");return r>=0&&(i=e.slice(r+1),e=e.slice(0,r)),{type:e,name:i}})}function ES(t){return function(){var e=this.__on;if(e){for(var i=0,r=-1,n=e.length,s;i<n;++i)s=e[i],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function AS(t,e,i){return function(){var r=this.__on,n,s=TS(e);if(r){for(var a=0,o=r.length;a<o;++a)if((n=r[a]).type===t.type&&n.name===t.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=i),n.value=e;return}}this.addEventListener(t.type,s,i),n={type:t.type,name:t.name,value:e,listener:s,options:i},r?r.push(n):this.__on=[n]}}function CS(t,e,i){var r=SS(t+""),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=e?AS:ES,n=0;n<s;++n)this.each(o(r[n],e,i));return this}function a_(t,e,i){var r=t_(t),n=r.CustomEvent;typeof n=="function"?n=new n(e,i):(n=r.document.createEvent("Event"),i?(n.initEvent(e,i.bubbles,i.cancelable),n.detail=i.detail):n.initEvent(e,!1,!1)),t.dispatchEvent(n)}function MS(t,e){return function(){return a_(this,t,e)}}function PS(t,e){return function(){return a_(this,t,e.apply(this,arguments))}}function RS(t,e){return this.each((typeof e=="function"?PS:MS)(t,e))}function*kS(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var r=t[e],n=0,s=r.length,a;n<s;++n)(a=r[n])&&(yield a)}var o_=[null];function gi(t,e){this._groups=t,this._parents=e}function l_(){return new gi([[document.documentElement]],o_)}function BS(){return this}gi.prototype=l_.prototype={constructor:gi,select:nT,selectAll:lT,selectChild:dT,selectChildren:mT,filter:_T,data:TT,enter:vT,exit:ET,join:AT,merge:CT,selection:BS,order:MT,sort:PT,call:kT,nodes:BT,node:IT,size:GT,empty:OT,each:FT,attr:WT,style:XT,property:ZT,classed:tS,text:sS,html:hS,raise:cS,lower:fS,append:pS,insert:mS,remove:vS,clone:bS,datum:wS,on:CS,dispatch:RS,[Symbol.iterator]:kS};var us=l_;function Ri(t){return typeof t=="string"?new gi([[document.querySelector(t)]],[document.documentElement]):new gi([[t]],o_)}function IS(t){let e;for(;e=t.sourceEvent;)t=e;return t}function hr(t,e){if(t=IS(t),e===void 0&&(e=t.currentTarget),e){var i=e.ownerSVGElement||e;if(i.createSVGPoint){var r=i.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var n=e.getBoundingClientRect();return[t.clientX-n.left-e.clientLeft,t.clientY-n.top-e.clientTop]}}return[t.pageX,t.pageY]}var GS={passive:!1},cs={capture:!0,passive:!1};function ec(t){t.stopImmediatePropagation()}function wn(t){t.preventDefault(),t.stopImmediatePropagation()}function h_(t){var e=t.document.documentElement,i=Ri(t).on("dragstart.drag",wn,cs);"onselectstart"in e?i.on("selectstart.drag",wn,cs):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function u_(t,e){var i=t.document.documentElement,r=Ri(t).on("dragstart.drag",null);e&&(r.on("click.drag",wn,cs),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 fo=t=>()=>t;function tc(t,{sourceEvent:e,subject:i,target:r,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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}})}tc.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function OS(t){return!t.ctrlKey&&!t.button}function FS(){return this.parentNode}function DS(t,e){return e??{x:t.x,y:t.y}}function US(){return navigator.maxTouchPoints||"ontouchstart"in this}function LS(){var t=OS,e=FS,i=DS,r=US,n={},s=ho("start","drag","end"),a=0,o,l,h,u,d=0;function p(k){k.on("mousedown.drag",g).filter(r).on("touchstart.drag",_).on("touchmove.drag",T,GS).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(k,N){if(!(u||!t.call(this,k,N))){var re=F(this,e.call(this,k,N),k,N,"mouse");re&&(Ri(k.view).on("mousemove.drag",b,cs).on("mouseup.drag",x,cs),h_(k.view),ec(k),h=!1,o=k.clientX,l=k.clientY,re("start",k))}}function b(k){if(wn(k),!h){var N=k.clientX-o,re=k.clientY-l;h=N*N+re*re>d}n.mouse("drag",k)}function x(k){Ri(k.view).on("mousemove.drag mouseup.drag",null),u_(k.view,h),wn(k),n.mouse("end",k)}function _(k,N){if(t.call(this,k,N)){var re=k.changedTouches,ne=e.call(this,k,N),J=re.length,$,ie;for($=0;$<J;++$)(ie=F(this,ne,k,N,re[$].identifier,re[$]))&&(ec(k),ie("start",k,re[$]))}}function T(k){var N=k.changedTouches,re=N.length,ne,J;for(ne=0;ne<re;++ne)(J=n[N[ne].identifier])&&(wn(k),J("drag",k,N[ne]))}function C(k){var N=k.changedTouches,re=N.length,ne,J;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),ne=0;ne<re;++ne)(J=n[N[ne].identifier])&&(ec(k),J("end",k,N[ne]))}function F(k,N,re,ne,J,$){var ie=s.copy(),Se=hr($||re,N),Pe,ce,D;if((D=i.call(k,new tc("beforestart",{sourceEvent:re,target:p,identifier:J,active:a,x:Se[0],y:Se[1],dx:0,dy:0,dispatch:ie}),ne))!=null)return Pe=D.x-Se[0]||0,ce=D.y-Se[1]||0,function se(q,de,A){var M=Se,E;switch(q){case"start":n[J]=se,E=a++;break;case"end":delete n[J],--a;case"drag":Se=hr(A||de,N),E=a;break}ie.call(q,k,new tc(q,{sourceEvent:de,subject:D,target:p,identifier:J,active:E,x:Se[0]+Pe,y:Se[1]+ce,dx:Se[0]-M[0],dy:Se[1]-M[1],dispatch:ie}),ne)}}return p.filter=function(k){return arguments.length?(t=typeof k=="function"?k:fo(!!k),p):t},p.container=function(k){return arguments.length?(e=typeof k=="function"?k:fo(k),p):e},p.subject=function(k){return arguments.length?(i=typeof k=="function"?k:fo(k),p):i},p.touchable=function(k){return arguments.length?(r=typeof k=="function"?k:fo(!!k),p):r},p.on=function(){var k=s.on.apply(s,arguments);return k===s?p:k},p.clickDistance=function(k){return arguments.length?(d=(k=+k)*k,p):Math.sqrt(d)},p}function ic(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function c_(t,e){var i=Object.create(t.prototype);for(var r in e)i[r]=e[r];return i}function ds(){}var fs=.7,po=1/fs,Tn="\\s*([+-]?\\d+)\\s*",ps="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NS=/^#([0-9a-f]{3,8})$/,HS=new RegExp(`^rgb\\(${Tn},${Tn},${Tn}\\)$`),zS=new RegExp(`^rgb\\(${Xi},${Xi},${Xi}\\)$`),WS=new RegExp(`^rgba\\(${Tn},${Tn},${Tn},${ps}\\)$`),jS=new RegExp(`^rgba\\(${Xi},${Xi},${Xi},${ps}\\)$`),VS=new RegExp(`^hsl\\(${ps},${Xi},${Xi}\\)$`),$S=new RegExp(`^hsla\\(${ps},${Xi},${Xi},${ps}\\)$`),d_={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};ic(ds,gs,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:f_,formatHex:f_,formatHex8:XS,formatHsl:YS,formatRgb:p_,toString:p_});function f_(){return this.rgb().formatHex()}function XS(){return this.rgb().formatHex8()}function YS(){return y_(this).formatHsl()}function p_(){return this.rgb().formatRgb()}function gs(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=NS.exec(t))?(i=e[1].length,e=parseInt(e[1],16),i===6?g_(e):i===3?new li(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):i===8?go(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):i===4?go(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=HS.exec(t))?new li(e[1],e[2],e[3],1):(e=zS.exec(t))?new li(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=WS.exec(t))?go(e[1],e[2],e[3],e[4]):(e=jS.exec(t))?go(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=VS.exec(t))?v_(e[1],e[2]/100,e[3]/100,1):(e=$S.exec(t))?v_(e[1],e[2]/100,e[3]/100,e[4]):d_.hasOwnProperty(t)?g_(d_[t]):t==="transparent"?new li(NaN,NaN,NaN,0):null}function g_(t){return new li(t>>16&255,t>>8&255,t&255,1)}function go(t,e,i,r){return r<=0&&(t=e=i=NaN),new li(t,e,i,r)}function qS(t){return t instanceof ds||(t=gs(t)),t?(t=t.rgb(),new li(t.r,t.g,t.b,t.opacity)):new li}function mo(t,e,i,r){return arguments.length===1?qS(t):new li(t,e,i,r??1)}function li(t,e,i,r){this.r=+t,this.g=+e,this.b=+i,this.opacity=+r}ic(li,mo,c_(ds,{brighter(t){return t=t==null?po:Math.pow(po,t),new li(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?fs:Math.pow(fs,t),new li(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new li(Wr(this.r),Wr(this.g),Wr(this.b),_o(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:m_,formatHex:m_,formatHex8:KS,formatRgb:__,toString:__}));function m_(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}`}function KS(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}${jr((isNaN(this.opacity)?1:this.opacity)*255)}`}function __(){let t=_o(this.opacity);return`${t===1?"rgb(":"rgba("}${Wr(this.r)}, ${Wr(this.g)}, ${Wr(this.b)}${t===1?")":`, ${t})`}`}function _o(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Wr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function jr(t){return t=Wr(t),(t<16?"0":"")+t.toString(16)}function v_(t,e,i,r){return r<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new ki(t,e,i,r)}function y_(t){if(t instanceof ki)return new ki(t.h,t.s,t.l,t.opacity);if(t instanceof ds||(t=gs(t)),!t)return new ki;if(t instanceof ki)return t;t=t.rgb();var e=t.r/255,i=t.g/255,r=t.b/255,n=Math.min(e,i,r),s=Math.max(e,i,r),a=NaN,o=s-n,l=(s+n)/2;return o?(e===s?a=(i-r)/o+(i<r)*6:i===s?a=(r-e)/o+2:a=(e-i)/o+4,o/=l<.5?s+n:2-s-n,a*=60):o=l>0&&l<1?0:a,new ki(a,o,l,t.opacity)}function ZS(t,e,i,r){return arguments.length===1?y_(t):new ki(t,e,i,r??1)}function ki(t,e,i,r){this.h=+t,this.s=+e,this.l=+i,this.opacity=+r}ic(ki,ZS,c_(ds,{brighter(t){return t=t==null?po:Math.pow(po,t),new ki(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?fs:Math.pow(fs,t),new ki(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*e,n=2*i-r;return new li(rc(t>=240?t-240:t+120,n,r),rc(t,n,r),rc(t<120?t+240:t-120,n,r),this.opacity)},clamp(){return new ki(x_(this.h),vo(this.s),vo(this.l),_o(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 t=_o(this.opacity);return`${t===1?"hsl(":"hsla("}${x_(this.h)}, ${vo(this.s)*100}%, ${vo(this.l)*100}%${t===1?")":`, ${t})`}`}}));function x_(t){return t=(t||0)%360,t<0?t+360:t}function vo(t){return Math.max(0,Math.min(1,t||0))}function rc(t,e,i){return(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)*255}function b_(t,e,i,r,n){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*i+(1+3*t+3*s-3*a)*r+a*n)/6}function QS(t){var e=t.length-1;return function(i){var r=i<=0?i=0:i>=1?(i=1,e-1):Math.floor(i*e),n=t[r],s=t[r+1],a=r>0?t[r-1]:2*n-s,o=r<e-1?t[r+2]:2*s-n;return b_((i-r/e)*e,a,n,s,o)}}function JS(t){var e=t.length;return function(i){var r=Math.floor(((i%=1)<0?++i:i)*e),n=t[(r+e-1)%e],s=t[r%e],a=t[(r+1)%e],o=t[(r+2)%e];return b_((i-r/e)*e,n,s,a,o)}}var w_=t=>()=>t;function eE(t,e){return function(i){return t+i*e}}function tE(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(r){return Math.pow(t+r*e,i)}}function iE(t){return(t=+t)==1?T_:function(e,i){return i-e?tE(e,i,t):w_(isNaN(e)?i:e)}}function T_(t,e){var i=e-t;return i?eE(t,i):w_(isNaN(t)?e:t)}var S_=function t(e){var i=iE(e);function r(n,s){var a=i((n=mo(n)).r,(s=mo(s)).r),o=i(n.g,s.g),l=i(n.b,s.b),h=T_(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=t,r}(1);function E_(t){return function(e){var i=e.length,r=new Array(i),n=new Array(i),s=new Array(i),a,o;for(a=0;a<i;++a)o=mo(e[a]),r[a]=o.r||0,n[a]=o.g||0,s[a]=o.b||0;return r=t(r),n=t(n),s=t(s),o.opacity=1,function(l){return o.r=r(l),o.g=n(l),o.b=s(l),o+""}}}var PA=E_(QS),RA=E_(JS);function Er(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}var nc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sc=new RegExp(nc.source,"g");function rE(t){return function(){return t}}function nE(t){return function(e){return t(e)+""}}function sE(t,e){var i=nc.lastIndex=sc.lastIndex=0,r,n,s,a=-1,o=[],l=[];for(t=t+"",e=e+"";(r=nc.exec(t))&&(n=sc.exec(e));)(s=n.index)>i&&(s=e.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:Er(r,n)})),i=sc.lastIndex;return i<e.length&&(s=e.slice(i),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?nE(l[0].x):rE(e):(e=l.length,function(h){for(var u=0,d;u<e;++u)o[(d=l[u]).i]=d.x(h);return o.join("")})}var A_=180/Math.PI,ac={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function C_(t,e,i,r,n,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*i+e*r)&&(i-=t*l,r-=e*l),(o=Math.sqrt(i*i+r*r))&&(i/=o,r/=o,l/=o),t*r<e*i&&(t=-t,e=-e,l=-l,a=-a),{translateX:n,translateY:s,rotate:Math.atan2(e,t)*A_,skewX:Math.atan(l)*A_,scaleX:a,scaleY:o}}var yo;function aE(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ac:C_(e.a,e.b,e.c,e.d,e.e,e.f)}function oE(t){return t==null?ac:(yo||(yo=document.createElementNS("http://www.w3.org/2000/svg","g")),yo.setAttribute("transform",t),(t=yo.transform.baseVal.consolidate())?(t=t.matrix,C_(t.a,t.b,t.c,t.d,t.e,t.f)):ac)}function M_(t,e,i,r){function n(h){return h.length?h.pop()+" ":""}function s(h,u,d,p,g,b){if(h!==d||u!==p){var x=g.push("translate(",null,e,null,i);b.push({i:x-4,x:Er(h,d)},{i:x-2,x:Er(u,p)})}else(d||p)&&g.push("translate("+d+e+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:Er(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:Er(h,u)}):u&&d.push(n(d)+"skewX("+u+r)}function l(h,u,d,p,g,b){if(h!==d||u!==p){var x=g.push(n(g)+"scale(",null,",",null,")");b.push({i:x-4,x:Er(h,d)},{i:x-2,x:Er(u,p)})}else(d!==1||p!==1)&&g.push(n(g)+"scale("+d+","+p+")")}return function(h,u){var d=[],p=[];return h=t(h),u=t(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(g){for(var b=-1,x=p.length,_;++b<x;)d[(_=p[b]).i]=_.x(g);return d.join("")}}}var lE=M_(aE,"px, ","px)","deg)"),hE=M_(oE,", ",")",")"),uE=1e-12;function P_(t){return((t=Math.exp(t))+1/t)/2}function cE(t){return((t=Math.exp(t))-1/t)/2}function dE(t){return((t=Math.exp(2*t))-1)/(t+1)}var fE=function t(e,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],g=u-o,b=d-l,x=g*g+b*b,_,T;if(x<uE)T=Math.log(p/h)/e,_=function(ne){return[o+ne*g,l+ne*b,h*Math.exp(e*ne*T)]};else{var C=Math.sqrt(x),F=(p*p-h*h+r*x)/(2*h*i*C),k=(p*p-h*h-r*x)/(2*p*i*C),N=Math.log(Math.sqrt(F*F+1)-F),re=Math.log(Math.sqrt(k*k+1)-k);T=(re-N)/e,_=function(ne){var J=ne*T,$=P_(N),ie=h/(i*C)*($*dE(e*J+N)-cE(N));return[o+ie*g,l+ie*b,h*$/P_(e*J+N)]}}return _.duration=T*1e3*e/Math.SQRT2,_}return n.rho=function(s){var a=Math.max(.001,+s),o=a*a,l=o*o;return t(a,o,l)},n}(Math.SQRT2,2,4),Sn=0,ms=0,_s=0,R_=1e3,xo,vs,bo=0,Vr=0,wo=0,ys=typeof performance=="object"&&performance.now?performance:Date,k_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function oc(){return Vr||(k_(pE),Vr=ys.now()+wo)}function pE(){Vr=0}function To(){this._call=this._time=this._next=null}To.prototype=lc.prototype={constructor:To,restart:function(t,e,i){if(typeof t!="function")throw new TypeError("callback is not a function");i=(i==null?oc():+i)+(e==null?0:+e),!this._next&&vs!==this&&(vs?vs._next=this:xo=this,vs=this),this._call=t,this._time=i,hc()},stop:function(){this._call&&(this._call=null,this._time=1/0,hc())}};function lc(t,e,i){var r=new To;return r.restart(t,e,i),r}function gE(){oc(),++Sn;for(var t=xo,e;t;)(e=Vr-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Sn}function B_(){Vr=(bo=ys.now())+wo,Sn=ms=0;try{gE()}finally{Sn=0,_E(),Vr=0}}function mE(){var t=ys.now(),e=t-bo;e>R_&&(wo-=e,bo=t)}function _E(){for(var t,e=xo,i,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(i=e._next,e._next=null,e=t?t._next=i:xo=i);vs=t,hc(r)}function hc(t){if(!Sn){ms&&(ms=clearTimeout(ms));var e=t-Vr;e>24?(t<1/0&&(ms=setTimeout(B_,t-ys.now()-wo)),_s&&(_s=clearInterval(_s))):(_s||(bo=ys.now(),_s=setInterval(mE,R_)),Sn=1,k_(B_))}}function I_(t,e,i){var r=new To;return e=e==null?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,i),r}var vE=ho("start","end","cancel","interrupt"),yE=[],G_=0,O_=1,uc=2,So=3,F_=4,cc=5,Eo=6;function Ao(t,e,i,r,n,s){var a=t.__transition;if(!a)t.__transition={};else if(i in a)return;xE(t,i,{name:e,index:r,group:n,on:vE,tween:yE,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:G_})}function dc(t,e){var i=Bi(t,e);if(i.state>G_)throw new Error("too late; already scheduled");return i}function Yi(t,e){var i=Bi(t,e);if(i.state>So)throw new Error("too late; already running");return i}function Bi(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function xE(t,e,i){var r=t.__transition,n;r[e]=i,i.timer=lc(s,0,i.time);function s(h){i.state=O_,i.timer.restart(a,i.delay,i.time),i.delay<=h&&a(h-i.delay)}function a(h){var u,d,p,g;if(i.state!==O_)return l();for(u in r)if(g=r[u],g.name===i.name){if(g.state===So)return I_(a);g.state===F_?(g.state=Eo,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=Eo,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(I_(function(){i.state===So&&(i.state=F_,i.timer.restart(o,i.delay,i.time),o(h))}),i.state=uc,i.on.call("start",t,t.__data__,i.index,i.group),i.state===uc){for(i.state=So,n=new Array(p=i.tween.length),u=0,d=-1;u<p;++u)(g=i.tween[u].value.call(t,t.__data__,i.index,i.group))&&(n[++d]=g);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=cc,1),d=-1,p=n.length;++d<p;)n[d].call(t,u);i.state===cc&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){i.state=Eo,i.timer.stop(),delete r[e];for(var h in r)return;delete t.__transition}}function Co(t,e){var i=t.__transition,r,n,s=!0,a;if(i){e=e==null?null:e+"";for(a in i){if((r=i[a]).name!==e){s=!1;continue}n=r.state>uc&&r.state<cc,r.state=Eo,r.timer.stop(),r.on.call(n?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete i[a]}s&&delete t.__transition}}function bE(t){return this.each(function(){Co(this,t)})}function wE(t,e){var i,r;return function(){var n=Yi(this,t),s=n.tween;if(s!==i){r=i=s;for(var a=0,o=r.length;a<o;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}n.tween=r}}function TE(t,e,i){var r,n;if(typeof i!="function")throw new Error;return function(){var s=Yi(this,t),a=s.tween;if(a!==r){n=(r=a).slice();for(var o={name:e,value:i},l=0,h=n.length;l<h;++l)if(n[l].name===e){n[l]=o;break}l===h&&n.push(o)}s.tween=n}}function SE(t,e){var i=this._id;if(t+="",arguments.length<2){for(var r=Bi(this.node(),i).tween,n=0,s=r.length,a;n<s;++n)if((a=r[n]).name===t)return a.value;return null}return this.each((e==null?wE:TE)(i,t,e))}function fc(t,e,i){var r=t._id;return t.each(function(){var n=Yi(this,r);(n.value||(n.value={}))[e]=i.apply(this,arguments)}),function(n){return Bi(n,r).value[e]}}function D_(t,e){var i;return(typeof e=="number"?Er:e instanceof gs?S_:(i=gs(e))?(e=i,S_):sE)(t,e)}function EE(t){return function(){this.removeAttribute(t)}}function AE(t){return function(){this.removeAttributeNS(t.space,t.local)}}function CE(t,e,i){var r,n=i+"",s;return function(){var a=this.getAttribute(t);return a===n?null:a===r?s:s=e(r=a,i)}}function ME(t,e,i){var r,n=i+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===n?null:a===r?s:s=e(r=a,i)}}function PE(t,e,i){var r,n,s;return function(){var a,o=i(this),l;return o==null?void this.removeAttribute(t):(a=this.getAttribute(t),l=o+"",a===l?null:a===r&&l===n?s:(n=l,s=e(r=a,o)))}}function RE(t,e,i){var r,n,s;return function(){var a,o=i(this),l;return o==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),l=o+"",a===l?null:a===r&&l===n?s:(n=l,s=e(r=a,o)))}}function kE(t,e){var i=uo(t),r=i==="transform"?hE:D_;return this.attrTween(t,typeof e=="function"?(i.local?RE:PE)(i,r,fc(this,"attr."+t,e)):e==null?(i.local?AE:EE)(i):(i.local?ME:CE)(i,r,e))}function BE(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}function IE(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}function GE(t,e){var i,r;function n(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&IE(t,s)),i}return n._value=e,n}function OE(t,e){var i,r;function n(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&BE(t,s)),i}return n._value=e,n}function FE(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;var r=uo(t);return this.tween(i,(r.local?GE:OE)(r,e))}function DE(t,e){return function(){dc(this,t).delay=+e.apply(this,arguments)}}function UE(t,e){return e=+e,function(){dc(this,t).delay=e}}function LE(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?DE:UE)(e,t)):Bi(this.node(),e).delay}function NE(t,e){return function(){Yi(this,t).duration=+e.apply(this,arguments)}}function HE(t,e){return e=+e,function(){Yi(this,t).duration=e}}function zE(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?NE:HE)(e,t)):Bi(this.node(),e).duration}function WE(t,e){if(typeof e!="function")throw new Error;return function(){Yi(this,t).ease=e}}function jE(t){var e=this._id;return arguments.length?this.each(WE(e,t)):Bi(this.node(),e).ease}function VE(t,e){return function(){var i=e.apply(this,arguments);if(typeof i!="function")throw new Error;Yi(this,t).ease=i}}function $E(t){if(typeof t!="function")throw new Error;return this.each(VE(this._id,t))}function XE(t){typeof t!="function"&&(t=Qm(t));for(var e=this._groups,i=e.length,r=new Array(i),n=0;n<i;++n)for(var s=e[n],a=s.length,o=r[n]=[],l,h=0;h<a;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&o.push(l);return new ur(r,this._parents,this._name,this._id)}function YE(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,r=e.length,n=i.length,s=Math.min(r,n),a=new Array(r),o=0;o<s;++o)for(var l=e[o],h=i[o],u=l.length,d=a[o]=new Array(u),p,g=0;g<u;++g)(p=l[g]||h[g])&&(d[g]=p);for(;o<r;++o)a[o]=e[o];return new ur(a,this._parents,this._name,this._id)}function qE(t){return(t+"").trim().split(/^|\s+/).every(function(e){var i=e.indexOf(".");return i>=0&&(e=e.slice(0,i)),!e||e==="start"})}function KE(t,e,i){var r,n,s=qE(e)?dc:Yi;return function(){var a=s(this,t),o=a.on;o!==r&&(n=(r=o).copy()).on(e,i),a.on=n}}function ZE(t,e){var i=this._id;return arguments.length<2?Bi(this.node(),i).on.on(t):this.each(KE(i,t,e))}function QE(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}function JE(){return this.on("end.remove",QE(this._id))}function e2(t){var e=this._name,i=this._id;typeof t!="function"&&(t=Qu(t));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=t.call(u,u.__data__,p,o))&&("__data__"in u&&(d.__data__=u.__data__),h[p]=d,Ao(h[p],e,i,p,h,Bi(u,i)));return new ur(s,this._parents,e,i)}function t2(t){var e=this._name,i=this._id;typeof t!="function"&&(t=Zm(t));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=t.call(u,u.__data__,d,l),g,b=Bi(u,i),x=0,_=p.length;x<_;++x)(g=p[x])&&Ao(g,e,i,x,p,b);s.push(p),a.push(u)}return new ur(s,a,e,i)}var i2=us.prototype.constructor;function r2(){return new i2(this._groups,this._parents)}function n2(t,e){var i,r,n;return function(){var s=bn(this,t),a=(this.style.removeProperty(t),bn(this,t));return s===a?null:s===i&&a===r?n:n=e(i=s,r=a)}}function U_(t){return function(){this.style.removeProperty(t)}}function s2(t,e,i){var r,n=i+"",s;return function(){var a=bn(this,t);return a===n?null:a===r?s:s=e(r=a,i)}}function a2(t,e,i){var r,n,s;return function(){var a=bn(this,t),o=i(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(t),bn(this,t))),a===l?null:a===r&&l===n?s:(n=l,s=e(r=a,o))}}function o2(t,e){var i,r,n,s="style."+e,a="end."+s,o;return function(){var l=Yi(this,t),h=l.on,u=l.value[s]==null?o||(o=U_(e)):void 0;(h!==i||n!==u)&&(r=(i=h).copy()).on(a,n=u),l.on=r}}function l2(t,e,i){var r=(t+="")=="transform"?lE:D_;return e==null?this.styleTween(t,n2(t,r)).on("end.style."+t,U_(t)):typeof e=="function"?this.styleTween(t,a2(t,r,fc(this,"style."+t,e))).each(o2(this._id,t)):this.styleTween(t,s2(t,r,e),i).on("end.style."+t,null)}function h2(t,e,i){return function(r){this.style.setProperty(t,e.call(this,r),i)}}function u2(t,e,i){var r,n;function s(){var a=e.apply(this,arguments);return a!==n&&(r=(n=a)&&h2(t,a,i)),r}return s._value=e,s}function c2(t,e,i){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,u2(t,e,i??""))}function d2(t){return function(){this.textContent=t}}function f2(t){return function(){var e=t(this);this.textContent=e??""}}function p2(t){return this.tween("text",typeof t=="function"?f2(fc(this,"text",t)):d2(t==null?"":t+""))}function g2(t){return function(e){this.textContent=t.call(this,e)}}function m2(t){var e,i;function r(){var n=t.apply(this,arguments);return n!==i&&(e=(i=n)&&g2(n)),e}return r._value=t,r}function _2(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,m2(t))}function v2(){for(var t=this._name,e=this._id,i=L_(),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=Bi(l,e);Ao(l,t,i,h,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ur(r,this._parents,t,i)}function y2(){var t,e,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=Yi(this,r),u=h.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),h.on=e}),n===0&&s()})}var x2=0;function ur(t,e,i,r){this._groups=t,this._parents=e,this._name=i,this._id=r}function b2(t){return us().transition(t)}function L_(){return++x2}var cr=us.prototype;ur.prototype=b2.prototype={constructor:ur,select:e2,selectAll:t2,selectChild:cr.selectChild,selectChildren:cr.selectChildren,filter:XE,merge:YE,selection:r2,transition:v2,call:cr.call,nodes:cr.nodes,node:cr.node,size:cr.size,empty:cr.empty,each:cr.each,on:ZE,attr:kE,attrTween:FE,style:l2,styleTween:c2,text:p2,textTween:_2,remove:JE,tween:SE,delay:LE,duration:zE,ease:jE,easeVarying:$E,end:y2,[Symbol.iterator]:cr[Symbol.iterator]};function w2(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var T2={time:null,delay:0,duration:250,ease:w2};function S2(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}function E2(t){var e,i;t instanceof ur?(e=t._id,t=t._name):(e=L_(),(i=T2).time=oc(),t=t==null?null:t+"");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])&&Ao(l,t,e,h,a,i||S2(l,e));return new ur(r,this._parents,t,e)}us.prototype.interrupt=bE,us.prototype.transition=E2;var{abs:kA,max:BA,min:IA}=Math;function N_(t){return[+t[0],+t[1]]}function A2(t){return[N_(t[0]),N_(t[1])]}var GA={name:"x",handles:["w","e"].map(pc),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},OA={name:"y",handles:["n","s"].map(pc),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},FA={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(pc),input:function(t){return t==null?null:A2(t)},output:function(t){return t}};function pc(t){return{type:t}}function C2(t,e){var i,r=1;t==null&&(t=0),e==null&&(e=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-t)*r,h=(h/a-e)*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?(t=+s,n):t},n.y=function(s){return arguments.length?(e=+s,n):e},n.strength=function(s){return arguments.length?(r=+s,n):r},n}function M2(t){let e=+this._x.call(null,t),i=+this._y.call(null,t);return H_(this.cover(e,i),e,i,t)}function H_(t,e,i,r){if(isNaN(e)||isNaN(i))return t;var n,s=t._root,a={data:r},o=t._x0,l=t._y0,h=t._x1,u=t._y1,d,p,g,b,x,_,T,C;if(!s)return t._root=a,t;for(;s.length;)if((x=e>=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p,n=s,!(s=s[T=_<<1|x]))return n[T]=a,t;if(g=+t._x.call(null,s.data),b=+t._y.call(null,s.data),e===g&&i===b)return a.next=s,n?n[T]=a:t._root=a,t;do n=n?n[T]=new Array(4):t._root=new Array(4),(x=e>=(d=(o+h)/2))?o=d:h=d,(_=i>=(p=(l+u)/2))?l=p:u=p;while((T=_<<1|x)===(C=(b>=p)<<1|g>=d));return n[C]=s,n[T]=a,t}function P2(t){var e,i,r=t.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,e=t[i]))||isNaN(s=+this._y.call(null,e))||(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)H_(this,a[i],o[i],t[i]);return this}function R2(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,r=this._y0,n=this._x1,s=this._y1;if(isNaN(i))n=(i=Math.floor(t))+1,s=(r=Math.floor(e))+1;else{for(var a=n-i||1,o=this._root,l,h;i>t||t>=n||r>e||e>=s;)switch(h=(e<r)<<1|t<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 k2(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function B2(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ri(t,e,i,r,n){this.node=t,this.x0=e,this.y0=i,this.x1=r,this.y1=n}function I2(t,e,i){var r,n=this._x0,s=this._y0,a,o,l,h,u=this._x1,d=this._y1,p=[],g=this._root,b,x;for(g&&p.push(new ri(g,n,s,u,d)),i==null?i=1/0:(n=t-i,s=e-i,u=t+i,d=e+i,i*=i);b=p.pop();)if(!(!(g=b.node)||(a=b.x0)>u||(o=b.y0)>d||(l=b.x1)<n||(h=b.y1)<s))if(g.length){var _=(a+l)/2,T=(o+h)/2;p.push(new ri(g[3],_,T,l,h),new ri(g[2],a,T,_,h),new ri(g[1],_,o,l,T),new ri(g[0],a,o,_,T)),(x=(e>=T)<<1|t>=_)&&(b=p[p.length-1],p[p.length-1]=p[p.length-1-x],p[p.length-1-x]=b)}else{var C=t-+this._x.call(null,g.data),F=e-+this._y.call(null,g.data),k=C*C+F*F;if(k<i){var N=Math.sqrt(i=k);n=t-N,s=e-N,u=t+N,d=e+N,r=g.data}}return r}function G2(t){if(isNaN(u=+this._x.call(null,t))||isNaN(d=+this._y.call(null,t)))return this;var e,i=this._root,r,n,s,a=this._x0,o=this._y0,l=this._x1,h=this._y1,u,d,p,g,b,x,_,T;if(!i)return this;if(i.length)for(;;){if((b=u>=(p=(a+l)/2))?a=p:l=p,(x=d>=(g=(o+h)/2))?o=g:h=g,e=i,!(i=i[_=x<<1|b]))return this;if(!i.length)break;(e[_+1&3]||e[_+2&3]||e[_+3&3])&&(r=e,T=_)}for(;i.data!==t;)if(n=i,!(i=i.next))return this;return(s=i.next)&&delete i.next,n?(s?n.next=s:delete n.next,this):e?(s?e[_]=s:delete e[_],(i=e[0]||e[1]||e[2]||e[3])&&i===(e[3]||e[2]||e[1]||e[0])&&!i.length&&(r?r[T]=i:this._root=i),this):(this._root=s,this)}function O2(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this}function F2(){return this._root}function D2(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function U2(t){var e=[],i,r=this._root,n,s,a,o,l;for(r&&e.push(new ri(r,this._x0,this._y0,this._x1,this._y1));i=e.pop();)if(!t(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])&&e.push(new ri(n,h,u,o,l)),(n=r[2])&&e.push(new ri(n,s,u,h,l)),(n=r[1])&&e.push(new ri(n,h,a,o,u)),(n=r[0])&&e.push(new ri(n,s,a,h,u))}return this}function L2(t){var e=[],i=[],r;for(this._root&&e.push(new ri(this._root,this._x0,this._y0,this._x1,this._y1));r=e.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])&&e.push(new ri(s,a,o,u,d)),(s=n[1])&&e.push(new ri(s,u,o,l,d)),(s=n[2])&&e.push(new ri(s,a,d,u,h)),(s=n[3])&&e.push(new ri(s,u,d,l,h))}i.push(r)}for(;r=i.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function N2(t){return t[0]}function H2(t){return arguments.length?(this._x=t,this):this._x}function z2(t){return t[1]}function W2(t){return arguments.length?(this._y=t,this):this._y}function gc(t,e,i){var r=new mc(e??N2,i??z2,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function mc(t,e,i,r,n,s){this._x=t,this._y=e,this._x0=i,this._y0=r,this._x1=n,this._y1=s,this._root=void 0}function z_(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var ni=gc.prototype=mc.prototype;ni.copy=function(){var t=new mc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,i,r;if(!e)return t;if(!e.length)return t._root=z_(e),t;for(i=[{source:e,target:t._root=new Array(4)}];e=i.pop();)for(var n=0;n<4;++n)(r=e.source[n])&&(r.length?i.push({source:r,target:e.target[n]=new Array(4)}):e.target[n]=z_(r));return t},ni.add=M2,ni.addAll=P2,ni.cover=R2,ni.data=k2,ni.extent=B2,ni.find=I2,ni.remove=G2,ni.removeAll=O2,ni.root=F2,ni.size=D2,ni.visit=U2,ni.visitAfter=L2,ni.x=H2,ni.y=W2;function $r(t){return function(){return t}}function Ar(t){return(t()-.5)*1e-6}function j2(t){return t.x+t.vx}function V2(t){return t.y+t.vy}function $2(t){var e,i,r,n=1,s=1;typeof t!="function"&&(t=$r(t==null?1:+t));function a(){for(var h,u=e.length,d,p,g,b,x,_,T=0;T<s;++T)for(d=gc(e,j2,V2).visitAfter(o),h=0;h<u;++h)p=e[h],x=i[p.index],_=x*x,g=p.x+p.vx,b=p.y+p.vy,d.visit(C);function C(F,k,N,re,ne){var J=F.data,$=F.r,ie=x+$;if(J){if(J.index>p.index){var Se=g-J.x-J.vx,Pe=b-J.y-J.vy,ce=Se*Se+Pe*Pe;ce<ie*ie&&(Se===0&&(Se=Ar(r),ce+=Se*Se),Pe===0&&(Pe=Ar(r),ce+=Pe*Pe),ce=(ie-(ce=Math.sqrt(ce)))/ce*n,p.vx+=(Se*=ce)*(ie=($*=$)/(_+$)),p.vy+=(Pe*=ce)*ie,J.vx-=Se*(ie=1-ie),J.vy-=Pe*ie)}return}return k>g+ie||re<g-ie||N>b+ie||ne<b-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(e){var h,u=e.length,d;for(i=new Array(u),h=0;h<u;++h)d=e[h],i[d.index]=+t(d,h,e)}}return a.initialize=function(h,u){e=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?(t=typeof h=="function"?h:$r(+h),l(),a):t},a}function X2(t){return t.index}function W_(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}function Y2(t){var e=X2,i=d,r,n=$r(30),s,a,o,l,h,u=1;t==null&&(t=[]);function d(_){return 1/Math.min(o[_.source.index],o[_.target.index])}function p(_){for(var T=0,C=t.length;T<u;++T)for(var F=0,k,N,re,ne,J,$,ie;F<C;++F)k=t[F],N=k.source,re=k.target,ne=re.x+re.vx-N.x-N.vx||Ar(h),J=re.y+re.vy-N.y-N.vy||Ar(h),$=Math.sqrt(ne*ne+J*J),$=($-s[F])/$*_*r[F],ne*=$,J*=$,re.vx-=ne*(ie=l[F]),re.vy-=J*ie,N.vx+=ne*(ie=1-ie),N.vy+=J*ie}function g(){if(a){var _,T=a.length,C=t.length,F=new Map(a.map((N,re)=>[e(N,re,a),N])),k;for(_=0,o=new Array(T);_<C;++_)k=t[_],k.index=_,typeof k.source!="object"&&(k.source=W_(F,k.source)),typeof k.target!="object"&&(k.target=W_(F,k.target)),o[k.source.index]=(o[k.source.index]||0)+1,o[k.target.index]=(o[k.target.index]||0)+1;for(_=0,l=new Array(C);_<C;++_)k=t[_],l[_]=o[k.source.index]/(o[k.source.index]+o[k.target.index]);r=new Array(C),b(),s=new Array(C),x()}}function b(){if(a)for(var _=0,T=t.length;_<T;++_)r[_]=+i(t[_],_,t)}function x(){if(a)for(var _=0,T=t.length;_<T;++_)s[_]=+n(t[_],_,t)}return p.initialize=function(_,T){a=_,h=T,g()},p.links=function(_){return arguments.length?(t=_,g(),p):t},p.id=function(_){return arguments.length?(e=_,p):e},p.iterations=function(_){return arguments.length?(u=+_,p):u},p.strength=function(_){return arguments.length?(i=typeof _=="function"?_:$r(+_),b(),p):i},p.distance=function(_){return arguments.length?(n=typeof _=="function"?_:$r(+_),x(),p):n},p}function q2(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function K2(t){return t.x}function Z2(t){return t.y}var Q2=10,J2=Math.PI*(3-Math.sqrt(5));function eA(t){var e,i=1,r=.001,n=1-Math.pow(r,1/300),s=0,a=.6,o=new Map,l=lc(d),h=ho("tick","end"),u=q2();t==null&&(t=[]);function d(){p(),h.call("tick",e),i<r&&(l.stop(),h.call("end",e))}function p(x){var _,T=t.length,C;x===void 0&&(x=1);for(var F=0;F<x;++F)for(i+=(s-i)*n,o.forEach(function(k){k(i)}),_=0;_<T;++_)C=t[_],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 e}function g(){for(var x=0,_=t.length,T;x<_;++x){if(T=t[x],T.index=x,T.fx!=null&&(T.x=T.fx),T.fy!=null&&(T.y=T.fy),isNaN(T.x)||isNaN(T.y)){var C=Q2*Math.sqrt(.5+x),F=x*J2;T.x=C*Math.cos(F),T.y=C*Math.sin(F)}(isNaN(T.vx)||isNaN(T.vy))&&(T.vx=T.vy=0)}}function b(x){return x.initialize&&x.initialize(t,u),x}return g(),e={tick:p,restart:function(){return l.restart(d),e},stop:function(){return l.stop(),e},nodes:function(x){return arguments.length?(t=x,g(),o.forEach(b),e):t},alpha:function(x){return arguments.length?(i=+x,e):i},alphaMin:function(x){return arguments.length?(r=+x,e):r},alphaDecay:function(x){return arguments.length?(n=+x,e):+n},alphaTarget:function(x){return arguments.length?(s=+x,e):s},velocityDecay:function(x){return arguments.length?(a=1-x,e):1-a},randomSource:function(x){return arguments.length?(u=x,o.forEach(b),e):u},force:function(x,_){return arguments.length>1?(_==null?o.delete(x):o.set(x,b(_)),e):o.get(x)},find:function(x,_,T){var C=0,F=t.length,k,N,re,ne,J;for(T==null?T=1/0:T*=T,C=0;C<F;++C)ne=t[C],k=x-ne.x,N=_-ne.y,re=k*k+N*N,re<T&&(J=ne,T=re);return J},on:function(x,_){return arguments.length>1?(h.on(x,_),e):h.on(x)}}}function tA(){var t,e,i,r,n=$r(-30),s,a=1,o=1/0,l=.81;function h(g){var b,x=t.length,_=gc(t,K2,Z2).visitAfter(d);for(r=g,b=0;b<x;++b)e=t[b],_.visit(p)}function u(){if(t){var g,b=t.length,x;for(s=new Array(b),g=0;g<b;++g)x=t[g],s[x.index]=+n(x,g,t)}}function d(g){var b=0,x,_,T=0,C,F,k;if(g.length){for(C=F=k=0;k<4;++k)(x=g[k])&&(_=Math.abs(x.value))&&(b+=x.value,T+=_,C+=_*x.x,F+=_*x.y);g.x=C/T,g.y=F/T}else{x=g,x.x=x.data.x,x.y=x.data.y;do b+=s[x.data.index];while(x=x.next)}g.value=b}function p(g,b,x,_){if(!g.value)return!0;var T=g.x-e.x,C=g.y-e.y,F=_-b,k=T*T+C*C;if(F*F/l<k)return k<o&&(T===0&&(T=Ar(i),k+=T*T),C===0&&(C=Ar(i),k+=C*C),k<a&&(k=Math.sqrt(a*k)),e.vx+=T*g.value*r/k,e.vy+=C*g.value*r/k),!0;if(!(g.length||k>=o)){(g.data!==e||g.next)&&(T===0&&(T=Ar(i),k+=T*T),C===0&&(C=Ar(i),k+=C*C),k<a&&(k=Math.sqrt(a*k)));do g.data!==e&&(F=s[g.data.index]*r/k,e.vx+=T*F,e.vy+=C*F);while(g=g.next)}}return h.initialize=function(g,b){t=g,i=b,u()},h.strength=function(g){return arguments.length?(n=typeof g=="function"?g:$r(+g),u(),h):n},h.distanceMin=function(g){return arguments.length?(a=g*g,h):Math.sqrt(a)},h.distanceMax=function(g){return arguments.length?(o=g*g,h):Math.sqrt(o)},h.theta=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h}var Mo=t=>()=>t;function iA(t,{sourceEvent:e,target:i,transform:r,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:n}})}function dr(t,e,i){this.k=t,this.x=e,this.y=i}dr.prototype={constructor:dr,scale:function(t){return t===1?this:new dr(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new dr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Po=new dr(1,0,0);rA.prototype=dr.prototype;function rA(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Po;return t.__zoom}function _c(t){t.stopImmediatePropagation()}function xs(t){t.preventDefault(),t.stopImmediatePropagation()}function nA(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function sA(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function j_(){return this.__zoom||Po}function aA(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function oA(){return navigator.maxTouchPoints||"ontouchstart"in this}function lA(t,e,i){var r=t.invertX(e[0][0])-i[0][0],n=t.invertX(e[1][0])-i[1][0],s=t.invertY(e[0][1])-i[0][1],a=t.invertY(e[1][1])-i[1][1];return t.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 hA(){var t=nA,e=sA,i=lA,r=aA,n=oA,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=fE,h=ho("start","zoom","end"),u,d,p,g=500,b=150,x=0,_=10;function T(D){D.property("__zoom",j_).on("wheel.zoom",J,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",ie).filter(n).on("touchstart.zoom",Se).on("touchmove.zoom",Pe).on("touchend.zoom touchcancel.zoom",ce).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}T.transform=function(D,se,q,de){var A=D.selection?D.selection():D;A.property("__zoom",j_),D!==A?N(D,se,q,de):A.interrupt().each(function(){re(this,arguments).event(de).start().zoom(null,typeof se=="function"?se.apply(this,arguments):se).end()})},T.scaleBy=function(D,se,q,de){T.scaleTo(D,function(){var A=this.__zoom.k,M=typeof se=="function"?se.apply(this,arguments):se;return A*M},q,de)},T.scaleTo=function(D,se,q,de){T.transform(D,function(){var A=e.apply(this,arguments),M=this.__zoom,E=q==null?k(A):typeof q=="function"?q.apply(this,arguments):q,z=M.invert(E),L=typeof se=="function"?se.apply(this,arguments):se;return i(F(C(M,L),E,z),A,a)},q,de)},T.translateBy=function(D,se,q,de){T.transform(D,function(){return i(this.__zoom.translate(typeof se=="function"?se.apply(this,arguments):se,typeof q=="function"?q.apply(this,arguments):q),e.apply(this,arguments),a)},null,de)},T.translateTo=function(D,se,q,de,A){T.transform(D,function(){var M=e.apply(this,arguments),E=this.__zoom,z=de==null?k(M):typeof de=="function"?de.apply(this,arguments):de;return i(Po.translate(z[0],z[1]).scale(E.k).translate(typeof se=="function"?-se.apply(this,arguments):-se,typeof q=="function"?-q.apply(this,arguments):-q),M,a)},de,A)};function C(D,se){return se=Math.max(s[0],Math.min(s[1],se)),se===D.k?D:new dr(se,D.x,D.y)}function F(D,se,q){var de=se[0]-q[0]*D.k,A=se[1]-q[1]*D.k;return de===D.x&&A===D.y?D:new dr(D.k,de,A)}function k(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function N(D,se,q,de){D.on("start.zoom",function(){re(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){re(this,arguments).event(de).end()}).tween("zoom",function(){var A=this,M=arguments,E=re(A,M).event(de),z=e.apply(A,M),L=q==null?k(z):typeof q=="function"?q.apply(A,M):q,Z=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),K=A.__zoom,ae=typeof se=="function"?se.apply(A,M):se,be=l(K.invert(L).concat(Z/K.k),ae.invert(L).concat(Z/ae.k));return function(_e){if(_e===1)_e=ae;else{var Fe=be(_e),Le=Z/Fe[2];_e=new dr(Le,L[0]-Fe[0]*Le,L[1]-Fe[1]*Le)}E.zoom(null,_e)}})}function re(D,se,q){return!q&&D.__zooming||new ne(D,se)}function ne(D,se){this.that=D,this.args=se,this.active=0,this.sourceEvent=null,this.extent=e.apply(D,se),this.taps=0}ne.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,se){return this.mouse&&D!=="mouse"&&(this.mouse[1]=se.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=se.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=se.invert(this.touch1[0])),this.that.__zoom=se,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var se=Ri(this.that).datum();h.call(D,this.that,new iA(D,{sourceEvent:this.sourceEvent,target:T,type:D,transform:this.that.__zoom,dispatch:h}),se)}};function J(D,...se){if(!t.apply(this,arguments))return;var q=re(this,se).event(D),de=this.__zoom,A=Math.max(s[0],Math.min(s[1],de.k*Math.pow(2,r.apply(this,arguments)))),M=hr(D);if(q.wheel)(q.mouse[0][0]!==M[0]||q.mouse[0][1]!==M[1])&&(q.mouse[1]=de.invert(q.mouse[0]=M)),clearTimeout(q.wheel);else{if(de.k===A)return;q.mouse=[M,de.invert(M)],Co(this),q.start()}xs(D),q.wheel=setTimeout(E,b),q.zoom("mouse",i(F(C(de,A),q.mouse[0],q.mouse[1]),q.extent,a));function E(){q.wheel=null,q.end()}}function $(D,...se){if(p||!t.apply(this,arguments))return;var q=D.currentTarget,de=re(this,se,!0).event(D),A=Ri(D.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",Z,!0),M=hr(D,q),E=D.clientX,z=D.clientY;h_(D.view),_c(D),de.mouse=[M,this.__zoom.invert(M)],Co(this),de.start();function L(K){if(xs(K),!de.moved){var ae=K.clientX-E,be=K.clientY-z;de.moved=ae*ae+be*be>x}de.event(K).zoom("mouse",i(F(de.that.__zoom,de.mouse[0]=hr(K,q),de.mouse[1]),de.extent,a))}function Z(K){A.on("mousemove.zoom mouseup.zoom",null),u_(K.view,de.moved),xs(K),de.event(K).end()}}function ie(D,...se){if(t.apply(this,arguments)){var q=this.__zoom,de=hr(D.changedTouches?D.changedTouches[0]:D,this),A=q.invert(de),M=q.k*(D.shiftKey?.5:2),E=i(F(C(q,M),de,A),e.apply(this,se),a);xs(D),o>0?Ri(this).transition().duration(o).call(N,E,de,D):Ri(this).call(T.transform,E,de,D)}}function Se(D,...se){if(t.apply(this,arguments)){var q=D.touches,de=q.length,A=re(this,se,D.changedTouches.length===de).event(D),M,E,z,L;for(_c(D),E=0;E<de;++E)z=q[E],L=hr(z,this),L=[L,this.__zoom.invert(L),z.identifier],A.touch0?!A.touch1&&A.touch0[2]!==L[2]&&(A.touch1=L,A.taps=0):(A.touch0=L,M=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),M&&(A.taps<2&&(d=L[0],u=setTimeout(function(){u=null},g)),Co(this),A.start())}}function Pe(D,...se){if(this.__zooming){var q=re(this,se).event(D),de=D.changedTouches,A=de.length,M,E,z,L;for(xs(D),M=0;M<A;++M)E=de[M],z=hr(E,this),q.touch0&&q.touch0[2]===E.identifier?q.touch0[0]=z:q.touch1&&q.touch1[2]===E.identifier&&(q.touch1[0]=z);if(E=q.that.__zoom,q.touch1){var Z=q.touch0[0],K=q.touch0[1],ae=q.touch1[0],be=q.touch1[1],_e=(_e=ae[0]-Z[0])*_e+(_e=ae[1]-Z[1])*_e,Fe=(Fe=be[0]-K[0])*Fe+(Fe=be[1]-K[1])*Fe;E=C(E,Math.sqrt(_e/Fe)),z=[(Z[0]+ae[0])/2,(Z[1]+ae[1])/2],L=[(K[0]+be[0])/2,(K[1]+be[1])/2]}else if(q.touch0)z=q.touch0[0],L=q.touch0[1];else return;q.zoom("touch",i(F(E,z,L),q.extent,a))}}function ce(D,...se){if(this.__zooming){var q=re(this,se).event(D),de=D.changedTouches,A=de.length,M,E;for(_c(D),p&&clearTimeout(p),p=setTimeout(function(){p=null},g),M=0;M<A;++M)E=de[M],q.touch0&&q.touch0[2]===E.identifier?delete q.touch0:q.touch1&&q.touch1[2]===E.identifier&&delete q.touch1;if(q.touch1&&!q.touch0&&(q.touch0=q.touch1,delete q.touch1),q.touch0)q.touch0[1]=this.__zoom.invert(q.touch0[0]);else if(q.end(),q.taps===2&&(E=hr(E,this),Math.hypot(d[0]-E[0],d[1]-E[1])<_)){var z=Ri(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return T.wheelDelta=function(D){return arguments.length?(r=typeof D=="function"?D:Mo(+D),T):r},T.filter=function(D){return arguments.length?(t=typeof D=="function"?D:Mo(!!D),T):t},T.touchable=function(D){return arguments.length?(n=typeof D=="function"?D:Mo(!!D),T):n},T.extent=function(D){return arguments.length?(e=typeof D=="function"?D:Mo([[+D[0][0],+D[0][1]],[+D[1][0],+D[1][1]]]),T):e},T.scaleExtent=function(D){return arguments.length?(s[0]=+D[0],s[1]=+D[1],T):[s[0],s[1]]},T.translateExtent=function(D){return arguments.length?(a[0][0]=+D[0][0],a[1][0]=+D[1][0],a[0][1]=+D[0][1],a[1][1]=+D[1][1],T):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},T.constrain=function(D){return arguments.length?(i=D,T):i},T.duration=function(D){return arguments.length?(o=+D,T):o},T.interpolate=function(D){return arguments.length?(l=D,T):l},T.on=function(){var D=h.on.apply(h,arguments);return D===h?T:D},T.clickDistance=function(D){return arguments.length?(x=(D=+D)*D,T):Math.sqrt(x)},T.tapDistance=function(D){return arguments.length?(_=+D,T):_},T}te();var uA={extension:{type:O.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(x0(),y0))}};te();var cA={extension:{type:O.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(w0(),b0))}};te(),Sl(),ml(),te(),Ot(),ja();var vc;function dA(t){return vc!==void 0||(vc=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??rs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!ft.get().getWebGLRenderingContext())return!1;let i=ft.get().createCanvas().getContext("webgl",e),r=!!i?.getContextAttributes()?.stencil;if(i){let n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}})()),vc}Ot();var yc;async function fA(t={}){return yc!==void 0||(yc=await(async()=>{let e=ft.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),yc}ja();var V_=["webgl","webgpu","canvas"];async function pA(t){let e=[];t.preference?(e.push(t.preference),V_.forEach(s=>{s!==t.preference&&e.push(s)})):e=V_.slice();let i,r={};for(let s=0;s<e.length;s++){let a=e[s];if(a==="webgpu"&&await fA()){let{WebGPURenderer:o}=await Promise.resolve().then(()=>(j1(),tm));i=o,r={...t,...t.webgpu};break}else if(a==="webgl"&&dA(t.failIfMajorPerformanceCaveat??rs.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(Kw(),zm));i=o,r={...t,...t.webgl};break}else if(a==="canvas")throw r={...t},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}Ni(),pg(),_t();var $_=class kc{constructor(...e){this.stage=new bt,e[0]!==void 0&&We(je,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await pA(e),kc._plugins.forEach(i=>{i.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return We(je,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,i=!1){let r=kc._plugins.slice(0);r.reverse(),r.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};$_._plugins=[];var X_=$_;ge.handleByList(O.Application,X_._plugins),ge.add(Vh),Cr(),_t(),vl();var gA=class extends zs{constructor(t,e){let{text:i,resolution:r,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new Tt({_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(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t=t||{},this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),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(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){let e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,r=-e*this.anchor.x,n=0;return t.x>=r&&t.x<=r+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function mA(t,e){let i=t[0]??{};return(typeof i=="string"||t[1])&&(We(je,`use new ${e}({ text: "hi!", style }) instead`),i={text:i,style:t[1]}),i}Da(),Kn();var _A=class extends gA{constructor(...t){let e=mA(t,"Text");super(e,$i),this.renderPipeId="text"}_updateBounds(){let t=this._bounds,e=this._anchor,i=Pi.measureText(this._text,this._style),{width:r,height:n}=i;t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*n,t.maxY=t.minY+n}};If(),wd(),Ni(),fp(),gt();var DA=lt(df(),1);ge.add(uA,cA);var bs=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-bs.Bounce.Out(1-t)},Out:function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},InOut:function(t){return t<.5?bs.Bounce.In(t*2)*.5:bs.Bounce.Out(t*2-1)*.5+.5}}),generatePow:function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5}}}}),ws=function(){return performance.now()},Ro=function(){function t(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(i){return e._tweens[i]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,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];(e=a._group)===null||e===void 0||e.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},t.prototype.remove=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var r=0,n=e;r<n.length;r++){var s=n[r];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,i){e===void 0&&(e=ws()),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(e,a)===!1&&!i&&this.remove(s)}r=Object.keys(this._tweensAddedDuringUpdate)}},t}(),En={Linear:function(t,e){var i=t.length-1,r=i*e,n=Math.floor(r),s=En.Utils.Linear;return e<0?s(t[0],t[1],r):e>1?s(t[i],t[i-1],i-r):s(t[n],t[n+1>i?i:n+1],r-n)},Bezier:function(t,e){for(var i=0,r=t.length-1,n=Math.pow,s=En.Utils.Bernstein,a=0;a<=r;a++)i+=n(1-e,r-a)*n(e,a)*t[a]*s(r,a);return i},CatmullRom:function(t,e){var i=t.length-1,r=i*e,n=Math.floor(r),s=En.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(n=Math.floor(r=i*(1+e))),s(t[(n-1+i)%i],t[n],t[(n+1)%i],t[(n+2)%i],r-n)):e<0?t[0]-(s(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[i]-(s(t[i],t[i],t[i-1],t[i-1],r-i)-t[i]):s(t[n?n-1:0],t[n],t[i<n+1?i:n+1],t[i<n+2?i:n+2],r-n)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=En.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:function(){var t=[1];return function(e){var i=1;if(t[e])return t[e];for(var r=e;r>1;r--)i*=r;return t[e]=i,i}}(),CatmullRom:function(t,e,i,r,n){var s=(i-t)*.5,a=(r-e)*.5,o=n*n,l=n*o;return(2*e-2*i+s+a)*l+(-3*e+3*i-2*s-a)*o+s*n+e}}},Y_=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),xc=new Ro,ko=function(){function t(e,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=bs.Linear.None,this._interpolationFunction=En.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Y_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=xc,xc.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,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=e,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,i){if(e===void 0&&(e=ws()),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=e,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},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,i,r,n,s){for(var a in r){var o=e[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],g=0,b=d.length;g<b;g+=1){var x=this._handleRelativeValue(o,d[g]);if(isNaN(x)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(x)}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}}},t.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},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=ws()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=ws()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,i=this._chainedTweens.length;e<i;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=bs.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=En.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,i){var r=this,n;if(e===void 0&&(e=ws()),i===void 0&&(i=t.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<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=e-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 x=Math.trunc(a/o),_=a-x*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 g=0,b=this._chainedTweens.length;g<b;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,i,r,n){for(var s in r)if(i[s]!==void 0){var a=i[s]||0,o=r[s],l=Array.isArray(e[s]),h=Array.isArray(o),u=!l&&h;u?e[s]=this._interpolationFunction(o,n):typeof o=="object"&&o?this._updateProperties(e[s],a,o,n):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(e[s]=a+(o-a)*n))}},t.prototype._handleRelativeValue=function(e,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?e+parseFloat(i):parseFloat(i)},t.prototype._swapEndStartRepeatValues=function(e){var i=this._valuesStartRepeat[e],r=this._valuesEnd[e];typeof r=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(r):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=i},t.autoStartOnUpdate=!1,t}(),UA=Y_.nextId,qi=xc,LA=qi.getAll.bind(qi),NA=qi.removeAll.bind(qi),HA=qi.add.bind(qi),zA=qi.remove.bind(qi),WA=qi.update.bind(qi);function vA(t,e){if(!t)return;function i(n){n.target===this&&(n.preventDefault(),n.stopPropagation(),e())}function r(n){n.key.startsWith("Esc")&&(n.preventDefault(),e())}t?.addEventListener("click",i),window.addCleanup(()=>t?.removeEventListener("click",i)),document.addEventListener("keydown",r),window.addCleanup(()=>document.removeEventListener("keydown",r))}function yA(t){for(;t.firstChild;)t.removeChild(t.firstChild)}var jA=Object.hasOwnProperty,xA=lt(Zw(),1),VA=(0,xA.default)();function bA(t){return t.document.body.dataset.slug}function Ts(t){let e=AA(EA(t,"index"),!0);return e.length===0?"/":e}function wA(t){let e=t.split("/").filter(i=>i!=="").slice(0,-1).map(i=>"..").join("/");return e.length===0&&(e="."),e}function q_(t,e){return TA(wA(t),Ts(e))}function TA(...t){return t.filter(e=>e!=="").join("/").replace(/\/\/+/g,"/")}function SA(t,e){return t===e||t.endsWith("/"+e)}function EA(t,e){return SA(t,e)&&(t=t.slice(0,-e.length)),t}function AA(t,e){return t.startsWith("/")&&(t=t.substring(1)),!e&&t.endsWith("/")&&(t=t.slice(0,-1)),t}var K_="graph-visited";function Z_(){return new Set(JSON.parse(localStorage.getItem(K_)??"[]"))}function CA(t){let e=Z_();e.add(t),localStorage.setItem(K_,JSON.stringify([...e]))}async function bc(t,e){let i=Ts(e),r=Z_(),n=document.getElementById(t);if(!n)return;yA(n);let{drag:s,zoom:a,depth:o,scale:l,repelForce:h,centerForce:u,linkDistance:d,fontSize:p,opacityScale:g,removeTags:b,showTags:x,focusOnHover:_}=JSON.parse(n.dataset.cfg),T=new Map(Object.entries(await fetchData).map(([Y,oe])=>[Ts(Y),oe])),C=[],F=[],k=new Set(T.keys()),N=new Map;for(let[Y,oe]of T.entries()){let he=oe.links??[];for(let me of he)k.has(me)&&C.push({source:Y,target:me});if(x){let me=oe.tags.filter(Et=>!b.includes(Et)).map(Et=>Ts("tags/"+Et));F.push(...me.filter(Et=>!F.includes(Et)));for(let Et of me)C.push({source:Y,target:Et})}}let re=new Set,ne=[i,"__SENTINEL"];if(o>=0)for(;o>=0&&ne.length>0;){let Y=ne.shift();if(Y==="__SENTINEL")o--,ne.push("__SENTINEL");else{re.add(Y);let oe=C.filter(me=>me.source===Y),he=C.filter(me=>me.target===Y);ne.push(...oe.map(me=>me.target),...he.map(me=>me.source))}}else k.forEach(Y=>re.add(Y)),x&&F.forEach(Y=>re.add(Y));let J=[...re].map(Y=>{let oe=Y.startsWith("tags/")?"#"+Y.substring(5):T.get(Y)?.title??Y;return{id:Y,text:oe,tags:T.get(Y)?.tags??[]}}),$={nodes:J,links:C.filter(Y=>re.has(Y.source)&&re.has(Y.target)).map(Y=>({source:J.find(oe=>oe.id===Y.source),target:J.find(oe=>oe.id===Y.target)}))},ie=eA($.nodes).force("charge",tA().strength(-100*h)).force("center",C2().strength(u)).force("link",Y2($.links).distance(d)).force("collide",$2(Y=>se(Y)).iterations(3)),Se=n.offsetWidth,Pe=Math.max(n.offsetHeight,250),ce=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((Y,oe)=>(Y[oe]=getComputedStyle(document.documentElement).getPropertyValue(oe),Y),{}),D=Y=>Y.id===i?ce["--secondary"]:r.has(Y.id)||Y.id.startsWith("tags/")?ce["--tertiary"]:ce["--gray"];function se(Y){let oe=$.links.filter(he=>he.source.id===Y.id||he.target.id===Y.id).length;return 2+Math.sqrt(oe)}let q=null,de=new Set,A=[],M=[];function E(Y){if(q=Y,Y===null){de=new Set;for(let oe of M)oe.active=!1;for(let oe of A)oe.active=!1}else{de=new Set;for(let oe of A){let he=oe.simulationData;(he.source.id===Y||he.target.id===Y)&&(de.add(he.source.id),de.add(he.target.id)),oe.active=he.source.id===Y||he.target.id===Y}for(let oe of M)oe.active=de.has(oe.simulationData.id)}}let z=0,L=!1;function Z(){N.get("link")?.stop();let Y=new Ro;for(let oe of A){let he=1;q&&(he=oe.active?1:.2),oe.color=oe.active?ce["--gray"]:ce["--lightgray"],Y.add(new ko(oe).to({alpha:he},200))}Y.getAll().forEach(oe=>oe.start()),N.set("link",{update:Y.update.bind(Y),stop(){Y.getAll().forEach(oe=>oe.stop())}})}function K(){N.get("label")?.stop();let Y=new Ro,oe=1/l,he=oe*1.1;for(let me of M){let Et=me.simulationData.id;q===Et?Y.add(new ko(me.label).to({alpha:1,scale:{x:he,y:he}},100)):Y.add(new ko(me.label).to({alpha:me.label.alpha,scale:{x:oe,y:oe}},100))}Y.getAll().forEach(me=>me.start()),N.set("label",{update:Y.update.bind(Y),stop(){Y.getAll().forEach(me=>me.stop())}})}function ae(){N.get("hover")?.stop();let Y=new Ro;for(let oe of M){let he=1;q!==null&&_&&(he=oe.active?1:.2),Y.add(new ko(oe.gfx,Y).to({alpha:he},200))}Y.getAll().forEach(oe=>oe.start()),N.set("hover",{update:Y.update.bind(Y),stop(){Y.getAll().forEach(oe=>oe.stop())}})}function be(){ae(),Z(),K()}N.forEach(Y=>Y.stop()),N.clear();let _e=new X_;await _e.init({width:Se,height:Pe,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),n.appendChild(_e.canvas);let Fe=_e.stage;Fe.interactive=!1;let Le=new bt({zIndex:3}),$e=new bt({zIndex:2}),wt=new bt({zIndex:1});Fe.addChild($e,Le,wt);for(let Y of $.nodes){let oe=Y.id,he=new _A({interactive:!1,eventMode:"none",text:Y.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 me=0,Et=oe.startsWith("tags/"),Ss=new La({interactive:!0,label:oe,eventMode:"static",hitArea:new ih(0,0,se(Y)),cursor:"pointer"}).circle(0,0,se(Y)).fill({color:Et?ce["--light"]:D(Y)}).stroke({width:Et?2:0,color:D(Y)}).on("pointerover",MA=>{E(MA.target.label),me=he.alpha,L||be()}).on("pointerleave",()=>{E(null),he.alpha=me,L||be()});$e.addChild(Ss),Le.addChild(he);let wc={simulationData:Y,gfx:Ss,label:he,color:D(Y),alpha:1,active:!1};M.push(wc)}for(let Y of $.links){let oe=new La({interactive:!1,eventMode:"none"});wt.addChild(oe);let he={simulationData:Y,gfx:oe,color:ce["--lightgray"],alpha:1,active:!1};A.push(he)}let Ye=Po;if(s)Ri(_e.canvas).call(LS().container(()=>_e.canvas).subject(()=>$.nodes.find(Y=>Y.id===q)).on("start",function(Y){Y.active||ie.alphaTarget(1).restart(),Y.subject.fx=Y.subject.x,Y.subject.fy=Y.subject.y,Y.subject.__initialDragPos={x:Y.subject.x,y:Y.subject.y,fx:Y.subject.fx,fy:Y.subject.fy},z=Date.now(),L=!0}).on("drag",function(Y){let oe=Y.subject.__initialDragPos;Y.subject.fx=oe.x+(Y.x-oe.x)/Ye.k,Y.subject.fy=oe.y+(Y.y-oe.y)/Ye.k}).on("end",function(Y){if(Y.active||ie.alphaTarget(0),Y.subject.fx=null,Y.subject.fy=null,L=!1,Date.now()-z<500){let oe=$.nodes.find(me=>me.id===Y.subject.id),he=q_(e,oe.id);window.spaNavigate(new URL(he,window.location.toString()))}}));else for(let Y of M)Y.gfx.on("click",()=>{let oe=q_(e,Y.simulationData.id);window.spaNavigate(new URL(oe,window.location.toString()))});a&&Ri(_e.canvas).call(hA().extent([[0,0],[Se,Pe]]).scaleExtent([.25,4]).on("zoom",({transform:Y})=>{Ye=Y,Fe.scale.set(Y.k,Y.k),Fe.position.set(Y.x,Y.y);let oe=Y.k*g,he=Math.max((oe-1)/3.75,0),me=M.filter(Et=>Et.active).flatMap(Et=>Et.label);for(let Et of Le.children)me.includes(Et)||(Et.alpha=he)}));function mi(Y){for(let oe of M){let{x:he,y:me}=oe.simulationData;!he||!me||(oe.gfx.position.set(he+Se/2,me+Pe/2),oe.label&&oe.label.position.set(he+Se/2,me+Pe/2))}for(let oe of A){let he=oe.simulationData;oe.gfx.clear(),oe.gfx.moveTo(he.source.x+Se/2,he.source.y+Pe/2),oe.gfx.lineTo(he.target.x+Se/2,he.target.y+Pe/2).stroke({alpha:oe.alpha,width:1,color:oe.color})}N.forEach(oe=>oe.update(Y)),_e.renderer.render(Fe),requestAnimationFrame(mi)}let Ii=requestAnimationFrame(mi);window.addCleanup(()=>cancelAnimationFrame(Ii))}document.addEventListener("nav",async t=>{let e=t.detail.url;CA(Ts(e)),await bc("graph-container",e);let i=()=>{bc("graph-container",e)};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=bA(window);r?.classList.add("active"),n&&(n.style.zIndex="1"),bc("global-graph-container",h),vA(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 kt=new IntersectionObserver(ut=>{for(let Ct of ut){let Zt=Ct.target.id,v=document.querySelector(`a[data-for="${Zt}"]`),Ne=Ct.rootBounds?.height;Ne&&v&&(Ct.boundingClientRect.y<Ne?v.classList.add("in-view"):v.classList.remove("in-view"))}});function At(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let ut=this.nextElementSibling;ut&&ut.classList.toggle("collapsed")}function Wt(){let ut=document.getElementById("toc");if(ut){let Ct=ut.classList.contains("collapsed");if(!ut.nextElementSibling)return;ut.addEventListener("click",At),window.addCleanup(()=>ut.removeEventListener("click",At))}}window.addEventListener("resize",Wt),document.addEventListener("nav",()=>{Wt(),kt.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(ut=>kt.observe(ut))})}(),function(){var kt=Object.create,At=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyNames,Ct=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,v=(c,f)=>()=>(f||c((f={exports:{}}).exports,f),f.exports),Ne=(c,f,m,y)=>{if(f&&typeof f=="object"||typeof f=="function")for(let w of ut(f))!Zt.call(c,w)&&w!==m&&At(c,w,{get:()=>f[w],enumerable:!(y=Wt(f,w))||y.enumerable});return c},ze=(c,f,m)=>(m=c!=null?kt(Ct(c)):{},Ne(f||!c||!c.__esModule?At(m,"default",{value:c,enumerable:!0}):m,c)),Mt=v((c,f)=>{"use strict";f.exports=y;function m(S){return S instanceof Buffer?Buffer.from(S):new S.constructor(S.buffer.slice(),S.byteOffset,S.length)}function y(S){if(S=S||{},S.circles)return w(S);let P=new Map;if(P.set(Date,G=>new Date(G)),P.set(Map,(G,j)=>new Map(U(Array.from(G),j))),P.set(Set,(G,j)=>new Set(U(Array.from(G),j))),S.constructorHandlers)for(let G of S.constructorHandlers)P.set(G[0],G[1]);let R=null;return S.proto?Q:H;function U(G,j){let I=Object.keys(G),B=new Array(I.length);for(let X=0;X<I.length;X++){let V=I[X],ue=G[V];typeof ue!="object"||ue===null?B[V]=ue:ue.constructor!==Object&&(R=P.get(ue.constructor))?B[V]=R(ue,j):ArrayBuffer.isView(ue)?B[V]=m(ue):B[V]=j(ue)}return B}function H(G){if(typeof G!="object"||G===null)return G;if(Array.isArray(G))return U(G,H);if(G.constructor!==Object&&(R=P.get(G.constructor)))return R(G,H);let j={};for(let I in G){if(Object.hasOwnProperty.call(G,I)===!1)continue;let B=G[I];typeof B!="object"||B===null?j[I]=B:B.constructor!==Object&&(R=P.get(B.constructor))?j[I]=R(B,H):ArrayBuffer.isView(B)?j[I]=m(B):j[I]=H(B)}return j}function Q(G){if(typeof G!="object"||G===null)return G;if(Array.isArray(G))return U(G,Q);if(G.constructor!==Object&&(R=P.get(G.constructor)))return R(G,Q);let j={};for(let I in G){let B=G[I];typeof B!="object"||B===null?j[I]=B:B.constructor!==Object&&(R=P.get(B.constructor))?j[I]=R(B,Q):ArrayBuffer.isView(B)?j[I]=m(B):j[I]=Q(B)}return j}}function w(S){let P=[],R=[],U=new Map;if(U.set(Date,I=>new Date(I)),U.set(Map,(I,B)=>new Map(Q(Array.from(I),B))),U.set(Set,(I,B)=>new Set(Q(Array.from(I),B))),S.constructorHandlers)for(let I of S.constructorHandlers)U.set(I[0],I[1]);let H=null;return S.proto?j:G;function Q(I,B){let X=Object.keys(I),V=new Array(X.length);for(let ue=0;ue<X.length;ue++){let Me=X[ue],Ee=I[Me];if(typeof Ee!="object"||Ee===null)V[Me]=Ee;else if(Ee.constructor!==Object&&(H=U.get(Ee.constructor)))V[Me]=H(Ee,B);else if(ArrayBuffer.isView(Ee))V[Me]=m(Ee);else{let Ke=P.indexOf(Ee);Ke!==-1?V[Me]=R[Ke]:V[Me]=B(Ee)}}return V}function G(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return Q(I,G);if(I.constructor!==Object&&(H=U.get(I.constructor)))return H(I,G);let B={};P.push(I),R.push(B);for(let X in I){if(Object.hasOwnProperty.call(I,X)===!1)continue;let V=I[X];if(typeof V!="object"||V===null)B[X]=V;else if(V.constructor!==Object&&(H=U.get(V.constructor)))B[X]=H(V,G);else if(ArrayBuffer.isView(V))B[X]=m(V);else{let ue=P.indexOf(V);ue!==-1?B[X]=R[ue]:B[X]=G(V)}}return P.pop(),R.pop(),B}function j(I){if(typeof I!="object"||I===null)return I;if(Array.isArray(I))return Q(I,j);if(I.constructor!==Object&&(H=U.get(I.constructor)))return H(I,j);let B={};P.push(I),R.push(B);for(let X in I){let V=I[X];if(typeof V!="object"||V===null)B[X]=V;else if(V.constructor!==Object&&(H=U.get(V.constructor)))B[X]=H(V,j);else if(ArrayBuffer.isView(V))B[X]=m(V);else{let ue=P.indexOf(V);ue!==-1?B[X]=R[ue]:B[X]=j(V)}}return P.pop(),R.pop(),B}}}),lt=Math.min,O=Math.max,Pt=Math.round,Ve=c=>({x:c,y:c}),ge={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function dt(c,f,m){return O(c,lt(f,m))}function Ut(c,f){return typeof c=="function"?c(f):c}function qe(c){return c.split("-")[0]}function gt(c){return c.split("-")[1]}function Gi(c){return c==="x"?"y":"x"}function Bt(c){return c==="y"?"height":"width"}function it(c){return["top","bottom"].includes(qe(c))?"y":"x"}function mt(c){return Gi(it(c))}function rt(c,f,m){m===void 0&&(m=!1);let y=gt(c),w=mt(c),S=Bt(w),P=w==="x"?y===(m?"end":"start")?"right":"left":y==="start"?"bottom":"top";return f.reference[S]>f.floating[S]&&(P=It(P)),[P,It(P)]}function Zi(c){let f=It(c);return[vi(c),f,vi(f)]}function vi(c){return c.replace(/start|end/g,f=>te[f])}function fr(c,f,m){let y=["left","right"],w=["right","left"],S=["top","bottom"],P=["bottom","top"];switch(c){case"top":case"bottom":return m?f?w:y:f?y:w;case"left":case"right":return f?S:P;default:return[]}}function hi(c,f,m,y){let w=gt(c),S=fr(qe(c),m==="start",y);return w&&(S=S.map(P=>P+"-"+w),f&&(S=S.concat(S.map(vi)))),S}function It(c){return c.replace(/left|right|bottom|top/g,f=>ge[f])}function Oi(c){return{top:0,right:0,bottom:0,left:0,...c}}function si(c){return typeof c!="number"?Oi(c):{top:c,right:c,bottom:c,left:c}}function Gt(c){let{x:f,y:m,width:y,height:w}=c;return{width:y,height:w,top:m,left:f,right:f+y,bottom:m+w,x:f,y:m}}function Fi(c,f,m){let{reference:y,floating:w}=c,S=it(f),P=mt(f),R=Bt(P),U=qe(f),H=S==="y",Q=y.x+y.width/2-w.width/2,G=y.y+y.height/2-w.height/2,j=y[R]/2-w[R]/2,I;switch(U){case"top":I={x:Q,y:y.y-w.height};break;case"bottom":I={x:Q,y:y.y+y.height};break;case"right":I={x:y.x+y.width,y:G};break;case"left":I={x:y.x-w.width,y:G};break;default:I={x:y.x,y:y.y}}switch(gt(f)){case"start":I[P]-=j*(m&&H?-1:1);break;case"end":I[P]+=j*(m&&H?-1:1);break}return I}var Qt=async(c,f,m)=>{let{placement:y="bottom",strategy:w="absolute",middleware:S=[],platform:P}=m,R=S.filter(Boolean),U=await(P.isRTL==null?void 0:P.isRTL(f)),H=await P.getElementRects({reference:c,floating:f,strategy:w}),{x:Q,y:G}=Fi(H,y,U),j=y,I={},B=0;for(let X=0;X<R.length;X++){let{name:V,fn:ue}=R[X],{x:Me,y:Ee,data:Ke,reset:St}=await ue({x:Q,y:G,initialPlacement:y,placement:j,strategy:w,middlewareData:I,rects:H,platform:P,elements:{reference:c,floating:f}});Q=Me??Q,G=Ee??G,I={...I,[V]:{...I[V],...Ke}},St&&B<=50&&(B++,typeof St=="object"&&(St.placement&&(j=St.placement),St.rects&&(H=St.rects===!0?await P.getElementRects({reference:c,floating:f,strategy:w}):St.rects),{x:Q,y:G}=Fi(H,j,U)),X=-1)}return{x:Q,y:G,placement:j,strategy:w,middlewareData:I}};async function Di(c,f){var m;f===void 0&&(f={});let{x:y,y:w,platform:S,rects:P,elements:R,strategy:U}=c,{boundary:H="clippingAncestors",rootBoundary:Q="viewport",elementContext:G="floating",altBoundary:j=!1,padding:I=0}=Ut(f,c),B=si(I),X=R[j?G==="floating"?"reference":"floating":G],V=Gt(await S.getClippingRect({element:(m=await(S.isElement==null?void 0:S.isElement(X)))==null||m?X:X.contextElement||await(S.getDocumentElement==null?void 0:S.getDocumentElement(R.floating)),boundary:H,rootBoundary:Q,strategy:U})),ue=G==="floating"?{...P.floating,x:y,y:w}:P.reference,Me=await(S.getOffsetParent==null?void 0:S.getOffsetParent(R.floating)),Ee=await(S.isElement==null?void 0:S.isElement(Me))?await(S.getScale==null?void 0:S.getScale(Me))||{x:1,y:1}:{x:1,y:1},Ke=Gt(S.convertOffsetParentRelativeRectToViewportRelativeRect?await S.convertOffsetParentRelativeRectToViewportRelativeRect({elements:R,rect:ue,offsetParent:Me,strategy:U}):ue);return{top:(V.top-Ke.top+B.top)/Ee.y,bottom:(Ke.bottom-V.bottom+B.bottom)/Ee.y,left:(V.left-Ke.left+B.left)/Ee.x,right:(Ke.right-V.right+B.right)/Ee.x}}var Qi=function(c){return c===void 0&&(c={}),{name:"flip",options:c,async fn(f){var m,y;let{placement:w,middlewareData:S,rects:P,initialPlacement:R,platform:U,elements:H}=f,{mainAxis:Q=!0,crossAxis:G=!0,fallbackPlacements:j,fallbackStrategy:I="bestFit",fallbackAxisSideDirection:B="none",flipAlignment:X=!0,...V}=Ut(c,f);if((m=S.arrow)!=null&&m.alignmentOffset)return{};let ue=qe(w),Me=qe(R)===R,Ee=await(U.isRTL==null?void 0:U.isRTL(H.floating)),Ke=j||(Me||!X?[It(R)]:Zi(R));!j&&B!=="none"&&Ke.push(...hi(R,X,B,Ee));let St=[R,...Ke],ai=await Di(f,V),$t=[],qt=((y=S.flip)==null?void 0:y.overflows)||[];if(Q&&$t.push(ai[ue]),G){let Oe=rt(w,P,Ee);$t.push(ai[Oe[0]],ai[Oe[1]])}if(qt=[...qt,{placement:w,overflows:$t}],!$t.every(Oe=>Oe<=0)){var ir,xe;let Oe=(((ir=S.flip)==null?void 0:ir.index)||0)+1,xt=St[Oe];if(xt)return{data:{index:Oe,overflows:qt},reset:{placement:xt}};let ot=(xe=qt.filter(tt=>tt.overflows[0]<=0).sort((tt,Rt)=>tt.overflows[1]-Rt.overflows[1])[0])==null?void 0:xe.placement;if(!ot)switch(I){case"bestFit":{var Ge;let tt=(Ge=qt.map(Rt=>[Rt.placement,Rt.overflows.filter(Kt=>Kt>0).reduce((Kt,Nt)=>Kt+Nt,0)]).sort((Rt,Kt)=>Rt[1]-Kt[1])[0])==null?void 0:Ge[0];tt&&(ot=tt);break}case"initialPlacement":ot=R;break}if(w!==ot)return{reset:{placement:ot}}}return{}}}};function Ei(c){let f=lt(...c.map(S=>S.left)),m=lt(...c.map(S=>S.top)),y=O(...c.map(S=>S.right)),w=O(...c.map(S=>S.bottom));return{x:f,y:m,width:y-f,height:w-m}}function Xt(c){let f=c.slice().sort((w,S)=>w.y-S.y),m=[],y=null;for(let w=0;w<f.length;w++){let S=f[w];!y||S.y-y.y>y.height/2?m.push([S]):m[m.length-1].push(S),y=S}return m.map(w=>Gt(Ei(w)))}var Jt=function(c){return c===void 0&&(c={}),{name:"inline",options:c,async fn(f){let{placement:m,elements:y,rects:w,platform:S,strategy:P}=f,{padding:R=2,x:U,y:H}=Ut(c,f),Q=Array.from(await(S.getClientRects==null?void 0:S.getClientRects(y.reference))||[]),G=Xt(Q),j=Gt(Ei(Q)),I=si(R);function B(){if(G.length===2&&G[0].left>G[1].right&&U!=null&&H!=null)return G.find(V=>U>V.left-I.left&&U<V.right+I.right&&H>V.top-I.top&&H<V.bottom+I.bottom)||j;if(G.length>=2){if(it(m)==="y"){let xe=G[0],Ge=G[G.length-1],Oe=qe(m)==="top",xt=xe.top,ot=Ge.bottom,tt=Oe?xe.left:Ge.left,Rt=Oe?xe.right:Ge.right,Kt=Rt-tt,Nt=ot-xt;return{top:xt,bottom:ot,left:tt,right:Rt,width:Kt,height:Nt,x:tt,y:xt}}let V=qe(m)==="left",ue=O(...G.map(xe=>xe.right)),Me=lt(...G.map(xe=>xe.left)),Ee=G.filter(xe=>V?xe.left===Me:xe.right===ue),Ke=Ee[0].top,St=Ee[Ee.length-1].bottom,ai=Me,$t=ue,qt=$t-ai,ir=St-Ke;return{top:Ke,bottom:St,left:ai,right:$t,width:qt,height:ir,x:ai,y:Ke}}return j}let X=await S.getElementRects({reference:{getBoundingClientRect:B},floating:y.floating,strategy:P});return w.reference.x!==X.reference.x||w.reference.y!==X.reference.y||w.reference.width!==X.reference.width||w.reference.height!==X.reference.height?{reset:{rects:X}}:{}}}},Yt=function(c){return c===void 0&&(c={}),{name:"shift",options:c,async fn(f){let{x:m,y,placement:w}=f,{mainAxis:S=!0,crossAxis:P=!1,limiter:R={fn:V=>{let{x:ue,y:Me}=V;return{x:ue,y:Me}}},...U}=Ut(c,f),H={x:m,y},Q=await Di(f,U),G=it(qe(w)),j=Gi(G),I=H[j],B=H[G];if(S){let V=j==="y"?"top":"left",ue=j==="y"?"bottom":"right",Me=I+Q[V],Ee=I-Q[ue];I=dt(Me,I,Ee)}if(P){let V=G==="y"?"top":"left",ue=G==="y"?"bottom":"right",Me=B+Q[V],Ee=B-Q[ue];B=dt(Me,B,Ee)}let X=R.fn({...f,[j]:I,[G]:B});return{...X,data:{x:X.x-m,y:X.y-y}}}}};function yi(){return typeof window<"u"}function W(c){return Te(c)?(c.nodeName||"").toLowerCase():"#document"}function ee(c){var f;return(c==null||(f=c.ownerDocument)==null?void 0:f.defaultView)||window}function le(c){var f;return(f=(Te(c)?c.ownerDocument:c.document)||window.document)==null?void 0:f.documentElement}function Te(c){return yi()?c instanceof Node||c instanceof ee(c).Node:!1}function we(c){return yi()?c instanceof Element||c instanceof ee(c).Element:!1}function fe(c){return yi()?c instanceof HTMLElement||c instanceof ee(c).HTMLElement:!1}function Re(c){return!yi()||typeof ShadowRoot>"u"?!1:c instanceof ShadowRoot||c instanceof ee(c).ShadowRoot}function He(c){let{overflow:f,overflowX:m,overflowY:y,display:w}=ye(c);return/auto|scroll|overlay|hidden|clip/.test(f+y+m)&&!["inline","contents"].includes(w)}function Qe(c){return["table","td","th"].includes(W(c))}function nt(c){return[":popover-open",":modal"].some(f=>{try{return c.matches(f)}catch{return!1}})}function ct(c){let f=Ie(),m=we(c)?ye(c):c;return m.transform!=="none"||m.perspective!=="none"||(m.containerType?m.containerType!=="normal":!1)||!f&&(m.backdropFilter?m.backdropFilter!=="none":!1)||!f&&(m.filter?m.filter!=="none":!1)||["transform","perspective","filter"].some(y=>(m.willChange||"").includes(y))||["paint","layout","strict","content"].some(y=>(m.contain||"").includes(y))}function pe(c){let f=Be(c);for(;fe(f)&&!ve(f);){if(ct(f))return f;if(nt(f))return null;f=Be(f)}return null}function Ie(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ve(c){return["html","body","#document"].includes(W(c))}function ye(c){return ee(c).getComputedStyle(c)}function Je(c){return we(c)?{scrollLeft:c.scrollLeft,scrollTop:c.scrollTop}:{scrollLeft:c.scrollX,scrollTop:c.scrollY}}function Be(c){if(W(c)==="html")return c;let f=c.assignedSlot||c.parentNode||Re(c)&&c.host||le(c);return Re(f)?f.host:f}function st(c){let f=Be(c);return ve(f)?c.ownerDocument?c.ownerDocument.body:c.body:fe(f)&&He(f)?f:st(f)}function ei(c,f,m){var y;f===void 0&&(f=[]),m===void 0&&(m=!0);let w=st(c),S=w===((y=c.ownerDocument)==null?void 0:y.body),P=ee(w);if(S){let R=De(P);return f.concat(P,P.visualViewport||[],He(w)?w:[],R&&m?ei(R):[])}return f.concat(w,ei(w,[],m))}function De(c){return c.parent&&Object.getPrototypeOf(c.parent)?c.frameElement:null}function ui(c){let f=ye(c),m=parseFloat(f.width)||0,y=parseFloat(f.height)||0,w=fe(c),S=w?c.offsetWidth:m,P=w?c.offsetHeight:y,R=Pt(m)!==S||Pt(y)!==P;return R&&(m=S,y=P),{width:m,height:y,$:R}}function jt(c){return we(c)?c:c.contextElement}function Ae(c){let f=jt(c);if(!fe(f))return Ve(1);let m=f.getBoundingClientRect(),{width:y,height:w,$:S}=ui(f),P=(S?Pt(m.width):m.width)/y,R=(S?Pt(m.height):m.height)/w;return(!P||!Number.isFinite(P))&&(P=1),(!R||!Number.isFinite(R))&&(R=1),{x:P,y:R}}var Xr=Ve(0);function pr(c){let f=ee(c);return!Ie()||!f.visualViewport?Xr:{x:f.visualViewport.offsetLeft,y:f.visualViewport.offsetTop}}function Xe(c,f,m){return f===void 0&&(f=!1),!m||f&&m!==ee(c)?!1:f}function Tt(c,f,m,y){f===void 0&&(f=!1),m===void 0&&(m=!1);let w=c.getBoundingClientRect(),S=jt(c),P=Ve(1);f&&(y?we(y)&&(P=Ae(y)):P=Ae(c));let R=Xe(S,m,y)?pr(S):Ve(0),U=(w.left+R.x)/P.x,H=(w.top+R.y)/P.y,Q=w.width/P.x,G=w.height/P.y;if(S){let j=ee(S),I=y&&we(y)?ee(y):y,B=j,X=De(B);for(;X&&y&&I!==B;){let V=Ae(X),ue=X.getBoundingClientRect(),Me=ye(X),Ee=ue.left+(X.clientLeft+parseFloat(Me.paddingLeft))*V.x,Ke=ue.top+(X.clientTop+parseFloat(Me.paddingTop))*V.y;U*=V.x,H*=V.y,Q*=V.x,G*=V.y,U+=Ee,H+=Ke,B=ee(X),X=De(B)}}return Gt({width:Q,height:G,x:U,y:H})}function Cr(c){let{elements:f,rect:m,offsetParent:y,strategy:w}=c,S=w==="fixed",P=le(y),R=f?nt(f.floating):!1;if(y===P||R&&S)return m;let U={scrollLeft:0,scrollTop:0},H=Ve(1),Q=Ve(0),G=fe(y);if((G||!G&&!S)&&((W(y)!=="body"||He(P))&&(U=Je(y)),fe(y))){let j=Tt(y);H=Ae(y),Q.x=j.x+y.clientLeft,Q.y=j.y+y.clientTop}return{width:m.width*H.x,height:m.height*H.y,x:m.x*H.x-U.scrollLeft*H.x+Q.x,y:m.y*H.y-U.scrollTop*H.y+Q.y}}function ht(c){return Array.from(c.getClientRects())}function Ui(c,f){let m=Je(c).scrollLeft;return f?f.left+m:Tt(le(c)).left+m}function yt(c){let f=le(c),m=Je(c),y=c.ownerDocument.body,w=O(f.scrollWidth,f.clientWidth,y.scrollWidth,y.clientWidth),S=O(f.scrollHeight,f.clientHeight,y.scrollHeight,y.clientHeight),P=-m.scrollLeft+Ui(c),R=-m.scrollTop;return ye(y).direction==="rtl"&&(P+=O(f.clientWidth,y.clientWidth)-w),{width:w,height:S,x:P,y:R}}function We(c,f){let m=ee(c),y=le(c),w=m.visualViewport,S=y.clientWidth,P=y.clientHeight,R=0,U=0;if(w){S=w.width,P=w.height;let H=Ie();(!H||H&&f==="fixed")&&(R=w.offsetLeft,U=w.offsetTop)}return{width:S,height:P,x:R,y:U}}function Mr(c,f){let m=Tt(c,!0,f==="fixed"),y=m.top+c.clientTop,w=m.left+c.clientLeft,S=fe(c)?Ae(c):Ve(1),P=c.clientWidth*S.x,R=c.clientHeight*S.y,U=w*S.x,H=y*S.y;return{width:P,height:R,x:U,y:H}}function je(c,f,m){let y;if(f==="viewport")y=We(c,m);else if(f==="document")y=yt(le(c));else if(we(f))y=Mr(f,m);else{let w=pr(c);y={...f,x:f.x-w.x,y:f.y-w.y}}return Gt(y)}function Pr(c,f){let m=Be(c);return m===f||!we(m)||ve(m)?!1:ye(m).position==="fixed"||Pr(m,f)}function _t(c,f){let m=f.get(c);if(m)return m;let y=ei(c,[],!1).filter(R=>we(R)&&W(R)!=="body"),w=null,S=ye(c).position==="fixed",P=S?Be(c):c;for(;we(P)&&!ve(P);){let R=ye(P),U=ct(P);!U&&R.position==="fixed"&&(w=null),(S?!U&&!w:!U&&R.position==="static"&&w&&["absolute","fixed"].includes(w.position)||He(P)&&!U&&Pr(c,P))?y=y.filter(H=>H!==P):w=R,P=Be(P)}return f.set(c,y),y}function gr(c){let{element:f,boundary:m,rootBoundary:y,strategy:w}=c,S=[...m==="clippingAncestors"?nt(f)?[]:_t(f,this._c):[].concat(m),y],P=S[0],R=S.reduce((U,H)=>{let Q=je(f,H,w);return U.top=O(Q.top,U.top),U.right=lt(Q.right,U.right),U.bottom=lt(Q.bottom,U.bottom),U.left=O(Q.left,U.left),U},je(f,P,w));return{width:R.right-R.left,height:R.bottom-R.top,x:R.left,y:R.top}}function Yr(c){let{width:f,height:m}=ui(c);return{width:f,height:m}}function qr(c,f,m){let y=fe(f),w=le(f),S=m==="fixed",P=Tt(c,!0,S,f),R={scrollLeft:0,scrollTop:0},U=Ve(0);if(y||!y&&!S)if((W(f)!=="body"||He(w))&&(R=Je(f)),y){let I=Tt(f,!0,S,f);U.x=I.x+f.clientLeft,U.y=I.y+f.clientTop}else w&&(U.x=Ui(w));let H=0,Q=0;if(w&&!y&&!S){let I=w.getBoundingClientRect();Q=I.top+R.scrollTop,H=I.left+R.scrollLeft-Ui(w,I)}let G=P.left+R.scrollLeft-U.x-H,j=P.top+R.scrollTop-U.y-Q;return{x:G,y:j,width:P.width,height:P.height}}function Ue(c){return ye(c).position==="static"}function Lt(c,f){if(!fe(c)||ye(c).position==="fixed")return null;if(f)return f(c);let m=c.offsetParent;return le(c)===m&&(m=m.ownerDocument.body),m}function Rr(c,f){let m=ee(c);if(nt(c))return m;if(!fe(c)){let w=Be(c);for(;w&&!ve(w);){if(we(w)&&!Ue(w))return w;w=Be(w)}return m}let y=Lt(c,f);for(;y&&Qe(y)&&Ue(y);)y=Lt(y,f);return y&&ve(y)&&Ue(y)&&!ct(y)?m:y||pe(c)||m}var Kr=async function(c){let f=this.getOffsetParent||Rr,m=this.getDimensions,y=await m(c.floating);return{reference:qr(c.reference,await f(c.floating),c.strategy),floating:{x:0,y:0,width:y.width,height:y.height}}};function ci(c){return ye(c).direction==="rtl"}var Vt={convertOffsetParentRelativeRectToViewportRelativeRect:Cr,getDocumentElement:le,getClippingRect:gr,getOffsetParent:Rr,getElementRects:Kr,getClientRects:ht,getDimensions:Yr,getScale:Ae,isElement:we,isRTL:ci},Ji=Yt,Ai=Qi,Zr=Jt,Li=(c,f,m)=>{let y=new Map,w={platform:Vt,...m},S={...w.platform,_c:y};return Qt(c,f,{...w,platform:S})},kr=Object.hasOwnProperty,er=ze(Mt(),1),Cs=(0,er.default)(),mr=(c,f,m)=>{let y=new URL(c.getAttribute(f),m);c.setAttribute(f,y.pathname+y.hash)};function Qr(c,f){c.querySelectorAll('[href^="./"], [href^="../"]').forEach(m=>mr(m,"href",f)),c.querySelectorAll('[src^="./"], [src^="../"]').forEach(m=>mr(m,"src",f))}var tr=new DOMParser;async function at({clientX:c,clientY:f}){let m=this;if(m.dataset.noPopover==="true")return;async function y(B){let{x:X,y:V}=await Li(m,B,{middleware:[Zr({x:c,y:f}),Ji(),Ai()]});Object.assign(B.style,{left:`${X}px`,top:`${V}px`})}let w=()=>[...m.children].some(B=>B.classList.contains("popover"));if(w())return y(m.lastChild);let S=new URL(document.location.href);S.hash="",S.search="";let P=new URL(m.href),R=decodeURIComponent(P.hash);P.hash="",P.search="";let U=await fetch(`${P}`).catch(B=>{console.error(B)});if(w()||!U)return;let[H]=U.headers.get("Content-Type").split(";"),[Q,G]=H.split("/"),j=document.createElement("div");j.classList.add("popover");let I=document.createElement("div");switch(I.classList.add("popover-inner"),j.appendChild(I),I.dataset.contentType=H??void 0,Q){case"image":let B=document.createElement("img");B.src=P.toString(),B.alt=P.pathname,I.appendChild(B);break;case"application":switch(G){case"pdf":let Me=document.createElement("iframe");Me.src=P.toString(),I.appendChild(Me);break;default:break}break;default:let X=await U.text(),V=tr.parseFromString(X,"text/html");Qr(V,P);let ue=[...V.getElementsByClassName("popover-hint")];if(ue.length===0)return;ue.forEach(Me=>I.appendChild(Me))}if(y(j),m.appendChild(j),R!==""){let B=I.querySelector(R);B&&I.scroll({top:B.offsetTop-12,behavior:"instant"})}}document.addEventListener("nav",()=>{let c=[...document.getElementsByClassName("internal")];for(let f of c)f.addEventListener("mouseenter",at),window.addCleanup(()=>f.removeEventListener("mouseenter",at))})}(),function(){var kt=Object.create,At=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyNames,Ct=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,v=(W,ee)=>()=>(ee||W((ee={exports:{}}).exports,ee),ee.exports),Ne=(W,ee,le,Te)=>{if(ee&&typeof ee=="object"||typeof ee=="function")for(let we of ut(ee))!Zt.call(W,we)&&we!==le&&At(W,we,{get:()=>ee[we],enumerable:!(Te=Wt(ee,we))||Te.enumerable});return W},ze=(W,ee,le)=>(le=W!=null?kt(Ct(W)):{},Ne(ee||!W||!W.__esModule?At(le,"default",{value:W,enumerable:!0}):le,W)),Mt=v((W,ee)=>{"use strict";ee.exports=Te;function le(fe){return fe instanceof Buffer?Buffer.from(fe):new fe.constructor(fe.buffer.slice(),fe.byteOffset,fe.length)}function Te(fe){if(fe=fe||{},fe.circles)return we(fe);let Re=new Map;if(Re.set(Date,pe=>new Date(pe)),Re.set(Map,(pe,Ie)=>new Map(Qe(Array.from(pe),Ie))),Re.set(Set,(pe,Ie)=>new Set(Qe(Array.from(pe),Ie))),fe.constructorHandlers)for(let pe of fe.constructorHandlers)Re.set(pe[0],pe[1]);let He=null;return fe.proto?ct:nt;function Qe(pe,Ie){let ve=Object.keys(pe),ye=new Array(ve.length);for(let Je=0;Je<ve.length;Je++){let Be=ve[Je],st=pe[Be];typeof st!="object"||st===null?ye[Be]=st:st.constructor!==Object&&(He=Re.get(st.constructor))?ye[Be]=He(st,Ie):ArrayBuffer.isView(st)?ye[Be]=le(st):ye[Be]=Ie(st)}return ye}function nt(pe){if(typeof pe!="object"||pe===null)return pe;if(Array.isArray(pe))return Qe(pe,nt);if(pe.constructor!==Object&&(He=Re.get(pe.constructor)))return He(pe,nt);let Ie={};for(let ve in pe){if(Object.hasOwnProperty.call(pe,ve)===!1)continue;let ye=pe[ve];typeof ye!="object"||ye===null?Ie[ve]=ye:ye.constructor!==Object&&(He=Re.get(ye.constructor))?Ie[ve]=He(ye,nt):ArrayBuffer.isView(ye)?Ie[ve]=le(ye):Ie[ve]=nt(ye)}return Ie}function ct(pe){if(typeof pe!="object"||pe===null)return pe;if(Array.isArray(pe))return Qe(pe,ct);if(pe.constructor!==Object&&(He=Re.get(pe.constructor)))return He(pe,ct);let Ie={};for(let ve in pe){let ye=pe[ve];typeof ye!="object"||ye===null?Ie[ve]=ye:ye.constructor!==Object&&(He=Re.get(ye.constructor))?Ie[ve]=He(ye,ct):ArrayBuffer.isView(ye)?Ie[ve]=le(ye):Ie[ve]=ct(ye)}return Ie}}function we(fe){let Re=[],He=[],Qe=new Map;if(Qe.set(Date,ve=>new Date(ve)),Qe.set(Map,(ve,ye)=>new Map(ct(Array.from(ve),ye))),Qe.set(Set,(ve,ye)=>new Set(ct(Array.from(ve),ye))),fe.constructorHandlers)for(let ve of fe.constructorHandlers)Qe.set(ve[0],ve[1]);let nt=null;return fe.proto?Ie:pe;function ct(ve,ye){let Je=Object.keys(ve),Be=new Array(Je.length);for(let st=0;st<Je.length;st++){let ei=Je[st],De=ve[ei];if(typeof De!="object"||De===null)Be[ei]=De;else if(De.constructor!==Object&&(nt=Qe.get(De.constructor)))Be[ei]=nt(De,ye);else if(ArrayBuffer.isView(De))Be[ei]=le(De);else{let ui=Re.indexOf(De);ui!==-1?Be[ei]=He[ui]:Be[ei]=ye(De)}}return Be}function pe(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return ct(ve,pe);if(ve.constructor!==Object&&(nt=Qe.get(ve.constructor)))return nt(ve,pe);let ye={};Re.push(ve),He.push(ye);for(let Je in ve){if(Object.hasOwnProperty.call(ve,Je)===!1)continue;let Be=ve[Je];if(typeof Be!="object"||Be===null)ye[Je]=Be;else if(Be.constructor!==Object&&(nt=Qe.get(Be.constructor)))ye[Je]=nt(Be,pe);else if(ArrayBuffer.isView(Be))ye[Je]=le(Be);else{let st=Re.indexOf(Be);st!==-1?ye[Je]=He[st]:ye[Je]=pe(Be)}}return Re.pop(),He.pop(),ye}function Ie(ve){if(typeof ve!="object"||ve===null)return ve;if(Array.isArray(ve))return ct(ve,Ie);if(ve.constructor!==Object&&(nt=Qe.get(ve.constructor)))return nt(ve,Ie);let ye={};Re.push(ve),He.push(ye);for(let Je in ve){let Be=ve[Je];if(typeof Be!="object"||Be===null)ye[Je]=Be;else if(Be.constructor!==Object&&(nt=Qe.get(Be.constructor)))ye[Je]=nt(Be,Ie);else if(ArrayBuffer.isView(Be))ye[Je]=le(Be);else{let st=Re.indexOf(Be);st!==-1?ye[Je]=He[st]:ye[Je]=Ie(Be)}}return Re.pop(),He.pop(),ye}}}),lt=W=>(ee,le)=>ee[`node${W}`]===le[`node${W}`],O=lt("Name"),Pt=lt("Type"),Ve=lt("Value");function ge(W,ee){if(W.attributes.length===0&&ee.attributes.length===0)return[];let le=[],Te=new Map,we=new Map;for(let fe of W.attributes)Te.set(fe.name,fe.value);for(let fe of ee.attributes){let Re=Te.get(fe.name);fe.value===Re?Te.delete(fe.name):(typeof Re<"u"&&Te.delete(fe.name),we.set(fe.name,fe.value))}for(let fe of Te.keys())le.push({type:5,name:fe});for(let[fe,Re]of we.entries())le.push({type:4,name:fe,value:Re});return le}function te(W,ee=!0){let le=`${W.localName}`;for(let{name:Te,value:we}of W.attributes)ee&&Te.startsWith("data-")||(le+=`[${Te}=${we}]`);return le+=W.innerHTML,le}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 Ut(W){let[ee,le=""]=W.split("?");return`${ee}?t=${Date.now()}&${le.replace(/t=\d+/g,"")}`}function qe(W){if(W.nodeType===1&&W.hasAttribute("data-persist"))return W;if(W.nodeType===1&&W.localName==="script"){let ee=document.createElement("script");for(let{name:le,value:Te}of W.attributes)le==="src"&&(Te=Ut(Te)),ee.setAttribute(le,Te);return ee.innerHTML=W.innerHTML,ee}return W.cloneNode(!0)}function gt(W,ee){if(W.children.length===0&&ee.children.length===0)return[];let le=[],Te=new Map,we=new Map,fe=new Map;for(let Re of W.children)Te.set(dt(Re),Re);for(let Re of ee.children){let He=dt(Re),Qe=Te.get(He);Qe?te(Re,!1)!==te(Qe,!1)&&we.set(He,qe(Re)):fe.set(He,qe(Re)),Te.delete(He)}for(let Re of W.childNodes){if(Re.nodeType===1){let He=dt(Re);if(Te.has(He)){le.push({type:1});continue}else if(we.has(He)){let Qe=we.get(He);le.push({type:3,attributes:ge(Re,Qe),children:Gi(Re,Qe)});continue}}le.push(void 0)}for(let Re of fe.values())le.push({type:0,node:qe(Re)});return le}function Gi(W,ee){let le=[],Te=Math.max(W.childNodes.length,ee.childNodes.length);for(let we=0;we<Te;we++){let fe=W.childNodes.item(we),Re=ee.childNodes.item(we);le[we]=Bt(fe,Re)}return le}function Bt(W,ee){if(!W)return{type:0,node:qe(ee)};if(!ee)return{type:1};if(Pt(W,ee)){if(W.nodeType===3){let le=W.nodeValue,Te=ee.nodeValue;if(le.trim().length===0&&Te.trim().length===0)return}if(W.nodeType===1){if(O(W,ee)){let le=W.tagName==="HEAD"?gt:Gi;return{type:3,attributes:ge(W,ee),children:le(W,ee)}}return{type:2,node:qe(ee)}}else return W.nodeType===9?Bt(W.documentElement,ee.documentElement):Ve(W,ee)?void 0:{type:2,value:ee.nodeValue}}return{type:2,node:qe(ee)}}function it(W,ee){if(ee.length!==0)for(let{type:le,name:Te,value:we}of ee)le===5?W.removeAttribute(Te):le===4&&W.setAttribute(Te,we)}async function mt(W,ee,le){if(!ee)return;let Te;switch(W.nodeType===9?(W=W.documentElement,Te=W):le?Te=le:Te=W,ee.type){case 0:{let{node:we}=ee;W.appendChild(we);return}case 1:{if(!Te)return;W.removeChild(Te);return}case 2:{if(!Te)return;let{node:we,value:fe}=ee;if(typeof fe=="string"){Te.nodeValue=fe;return}Te.replaceWith(we);return}case 3:{if(!Te)return;let{attributes:we,children:fe}=ee;it(Te,we);let Re=Array.from(Te.childNodes);await Promise.all(fe.map((He,Qe)=>mt(Te,He,Re[Qe])));return}}}function rt(W,ee){let le=Bt(W,ee);return mt(W,le)}var Zi=Object.hasOwnProperty,vi=ze(Mt(),1),fr=(0,vi.default)();function hi(W){return W.document.body.dataset.slug}var It=(W,ee,le)=>{let Te=new URL(W.getAttribute(ee),le);W.setAttribute(ee,Te.pathname+Te.hash)};function Oi(W,ee){W.querySelectorAll('[href^="./"], [href^="../"]').forEach(le=>It(le,"href",ee)),W.querySelectorAll('[src^="./"], [src^="../"]').forEach(le=>It(le,"src",ee))}var si=1,Gt=document.createElement("route-announcer"),Fi=W=>W?.nodeType===si,Qt=W=>{try{let ee=new URL(W);if(window.location.origin===ee.origin)return!0}catch{}return!1},Di=W=>{let ee=W.origin===window.location.origin,le=W.pathname===window.location.pathname;return ee&&le},Qi=({target:W})=>{if(!Fi(W)||W.attributes.getNamedItem("target")?.value==="_blank")return;let ee=W.closest("a");if(!ee||"routerIgnore"in ee.dataset)return;let{href:le}=ee;if(Qt(le))return{url:new URL(le),scroll:"routerNoscroll"in ee.dataset?!1:void 0}};function Ei(W){let ee=new CustomEvent("nav",{detail:{url:W}});document.dispatchEvent(ee)}var Xt=new Set;window.addCleanup=W=>Xt.add(W);var Jt;async function Yt(W,ee=!1){Jt=Jt||new DOMParser;let le=await fetch(`${W}`).then(fe=>{if(fe.headers.get("content-type")?.startsWith("text/html"))return fe.text();window.location.assign(W)}).catch(()=>{window.location.assign(W)});if(!le)return;Xt.forEach(fe=>fe()),Xt.clear();let Te=Jt.parseFromString(le,"text/html");Oi(Te,W);let we=Te.querySelector("title")?.textContent;if(we)document.title=we;else{let fe=document.querySelector("h1");we=fe?.innerText??fe?.textContent??W.pathname}Gt.textContent!==we&&(Gt.textContent=we),Gt.dataset.persist="",Te.body.appendChild(Gt),rt(document.body,Te.body),ee||(W.hash?document.getElementById(decodeURIComponent(W.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(fe=>fe.remove()),Te.head.querySelectorAll(":not([spa-preserve])").forEach(fe=>document.head.appendChild(fe)),ee||history.pushState({},"",W),Ei(hi(window)),delete Gt.dataset.persist}window.spaNavigate=Yt;function yi(){return typeof window<"u"&&(window.addEventListener("click",async W=>{let{url:ee}=Qi(W)??{};if(!(!ee||W.ctrlKey||W.metaKey)){if(W.preventDefault(),Di(ee)&&ee.hash){document.getElementById(decodeURIComponent(ee.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",ee);return}try{Yt(ee,!1)}catch{window.location.assign(ee)}}}),window.addEventListener("popstate",W=>{let{url:ee}=Qi(W)??{};if(!(window.location.hash&&window.location.pathname===ee?.pathname))try{Yt(new URL(window.location.toString()),!0)}catch{window.location.reload()}})),new class{go(W){let ee=new URL(W,window.location.toString());return Yt(ee,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(yi(),Ei(hi(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[ee,le]of Object.entries(W))this.setAttribute(ee,le)}})}}();
|